Downloading and uploading data

The module josm/api provides two classes for downloading data from and uploading data to the central OSM server:

Downloading data

The class Api provides several methods to download data using the OSM API.

Here's a sample scripts which downloads a bounding box:

var api = require("josm/api").Api;
var dataset = api.downloadArea({
      min: {lat: 46.9479186, lon: 7.4619484}, 
      max: {lat: 46.9497642, lon: 7.4660683}  
});
josm.layers.addDataLayer({ds: dataset, name: "Obstberg"});  

Uploading data

The class Api provides the method upload() to upload data to the server. It can be used to upload data using one of the upload strategies JOSM supports: