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


Python ArcGIS MapFeatureLayer.fromitem用法及代码示例


本文简要介绍 python 语言中 arcgis.mapping.MapFeatureLayer.fromitem 的用法。

用法:

classmethod fromitem(item, layer_id=0)

返回:

MapFeatureLayer 对象

fromitem 方法从 GIS Item 创建 MapFeatureLayer

Parameter

Description

item

必需的 Item 对象。项目的类型应该是MapServiceLayer 对象。

layer_id

可选整数。Map服务图层中图层的 ID。默认值为 0。

例子:

# USAGE EXAMPLE

>>> from arcgis.mapping import MapImageLayer, MapFeatureLayer
>>> 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")
>>> map_feature_layer = MapFeatureLayer.fromitem(item = map_image_item,
                                                 layer_id = 2)
>>> print(f"{map_feature_layer.properties.name:30}{type(map_feature_layer)}")
<State Boundaries              <class 'arcgis.mapping._msl.layer.MapFeatureLayer'>>

相关用法


注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 arcgis.mapping.MapFeatureLayer.fromitem。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。