[gdal-dev] Connect to PostGIS with Python

Howard Butler hobu.inc at gmail.com
Sun Apr 20 16:29:17 EDT 2008


On Apr 20, 2008, at 2:50 PM, Tod Haren wrote:
> I've installed gdalwin32-1.5 and the PostGIS plugin, but can't connect
> to a remote PostGIS database using python.  I've tried installing the
> python bindings with the windows installer from the Python CheeseShop
> and through easy_install.  I can open shapefiles with OGR and rasters
> with GDAL just fine.  The PostgreSQL driver isn't getting registered
> for Python.  I've checked that gdalwin32-1.5\bin is in my PATH and
> gdalwin32-1.5\data is in GDAL_DATA.  What else could be missing?
> Using ogrinfo opens the PostGIS database just fine, so my guess is
> that there is something I've missed in the install for python.  Any
> ideas?  Is there some documentation that I'm missing?  Google, etc
> hasn't been much help.
>
> Using a seperate install of FWTools 2.02 I can open the database with
> Python using the same connection string.
>
> Thanks,
>
> Tod

Tod,

The PostGIS driver is not enabled by default and must be switched on  
manually by downloading the PostGIS plugin from http://download.osgeo.org/gdal/win32/1.5/gdalwin32pg150.zip 
  and unzipping it and then setting GDAL_DRIVER_PATH to the directory  
where it exists.

The FAQ has a small note about this that might provide a little more  
detail.

HTH,

Howard


More information about the gdal-dev mailing list