

With open("mapservice.json", "wb") as ms_json:Īrcpy.JSONToFeatures_conversion("mapservice.json", ws + "mapservice.shp", ) 'spatialRel': 'esriSpatialRelIntersects',Įncode_params = (params).encode("utf-8")

# Specify REST URL for service JSON to be returned Params = ĭata = (query=params).encode('utf-8')
#BARTENDER 10.1 JSON QUERY HOW TO#
The following instructions demonstrate how to query a map service for features, write the JSON response to a file, and convert the JSON file to a shapefile using the arcpy.JSONToFeatures_conversion() function. It is possible to use the script as-is, or format them into functions that take a URL argument.Īdjust the query parameters as needed (most, but not all, of the possible parameters are included). This article describes how to do so with a publicly shared map service using ArcPy and other built-in Python libraries. However, data can be downloaded from a map service in the form of JSON and the JSON code can be converted to a shapefile or Feature Class.
#BARTENDER 10.1 JSON QUERY DOWNLOAD#
In some cases, users enable the Feature Access function on map services to allow easy download of data. How To: Extract data from a map service using Python Summary
