简述
本文将介绍如何使用ArcGIS Pro 3.2连接到微软Planetary Computer中的Landsat Collection,在ArcGIS Pro客户端实现对Landsat数据的检索、加载到镶嵌数据集中以及进行后续分析。
步骤
创建镶嵌数据集
创建云存储连接文件
获取创建云存储连接文件所需参数
- 在Data Catalog页面寻找需要的数据集(https://planetarycomputer.microsoft.com/catalog)
- 以Landsat Collection 2 Level-2数据集(https://planetarycomputer.microsoft.com/dataset/landsat-c2-l2)为例,单击其中的STAC Collection链接。
- 在页面中查询三个参数,分别是 ID、msft:container和msft:storage_account。本例中,ID为“landsat-c2-l2”,msft:container为“landsat-c2”,msft:storage_account为“landsateuwest”。
-
在使用创建云存储连接文件工具时,需要以上几个参数,其中
a. Access Key ID(Account Name)对应上面的msft:storage_account参数 b. Bucket(Container)Name对应上面的msft:container参数 c. 连接到数据集需要使用MPC的认证服务,首先将ARC_TOKEN_OPTION_NAME 的参数设为AZURE_STORAGE_SAS_TOKEN,即表示将使用SAS TOKEN进行认证。接下来提供ARC_TOKEN_SERVICE_API参数(token生成api),需要按以下标准进行构建, [https://planetarycomputer.microsoft.com/api/sas/v1/token/collection_id](https://planetarycomputer.microsoft.com/api/sas/v1/token/collection_id),其中需要用上面获取的id参数替换链接中的collection_id项
token生成的两种方式:
方法1:使用“Create Cloud Storage Connection File”工具创建云存储连接文件
服务端关键参数
provider = "Azure"
accesskey = "landsateuwest"
secretkey = ""
bucketname = "landsat-c2"
folder = ""
region = ""
endpoint = ""
config_options= "ARC_TOKEN_OPTION_NAME AZURE_STORAGE_SAS_TOKEN; ARC_TOKEN_SERVICE_API https://planetarycomputer.microsoft.com/api/sas/v1/token/landsateuwest/landsat-c2"
方法2:使用Python脚本创建
import arcpy
outfolder = "C:\Test\STAC_TEST"
connectname = "planetary_landsat.acs"
provider = "Azure"
accesskey = "landsateuwest"
secretkey = ""
bucketname = "landsat-c2"
folder = ""
region = ""
endpoint = ""
config_options= "ARC_TOKEN_OPTION_NAME AZURE_STORAGE_SAS_TOKEN; ARC_TOKEN_SERVICE_API https://planetarycomputer.microsoft.com/api/sas/v1/token/landsateuwest/landsat-c2"
# Create connection to planetary computer landsat data collection
print(arcpy.CreateCloudStorageConnectionFile_management(outfolder, connectname, provider, bucketname, accesskey, secretkey, region, endpoint, config_options, folder))
print(arcpy.GetMessages())
查看创建的云存储连接
使用已创建好的云存储连接文件
在此地址(https://github.com/Esri/arcgis-for-mpc/tree/main/AMPC_Resources/ACS_Files)可下载Esri针对MPC资源里的各数据集预创建好的云存储连接文件,可直接使用。
创建STAC连接
配置STAC连接
连接到Microsoft Planetary Computer STAC:
- Connection Name:取一个连接名称
- Connections:在这里从下拉菜单中选择预设的“Microsoft Planetary Computer”,若是其他STAC资源,需要填入资源URL地址
- Cloud Storage Connection:选择刚创建云存储连接文件
影像检索
进入检索界面
选中刚创建的STAC连接,点击右键,选择Search STAC Items
选择数据集
选择“landsat-c2-l2”数据集
指定时间范围
指定空间搜索范围
指定属性搜索条件
本例中搜索平台为“lansat-9”卫星,且云量小于10%
查看搜索结果
切换到“result”标签页查看搜索结果
将影像加载至镶嵌数据集
选中其中的一个影像,加载至镶嵌数据集
在弹出的“添加栅格至镶嵌数据集”工具中,选择之前创建好的镶嵌数据集,栅格类型选择Landsat9,处理模板选择地表反射率(Surface Reflectance),点击运行。
查看镶嵌数据集
查看镶嵌数据集并设置拉伸
影像分析
尝试裁剪功能,成功
结论
- 提供的ArcGIS Pro 3.2中的STAC功能可快速连接到STAC节点
- 可提供镶嵌数据集的所有功能,例如分析
参考文档
Introduction to the STAC UI in ArcGIS Pro
Microsoft Planetary Computer STAC - unable to add image to moasic dataset in ArcGIS Pro