Skip to content

gdal_translate: expand output to include pixels partially within -projwin #12105

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

Merged
merged 3 commits into from
Apr 10, 2025

Conversation

dbaston
Copy link
Member

@dbaston dbaston commented Apr 7, 2025

Currently, gdal_translate rounds -projwin to the nearest pixels to avoid a grid shift. This may result in an output dataset that does not fully cover -projwin. This can be confusing, particularly when -projwin is specified in a different CRS from the source dataset. This PR modifies this behavior such that the output extent always includes -projwin.

This breaks several driver tests. I can fix those if the change is conceptually OK.

@dbaston dbaston marked this pull request as draft April 7, 2025 21:36
@rouault
Copy link
Member

rouault commented Apr 7, 2025

if the change is conceptually OK.

looks good to me!

@dbaston dbaston force-pushed the translate-projwin-expand branch from af2c4c3 to 0c3cf66 Compare April 7, 2025 23:02
@dbaston dbaston force-pushed the translate-projwin-expand branch 2 times, most recently from 35e8ea8 to 3c41908 Compare April 10, 2025 18:05
@dbaston dbaston force-pushed the translate-projwin-expand branch from 73f081e to ca3ae9b Compare April 10, 2025 18:10
@dbaston
Copy link
Member Author

dbaston commented Apr 10, 2025

In the end I needed to update expected results for tests in the VRT, WCS, ESRIC, and OGCAPI drivers. I'm not super-comfortable with the 50k-line diff in the OGCAPI tests, but 🤷‍♂️

@dbaston dbaston marked this pull request as ready for review April 10, 2025 19:56
@rouault rouault merged commit c4a2e0b into OSGeo:master Apr 10, 2025
37 checks passed
@rouault rouault added this to the 3.11.0 milestone Apr 10, 2025
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