Select to view content in your preferred language

Use Sentinel-2A images with Python (ArcPy)

1298
2
Jump to solution
11-11-2021 07:47 AM
Diego_Mendes_Rodrigues
Emerging Contributor

Colleagues,

I need to access Sentinel-2 Level-2A images from Esri's Living Atlas of The World using ArcPy.
(https://imagem.maps.arcgis.com/home/item.html?id=255af1ceee844d6da8ef8440c8f90d00)

If I cannot access the Living Atlas images, what would be another alternative?

The Sentinel-2 image I access needs to be with a certain objectid, example objectid: 23156221.

What should the code in ArcPy (or Python) look like for me to use Sentinel-2 images?

Thanks!

Diego

 

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
DonMorrison1
Frequent Contributor

I wasn't able to access the layer from arcpy - I'm not sure why. But an alternative is to use the  ArcGIS API for python.  The code to access your object would look like this ('255af1ceee844d6da8ef8440c8f90d00' is the ArcGIS item ID for the sentinal image layer):

from arcgis.gis import GIS

gis = GIS(url=None, username=<my_id>, password=<my_pw>)
item = gis.content.get('255af1ceee844d6da8ef8440c8f90d00')
record = item.layers[0].query(where="objectid=23156221").to_dict()['features'][0]
print (record)

 

View solution in original post

2 Replies
DonMorrison1
Frequent Contributor

I wasn't able to access the layer from arcpy - I'm not sure why. But an alternative is to use the  ArcGIS API for python.  The code to access your object would look like this ('255af1ceee844d6da8ef8440c8f90d00' is the ArcGIS item ID for the sentinal image layer):

from arcgis.gis import GIS

gis = GIS(url=None, username=<my_id>, password=<my_pw>)
item = gis.content.get('255af1ceee844d6da8ef8440c8f90d00')
record = item.layers[0].query(where="objectid=23156221").to_dict()['features'][0]
print (record)

 

Diego_Mendes_Rodrigues
Emerging Contributor

How can I download this service's image using Python?

0 Kudos