1

I am trying to export the data in GeoJSON or JSON format from this REST service. I keep getting an error from the request.

http://maps3.arcgisonline.com/ArcGIS/rest/services/A-16/FEMA_100-Year_Flood_Zones_in_the_USA/MapServer/1

I need the geometry and attributes returned.

I am using this page to try and query for all of the data.

http://maps3.arcgisonline.com/ArcGIS/rest/services/A-16/FEMA_100-Year_Flood_Zones_in_the_USA/MapServer/1/query

I choose the format as JSON and in the Return Fields (Comma Separated): I enter "*"

What else do I need to enter into the QUERY to return this layer?


I entered objectid is not null into the where clause and it returned the cryptic Esri rings format

http://maps3.arcgisonline.com/ArcGIS/rest/services/A-16/FEMA_100-Year_Flood_Zones_in_the_USA/MapServer/1/query?text=&geometry=&geometryType=esriGeometryPoint&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&objectIds=&where=objectid+is+not+null&time=&returnIdsOnly=false&returnGeometry=true&maxAllowableOffset=&outSR=&outFields=%22*%22&f=pjson
PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Aug 17, 2017 at 18:20
0

2 Answers 2

5

You need to make a request to the ?query endpoint of the layer, and supply a where clause. Specify &f=json to receive the response in JSON.

Note that ArcGIS Server by default only returns the first 1000 records, so you may need to batch your requests using OBJECTID ranges as the where clause until you've retrieved all records, using this syntax:

http://maps3.arcgisonline.com/ArcGIS/rest/services/A-16/FEMA_100-Year_Flood_Zones_in_the_USA/MapServer/1/query?&where=objectid%3E=1000+and+objectid%3C1999&f=json

That is, use where objectid < 999 in the first request, then where objectid>= 1000 and objectid < 1999, etc, until there are no more responses.

See Converting ArcGIS Server JSON to GeoJSON to convert this JSON response to GeoJSON

answered Aug 18, 2017 at 4:02
0
0

You can see 'maxRecordCount' in rest service. Then you make a request with 'returnIdsOnly' with your filter where/spatial. On this request there is no limit to the number of object IDs returned in the ID array response so you have full list of oids and then you make n-request (chunk) -> ceil((len(oids) / maxRecordCount )) with group of oids using in request query only 'objectIds'

You can see it in my toolbox for arcgis pro where I use this logic Download service

answered Mar 29, 2018 at 18:42

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.