3

I spent the whole day trying to install GDAL binding for Python. And now it seems to work. At least this import statement now does not produce any error messages:

from osgeo import gdal

now I want to use this creature, which is supposed for creating tiles.I tried two different ways:

import gdal_retile

and

from osgeo import gdal_retile

But they do not work.

How can I use this functionality?

2

gdal_retile.py is a Python script that makes use of the GDAL Python bindings but cannot be imported as a class or function. Depending on your GDAL version (>2.0) you can import most gdal utilities (gdalwarp, gdal_translate, ...) but not the Python scripts.

You can look at the source code of gdal_retile.py and pick out the functions you want to use and import them.

Alternatively you can call it as is (a command line utility) with subprocess.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.