Skip to main content

Hello,

i’mtrying to download images from sentinel2 using AwsTileRequest .

my bbox coodinates are in WGS84 (e.g ESPG 4326), but when I read ther esult image seems like the the CRS is 32613.


This is how I have retrieved the images:


#get the bbox variables from given shape

bbox_size,bbox,bbox_coords_wgs84=get_bbox_from_shape(shapes,10)

#create list of available tiles and dates:

search_bbox = BBox(bbox_coords_wgs84, crs=CRS.WGS84)
search_time_interval = ('2020-11-28T00:00:00', '2020-12-09T23:59:59')


wfs_iterator = WebFeatureService(
search_bbox,
search_time_interval,
data_collection=DataCollection.SENTINEL2_L1C,
maxcc=1.0,
config=config
)

imgs_id=d]
dates=s]


for tile_info in wfs_iterator:
#print(tile_info)
tile_id=tile_infof'properties']''id']
date=tile_infof'properties']''date']
imgs_id.append(tile_id)
dates.append(date)

imgs_available=pd.DataFrame(list(zip(imgs_id,dates)),columns=s'tile_id','date'])
imgs_available

#save images

from sentinelhub import AwsTile
from sentinelhub import AwsTileRequest

imgs_id
for i in imgs_id:
try:
tile_id=i
print(tile_id)
tile_name, time, aws_index = AwsTile.tile_id_to_tile(tile_id)
print(tile_name,time,aws_index)

bands = ='B04','B08']
metafiles = ='tileInfo', 'preview', 'qi/MSK_CLOUDS_B00']
data_folder = '/imgs'

request = AwsTileRequest(
tile=tile_name,
time=time,
aws_index=aws_index,
bands=bands,
metafiles=metafiles,
data_folder=data_folder,
data_collection=DataCollection.SENTINEL2_L1C
)
request.save_data() # This is where the download is triggered

print('image was saved in '+ data_folder)
print(' ')


except:
print('I had problem')
continue

#read band 04

import rasterio
from rasterio.plot import show


with rasterio.open('./imgs/13QHC,2020-11-30,0/B04.jp2', driver='JP2OpenJPEG') as src:
print(dataset.profile)
show(src)


that shows the image with some metadata:


It looks to me like different than the area I was excpected to get and also it says differenct crs. so my question is if I suppose to handle differently the bbox (for example reproject the bbox coordinates) , or it suppose to be fine ?

The JP2 files on AWS come from ESA, and they are in UTMs. Sentinel-Hub makes searching for data simpler by taking care of the appropriate transformations. What happens in your case is that you have searched for tiles by specifying bounding box in WGS84, SH found the appropriate tile(s) and responded with AWS s3 bucket locations of original tiles. When you downloaded the JP2 files, they are in their appropriate UTM crs, as given by ESA.


TL;DR: everything is as it is supposed to be.


PS: You could also use SH to retrieve images (not only metadata); in this case you could also get the data in WGS84 (or a number of other CRSs) - Sentinel Hub service would do the necessary transformations for you.


Reply