Don't forget the PG tip

When opening a PostGIS datasource using the OGR C# wrapper in .Net, the connection string must have "PG:" prefix, as follows:


Imports OSGeo.OGR


Dim drv As OSGeo.OGR.Driver = OSGeo.OGR.Ogr.GetDriverByName("PostgreSQL")
Dim connStr as string = "PG:dbname='myDB' host='192.168.etc.etc' port='5433' user='foo' password='bar'"
Dim ds As OSGeo.OGR.DataSource  = drv.Open(connStr, 0)


Comments are closed on this post.
Find out more