Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

share|improve this question
    
For featureset to json Esri and json Esri to featureset you can see my post nicogis.blogspot.it/2012/04/json-arcobjects.html –  nicogis Feb 4 at 11:37
add comment

6 Answers

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.

Best,

Bill

share|improve this answer
    
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 '10 at 3:18
add comment

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.

share|improve this answer
    
While this is a good time, I'd have liked them to use a similar idea to the IXMLSerializer interface, but with Json. More consistent, and available in all languages which can use ArcObjects. –  BlinkyBill Aug 11 '10 at 3:17
1  
You could roll your own in ArcGIS 10 with IJSONWriter and the JSONWriter CoClass: help.arcgis.com/en/sdk/10.0/Arcobjects_CPP/componenthelp/… –  Jason Scheirer Sep 28 '10 at 6:12
    
arcpy's AsShape/__geo_interface__ is handy but just don't pass in any polygons with interior rings: gis.stackexchange.com/questions/10201/… –  valveLondon Dec 14 '11 at 18:55
add comment

This question with answer from Stack Overflow may work.

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

share|improve this answer
1  
Thanks for the suggestion. Sadly the library referenced reads shapefiles natively, rather than using the ArcObjects framework. –  BlinkyBill Aug 5 '10 at 2:17
add comment

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.

share|improve this answer
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 '10 at 3:12
add comment

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.

share|improve this answer
    
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 '10 at 3:14
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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