[postgis-users] Fast access to PostGIS from c/c++
Markus Schaber
schabi at logix-tt.com
Fri Dec 8 08:40:04 PST 2006
Hi, Andreas,
Boehm, Andreas wrote:
> I have tried several approaches with libpqxx. The only way to insert
> points is executing a statement with WNT like "INSERT INTO points VALUES
> (1, GeometryFromText('POINT (10 20)', -1) )". Either the tabelwriter
> functionality (internally using COPY) nor predefined statements ("INSERT
> INTO points VALUES ($1, GeometryFromText('POINT ($2 $3)', -1)" do work.
Why does the Tablewriter not work? Can you give us the code example, and
the error message? We've used COPY to fill lots of geometry tables over
here.
And for predefined statements, the following ones should work:
- INSERT INTO points VALUES($1, GeometryFromText('POINT('||$1||'
'||$2||')', -1)
- INSERT INTO points VALUES($1, makePoint($2, $3))
- INSERT INTO points VALUES($1, $2)
and giving the 'POINT(0 0)' representation as String in $2. (or use hexWKB).
I'd expect the last one to be the fastest, because the insert does not
contain any functions, which allows PostgreSQL to shortcut some code pathes.
> There seems to be a binary interface for ArcSDE. So I wonder if PostGIS
> would be fast enough. Could it make sense to convert geometries into WKB
> by myself on client side?
Yes. I don't know the exact libpqxx interface for TableWriter and
prepared Statements, but you can always send WKB to PostgreSQL when you
select binary parameter transfer, and hexed WBK when you selected text
parameter transfer (which is what pg_dump and psql do).
HTH,
Markus
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS
Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org
More information about the postgis-users
mailing list