Class: ChangesetApi

josm/api. ChangesetApi

Provides methods to open, close, get, update, etc. changesets on the OSM API server. Note: this class doesn't provide a constructor. Methods and properties are static.

new ChangesetApi()

Provides methods to open, close, get, update, etc. changesets on the OSM API server.

Source:
Example
// load the changeset api
import { ChangesetApi } from 'josm/api'

// create a new changeset on the server
const cs = ChangesetApi.open()

Methods


<static> close(changeset)

Closes a changeset
Parameters:
Name Type Description
changeset number | Changeset the changeset to close
Source:
Returns:
the changeset
Type
Changeset
Example
import { ChangesetApi } from 'josm/api'
import * as util from 'josm/util'
const Changeset = Java.type('org.openstreetmap.josm.data.osm.Changeset')

// closs the changeset 12345
ChangesetApi.close(12345)

// open a new changeset with the tags given by the supplied changeset
const cs2 = new Changeset(12345)
cs2 = ChangesetApi.close(cs2)
util.assert(cs2.closed)  // the changeset is now closed

<static> get(changeset)

Get a changeset from the server
Parameters:
Name Type Description
changeset number | Changeset the changeset to get
Source:
Returns:
the changeset
Type
Changeset
Example
import { ChangesetApi } from 'josm/api'
const Changeset = Java.type('org.openstreetmap.josm.data.osm.Changeset')

// get the changeset with id 12345
const cs1 = ChangesetApi.get(12345)

// get the changeset with id 12345
lets cs2 = new Changeset(12345)
cs2 = ChangesetApi.get(cs2)

<static> open( [changeset])

Creates and opens a changeset
Parameters:
Name Type Argument Description
changeset Changeset | object <optional>
the changeset to open
Source:
Returns:
the changeset
Type
Changeset
Example
import { ChangesetApi } from 'josm/api'
const Changeset = Java.type('org.openstreetmap.josm.data.osm.Changeset')

// open a new changeset with no tags
const cs1 = ChangesetApi.open()

// open a new changeset with the tags given by the supplied changeset
const cs2 = new Changeset()
cs2.put('comment', 'a test comment')
cs2 = ChangesetApi.open(cs2)

// open a new changeset with the tags given by the object
const cs3 = ChangesetApi.open({comment: 'a test comment'})

<static> update(changeset)

Updates a changeset
Parameters:
Name Type Description
changeset Changeset the changeset to update
Source:
Returns:
the changeset
Type
Changeset
Example
import { ChangesetApi } from 'josm/api'
const Changeset = Java.type('org.openstreetmap.josm.data.osm.Changeset')

// update the comment of a changeset
const cs2 = new Changeset(12345)
cs2.put('comment', 'an updated comment')
cs2 = ChangesetApi.update(cs2)