Is there an existing library for converting ArcGIS IFeature types to and from Json/GeoJson?
-
For featureset to json Esri and json Esri to featureset you can see my post http://nicogis.blogspot.it/2012/04/json-arcobjects.html – nicogis Feb 04 '14 at 11:37
7 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.
- 65,136
- 29
- 109
- 338
- 636
- 5
- 6
-
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 03:18
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.
- 18,002
- 2
- 53
- 72
-
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 03:17
-
1You could roll your own in ArcGIS 10 with IJSONWriter and the JSONWriter CoClass: http://help.arcgis.com/en/sdk/10.0/Arcobjects_CPP/componenthelp/index.html#//001n00000108000000 – Jason Scheirer Sep 28 '10 at 06:12
-
arcpy's AsShape/geo_interface is handy but just don't pass in any polygons with interior rings: http://gis.stackexchange.com/questions/10201/arcpy-geometry-geo-interface-and-asshape-function-loss-of-precision-and-h – Random Geo guy Dec 14 '11 at 18:55
This question with answer from Stack Overflow may work.
https://stackoverflow.com/questions/2223979/convert-a-shapefile-shp-to-xml-json
-
1Thanks for the suggestion. Sadly the library referenced reads shapefiles natively, rather than using the ArcObjects framework. – BlinkyBill Aug 05 '10 at 02:17
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.
- 6,298
- 3
- 36
- 71
-
1It'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 03:12
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.
- 525
- 2
- 10
- 26
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.
- 16,391
- 6
- 64
- 101
-
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 03:14