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

Add a snap_to method to GeoBoxes to enable coercing GeoBoxes to the same pixel alignment #59

Closed
robbibt opened this issue Jul 22, 2022 · 2 comments · Fixed by #65
Closed

Comments

@robbibt
Copy link
Contributor

robbibt commented Jul 22, 2022

I have two low-resolution GeoBoxes created by "zooming out" of two existing higher resolution dataset GeoBoxes:

lowres_geobox1 = ds1.odc.geobox.zoom_out(500)
lowres_geobox2 = ds2.odc.geobox.zoom_out(500)

Although these GeoBoxes share the same resolution and CRS, they do not share the same pixel alignment, resulting in pixels that do not align correctly:
image

I would like to be able to "snap" lowres_geobox2 to the pixel alignment of lowres_geobox1, so that both of my low resolution grids align perfectly:
image

Snapping is currently supported when creating a new GeoBox directly (e.g. via GeoBox.from_bbox), however it would be useful to have a GeoBox method that would allow a user to perform snapping on existing GeoBoxes as well.

@robbibt
Copy link
Contributor Author

robbibt commented Jul 22, 2022

Unsnapped and snapped grids:
image

image

@Kirill888
Copy link
Member

Probably also worth adding snap=False|True to zoom_out method, aligning two arbitrary geoboxes with compatible reprojections/resolution to each other is somewhat more involved (but not a lot more) than snapping to pixel size.

Maybe also worth supporting alignment between geoboxes of different resolutions when pixel sizes are related via exact integer scale 1x1 == 3x3.

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 a pull request may close this issue.

2 participants