geoJson > arcJson

I put together a dead simple interface to convert GeoJSON to ArcJSON using the Esri GeoJSON Utils repo. I also threw in a feature to preview the result on a map, but it’s a bit spotty…

brightrain.github.io/geoconverter

Source available on GitHub

It really is just a light wrapper around GeoJSON Utils.

Include, create, use:

<script src=”https://gist.github.com/brightrain/6252925.js"></script>


I built this for a few reasons:

  • I wanted to play with the excellent GeoJSON creation/editing tool from @tmcw: geojson.io
  • And I wanted to experiment with the new Bootstrap 3 flat design, which was a major departure from earlier versions in both look and behavior.

The idea came when I needed a coarse polygon dataset representing world regions and wanted to publish it as a map service for use in an ArcGIS JavaScript API application.

It was super simple to create the handful of regions I needed with geojson.io, and I ended up with GeoJSON polygons in just a few minutes.

Then I needed to get them into an ArcGIS feature service.

Uh oh — although it’s looking increasingly imminent, GeoJSON is not supported in the ArcGIS world currently. So here we are.

The new developers.arcgis.com site allowed me to quickly create and publish a new feature service to hold the new data. I copied the output from geojson.io, pasted it into a text box, hit the button, and I had ArcJSON.

Another copy/paste into the addFeatures endpoint here and I had my regions published in my map service.


Important note

If you need the same workflow, you must unwrap the ArcJSON before posting to addFeatures. Meaning: remove the outer "features" object and send only the array.

You’re stripping this bit (and the final curly brace):

stripfeatures

Definitely “innovation time” — this is just a bridge across open water until Esri provides full support for GeoJSON.

Let me know if you find it useful.