本文简要介绍 python 语言中 arcgis.geoanalytics.manage_data.merge_layers
的用法。
用法:
arcgis.geoanalytics.manage_data.merge_layers(input_layer, merge_layer, merge_attributes=None, output_name=None, gis=None, context=None, future=False)
返回:
merge_layers
任务组合两个要素层以创建单个输出层。该工具要求两个图层具有相同的几何类型(表格、点、线或多边形)。如果在一层上启用了时间,则另一层也必须启用时间并且具有相同的时间类型(即时或间隔)。结果将始终包含输入层的所有字段。默认情况下,将包含合并层中的所有字段,或者您可以指定自定义合并规则来定义结果架构。例如:I have three layers for England, Wales, and Scotland and I want a single layer of Great Britain. I can use Merge Layers to combine the areas and maintain all fields from each area.
I have two layers containing parcel information for contiguous townships. I want to join them together into a single layer, keeping only the fields that have the same name and type in the two layers.
注意:
仅在 ArcGIS Enterprise 10.7 及更高版本中可用。
Parameter
Description
input_layer
所需层。要与
merge_layer
参数合并的表、点、线或面要素。input_layer
中的所有字段都将包含在结果层中。请参阅特征输入。merge_layer
所需层。要与
input_layer
合并的点、线或面要素。merge_layer
必须包含与input_layer
相同的几何类型(表格、点、线或多边形)和相同的时间类型(无、即时或间隔)。默认情况下,merge_layer
中的所有字段都将包含在结果层中,或者您可以定义merge_attributes
来自定义结果架构。请参阅特征输入。merge_attributes
可选的字典列表。定义如何修改
merge_layer
中的字段。默认情况下,两个输入的所有字段都将包含在输出层中。如果一个字段存在于一个图层中而另一图层中不存在,则输出图层仍将包含该字段。输出字段将包含没有该字段的输入要素的空值。例如,如果
input_layer
包含名为 TYPE 的字段,但merge_layer
不包含 TYPE,则输出将包含 TYPE,但对于从merge_layer
复制的所有要素,其值为 null。您可以使用对指定
merge_layer
字段进行操作的以下合并类型来控制如何将merge_layer
中的字段写入输出层:Remove
- The field in themerge_layer
will be removed from the output layer.Rename
- The field in themerge_layer
will be renamed in the output layer. You cannot rename a field in themerge_layer
to a field in theinput_layer
. If you want to make field names equivalent, use Match.Match
- A field in the merge_layer is made equivalent to a field in theinput_layer
specified bymerge_layer
. For example, the input_layer has a field named CODE and the merge_layer has a field named STATUS. You can match STATUS to CODE, and the output will contain the CODE field with values of the STATUS field used for features copied from the merge_layer. Type casting is supported (for example, double to integer, integer to string) except for string to numeric.
# Example: >>> merge_attributes = [{"mergeLayerField": "Mean_Sales", "mergeType": "Match", "mergeValue": "Average_Sales"}, {"mergeLayerField": "Bonus", "mergeType": "Remove",}, {"mergeLayerField": "Field4", "mergeType": "Rename", "mergeValue": "Errors"}]
output_name
可选字符串。该任务将创建结果的要素服务。您定义服务的名称。
gis
可选
GIS
,将对其进行分析。context
可选字典。 context 参数包含影响任务执行的其他设置。对于此任务,有五个设置:
extent
- A bounding box that defines the analysis area. Only those features that intersect the bounding box will be analyzed.processSR
- The features will be projected into this coordinate system for analysis.outSR
- The features will be projected into this coordinate system after the analysis to be saved. The output spatial reference for the spatiotemporal big data store is always WGS84.dataStore
- Results will be saved to the specified data store. For ArcGIS Enterprise, the default is the spatiotemporal big data store.defaultAggregationStyles
- If set toTrue
, results will have square, hexagon, and triangle aggregation styles enabled on results map services.
future
可选布尔值。如果
True
,则返回 GPJob 而不是结果。可以查询 GPJob 的执行状态。默认值为
False
。例子:
# Usage Example: To merge census blocks from two states into one output layer. merge_result = merge_layers(input_layer=il_block, merge_layer=wi_block, merge_attributes=[{"mergeLayerField" : "State_Code", "mergeType" : "Match", "mergeValue" : "statecode"}], output_name="IL_WI_Census_Blocks")
相关用法
- Python ArcGIS merge_layers用法及代码示例
- Python ArcGIS merge_multidimensional_rasters用法及代码示例
- Python ArcGIS med用法及代码示例
- Python ArcGIS mean用法及代码示例
- Python ArcGIS mod用法及代码示例
- Python ArcGIS minority用法及代码示例
- Python ArcGIS minus用法及代码示例
- Python ArcGIS majority用法及代码示例
- Python ArcGIS mosaic_image用法及代码示例
- Python ArcGIS max用法及代码示例
- Python ArcGIS mosaic_rasters用法及代码示例
- Python ArcGIS min用法及代码示例
- Python ArcGIS manage_multidimensional_raster用法及代码示例
- Python ArcGIS power用法及代码示例
- Python ArcGIS APIKeyManager.get用法及代码示例
- Python ArcGIS KnowledgeGraph.named_object_type_delete用法及代码示例
- Python ArcGIS ContentManager.unshare_items用法及代码示例
- Python ArcGIS ImageryLayer.thumbnail用法及代码示例
- Python ArcGIS FormFieldElement用法及代码示例
- Python ArcGIS Geometry.true_centroid用法及代码示例
- Python ArcGIS Site.delete用法及代码示例
- Python ArcGIS GeoAccessor.bbox用法及代码示例
- Python arcgis.apps.hub.Initiative.update用法及代码示例
- Python ArcGIS generate_service_areas用法及代码示例
- Python ArcGIS build_overview用法及代码示例
注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 arcgis.geoanalytics.manage_data.merge_layers。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。