[postgis-users] insert into a geometry field from 4gl
Fay Du
fay.du at versaterm.com
Mon Feb 27 08:06:40 PST 2006
Hi All:
I have a new problem related the previous problem. I found the
performance of insert into database by using cursor is not good. I want
to create a pipe delimited text file than using Load from command to do
it.
LOAD FROM input_file DELIMITER "|" INSERT INTO gps_log (uid, Geom_pt)
The text file is like this:
10ABC|geomfromtext('POINT(1870391 320462)',-1)
I got an error, because geom._pt is a geometry field.
Can I use text file to load geometry field directly? I really want to do
this. Load data from text file into my table (including the time to
generate pipe delimited text file) is 6 times faster than loading data
by using cursor.
Many, many thanks for any help.
Fay
-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Markus Schaber
Sent: Thursday, February 23, 2006 3:20 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] insert into a geometry field from 4gl
Hi, Fay,
Fay Du wrote:
> INSERT INTO gps_log (uid, geom_pt) values ('test1',
> geomfromtext('POINT(1870391 320462)',-1));
This works fine.
> LET sql_stmt = "INSERT INTO gps_log (uid,geom_pt) Values (?,?)"
> PREPARE insert_gps_tb FROM sql_stmt
>
> LET Uid="test"
>
> LET gps_point = "geomfromtext('POINT(1870391 320462)',-1)"
>
> EXECUTE insert_gps_tb USING uid, gps_point
This inserts the whole "geomfromtext('POINT(1870391 320462)',-1)" as
textual geometry representation.
Try this:
LET sql_stmt =
"INSERT INTO gps_log (uid,geom_pt) Values (?,geomFromText(?,-1))"
PREPARE insert_gps_tb FROM sql_stmt
LET Uid="test"
LET gps_point = "'POINT(1870391 320462)'"
EXECUTE insert_gps_tb USING uid, gps_point
HTH,
Markus
--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf. | Software Development GIS
Fight against software patents in EU! www.ffii.org
www.nosoftwarepatents.org
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
More information about the postgis-users
mailing list