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

getBoundingBox tilegrid option #414

Merged

Conversation

mike-000
Copy link
Contributor

@mike-000 mike-000 commented Dec 5, 2023

The change introduced by #361 is not useful for OpenLayers which now has to duplicate the original code. An option to return the original value as a tilegrid extent would be more maintainable than duplication of code.

@DanielJDufour
Copy link
Contributor

Hi, @mike-000 . I appreciate your finding a solution that works for both uses cases. fwiw, looks good to me!

@mike-000
Copy link
Contributor Author

mike-000 commented Dec 8, 2023

@DanielJDufour In OpenLayers I simply applied the matrix transform or its inverse before or after any proj4 or identity transforms https://deploy-preview-15402--ol-site.netlify.app/en/latest/examples/cog-modeltransformation.html I'm not sure if that would be possible with Leaflet?

@DanielJDufour
Copy link
Contributor

@mike-000 , would you be able to share where in the OL code base you've been able to accomplish this? I'd love to learn more!

The newest version of GeoRasterLayer uses geowarp for the core resampling/reprojecting operations. It currently doesn't leverage the GPU or matrix multiplication, but I'm certainly open to it. I agree that there's a lot of potential there.

Our specific use case for getBoundingBox is Leaflet's GridLayer calling _isValidTile and needing to know if a web map tile intersects the rendered geotiff. A web map tile could be "valid" (need to render) depending on whether the matrix transform is applied.

@mike-000
Copy link
Contributor Author

mike-000 commented Dec 9, 2023

@DanielJDufour OpenLayers uses the same algorithm as its canvas reprojection https://openlayers.org/doc/tutorials/raster-reprojection.html using the canvas RGB bands - where there are more than 3 bytes of data per pixel the process is repeated until all have been processed (source code is in https://github.com/openlayers/openlayers/blob/main/src/ol/reproj/DataTile.js). The first commit in #15402 allows a transform matrix to be set on a projection which, if present, is used to create a custom coordinate transform which may also include a proj4 transform for the projection codes.

@ahocevar
Copy link
Contributor

ahocevar commented Jan 17, 2024

@DanielJDufour Could you please take another look at this? Having this merged and published would help in adding support for skewed or rotated GeoTIFFs in OpenLayers (openlayers/openlayers#15402), where this code is currently more or less duplicated.

@DanielJDufour
Copy link
Contributor

Hi, @constantinius . Just wanted to highlight this PR for your consideration. I think it's a great solution that works for both the OL and GeoRasterLayer use cases :-)

@constantinius constantinius merged commit b646d0b into geotiffjs:master Jan 19, 2024
@mike-000 mike-000 deleted the getBoundingBox-tilegrid-option branch January 19, 2024 11:22
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.

None yet

4 participants