Skip to content

Reproject PixelGridDefn object using dense bounding box edges (not just corners) - #206

Merged
neilflood merged 2 commits into
ubarsc:masterfrom
neilflood:dense-pixgrid-reproject
Aug 4, 2026
Merged

Reproject PixelGridDefn object using dense bounding box edges (not just corners)#206
neilflood merged 2 commits into
ubarsc:masterfrom
neilflood:dense-pixgrid-reproject

Conversation

@neilflood

@neilflood neilflood commented Aug 4, 2026

Copy link
Copy Markdown
Member

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.
circle_latlong

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.
circle_albers_clipped

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

Finally, this is the same image reprojected by gdalwarp, showing a very good match.
circle_gdalalbers

@neilflood

Copy link
Copy Markdown
Member Author

This addresses some of the concerns raised in #204

@neilflood

Copy link
Copy Markdown
Member Author

Thanks @gillins. I am just putting together a rigorous test of this code to include in the test suite.

@neilflood
neilflood merged commit 2d76f39 into ubarsc:master Aug 4, 2026
6 checks passed
@neilflood
neilflood deleted the dense-pixgrid-reproject branch August 4, 2026 04:11
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