-
create( [id] [, options])
Creates a new Node
-
Creates a new
Node.
Can be used in an instance or in a static context.
Parameters:
- Source:
-
Returns:
the created node
-
Type
-
Node
Example
import { NodeBuilder } from 'josm/builder'
// create a new local node at position [0,0]
const n1 = NodeBuilder.create()
// create a new global node with id 1111 at position [0,0]
const n2 = NodeBuilder.create(1111)
// create a new global node with version 3 at a specific position
// and with some tags
const n3 = NodeBuilder.create(2222, {
version: 3,
lat: 23.45,
lon: 87.23,
tags: {amenity: 'restaurant'}
})
-
createProxy(id)
-
Creates a new
proxy
Node. A proxy node is a node,
for which we only know its global id. In order to know more details
(position, tags, etc.), we would have to download it from the OSM server.
The method can be used in a static and in an instance context.
Parameters:
Name |
Type |
Description |
id |
number
|
the node id (not null, number > 0 expected) |
- Source:
-
Returns:
the new proxy node
-
Type
-
Node
Example
import { NodeBuilder } from 'josm/builder'
// a new proxy node for the global node with id 1111
const n1 = NodeBuilder.createProxy(1111)
-
forDataSet(ds)
Creates a new NodeBuilder for a specific
DataSet.
-
Creates or configures a NodeBuilder which will add created nodes
to the dataset ds
.
Parameters:
Name |
Type |
Description |
ds |
DataSet
|
the dataset which
created objects are added to |
- Source:
-
Returns:
the node builder
-
Type
-
module:josm/builder/node~NodeBuilder
Example
import { NodeBuilder } from 'josm/builder'
// create a new node builder building to a data set
const DataSet = Java.type('org.openstreetmap.josm.data.osm.DataSet')
const ds = new DataSet()
// ... using a static method ...
const nb1 = NodeBuilder.forDataSet(ds)
// ... or the instance method
const nb2 = new NodeBuilder.forDataSet(ds)
-
withId(id [, version])
-
Declares the global node id and the global node version.
The method can be used in a static and in an instance context.
Parameters:
Name |
Type |
Argument |
Default |
Description |
id |
number
|
|
|
the global node id. A number > 0. |
version |
number
|
<optional>
|
1
|
optional the global node version. If present,
a number > 0. |
- Source:
-
Returns:
the node builder (for method chaining)
-
Type
-
module:josm/builder/node~NodeBuilder
-
withPosition(lat, lon)
-
Declares the node position.
The method can be used in a static and in an instance context.
Parameters:
Name |
Type |
Description |
lat |
Number
|
the latitude. A number in the range [-90..90]. |
lon |
Number
|
the longitude. A number in the range [-180..180]. |
- Source:
-
Returns:
a node builder (for method chaining)
-
Type
-
module:josm/builder/node~NodeBuilder
Example
import { NodeBuilder } from 'josm/builder'
// a new global node with the global id 1111 at position (34,45)
const n1 = NodeBuilder.withPosition(34,45).create(1111)
// a new local node at position (23.2, 87.33)
const n2 = NodeBuilder.withPosition(23.3,87.33).create()
-
-
Declares the tags to be assigned to the new node.
The method can be used in a static and in an instance context.
Parameters:
Name |
Type |
Argument |
Description |
tags |
object
|
<optional>
|
the tags |
- Source:
-
Returns:
the node builder (for method chaining)
-
Type
-
module:josm/builder/node~NodeBuilder
Example
import { NodeBuilder } from 'josm/builder'
// a new global node with the global id 1111 and tags name=test and
// highway=road
const n1 = NodeBuilder.withTags({'name':'test', 'highway':'road'}).create(1111)
// a new local node with tags name=test and highway=road
const tags = {
'name' : 'test',
'highway' : 'road'
}
const n2 = NodeBuilder.withTags(tags).create()