ArcJSON
Javascript library to generate JSON objects in order to use the ArcGIS REST API.
How to use it
It works as a node module and also as a Javascript library in the browser.
In the browser
`
You can see an example here.
How to use it with Node.js
Install the package:
npm install arcgis-json-objects
And then you can use it like this:
var ArcJSON = ;ArcJSON;
You can see an example here.
Available methods
Method | Specifications | Description |
---|---|---|
featureService(options) | featureServiceObject | Description of a feature service |
featureLayer(options) | featureLayer | Definition of a feature layer ready to add to a feature service |
field(options) | n/a | Field of a feature layer |
exportableWebmap(options) | exportwebmap | Exportable webmap object |
The options params allows you to overwrite any attribute of the object, for example, if you call exportableWebmap like this:
;
You will get this:
"mapOptions": "showAttribution": false "extent": "xmin": -10212866663781697 "ymin": 3600493212559925 "xmax": -9987836052510148 "ymax": 38298042974154423 "spatialReference": "wkid": 102100 "latestWkid": 3857 "spatialReference": "wkid": 102100 "latestWkid": 3857 "operationalLayers": "id": "Ocean" "title": "Ocean" "opacity": 1 "url": "http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" "exportOptions": "outputSize": 300300 "dpi": 96
But if you call it like this:
;
You will get this:
"mapOptions": "showAttribution": true "extent": "xmin": -10212866663781697 "ymin": 3600493212559925 "xmax": -9987836052510148 "ymax": 38298042974154423 "spatialReference": "wkid": 102100 "latestWkid": 3857 "spatialReference": "wkid": 102100 "latestWkid": 3857 "operationalLayers": "id": "Ocean" "title": "Ocean" "opacity": 1 "url": "http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" "exportOptions": "outputSize": 600300 "dpi": 192