Quantcast
Channel: Question and Answer » postgresql
Viewing all articles
Browse latest Browse all 1138

How to get the geometry value from coordinates

$
0
0

I have a table with empty geometry column. I have two columns in the same table which has xcoordinate and ycoordinate values. I want to get the geometry value formed by these two coordinates. The geometry is POINT so I am using st_geomfromtext(‘POINT(x y)’) function.

I tried below syntax to update the geometry column the_geom in table ‘t1′:

 update t1 set the_geom=st_geomfromtext('POINT('||t1.xcoordinate||t1.ycoordinate||' )');

However this gives an error that :

"POINT(3458196941 )" <-- parse error at position 17 within geometry

I am not using ‘||’ string concatenation correctly here. Can any one correct me ?


Viewing all articles
Browse latest Browse all 1138

Trending Articles