Converting ArcGIS Server JSON to GeoJSON?
OGR:
ogr2ogr -f GeoJSON test.json "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Hydrography/Watershed173811/FeatureServer/0/query?where=objectid+%3D+objectid&outfields=*&f=json" OGRGeoJSON
That command will read the query result directly from the URL. You can also supply it with a text file containing your JSON or you can directly supply encoded JSON on the command line. You can of course use ORG Python bindings to automate it within a script if necessary, or the library to do it in code.
For those that like web services, see Ogre an ogr2ogr web client which can convert json to geojson to and back, as well as geojson to shapefile.
Reference: http://www.gdal.org/drv_geojson.html
You can also see Esri's geojson-utils on Github that "contains [javascript] utilities for converting GeoJSON to other geographic json formats and vice versa. Currently only GeoJSON to Esri JSON has been developed. Also, note that only geometries in the WGS84 coordinate system are supported."
ArcGIS now supports GeoJSON
Now ArcGIS Server (since 10.4) and ArcGIS Online has GeoJSON through ArcGIS Rest API URL. All you need to do is set f=geojson
in the URL and configure the service. Be aware, by default, ArcGIS Online will not allow GeoJSON export until you explicit permit other output formats.
Here is how to enable the export:
- Log into ArcGIS Online
- Click the feature layers,
- Click the setting tab
- Check this box that says
Export Data
Allow others to export to different formats. 5. Save and wait a few minutes.
In the query page, you should see the output format dropdown list with the GeoJSON option. The old was called json
.
- Here is news release announcing the feature from Dec 2014
- You can see a sample of their GeoJSON out here
- Here is an HTML forum with customizable options showing you what the ArcGIS API is capable of