0.0.7 • Published 10 years ago

arcgis-json-objects v0.0.7

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

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

<script src="https://esri-es.github.io/ArcJSON/lib/arcjson.js" charset="utf-8"></script>
<script>
  ArcJSON.method_name(options);
</script>`

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 = require('arcgis-json-objects');
ArcJSON.method_name(options);

You can see an example here.

Available methods

MethodSpecificationsDescription
featureService(options)featureServiceObjectDescription of a feature service
featureLayer(options)featureLayerDefinition of a feature layer ready to add to a feature service
field(options)n/aField of a feature layer
exportableWebmap(options)exportwebmapExportable webmap object

The options params allows you to overwrite any attribute of the object, for example, if you call exportableWebmap like this:

exportableWebmap();

You will get this:

{
	"mapOptions": {
		"showAttribution": false,
		"extent": {
			"xmin": -10212866.663781697,
			"ymin": 3600493.212559925,
			"xmax": -9987836.052510148,
			"ymax": 3829804.2974154423,
			"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": [300,300],
		"dpi": 96
	}
}

But if you call it like this:

exportableWebmap({
	"mapOptions": {
		"showAttribution": true
	},
	"exportOptions": {
		"outputSize": [600,300],
		"dpi": 192
	}
});

You will get this:

{
	"mapOptions": {
		"showAttribution": true,
		"extent": {
			"xmin": -10212866.663781697,
			"ymin": 3600493.212559925,
			"xmax": -9987836.052510148,
			"ymax": 3829804.2974154423,
			"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": [600,300],
		"dpi": 192
	}
}
0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago