Give WMS images' folders names based on the image id

Hello,

I have managed to download wms images using sentinel-hub py but I have problem to identify the images.
I can print their names as described in the documentation but I don’t know how to give the folders proper name that will tell me regard the date and the tile of the image.

with WFS I could do it using AwsTile:

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

imgs_id=[]
dates=[]


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

#now I have list of the dates and the ids
#next step to save the images with  proper name for the folder:

for i in imgs_id:
    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 = './imgs1'
    request = AwsTileRequest(
        tile=tile_name,
        time=time,
        aws_index=aws_index,
        bands=bands,
        metafiles=metafiles,
        data_folder=data_folder,
        image_format=MimeType.TIFF,
        data_collection=DataCollection.SENTINEL2_L1C
        )
    request.save_data()  # This is where the download is triggered
        
    print('image was saved in '+ data_folder)

but now wit hthe WMS I’m not sure how to do that.
the images saved in folder with name that I can not understand with json and tiff ,and as far as I understood the json has no information regard the image id.
this is how my folder with the images folders look like, no much information from folders name:
image

and the geojson seems not t ocontain information regard the image.

How can I give names to the folders or the images based on their image id?

Just updating that in the end I could do it wit hthe folllwing flow:

  1. WmsRequest without sacing the data
  2. create list of the dates using get_dates() function
  3. for loop with the list of dates- each time running WmsRequest for specific date, the date is the data_folder,and saving the data

on this way I could know which image is from which date.
However, if you have any explaination regard the names of the folders , of how it was generated, or easier solution, I would love to learn

1 Like