How Can I Get All the Images From an Area of Interest in a Desired Time Period?

Use Sentinel Hub WFS request** and retrieve all relevant geometries for a given bounding box and time frame. From the response gather the unique dates. For each date, construct a WCS request to retrieve the image.

See the code example below:

<script>
<script>
// using Sentinel Hub OGC web services - https://www.sentinel-hub.com/develop/capabilities/wms
// config
window.SENTINEL_HUB_INSTANCE_ID = '<SENTINEL_HUB_INSTANCE_ID>';
window.layerName = '1_NATURAL_COLOR';
window.from = '2015-01-01';
window.to = '2017-04-20';
window.bbox = '-410925.4640611076,4891969.810251283,-391357.58482010243,4911537.689492286';
window.maxFeatures = 100; // 100 is max
let images = [];
let url = `https://services.sentinel-hub.com/ogc/wfs/${window.SENTINEL_HUB_INSTANCE_ID}
?service=WFS&amp;version=2.0.0&amp;request=GetFeature&amp;time=${window.from}/${window.to}/P1D&amp;typenames
=TILE&amp;maxfeatures=${window.maxFeatures}&amp;srsname=EPSG:3857&amp;bbox=${window.bbox}&amp;outputformat=application/json`;
(async () =>; {
// retrieving
// relevant geometries/images in bbox at time from-to
// Sentinel Hub - WFS request - https://www.sentinel-hub.com/develop/documentation/api/ogc_api/wfs-request
try {
let response = await fetch(url);
let data = await response.json();
relevantGeometries = data;
return data;
} catch (e) {
throw new Error('There was an error fetching the list of geometries from WFS service.\nDid you
substitute your SENTINEL_HUB_INSTANCE_ID?');
}
})().then(geometries =>; {
// parsing
// relevant geometries ->; all relevant dates
if(geometries.features === undefined) geometries.features = []
let dates = new Set();
geometries.features.forEach(value =>; {
dates.add(value.properties.date)
});
return Array.from(dates);
}).then(dates =>; {
// mapping
// dates ->; image url
// images available via WCS request - https://www.sentinel-hub.com/develop/documentation/api/ogc_api/wcs-request
dates.forEach(date =>; {
let niceName = `${window.layerName} from ${date}.tiff`;
niceName = encodeURIComponent(niceName);
let imageUrl = `https://services.sentinel-hub.com/ogc/wcs/${window.SENTINEL_HUB_INSTANCE_ID}
?service=WCS&amp;version=1.1.2&amp;request=GetCoverage&amp;time=${date}&amp;coverage=
${window.layerName}&amp;nicename=${niceName}&amp;bbox=${window.bbox}`;
images.push(imageUrl);
});
shout(images);
});
let shout = value =>; {
console.log('Images', value);
}
</script>
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.