I'm using GDAL v2.14 on my Windows 10 machine. In that environment, I have two gdal python bindings. One is import gdal
, the other is import osgeo
. I installed Python's gdal using http://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal.
On my Ubuntu server, there are two ways to install gdal. One is to do sudo apt-get install python-gdal
and the other is pip install gdal
(but you need the C headers for this install).
On my Windows install, I can use gdal.Warp()
to warp a projection, or crop it. On Ubuntu, this fails with the error AttributeError: 'module' object has no attribute 'Warp'
on both "installations" of gdal. How can I make it cross-platform while also maintaining the same functionality?
Best Answer
The problem I was having was that my GDAL installation was version
1.11
(latest version on Ubuntu ppa due to the new major version) when my Windows installation was2.1.4
. I fixed that using these steps:Download GDAL's source using https://trac.osgeo.org/gdal/wiki/DownloadSource. I picked
2.1.4
. I then ran:It also turns out that
import gdal
andfrom osgeo import gdal
are the same.