I have a windows server (Microsoft Windows Server 2003) with:
GDAL 1.8.1 (installed from the windows installer (gdal-18-1500-core.msi) hosted at http://vbkto.dyndns.org/sdk/PackageList.aspx?file=release-1500-gdal-1-8-mapserver-6-0.zip), and
GDAL Python bindings installed from the windows installer (GDAL-1.8.1.win32-py2.7.msi) at the same url as above.
If I do
ogrinfo PG:"dbname=postgis_tpl user=postgres password=xxxxxx"
connection with the database is successful:
INFO: Open of `PG:dbname=postgis_tpl user=postgres password=xxxxxx' using driver `PostgreSQL' successful. 1: world_merc (Multi Polygon)
However, from the Python shell, if I do:
>>> from osgeo import ogr >>> print ogr.Open("PG:dbname=postgis_tpl user=postgres password=xxxxxx")
>>> print ogr.GetDriverByName("postgresql")
and if I list all the drivers available via the Python bindings:
>>> for i in range(0,ogr.GetDriverCount()): ... print ogr.GetDriver(i).name
the following drivers are listed (PostgreSQL is missing):
ESRI Shapefile, MapInfo File, UK .NTF, SDTS, TIGER, S57, DGN, VRT, REC, Memory, BNA, CSV, NAS, GML, GPX, KML, GeoJSON, GMT, SQLite, ODBC, PGeo, MSSQLSpatial, PCIDSK, XPlane, AVCBin, AVCE00, DXF, Geoconcept, GeoRSS, GPSTrackMaker, VFK, PGDump, GPSBabel, SUA, OpenAir, PDS, WFS, HTF, AeronavFAA
My environment variables are (I think) set correctly:
GDAL_DRIVER_PATH = C:\Program Files\GDAL\gdalplugins
(There's nothing that looks like the PostgreSQL driver in the gdal-plugins folder anyway).
GDAL_DATA = C:\Program Files\GDAL\gdal-data
is in my PATH (GDAL is installed at C:\Program Files\GDAL).
So what am I missing? Why can't Python see the PostgreSQL driver? Do I need to install its bindings separately?