當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


Python ArcGIS MapImageLayer.create_dynamic_layer用法及代碼示例


本文簡要介紹 python 語言中 arcgis.mapping.MapImageLayer.create_dynamic_layer 的用法。

用法:

create_dynamic_layer(layer)

返回:

FeatureLayer 或無(如果未啟用)

create_dynamic_layer 方法創建一個動態層。動態圖層/表格表示由ArcGIS 服務器發布的Map服務或已注冊工作空間的單個圖層/表格。僅當Map圖像圖層支持動態圖層時才支持此資源,如Map圖像圖層屬性上的supportsDynamicLayers 所示。

Parameter

Description

layer

必需的字典。動態層/表源定義。

用法:

{
“id”: <layerOrTableId>,
“source”: <layer source>, //required
“definitionExpression”: “<definitionExpression>”,
“drawingInfo”:
{
“renderer”: <renderer>,
“transparency”: <transparency>,
“scaleSymbols”: <true,false>,
“showLabels”: <true,false>,
“labelingInfo”: <labeling info>
},
“layerTimeOptions”: //supported only for time enabled map layers
{
“useTime” : <true,false>,
“timeDataCumulative” : <true,false>,
“timeOffset” : <timeOffset>,
“timeOffsetUnits” : “<esriTimeUnitsCenturies,esriTimeUnitsDays,
esriTimeUnitsDecades,esriTimeUnitsHours,
esriTimeUnitsMilliseconds,esriTimeUnitsMinutes,
esriTimeUnitsMonths,esriTimeUnitsSeconds,
esriTimeUnitsWeeks,esriTimeUnitsYears |
esriTimeUnitsUnknown>”
}
}

例子:

# USAGE EXAMPLE

>>> from arcgis.mapping import MapImageLayer
>>> from arcgis.gis import GIS

# connect to your GIS and get the web map item
>>> gis = GIS(url, username, password)

>>> map_image_item = gis.content.get("2aaddab96684405880d27f5261125061")
>>> layer_to_add ={
                    "id": <layerId>,
                    "source": <layer source>
                    "definitionExpression": "<definitionExpression>",
                    "drawingInfo":
                    {
                      "renderer": <renderer>,
                      "transparency": <transparency>,
                      "scaleSymbols": <true>,
                      "showLabels": <true>,
                      "labelingInfo": <labeling info>
                    },
                    "layerTimeOptions":
                    {
                      "useTime" : <true,false>,
                      "timeDataCumulative" : <true>,
                      "timeOffset" : <timeOffset>,
                      "timeOffsetUnits" : "<esriTimeUnitsCenturies>"
                    }
                  }
>>> new_layer = map_image_item.create_dynamic_layer(layer= layer_to_add)
>>>type(new_layer)
<arcgis.features.FeatureLayer>

相關用法


注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 arcgis.mapping.MapImageLayer.create_dynamic_layer。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。