Search code examples
pythongeodjangogdal

Error with GDAL python binding in GeoDjango Shell


I would like to use the GDAL python binding in my GeoDjango site. The aim of this is to use ogr2ogr capabilities in a script. I am on windows 7 so I have installed GDAL-1.9.2.win32-py2.7 downloaded here

The installation went correctly. I can import GDAL in python with: from osgeo import GDAL

However, in my geodjango app python shell, I have an error when I try to import osgeo. The error is the following:

>>> import osgeo
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "C:\Python27\lib\site-packages\osgeo\__init__.py", line 21, in
_gdal = swig_import_helper()
  File "C:\Python27\lib\site-packages\osgeo\__init__.py", line 17, in
t_helper_mod = imp.load_module('_gdal', fp, pathname, description)
 ImportError: DLL load failed: La procÚdure spÚcifiÚe est introuvable.
>>>

Can someone help me with this?

Im using GeoDjango v. 1.4.3 | python 2.7.3 | GDAL 1.9.2 win32


Solution

  • Installing just the python bindings does not provide access to GDAL. There is a short blog posted a few years ago that might be of assistance.

    In short, you need to head over to gisinternals and download GDAL. Then you should have a working installation of GDAL from which from osgeo import gdal will work.