[FWTools] Connecting to PostgreSQL with fwtools

Frank Warmerdam warmerdam at pobox.com
Tue Jul 7 09:00:42 EST 2009


Flavio Perri - QMap srl wrote:
> Hello Frank,
> thanks for your answer.
> 
> I tried looking at OGR documentation, and I found the method you wrote:
> 
> OGRDataSource * OGRSFDriverRegistrar::Open   (   const char *     
> pszName, int   bUpdate = FALSE, OGRSFDriver **   ppoDriver = NULL   ) .
> 
> I don't understand the first parameter: is it the NAME of a PSQL istance 
> or an handle? And, in this case, should I connect using the psql library?
> Please can you give me a simple example?

Flavio,

The pszName value is just the "PG:dbname=... ..." string you would pass on
the commandline to ogr2ogr.  You will want to pass bUpdate as TRUE and the
last argument can be left NULL since it isn't important for you to discover
what driver ended up being used.

Don't hesitate to skim the ogr2ogr source code for guidance.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the FWTools mailing list