Skip to main content

Hello,

I am using sentinelhub.WcsRequest to query an image from Sentinel-2 L2A.

I would like to know if there is an easy way to query the closest next image available from the query date.


For example:

I have the date “16/01/2020” and my goal is to obtain an image (True color RGB) as soon as there is an image available after that date that fits the maxcc (maximum cloud coverage) requirement (for example maxcc = 0.3)


I could just search a large range of dates. For example, I could search in (“16/01/2020”, “16/02/2020”). But there is no guarantee that there will be an available image if I constrain the maxcc too much. If I do not find an image, then I would search in a larger range and so on, but I am trying to find a smarter way than this.


For that matter, I am also trying to get the latest date up to that query date. That is to say, the closest previous date available that fits the constraints.


Any help or guidance would be much appreciated!

You might want to check the Catalogue API, which provides the list of available dates over specific area, them use these outputs in your WCS query.

docs.sentinel-hub.com
d3714e73b38a87afa3c31502a6696052a7395163.png


Catalog API examples



Catalog API examples in curl. To run the examples, you need an access token.








Thank you @gmilcinski !


In case someone finds this question I could get the available dates with this:


catalog = SentinelHubCatalog(config=config)

search_iterator = catalog.search(

DataCollection.SENTINEL_L2A,

bbox=bbox,

time=time_interval,

query={

“eo:cloud_cover”: {

“lt”: 5 # lt = Less Than

}

},

distinct=‘date’

)


or with


catalog = SentinelHubCatalog(config=config)

search_iterator = catalog.search(

DataCollection.SENTINEL_L2A,

bbox=bbox,

time=time_interval,

query={

“eo:cloud_cover”: {

“lt”: 5 # lt = Less Than

}

},

fields={

“include”: /

“properties.datetime”,

],

“exclude”: >]

}

)


And in case it is for LANDSAT 8, you have to provide the base_url:


catalog = SentinelHubCatalog(base_url=“http://services-uswest2.sentinel-hub.com”, config=config)

search_iterator = catalog.search(

DataCollection.LANDSAT8,

bbox=bbox,

time=time_interval,

query={

“eo:cloud_cover”: {

“lt”: 5

}

},

distinct=‘date’

)


Reply