Skip to content

Commit

Permalink
ol
Browse files Browse the repository at this point in the history
  • Loading branch information
morandd committed Nov 15, 2024
1 parent 4a8e702 commit cc89055
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/components/utils/ShowWholeCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ export function showWholeCollection(collectionUrl){
const layer = new STAC({
url: collectionUrl,
displayPreview: true,
collectionStyle: {
color: 'red',
},
assets: ['data'],

});

const background = new TileLayer({source: new OSM()});
Expand All @@ -27,15 +32,15 @@ export function showWholeCollection(collectionUrl){
}),
});
map.on('singleclick', async (event) => {
const objects = await getStacObjectsForEvent(event);
if (objects.length > 0) {
const ids = objects.map((obj) => obj.properties.productIdentifier);
document.getElementById('ids').innerText = ids.join(', ');
}
const objects = await getStacObjectsForEvent(event);
if (objects.length > 0) {
objects.forEach((obj) => console.log(obj));
}
});

layer.on('sourceready', () => {
const view = map.getView();
view.fit(layer.getExtent());
const view = map.getView();
view.fit(layer.getExtent());
});

return false;
Expand Down

0 comments on commit cc89055

Please sign in to comment.