Skip to main content
Tweeted twitter.com/StackGIS/status/1399697239413514243
Became Hot Network Question
baming
Link
Vince
  • 20.3k
  • 16
  • 48
  • 65

How to use gdalGDAL from within a Python program

Source Link
Pythonist
  • 389
  • 4
  • 12

How to use gdal from within a Python program

I have a fairly complex Python program that needs to use a single command of GDAL. Currently I'm using os.popen to call the command gdalwarp from Python. This works, but is an ugly approach, so I'd prefer to use GDAL from within the Python program. However I'm a bit overwhelmed by the documentation and I have found no simple example I can use to tackle my problem.

The command I'm using is something like:

gdalwarp -overwrite -co compress=none -of Gtiff -t_srs EPSG:4326 -te -180.02250000 -90.02250000 179.97750000 90.02250000 -tr 0.045 0.045 *.tiff output.tiff

How can I reproduce the behaviour of this command with Python calls to the GDAL library?