Concatenation of strings & geomfromtext or cast to numeric & makepoint, I'm not sure which would be faster, but both will work.
So (as below) update mytable set the_geom=ST_GeometryFromText('POINT(' || long || ' ' || lat || ')',4326) or update mytable set the_geom=setsrid(makepoint(long::numeric(7,4), lat::numeric(6,4)),4326) HTH, Brent Wood --- On Sat, 3/26/11, Charles Galpin <cgal...@lhsw.com> wrote: From: Charles Galpin <cgal...@lhsw.com> Subject: Re: [postgis-users] How to create a point geometry from two text fields? To: "PostGIS Users Discussion" <postgis-users@postgis.refractions.net> Date: Saturday, March 26, 2011, 4:34 AM But his lat/lon are character varying so I think it would be more like update mytable set the_geom=ST_GeometryFromText('POINT(' || long || ' ' || lat || ')',4326) On Mar 25, 2011, at 11:26 AM, Stephen Woodbridge wrote: update mytable set the_geom=st_setsrid(st_makepoint(lon,lat),4326); On 3/25/2011 10:44 AM, Gis Mage wrote: Hello! I have a table with two text fields "lat" and "long" of character varying type. I've created a field the_geom with type geometry. How do I calculate the_geom field with an sql query? The table is huge - about 1.5 million records, so I think the fastest way to do this is to use pointfromtext function, but I can't figure out how to put in the values of "lat" and "long" fields inside function arguments. Can anyone help me out? Thanks. _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users -----Inline Attachment Follows----- _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users