[gdal-dev] Python bindings and the Postgres driver
Pat Blair
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
no answer:
http://www.nabble.com/gdal-Python-bindings-and-postgis-question-td157056
50.html.)
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
dbname=mydb'
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:
[...etc...]
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
0xaf3a78...
>>> ogrPgDriver = ogr.GetDriverByName('PostgreSQL')
>>> print ogrPgDriver
None
>>>
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?
Many thanks,
Pat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080506/068b4dc1/attachment-0001.html
More information about the gdal-dev
mailing list