Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show (non-cloud-optimized) GeoTiffs by default, too #46

Merged
merged 3 commits into from
Aug 19, 2022

Conversation

m-mohr
Copy link
Collaborator

@m-mohr m-mohr commented Aug 19, 2022

Instead of just looking for COGs to show, also allow GeoTiffs to be loaded automatically. Added an option so it should now affect existing implementations.

Copy link
Member

@DanielJDufour DanielJDufour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a test case that we can build for this? It might help me understand a little better the use case. Is the scenario that sometimes there is a COG and separate non-COG asset and we want to prioritize them differently?

If we don't have time for that, I can approve, merge and just make sure there are no regressions before approving. I'm also wondering if we want to comment this option out in the README.md, so we aren't committing to maintaining it as part of the "public" api until we have more use cases.

src/index.js Outdated Show resolved Hide resolved
@m-mohr
Copy link
Collaborator Author

m-mohr commented Aug 19, 2022

Not yet, but I can add one quickly. By default only COGs were loaded automatically for e.g. Items and I also want this to be possible for GeoTiff. In my use-case it's just a single asset in the Item with the GeoTiff media type. That's the only use-case I have right now.

@m-mohr
Copy link
Collaborator Author

m-mohr commented Aug 19, 2022

Thanks! Just added a test (stac-item/geotiff-default.html). I think it's fine to have this in the public API, I feel it is useful in any case where you don't have COGs but smaller GeoTiffs in STAC.

@DanielJDufour
Copy link
Member

DanielJDufour commented Aug 19, 2022

hmm... lots of factors to think about!

I think originally the thinking for only displaying COGs was that if there is a large non-COG GeoTIFF, it would be bad to try to render it because the layer would try to fetch a lot of data into the browser. It would appear as if it wasn't working to the user, because it would take a long time for the layer to fetch and display.

I'm wondering if displayGeoTiff would be more preferable than displayGeoTiffByDefault. And adapt the code to only display a non-COG if the option is passed in as true. (my reading is that the new changes would always try to display a large non-COG if no COG is available)

Long-term, it would probably be possible to create an open-source library that could guess the file size of a GeoTIFF by its metadata or maybe can we do a HEAD request to get the file size? We could then set a threshold, so anything lower than 10 MB would be displayed by default.

It's a tough case, especially for stac-browser where you are trying to work for all cases! :-)

@m-mohr
Copy link
Collaborator Author

m-mohr commented Aug 19, 2022

Yes, that's why the option is off by default, also in STAC Browser. This is really for niche cases where the author is sure that the input/catalog only contains small GeoTiffs. We have that currently for a catalog that contains ML source imagery, which are all 256x256px GeoTiffs, which are pretty small and I need the GeoTiffs to show up automatically. In this case, I enable this specifically in that deployment.

The option is really just for default detection, because if you pass a GeoTiff asset it already loads large GeoTiffs with the existing code so displayGeoTiff sounds like it would also disable that, which would change the existing behavior.

As the current implementation shouldn't change anything if you don't set the option specifically, I don't see a huge risk here.

I like the HEAD idea for the future!

@DanielJDufour
Copy link
Member

sounds good. will merge and then test and republish

@DanielJDufour DanielJDufour merged commit e4f2a7e into main Aug 19, 2022
@m-mohr m-mohr deleted the allow-geotiff branch August 20, 2022 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants