[postgis-users] Intro and question about Update statements and Geometry columns

Liam Graham liamwgraham at yahoo.com
Sun Sep 26 23:44:15 PDT 2004


Hi, everyone,

I've been learning Postgis in my spare time (I don't currently work in the GIS field), and just
joined the list today, after reading through a lot of the archives recently.  I have a rather
basic question that I haven't been able to find an answer for in the documentation or in the
archives:  how can I populate a Geometry column based on the values in other non-Geometry columns
in the table?  For example, if I have a simple table with starting and stopping x and y
coordinates defining lines, and I add a Geometry column, how can I populate the new column based
on the existing columns?

So with a table named FOO and structured something like this:

 startx             | integer                 | not null
 stopx              | integer                 | not null
 starty             | integer                 | not null
 stopy              | integer                 | not null
 shape             | geometry                | 

I tried this, which I thought would work:
update foo set shape = GeometryFromText('LINESTRING(startx starty, stopx stopy)', -1);

But I get an error:  "ERROR:  couldnt parse object in GEOMETRY"

I'm sure my mistake is something simple ... and I should also mention that I'm a novice at
Postgres as well as Postgis (have used Oracle and Sybase much more).
 
Thanks for any help you can provide.  And if the answer is out there somewhere in the docs or
archives, I apologize: I did search, but couldn't find it.  

Sincerely,
Liam


		
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail



More information about the postgis-users mailing list