Skip to main content

Extracting Metadata information from SentinelHubRequest API

  • 26 April 2024
  • 3 replies
  • 6 views

Hi,

I am using the following API to pull images from the L1C collection for a specific perid for one of my research project. When extracting the images from the request.get_data() result, I would like to save them with the date when the image was acquired.


Is this available as part of the request.get_data or request? If not how do I extract the date information? Do I need to use evalscript?


Also, how do I obtain other metadata information such as cloud cover? From one of the question in the forum, it looks like I may need to do that in the evalscript. But. I am hoping there is a direct way to obtain this from the API response


Also, is there a way to optimize the following request ? Essentially, I am trying to pul the images from the areas affected by wildfire


request = SentinelHubRequest(
evalscript=evalscript(),
input_data=[
SentinelHubRequest.input_data(
data_collection=DataCollection.SENTINEL2_L1C,
time_interval=(start_date, end_date),
mosaicking_order='leastCC',
)
],
responses=[SentinelHubRequest.output_response("truecolor", mime_type),
SentinelHubRequest.output_response("falsecolor", mime_type),
SentinelHubRequest.output_response("firemask", mime_type)],
bbox=bbox,
size=SIZE,
config=config,
)

return request.get_data()

I appologize if this has been already asked/answered.

I am able to get the metadata by adding the userdata to evalscript


Hi,

To save the images you could use get_data(save_data=True).


Thank you, for your response.


I needed to capture some metadata as well and need to store as part of file name.

I am positive there may be better ways to do this. But, after adding the userdata, I was able to get those.


Reply