arcgis server 发布的wmts服务,可以下载为lyr 文件,想转为shapefile。
数据不在文件内的,复制要素,另存都无效
import urllib.parse, urllib.request, os, arcpy url = "http://ydt.haxxxxumap.g080/arcgis/rest/services/ghg_2021/MapServer/8/query?" params = {'where': 'objectid<=2000 and objectid>1000', 'geometryType': 'esriGeometryEnvelope', 'spatialRel': 'esriSpatialRelIntersects', 'relationParam': '', 'outFields': '*', 'returnGeometry': 'true', 'geometryPrecision':'', 'outSR': '', 'returnIdsOnly': 'false', 'returnCountOnly': 'false', 'orderByFields': '', 'groupByFieldsForStatistics': '', 'returnZ': 'false', 'returnM': 'false', 'returnDistinctValues': 'false', 'f': 'pjson' } encode_params = urllib.parse.urlencode(params).encode("utf-8") response = urllib.request.urlopen(url, encode_params) json = response.read() with open("mapservice.json", "wb") as ms_json: ms_json.write(json) ws = os.getcwd() + os.sep arcpy.JSONToFeatures_conversion("mapservice.json", ws + "mapservice.shp")
来自:
https://support.esri.com/zh-cn/technical-article/000019645