1

I have seen a number of posts similar to this but with no resolution.

I am experimenting with GDAL commands and am fairly new to it however when using a PostgreSQL database connection I am getting the following errors:

FAILURE: Unable to open datasource `PG:host=127.0.0.1 port=5432 dbname=postgres user=postgres password=*******' with the following drivers. (Lists all drivers)

or

ERROR 1: Unable to find driver `PostgreSQL

ogr2ogr -overwrite -update -f PostgreSQL PG:"dbname='cadcorp' host='localhost' port='5432' user='postgres' password='********'" C:\Users\tommyh\Desktop\data\merged.shp -nlt POLYGON -nln gdaltestupload -progress

when I run gdalinfo --formats the list doesn't PostgreSQL so I guess I can see why the PostgreSQL connection isn't working compared to when I use a SQL Server connection MMSQLSpatial which is in the formats list.

I have set the environment variables:

GDAL_DATA=C:\Program Files\GDAL\gdal-data

GDAL_DRIVER_PATH=C:\Program Files\GDAL\gdalplugins

My GDAL version is:

gdalinfo --version GDAL 2.2.3, released 2017/11/20

Running through the command prompt on Windows 10.

Any ideas on what I may be missing or need to do?

  • Do have installed postgres on your machine = localhost? – Kurt Feb 8 at 16:32
  • @kurt Yes, I have also tried with 127.0.0.1 – Hutch Feb 8 at 18:06
  • did you install the postgres-server-software from postgresql.org on your machine? – Kurt Feb 8 at 18:37
  • PostgreSQL 10.6 is installed and is fully functioning, the database holds multiple datasets which have been added into other GIS applications for styling and editing. I do not believe this is a postgreSQL software issue. The software has been downloaded from: enterprisedb.com/downloads/postgres-postgresql-downloads – Hutch Feb 8 at 20:57
  • 1
    gdalinfo --formats is listing the raster drivers, check ogrinfo --formatsinstead. – user30184 Feb 10 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.