Name | Type | Argument | Description |
---|---|---|---|
obj |
OsmPrimitive | OsmPrimitive[] | Collection |
<repeatable> |
the primitives to add |
Name | Type | Argument | Description |
---|---|---|---|
objs |
OsmPrimitive | OsmPrimitive[] | Collection |
<repeatable> |
the objects to change. See documentation. |
change |
module:josm/command~ChangeSpec | the change specification |
1 2 3 4 5 6 7 8 9 10 11
import {buildChangeCommand} from 'josm/command'
import layers from 'josm/layers'
const layer = layers.get("Data Layer 1")
// change the position of a node
buildChangeCommand(n1, {lat: 123.45, lon: 44.234}).applyTo(layer)
// change the tags of a collection of primitives
buildChangeCommand(n1, n3, w1, r1, {
tags: {'mycustomtag': 'value'}
}).applyTo(layer)
Name | Type | Argument | Description |
---|---|---|---|
obj |
OsmPrimitive | OsmPrimitive[] | Collection |
<repeatable> |
the primitives to delete |
Combines the currently selected ways.
Combines two or more ways into one resulting way.
Reuses the logic behind the JOSM standard menu entry Tools->Combine Ways. If invoked from a script, this may trigger modal dialogs which are presented to the user, in particular if the direction of the ways has to be reversed because otherwise they could not be combined.
Name | Type | Description |
---|---|---|
ways |
the ways to be combined | |
ways |
Way | array | the ways to be combined |
1 2 3 4 5 6 7 8 9 10
import {combineWays} from 'josm/command'
import layers from 'josm/layer'
const ds = layers.activeLayer.data
const ways = [ds.way(1), ds.way(2), ds.way(3)]
// pass in an array ...
combineWays(ways)
// ... or the individual ways ...
combineWays(ds.way(1), ds.way(2), ds.way(3))
// ... or any combination thereof.
Name | Type | Description |
---|---|---|
lat |
number | if present and applied to a node, changes the nodes latitude |
lon |
number | if present and applied to a node, changes the nodes longitude |
pos |
LatLon | module:josm/command~LatLonSpec | if present and applied to a node, changes the nodes position |
tags |
Map | object | if present, changes the tags of the target object |
nodes |
List | OsmPrimitive[] | if present and applied to a way, changes the ways nodes |
nodes |
List | RelationMember[] | if present and applied to a relation, changes the relations members |
Name | Type | Description |
---|---|---|
lat |
number | the latitude of the position |
lon |
number | the longitude of the position |