我已连接到 ArcGIS 门户并访问了镶嵌数据集影像服务。我只想将一些栅格函数仅应用于马赛克内的特定栅格,但我无法访问它们。
我通过
连接到 arcgis 门户gis = GIS("https://portal", username="user", password="pwd")
我可以访问图像服务层
lyr1 = gis.content.get('6be0d723157c46ada260d2649d94655f')
lyr1 = lyr1.layers[0]
现在由于该图层是马赛克,我想应用一些栅格函数。但只能访问马赛克中的特定栅格。
我已经尝试过查询方法了
search_res = lyr1.query(where="OBJECTID=2834")
但它返回一个
<class 'arcgis.features.feature.FeatureSet'>
而不是图像服务对象
有什么建议吗?我只能在 jupyter 笔记本上使用 Python API
arcgis.raster.analytics.convert_feature_to_raster
将要素集转换为影像图层项目。
from arcgis.raster.analytics import convert_feature_to_raster
from arcgis.raster import ImageryLayer
#...
search_res = lyr1.query(where="OBJECTID=2834")
search_res_il = convert_feature_to_raster(search_res_df.sdf,
output_name='Search Raster',
output_raster_type='ImageryLayer',
gis=gis)