[FWTools] Connecting to PostgreSQL with fwtools

Flavio Perri - QMap srl flavio.perri at qmap.it
Tue Jul 7 08:31:59 EST 2009


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?

Thanks a lot,
Flavio

2009/7/7 Frank Warmerdam <warmerdam at pobox.com>

> Flavio Perri - QMap srl wrote:
>
>> dataSource = poDriver->CreateDataSource("layerName",(char**)options );
>>
>> [...]
>>
>> I always get a NULL dataSource, and I'm stuck.
>>
>> I'm sure that OGR is capable to connect to PGSQL, because I tried the tool
>> "ogr2ogr" and it connects to PG and manipulate GIS data with a simple
>> connection string like: PG:"dbname='databasename' host='addr' port='5432'
>> user='x' passwd='y'".
>>
>
> Flavio,
>
> OGR does not support creating new postgres database instances.  What
> you want to do is connect to an existing instance in update mode using
> OGROpen() or OGRSFDriverRegistrar::Open().
>
> 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<http://pobox.com/%7Ewarmerdam>
> and watch the world go round - Rush    | Geospatial Programmer for Rent
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/fwtools/attachments/20090707/21ae1383/attachment.htm 


More information about the FWTools mailing list