Request for more images.

I have a list with multiple image ids. How can I make a download request for all the images in the list at once?

Hi Maria,

can you be more specific? Are you trying to download full images or just a certain AOI? And which sensor are you trying to use?

hi :smile:

I am trying to download a series of Sentinel 2 images after a polygon for a year to observe the evolution.

Then I suggest having a look at this example in the Sentinel Hub Python documentation. It shows how you can loop several requests/time ranges using the Process API.

Hope that this helps you out!

1 Like

Thank you for your help.
I managed to do what I set out to do. I automatically created slots at 5-day intervals (the time interval in which the sentinel 2 images are retrieved) and that’s how I managed to iterate one request for each slot separately.

Part of the code looks like this:

  #Definirea perioadei de timp
  start = datetime.datetime(2023, 1, 3)
  end = datetime.datetime(2023, 12, 31)
  
  #Definirea numărului de timestamp-uri și a intervalului de timp
  n_chunks = int((end - start).days / 5) + 1  # Calculăm numărul de intervale de 15 zile
  tdelta = datetime.timedelta(days=5)
  edges = [(start + i * tdelta).date().isoformat() for i in range(n_chunks)]
  slots = [(edges[i], edges[i + 1]) for i in range(len(edges) - 1)]
  
  print("time windows:\n")
  for slot in slots:
      print(slot)
  
  for slot_index, slot in enumerate(slots):
      # Iterați prin fiecare poligon și obțineți BBox-ul
      for index, row in gdf.iterrows():
          bbox = BBox([row.geometry.bounds[0], row.geometry.bounds[1], row.geometry.bounds[2], row.geometry.bounds[3]], crs=crs_4326)

    # Obțineți limitele BBox-ului
    min_x, min_y = bbox.min_x, bbox.min_y
    max_x, max_y = bbox.max_x, bbox.max_y
    bbox_size = bbox_to_dimensions(bbox, resolution=10)

    # Definirea funcției pentru cererea de imagine 
    def get_sentinel2(time_interval): 
        return SentinelHubRequest(
            evalscript=evalscript_sentinel2,
            input_data=[
                SentinelHubRequest.input_data(
                    data_collection=DataCollection.SENTINEL2_L2A,
                    time_interval=time_interval,
                    mosaicking_order='mostRecent',  # Utilizăm cea mai recentă imagine pentru mozaic
                )
            ],
            responses=[SentinelHubRequest.output_response("default", MimeType.TIFF)],
            bbox=bbox,
            size=bbox_size,
            config=config,
        )
1 Like