本文簡要介紹 python 語言中 arcgis.raster.analytics.optimal_path_as_line
的用法。
用法:
arcgis.raster.analytics.optimal_path_as_line(input_destination_data, input_distance_accumulation_raster, input_back_direction_raster, destination_field=None, path_type='EACH_ZONE', output_feature_name=None, context=None, create_network_paths='DESTINATIONS_TO_SOURCES', *, gis=None, future=False, **kwargs)
返回:
輸出要素圖層項目
計算從源到目的地的最佳路徑作為特征。 ArcGIS Image Server 10.8.1 及更高版本中可用的函數。
Parameter
Description
input_destination_data
必需的
ImageryLayer
或FeatureLayer
對象。傳送門物品可以通過。一個數據集,用於識別確定到達成本最低來源的最佳路徑的位置。如果輸入是柵格,則它必須包含具有目的地有效值的像元,並且必須為其餘像元指定 NoData。零是有效值。
input_distance_accumulation_raster
必需的
ImageryLayer
對象。傳送門物品可以通過。距離累積柵格用於確定從源到目的地的最佳路徑。距離累積柵格通常使用
distance_accumulation()
或distance_allocation()
創建。距離累積柵格中的每個像元表示表麵上從每個像元到一組源像元的最小累積成本距離。input_back_direction_raster
必需的
ImageryLayer
對象。傳送門物品可以通過。反向柵格包含計算的方向(以度為單位)。該方向確定沿著最佳路徑回到最小累積成本源的下一個單元格,同時避免障礙。值的範圍是從 0 度到 360 度,其中 0 保留給源單元格。正東(右)為 90,值順時針增加(180 為南,270 為西,360 為北)
destination_field
可選字符串。用於獲取目標位置值的字段。
path_type
可選字符串。定義輸入目標數據上的值和區域將在成本路徑計算中解釋的方式的關鍵字。
EACH_ZONE - 對於輸入目標數據上的每個區域,確定 least-cost 路徑並將其保存在輸出柵格上。使用此選項,每個區域的least-cost 路徑從區域中成本距離權重最低的像元開始。這是默認設置。
BEST_SINGLE - 對於輸入目標數據上的所有單元格,least-cost 路徑源自具有最小 least-cost 路徑到源單元格的單元格。
EACH_CELL - 對於輸入目標數據上具有有效值的每個像元,確定 least-cost 路徑並將其保存在輸出柵格上。使用此選項,輸入目標數據的每個單元格都被單獨處理,並為每個來自單元格的 least-cost 路徑確定。
output_feature_name
可選的。如果未提供,則由該方法創建要素圖層並將其用作輸出。
您可以從 GIS 中傳入現有要素圖層項目以使用它。
或者,您可以傳入應通過此方法創建的輸出要素圖層的名稱,以用作工具的輸出。如果該名稱的服務已經存在,則會引發 RuntimeError
context
可選字典。上下文包含影響任務執行的其他設置。
create_network_paths
可選字符串或布爾值。指定是否計算從目標到源的完整且可能重疊的路徑,或者是否創建不重疊的網絡路徑。
DESTINATIONS_TO_SOURCES(False):計算從目的地到源的完整路徑,該路徑可以重疊。這是默認的。
NETWORK_PATHS(真):計算不重疊的網絡路徑。
ArcGIS Image Server 10.9 及更高版本中可用的參數。
gis
僅關鍵字參數。可選的
GIS
對象。如果未指定,則使用當前活動的連接。future
僅關鍵字參數。可選的布爾值。如果為 True,則結果將是一個 GPJob 對象,並且結果將異步返回。
folder
僅關鍵字參數。可選的 str 或 dict。使用給定的文件夾名稱在門戶中創建一個文件夾(如果不存在),並將輸出保留在此文件夾中。
create_folder()
返回的字典也可以作為輸入傳入。例子:
{‘username’: ‘user1’,‘id’: ‘6a3b77c187514ef7873ba73338cf1af8’,‘title’: ‘trial’}例子:
# Usage Example 1: To calculate the optimal path from a source to a destination. destination_data = gis.content.search("my_destination_data")[0].layers[0] accumulation_raster = gis.content.search("my_accumulation_raster")[0].layers[0] back_direction_raster = gis.content.search("my_back_direction_raster")[0].layers[0] optimal_path_op = optimal_path_as_line(input_destination_data=destination_data, input_distance_accumulation_raster=accumulation_raster, input_back_direction_raster=back_direction_raster, output_feature_name="optimal_path_feature", gis=gis)
相關用法
- Python ArcGIS optimal_region_connections用法及代碼示例
- Python ArcGIS overlay_data用法及代碼示例
- Python ArcGIS offset用法及代碼示例
- Python ArcGIS overlay_layers用法及代碼示例
- 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用法及代碼示例
- Python ArcGIS RunInterval用法及代碼示例
- Python ArcGIS describe_dataset用法及代碼示例
- Python ArcGIS acos用法及代碼示例
- Python ArcGIS Item.publish用法及代碼示例
- Python ArcGIS MapImageLayer.find用法及代碼示例
- Python ArcGIS Group.get_members用法及代碼示例
- Python ArcGIS Geometry.last_point用法及代碼示例
- Python ArcGIS Worker用法及代碼示例
- Python ArcGIS ContentManager.delete_folder用法及代碼示例
注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 arcgis.raster.analytics.optimal_path_as_line。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。