Querying a map service with the ArcGIS REST API and Python
The query operation in the ArcGIS REST API performs a query against a map service and returns a feature set. The feature set includes values for fields requested by the user and can also return geometry, if requested.
Getting ready
In this recipe, you will build on the first recipe, in which you generated a URL using the ArcGIS Services page dialog box to generate results. In this recipe, you will use the ArcGIS Server Services page dialog box to generate a URL request that queried a map service layer and returned results. You may recall that the URL was http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/1/query?text=&geometry=&geometryType=esriGeometryPolygon&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&objectIds=&where=STATE_FIPS+%3D+%2748%27+and+CNTY_FIPS+%3D+%27021%27&time=&returnCountOnly=false&returnIdsOnly=false&returnGeometry=false&maxAllowableOffset=&outSR=&outFields=POP2000%2CPOP2007%2CBLKGRP&f=pjson ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access