Reproject PixelGridDefn object using dense bounding box edges (not just corners) - #206
Merged
Merged
Conversation
Member
Author
|
This addresses some of the concerns raised in #204 |
gillins
approved these changes
Aug 4, 2026
Member
Author
|
Thanks @gillins. I am just putting together a rigorous test of this code to include in the test suite. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, footprint intersections etc., are calculated using reprojected corners of pixel grid bounding boxes. For some combinations of projection, on sufficiently large areas, the lack of the curved edges can result in clipping of the reprojected bounding box in ways which can lose data.
This PR implements reprojection of these bounding boxes using a fairly dense sampling of points along the edges, allowing the curve to be represented. This largely eliminates the problem, at least up to the level of the much shorter straight lines between sample points.
The following images demonstrate the problem and solution. The first circle is in lat/long coordinates. It is centred at (133E, 12.5S), i.e. in northern Australia. The radius is 2.5 degrees. The image is 42 degrees wide (roughly the width of Australia), which gives a long enough edge for the curvature to be significant.

The second is output from RIOS, without this PR. The working grid was in Australian Albers projection (3577), which curves the top edge to the north. Since the bounding box of the working grid does not allow for this curvature, the top of the circle is clipped off.

The third output is the same, but using the new implementation. As desired, the circle is not clipped.

Finally, this is the same image reprojected by

gdalwarp, showing a very good match.