ArcGIS JSON to GeoJSON does not always work

7951
14
03-19-2014 04:02 AM
GregoryGiguashvili
New Contributor
I'm reading ArcGIS Server responses with conversion to GeoJSON format as described in http://gis.stackexchange.com/questions/13029/how-to-convert-arcgis-server-json-to-geojson post.

1. I've tried to search any explanation on how this conversion works, but I could not find anything. Could anyone provide pointers to how this query-based conversion works in general?

2. The above mentioned technique does not work for some Feature Server layers, returning empty results.
This one works fine:
http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Hydrography/Watershed173811/FeatureServer...

This one returns empty result:
http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/LandusePlanning/F...

Could anyone explain why and how the problem may be solved?

Thanks a lot
Giga
0 Kudos
14 Replies
GregoryGiguashvili
New Contributor
Ok, if you need make it client side you can run your query (arcgis js) and then you can use https://github.com/Esri/geojson-utils/blob/master/src/jsonConverters.js and convert featureset in geojson


Thank you for the link. By examining the Leaflet example of GeoJson-Utils, it looks like this is exactly what I need.

However, I'm still confused about this issue and I would appreciate more information on the topics below:

1. The main page of GeoJson-Utils package contains the following text:
Anybody looking to convert between Esri JSON and GeoJSON should check out the repository https://github.com/Esri/Terraformer. Terraformer contains a GeoJSON converter and a lot more functionality.

Could you please explain what is meant by this statement? These utilities really complement each other as I see it, but maybe I'm missing something.

2. It's still not fully clear how to query ArcGIS server so that it returns "features" in the ESRI Json output. This goes back to my original question. What query is supported for getting the "features" geometry from ArcGIS Feature Server?

Thank you
Giga
0 Kudos
GregoryGiguashvili
New Contributor
It's still not fully clear how to query ArcGIS server so that it returns "features" in the ESRI Json output. This goes back to my original question. What query is supported for getting the "features" geometry from ArcGIS Feature Server?


I think I understand the problem now. It seems to be in servers configured with MaxRecordCount=1000 attribute, so queries returning more than maximum records simply fail. I wonder if there's a recommended technique for pulling all geometry data from the server?

For example, using "returnIdsOnly=true" would return all the feature ids, which the client could iterate later. Can someone provide more information/example on the most effective technique for iterating features using REST API?
0 Kudos
GregoryGiguashvili
New Contributor
I'd like to respond to my own question for the benefit of others that may have encountered a similar problem.

The following special cases (at least) need to be considered when reading ArcGIS data using 3rd party client libraries:


  • Clients may not be able to process GeoJSON results containing UNICODE characters (\uABCD style)

  • ArcGIS limits the amount of objects returned per single query (usually to 1000), so iterators should be used

  • Empty feature sets may not be accepted by clients


This means that special care needs to be taken by the application client code for GeoJSON output returned by ArcGIS before passing it over to 3rd party libraries.
0 Kudos
sarahzohar
New Contributor
Now I'm trying to use ArcGIS to convert JSON to GeoJSON Terraformer
0 Kudos
JonHall
Occasional Contributor II

After a freaking hour plus, I have determined that ArcGIS Desktop 10.6.1 "Features To JSON" with the GEOJSON option ONLY WORKS with SHAPEFILE INPUT.

Come on, ESRI.... 

"Features To JSON" repeatedly crashed, after output for the first few polygons, on the 4th or 5th polygon geometry, WHEN USING a FILE GEODATABASE OR ARCSDE polygon FEATURECLASS INPUT.

I tested with 3 or 4 different polygon featureclasses that were in WGS84, whether or not within a featuredataset, in FGDB or SDE, no matter, it crashed every time with a useless "99999" err msg. The log file was also useless. Clearly it was choking when reading geometry.

Copy the same featureclasses into shapefiles, and the GEOJSON output option works fine.

ESRI, I can't believe your code doesn't support FGDB or SDE, only supports legacy shapefiles as input. And you want me to move to Pro...LMFAO

I'm sorry this is in the wrong forum...