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


Python ArcGIS upload_imagery_to_agol_userstore用法及代碼示例

本文簡要介紹 python 語言中 arcgis.raster.utils.upload_imagery_to_agol_userstore 的用法。

用法:

arcgis.raster.utils.upload_imagery_to_agol_userstore(files, direct_access_url=None, auto_renew=True, upload_properties=None, *, gis=None)

返回:

文件路徑列表。

在ArcGIS Online 上將文件上傳到用戶的柵格存儲並返回 url 列表。

然後可以將 url 列表與 copy_raster() create_image_collection() 方法一起使用,在 ArcGIS Online 上創建圖像層。

要使此函數正常工作,需要預先安裝適用於 Python 的 Azure 庫包(Azure SDK for Python - azure-storage-blob: 12.1<= version <=12.9)。參考https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-python#install-the-package

Parameter

Description

files

必需的。它可以是需要上傳的文件夾、文件列表或單個文件。

direct_access_url

可選字符串。使用 generate_direct_access_url() 生成的直接訪問 url。如果未指定,該函數將在內部生成直接訪問 url,有效期為 1440 分鍾。

auto_renew

可選的布爾值。如果設置為 True,函數將繼續上傳,直到通過自動更新直接訪問 url 上傳整個數據。 (默認為真)

upload_properties

可選字典。 upload_properties可以用來控製具體的上傳參數。

可用選項:

  • maxUploadConcurrency:可選整數。用於大型上傳的最大並行連接數(當單個文件/blob 大小超過 64MB 時)。這是max_concurrency的參數BlobClient.upload_blob()方法。 (默認為 6)

  • maxWorkerThreads:可選整數。上傳多個文件時異步執行的最大線程數。這是max_workers的參數ThreadPoolExecutor()類。 (默認為無)

  • displayProgress:可選布爾值。如果設置為 True,將顯示一個進度條,用於跟蹤上傳到用戶光柵存儲的進度。 (默認為False)

    例子:

    {“maxUploadConcurrency”:8,
    “maxWorkerThreads”:20,
    “displayProgress”:True}

gis

僅關鍵字參數。可選 GIS 。運行此函數的 GIS。如果未指定,則使用活動 GIS。

例子:

# Usage Example: Generates an expirable direct access url and uploads files to the user's raster store.

sas_url = generate_direct_access_url(expiration=180, gis=gis)

uploaded_imagery = upload_imagery_to_agol_userstore(files=r"/path/to/data", 
                                                    direct_access_url=sas_url,
                                                    upload_properties={"displayProgress":True},
                                                    gis=gis
                                                    )

# Following snippet executes the copy_raster() function on the uploaded imagery to create imagery layer item on ArcGIS Online.

copy_raster_op = copy_raster(input_raster=uploaded_imagery,
                             raster_type_name="Raster Dataset",
                             output_name="output_layer",
                             gis=gis)

相關用法


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