I try to merge two DEM data sets with python, using gdal_merge, but it doesn't work. I install like this:

from osgeo import gdal

But this doesn't work:

import gdal_merge as gm

I get the error message:

No module named 'gdal_merge'

I am entirely new to Python

  • 1
    gdal_warp is its own Python script, so it uses the gdal package but it's not actually part of it. You'll notice it's not listed in the docs, unlike some of the non-Python utilities that are wrapped into the API such as gdal.Translate() – mikewatt Jan 17 at 23:37
  • Hm. I tried to import it as from osgeo import gdal_warp import gdal_warp but this failed. I guess I need a more basic understanding – svein Jan 18 at 8:39
  • What I mean is that by default you can't import it at all, because it's not part of the osgeo module. It wouldn't be "best practice" by any means, but If you're brand new to Python the easiest way to get going will be to copy/paste the source of gdal_edit into your own script so you can call the function. Otherwise you'll need to alter the path so Python can find that file for import – mikewatt Jan 18 at 17:36

Your Answer

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

Browse other questions tagged or ask your own question.