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


Python ArcGIS extract_data用法及代碼示例

本文簡要介紹 python 語言中 arcgis.features.analysis.extract_data 的用法。

用法:

arcgis.features.analysis.extract_data(input_layers, extent=None, clip=False, data_format=None, output_name=None, gis=None, estimate=False, future=False)

返回:

result_layer:如果指定了output_name,則為 FeatureLayer ,否則為 Feature Collection

extract_data.png

extract_data 方法用於從給定範圍內的一個或多個圖層中提取數據。提取的數據格式可以是文件地理數據庫、shapefile、csv 或 kml。文件地理數據庫和 shapefile 被添加到可下載的 zip 文件中。

Parameter

Description

input_layers

必需的字符串列表。要提取的輸入層列表。請參閱特征輸入。

extent

可選層。範圍是用於提取輸入特征的感興趣區域。如果未指定,則提取每個輸入層的所有特征。請參閱特征輸入。

clip

可選的布爾值。一個布爾值,指定輸入圖層中的要素是否在範圍內裁剪。默認情況下,不會裁剪要素,並返回與範圍相交的所有要素。

默認值為假。

data_format

可選字符串。定義提取數據的輸出數據格式的關鍵字。

選擇列表:[‘FileGeodatabase’、‘ShapeFile’、‘KML’、‘CSV’]

默認值為“CSV”。

如果FileGeodatase被指定輸入層有附件:

  • if clip=False, the attachments will be extracted to the output file

  • if clip=True, the attachments will not be extracted

output_name

可選字符串或字典。

output_name 為字符串時,我的內容頁麵中的輸出項將由該值命名。其他項目屬性將接收默認值。

output_name = "my_extracted_item"

要顯式提供其他項目屬性,請使用具有以下語法的 dict。

output_name = {"title": "<title>",
               "tag": "<tags>",
               "snippet": "<snippet>",
               "description": "<description>"}

有關這些和其他項目屬性的更多信息,請參閱ArcGIS REST API. 中的項目資源頁麵

gis

可選,運行此工具的 GIS 。如果未指定,則使用活動 GIS。

estimate

可選的布爾值。如果為 True,將返回運行該操作的積分數。

future

可選布爾值。如果為 True,則將返回 future 對象,並且進程不會等待任務完成。默認為False,表示等待結果。

如果 future = True ,則結果是 Future 對象。調用result() 獲取響應。

例子:

# USAGE EXAMPLE: To extract data from highways layer with the extent of a state boundary.

ext_state_highway = extract_data(input_layers=[highways.layers[0]],
                         extent=state_area_boundary.layers[0],
                         clip=True,
                         data_format='ShapeFile',
                         output_name='state highway extracted')

相關用法


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