[gdal-dev] Python bindings and the Postgres driver
pat.blair at bullberrysystems.com
Tue May 6 11:16:20 EDT 2008
Hello. I am using GDAL/OGR from Python 2.5 and believe that I am having
trouble using the PostgreSQL driver. (The problem I am having is
similar or identical to one posted previously, but for which I can find
I am using Python 2.5 on Windows. I have C:\gdalwin32-1.5 in place, and
have the Postgres drivers in C:\gdalwin32-1.5\bin\gdalplugins
(libpq.dll, and ogr_PG.dll). I have also installed the Python bindings.
When I run the ogrinfo utility from a command line, I can use the
Postgres driver with no apparent problem.
For example, when I run...
ogrinfo PG:"host=localhost user=postgres password=sergtsop
dbname=arcturus" -al -summary
I get results...
INFO: Open of `PG:host=localhost user=postgres password=password
using driver `PostgreSQL' successful.
Layer name: streets
Geometry: Line String
Feature Count: 19187
Extent: (-77.116646, 38.793179) - (-76.909538, 38.995243)
Layer SRS WKT:
However, from within Python, the ogr module doesn't seem to be able to
find the 'PostgreSQL' driver. Below I have pasted in text from my
Python console. You can see that I can get the 'ESRI Shapefile' driver;
but if I try to get 'PostgreSQL' driver, I get None back.
>>> from osgeo import ogr
>>> ogrEsriDriver = ogr.GetDriverByName('ESRI Shapefile')
>>> print ogrEsriDriver
<osgeo.ogr.Driver; proxy of <Swig Object of type 'OGRDriverShadow *' at
>>> ogrPgDriver = ogr.GetDriverByName('PostgreSQL')
>>> print ogrPgDriver
So, I believe that GDAL/OGR are installed and working, and that the
Python bindings are generally working. But is there another step I must
take to help the Python bindings find the Postgres driver?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the gdal-dev