Opened 12 years ago
Closed 6 years ago
#4786 closed enhancement (fixed)
gdal_calc.py not import friendly
Reported by: | kyngchaos | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Utilities | Version: | 1.9.1 |
Severity: | normal | Keywords: | |
Cc: | CYesson |
Description
I needed to use gdal_calc functionality in a python script. As far as I know, the preferred method to use an executable python script in another is to import it and use its functions directly, instead of running it as a separate program (indeed, I had problems with using it with spawn*).
gdal_calc.py does have a function ("doit") to do the actual work based on options passed to the program, but the options are passed as OptionParser opts and args, from the optparse module (which is deprecated in Python 2.7 btw). I had to recreate the OptionParser configuration from gdal_calc's main() to be able to use the doit() function.
It would be much easier to use doit() if the options were passed as meaningful parameters to doit().
Change History (3)
comment:1 by , 12 years ago
Cc: | added |
---|
comment:2 by , 8 years ago
comment:3 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This issue was fixed in 2016 with this pull request: https://github.com/OSGeo/gdal/pull/121
Needs to be a programmer for understanding this. Is that a good suggestion?