stac-utils / stac-layer

Visualize a STAC Item or Collection on a Leaflet Map
Creative Commons Zero v1.0 Universal
47 stars 11 forks source link

integration with "planetary computer" #20

Open DanielJDufour opened 2 years ago

DanielJDufour commented 2 years ago

I created this issue to track issues with integrating with Microsoft's "planetary computer". @JustinGOSSES is leading the way on this effort: https://observablehq.com/@justingosses/exploring-microsoft-planetary-computer-stac-catalog

DanielJDufour commented 2 years ago

Both changes in this commit: https://github.com/stac-utils/stac-layer/commit/75903710d3c4720e24ffaa9ef075b4b00706d06b

DanielJDufour commented 2 years ago

Issue with https://github.com/stac-utils/stac-layer/blob/main/src/test/stac-item/planetary-computer.html is that the asset with role "overview" (but name preview.png) returned by planetary computer is fully transparent: https://planetarycomputer.microsoft.com/api/data/v1/item/preview.png?collection=gap&items=gap_landfire_nationalterrestrialecosystems2011_-1161135_562215_-861135_262215&assets=data&tile_format=png&colormap_name=gap-lulc

I loaded up the data GeoTIFF in QGIS and that's all zero values in it:

Screen Shot 2021-11-09 at 8 48 55 AM Screen Shot 2021-11-09 at 8 49 24 AM

I'll try out more STAC features and see if we can debug them as well.

fwiw, it should be possible to write a library/function that would check if an image is fully transparent and log to the console when this is the case. this might be over-engineering though, so we'll have to test and see how often this is the case.

(Please excuse all the messages)

DanielJDufour commented 2 years ago

@JustinGOSSES , apologies if you already figured this. I think the reason why some of the images for the gap_landfire_nationalterrestial... feature collection aren't appearing is because they are in Mexico. I think they intersect the bbox of the continental USA, but not the actual polygon boundaries of the Landuse-Landcover Dataset that Microsoft uses.

DanielJDufour commented 2 years ago

For the projection issue, @JustinGOSSES , do you mean when the Leaflet map is displayed in typical Web Mercator, but the data is in something like Albers, so the image is warped when it's displayed? Do you have a specific example that you would like us to look at? Thank you!

That's all for now :-)

JustinGOSSES commented 2 years ago

I'll need to replicate the projection issue a bit more.

I initially thought it was just different projection than leaflet default, but then I noticed some behavior that seemed like it might relate to zooming behaviors.

Haven't dived in deep yet, just put that note in the notebook as a reminder to look into it later.