错误
在 ArcMap 中,运行 Python 脚本以从 ArcGIS Server 添加的地图服务访问属性表会返回以下错误:
错误: 无法为 Load 打开表

发生此错误的原因是地图服务用于访问属性表。 地图服务不允许访问数据,并用于显示地图的表示。
注: 但是,只有在要素服务的所有者允许编辑时才能编辑要素服务。 有关详细信息,请参阅要素服务权限和编辑者追踪。
注: 只有在要素服务具有查询支持的操作时,才能运行查询。 有关详细信息,请参阅 ArcGIS REST API:查询(地图服务/图层)。
#import the required modules
import requests
import urllib
import arcpy
import os
url = "[query URL]"
#specify the Where clause and output fields
where ="[Field Name IN ('Field Value')]"
fields = "[Out Fields returned from the query]"
#Declare the request part of the web URL into a parameter
params = urllib.parse.urlencode({'where' : where, 'outFields' : fields, 'f' : 'json' })
#Declare the response from the web page
response = requests.get(url+params)
#Retrieve the JSON as a text
jsn = response.text
#Set the environment workspace
arcpy.env.workspace = "C:\\temp
#Save the JSON to a file
file = open("C:\\temp\\myFeatures.json", "a")
file.write(jsn)
file.close()
#Convert the JSON file named myFeatures" and join the storage folder of the current database with the desired database
arcpy.JSONToFeatures_conversion("C:\\temp\\myFeatures.json", os.path.join("C:\\temp\\Data.gdb", "myfeatures"))
                文章 ID: 000018476
获取来自 ArcGIS 专家的帮助
立即开始聊天