Microsoft Planetary Computer STAC - unable to add image to moasic dataset in ArcGIS Pro

1841
8
Jump to solution
12-26-2023 02:49 AM
xingchenc
Occasional Contributor

Hi Rohan and David,

@RohanGanapathy  @DavidWright  

I followed your instructions on the blog regarding STAC (Introduction to the STAC UI in ArcGIS Pro (esri.com)). However I get very confused in this part (please see pic below)where we are supposed to create a cloud storage connecton file. Can you elaborate on the this part? Does it mean I need to create my own Azure account first?

xingchenc_0-1703587306607.png

In the end, I skipped this step and found out I can still get the search result but unable to add the image to the mosaic dataset, is this caused by the lack of cloud storage connection file?

 

xingchenc_1-1703587652708.pngxingchenc_2-1703587708379.png

 

Thank you!

 

0 Kudos
3 Solutions

Accepted Solutions
DavidWright
Esri Contributor

Hi xingchenc,

The STAC API endpoint is public so you're able to discover the assets. When you go to use the asset(s) though you will need an ACS connection. You don't need an Azure account to create ACS files.

This documentation describes how to create the cloud storage connection files  https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/create-cloud-storage-connect... Be sure and change to the Python tab and the last python example you'll see is for creating the connection to Microsoft Planetary Computer (MPC) Landsat collection. The unique aspect here in CreateCloudStorageConnectionFile function is around the concept of connecting with "token vending service". For each collection in the MPC there is a different set of parameters that you'll name to make the connection. Specifically, accesskey, bucketname, and ARC_TOKEN_SERVICE_API will vary.

As an alternative to creating them yourself, you can also download them from the ArcGIS for the Microsoft Planetary Computer (AMPC) repository at https://github.com/Esri/arcgis-for-mpc 

PLEASE NOTE: If you are intending to conduct any analysis at scale, do deploy a virtual machine with ArcGIS Pro in the Azure West Europe region right next to the data. You can do this manually or through the Azure  Marketplace AMPC listing https://azuremarketplace.microsoft.com/en/marketplace/apps/esri.arcgis-4mpc-template?tab=Overview and take advantage of the options that you need for your particular workflow. More info on the AMPC here: https://doc.arcgis.com/en/microsoft-planetary-computer/latest/help/get-started-with-arcgis-for-micro... 

View solution in original post

xingchenc
Occasional Contributor

Hi David,

@DavidWright 

Thanks for the thorough explanation, after creating the could store connection file using the sample code, I am able to add selected image to the mosaic dataset.

xingchenc_0-1703656079632.png

I have one more question though, if I would like to access other collection listed in the MPC catalog(i.e. modis product), how could I get the parameters needed to create the connecton file(please see pic below)?

xingchenc_1-1703656365072.png

Specifically, parameters like access key, bucket name?

 

 

View solution in original post

0 Kudos
DavidWright
Esri Contributor

Hi xingchenc,

Thanks for the update. Glad it is working for you. To create ACS for other MPC datasets you'll need to first gather the parameter values from Microsoft's Planetary Computer  Data Catalog. For example with MODIS Surface Reflectance 500m the dataset overview page provides a STAC Collection link. Use your browser to open it and search for the values of these three pieces of metadata:

id, msft:container , and msft:storage_account

Following Microsoft's documentation on generating tokens, build the URL for ARC_TOKEN_SERVICE_API like this https://planetarycomputer.microsoft.com/api/sas/v1/token/collection_id where collection_id is the id value you got from STAC Collection link.

Set Container Name to the value of msft:container

Set Account Name to the value of msft:storage_account

You could also automate this by parsing the three values out of the STAC response JSON.

View solution in original post

8 Replies
DavidWright
Esri Contributor

Hi xingchenc,

The STAC API endpoint is public so you're able to discover the assets. When you go to use the asset(s) though you will need an ACS connection. You don't need an Azure account to create ACS files.

This documentation describes how to create the cloud storage connection files  https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/create-cloud-storage-connect... Be sure and change to the Python tab and the last python example you'll see is for creating the connection to Microsoft Planetary Computer (MPC) Landsat collection. The unique aspect here in CreateCloudStorageConnectionFile function is around the concept of connecting with "token vending service". For each collection in the MPC there is a different set of parameters that you'll name to make the connection. Specifically, accesskey, bucketname, and ARC_TOKEN_SERVICE_API will vary.

As an alternative to creating them yourself, you can also download them from the ArcGIS for the Microsoft Planetary Computer (AMPC) repository at https://github.com/Esri/arcgis-for-mpc 

PLEASE NOTE: If you are intending to conduct any analysis at scale, do deploy a virtual machine with ArcGIS Pro in the Azure West Europe region right next to the data. You can do this manually or through the Azure  Marketplace AMPC listing https://azuremarketplace.microsoft.com/en/marketplace/apps/esri.arcgis-4mpc-template?tab=Overview and take advantage of the options that you need for your particular workflow. More info on the AMPC here: https://doc.arcgis.com/en/microsoft-planetary-computer/latest/help/get-started-with-arcgis-for-micro... 

xingchenc
Occasional Contributor

Hi David,

@DavidWright 

Thanks for the thorough explanation, after creating the could store connection file using the sample code, I am able to add selected image to the mosaic dataset.

xingchenc_0-1703656079632.png

I have one more question though, if I would like to access other collection listed in the MPC catalog(i.e. modis product), how could I get the parameters needed to create the connecton file(please see pic below)?

xingchenc_1-1703656365072.png

Specifically, parameters like access key, bucket name?

 

 

0 Kudos
DavidWright
Esri Contributor

Hi xingchenc,

Thanks for the update. Glad it is working for you. To create ACS for other MPC datasets you'll need to first gather the parameter values from Microsoft's Planetary Computer  Data Catalog. For example with MODIS Surface Reflectance 500m the dataset overview page provides a STAC Collection link. Use your browser to open it and search for the values of these three pieces of metadata:

id, msft:container , and msft:storage_account

Following Microsoft's documentation on generating tokens, build the URL for ARC_TOKEN_SERVICE_API like this https://planetarycomputer.microsoft.com/api/sas/v1/token/collection_id where collection_id is the id value you got from STAC Collection link.

Set Container Name to the value of msft:container

Set Account Name to the value of msft:storage_account

You could also automate this by parsing the three values out of the STAC response JSON.

xingchenc
Occasional Contributor

Hi David, 

@DavidWright 

Thank you for your detailed explanation.

Do you plan to write another blog regarding this? I'm sure many people like me are very interested in remote sensing resouces provided by Microsoft Planeary Computer but don't know how to get started. It makes much sense to me once you explained it all. 

0 Kudos
DavidWright
Esri Contributor

Thanks xingchenc,

It's a good idea to create some more resources and examples for ArcGIS with the Microsoft Planetary Computer. Is there a particular application area in remote sensing or particular sensor that catches your interest?  Do stay tuned for more STAC topic blogs as well from Esri on the developer side with respect to our APIs, and Mosaic Dataset Configuration Script. I'll be sure and promote them as they are released.

0 Kudos
xingchenc
Occasional Contributor

Hi David,

@DavidWright 

Our research manily focus on Landsat-9 and Sentinel-2, but we are eager to learn more about the capability provided by MPC. 

Thanks!

0 Kudos
EslamAbuelella1993
New Contributor

Hi David,

Thanks for the detailed explanation.

I have a similar issue here, as I am trying to get Microsoft Building Footprints  into my ArcGIS Pro. I followed the steps you described preciously, though I got an error states "Failed to add" whenever trying to add any building footprint to the map.

The ACS file parameters I used are shown below:

EslamAbuelella1993_0-1721067026731.png

The STAC connection details are as below:

EslamAbuelella1993_1-1721067254965.png

The error is as follows:

EslamAbuelella1993_2-1721067496276.png

 

 

 

 

0 Kudos
DavidWright
Esri Contributor

Hi Eslam,

Looks like you took all the necessary steps but at this time the STAC Connections in ArcGIS Pro are supporting only raster datasets. My hope is that support for other data types will be introduced. For now, there are some alternatives to loading the Microsoft Building Footprints content in ArcGIS. Please have a look at these resources and see if they meet your needs.

https://hub.arcgis.com/datasets/esri::microsoft-building-footprints-features/about

or:

https://gavinr.com/getting-the-microsoft-us-building-footprints-into-arcgis-pro/

0 Kudos