Class 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".

// load the changeset api
var api = require("josm/api").ChangesetApi;

// create a new changeset on the server 
var cs = api.open();
Name Description
Methods
close Closes a changeset
get Get a changeset from the server
open Creates and opens a changeset
update Updates a changeset

Functions

close:Changeset

Closes a changeset

close(id)
closes the changeset with the given id
close(aChangeset)
Xloses the changeset given by aChangeset

Parameters

Name Type Description
changeset number the changeset to close

Examples

var api = require("josm/api").ChangesetApi;
var util = require("josm/util");
var Changeset = org.openstreetmap.josm.data.osm.Changeset;

// closs the changeset 12345 
api.close(12345);

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

get:Changeset

Get a changeset from the server

get(id)
gets the changeset for the id. id must be a number > 0.

Parameters

Name Type Description
changeset number the changeset to close

Examples

var api = require("josm/api").ChangesetApi;
var Changeset = org.openstreetmap.josm.data.osm.Changeset;

// get the changeset with id 12345 
var cs1 = api.get(12345);

// get the changeset with id 12345
var cs2 = new Changeset(12345);
cs2 = api.get(cs2);   

open:Changeset

Creates and opens a changeset

  • open() - open a new changeset with no tags
  • open(aChangeset) - open a new changeset with the tags from aChangeset
  • open(anObject) - open a new changeset with the tags given by the properties of anObject

Examples

var api = require("josm/api").ChangesetApi;
var Changeset = org.openstreetmap.josm.data.osm.Changeset;

// open a new changeset with no tags 
var cs1 = api.open();

// open a new changeset with the tags given by the supplied changeset
var cs2 = new Changeset();
cs2.put("comment", "a test comment");
cs2 = api.open(cs2);

// open a new changeset with the tags given by the object
var cs3 = api.open({comment: "a test comment"});

update:Changeset

Updates a changeset

update(aChangeset)
Updates the changeset aChangeset

Parameters

Name Type Description
changeset Changeset the changeset to update

Examples

var api = require("josm/api").ChangesetApi;
var Changeset = org.openstreetmap.josm.data.osm.Changeset;

// update the comment of a changeset
var cs2 = new Changeset(12345);
cs2.put("comment", "an updated comment");  
cs2 = api.update(cs2);