Skip to content

Python bindings: expose gdal_translate -eco and -epo #12128

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 4 commits into from
Apr 16, 2025

Conversation

dbaston
Copy link
Member

@dbaston dbaston commented Apr 11, 2025

  1. Sets GDALTranslateOptions::bQuiet to true by default. Otherwise, it is only true when called constructed with a progress callback. Possibly this variable could be removed altogether, as there are other methods for squelching errors.

  2. Exposes gdal_translate options -epo and -eco as errorIfWindowPartiallyOutsideSource and errorIfWindowCompletelyOutsideSource. I would love for these to be True by default, but...backwards compatibility. (Maybe they could be the default for gdal raster clip though? ) I also don't love the names, maybe there is a better way to do it with a single text argument.

@coveralls
Copy link
Collaborator

Coverage Status

coverage: 70.586% (+0.01%) from 70.574%
when pulling 5c7f295 on dbaston:gdal-translate-python-epo
into c4a2e0b on OSGeo:master.

@rouault
Copy link
Member

rouault commented Apr 11, 2025

2. I also don't love the names, maybe there is a better way to do it with a single text argument.

maybe errorIfWindowOutsideSource = partially | fully ?

(there's a conflict in the test with your previous PR I just merged)

@jratike80
Copy link
Collaborator

So this case, where the -projwin is in EPSG:2391 and is the minimum envelope that covers the whole source raster that is in EPSG:3067, is an -epo case, right? No complaint, just want to know.

image

@dbaston
Copy link
Member Author

dbaston commented Apr 11, 2025

So this case, where the -projwin is in EPSG:2391 and is the minimum envelope that covers the whole source raster that is in EPSG:3067, is an -epo case, right?

Yes, but I can see that this is crying out for some examples in the docs. You can also try it on with -epo on the command line (that has been available for a very long time).

For me, the surprising thing about allowing a window outside source raster is how the extra pixels get populated with zeros, not NoData.

@dbaston dbaston force-pushed the gdal-translate-python-epo branch from 5c7f295 to 663cc62 Compare April 16, 2025 16:20
@rouault rouault added this to the 3.11.0 milestone Apr 16, 2025
@rouault rouault merged commit f401ea8 into OSGeo:master Apr 16, 2025
47 of 49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants