Select to view content in your preferred language

Download client-side graphics using ArcGIS JS?

3734
10
08-21-2017 10:13 AM
NickRobles2
New Contributor II

I've looked everywhere for ways to to download user-drawn graphics using ArcGIS JS API but have not found a solution. Is this something that can at least be done using a GP task?

0 Kudos
10 Replies
DavidWilton
Occasional Contributor II

I had some simple user drawn data and I was able to do this by using the following two libs:

https://github.com/Esri/arcgis-to-geojson-utils

https://github.com/mapbox/shp-write


// convert it to geojson ready for saving
// parse ArcGIS JSON, convert it to GeoJSON
this.geojson = esriUtils.arcgisToGeoJSON(graphic);
// download the data
shpwrite.download({
type: 'FeatureCollection',
features: [
this.geojson
]
});
Currently an issue with mapbox which I had to manually fix: