1

I am trying to export the data in geoJSON or JSON format from this REST service I keep getting error request can someone help me with the input querys

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
  • What error are you getting? Are you using the linked Query page or sending a requestion? For either, what are you providing? – mkennedy Aug 17 '17 at 21:25
  • 1
    The "cryptic ESRI rings format" that you're seeing is the json response from the server. see Converting ArcGIS Server JSON to GeoJSON to convert it to GeoJSON – Stephen Lead Aug 18 '17 at 2:02
  • Notice how the home page for the server says it's version 10.0, so be sure to use the old documentation. resources.arcgis.com/en/help/rest/apiref/fsquery.html – Kirk Kuykendall Aug 18 '17 at 2:03
  • Note that ArcGIS Server by default only returns the first 1000 records, so you may need to batch your requests until you've retrieved all records. eg search &where=OBJECTID<999, then &where=OBJECTID>=1000+and+OBJECTID<1999, etc – Stephen Lead Aug 18 '17 at 2:04
  • @StephenLead I guess I will use python to batch it.. doesn't seem terribly difficult. How would the url request be formatted? – ziggy Aug 18 '17 at 2:11
4

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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