当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。