I need to let my users export data from an ArcGIS Online FeatureService as a shapefile.
I am aware of solutions based on the shp-write JS library. However, the process of converting ArcGIS JSON to geojson and then exporting this is way too slow and buggy. The shp-write library do not have proper support for saving multiple polygons in one shapefile.
I have stumpled upon this: https://developers.arcgis.com/rest/analysis/api-reference/extract-data.htm
This seems to be exactly what I need. Is it possible to call this from the ArcGIS JS API?
The REST API refers to an "analysis url", for example: http://<analysis url>/ExtractData/submitJob
Is it possible to get such a thing for ArcGIS Online, or is it limited to on premise ArcGIS Server solutions?
The esriRequest makes it possible to request data, yes, but it is not clear where to request the data.
I have solved it by requesting geojson data directly from the Feature Service. Luckily, the layer is publicly available, so I don't need to worry about tokens. Using the terraformer/arcgis library to convert arcgis JSON to geojson is way too slow.
The geojson data CAN be converted with shp-write, however, you need to use the fixes done here, in order to export polygons: https://github.com/hwbllmnn/shp-write/tree/master/src
It would be nice, if an export feature was available in the JS API right out of the box, but it obviously isn't. People expect to be able to work with shapefiles in ESRI products. :)