9

Is there an existing library for converting ArcGIS IFeature types to and from Json/GeoJson?

1

7 Answers 7

6

ArcGIS 10 has the AsShape function for converting GeoJSON to arcpy geometries, which mimics Shapely's AsShape, and arcpy geometry objects implement the __geo_interface__ standard (also from Shapely) for getting arcpy geometries back as GeoJSON.

3
6

You should check out GeoJSON.Net by Vish: http://viswaug.wordpress.com/2008/05/11/geojsonnet-a-net-library-to-produce-geojson-output/

It should be pretty easy to extend it to use ArcObjects geometries.

Also, you can take a look at the GeoJSON exporter I did for SharpMap (you'll have to Google that since StackExchange won't let me post a second hyperlink). The geometry objects in SharpMap have a very similar structure to those in ArcObjects so that should be pretty easy to extend as well.

1
  • A lot of good pointers there, but like most other options, I'd have to write my own implementation, which is the route I've gone.
    – BlinkyBill
    Aug 11, 2010 at 3:18
1

This question with answer from Stack Overflow may work.

https://stackoverflow.com/questions/2223979/convert-a-shapefile-shp-to-xml-json

1
  • 1
    Thanks for the suggestion. Sadly the library referenced reads shapefiles natively, rather than using the ArcObjects framework.
    – BlinkyBill
    Aug 5, 2010 at 2:17
1

Your best bet is to write your own framework. Use arcobjects so you can use geometries stored in any kind of geodatabase/shapefile/coverage. It shouldn't be too hard to do it.

1
  • 1
    It's fairly easy to write one for simple geometries, less so when you need to support the more exotic cases. This is however the route I've gone.
    – BlinkyBill
    Aug 11, 2010 at 3:12
0

I don't see any existing library, but this C# REST interface from ArcDeveloper provides a start. There's also this CC-AO licensed Python toolbox to export a feature class to GeoJSON which should fit the bill, it handles the five major vector types.

The GeoJSON spec is straightforward and shouldn't be too onerous to implement, if the toolbox doesn't meet your needs.

1
  • Sadly the python option, while it fits the bill, needs to be used in a server context, where using the geoprocessing object creates threading and scaling issues.
    – BlinkyBill
    Aug 11, 2010 at 3:14
0

ESRI has this free Python script that converts from feature class to json, geojson or csv. esri2open

0

A bit of a late addition, but figured it's a useful addition...

I use ArcGIS.PCL which works very well. Allows you to interact with ArcGIS and spit out any of the geometries as GeoJson.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.