[postgis-users] Convert already loaded table into a spatial table (points)

Andrea Peri aperi2007 at gmail.com
Thu Aug 12 11:09:32 PDT 2010


>I have already loaded a table that contains X, Y and Z values. AT the time of loading it was thought we did not need a spatial component to this table.
>Now we realize that we do have a need but do not want to reload the 190 million records again and create the point features on load.
>Is it possible to create the point geometry in the existing table....if so, how?
>Thanks in advance.
>Tony Appel


Assume the X,Y,Z are in three fields in a "tablename" table.

SELECT AddGeometryColumn( 'public','tablename','geom', <epsg>, 'POINT', 3 );
update public.tablename	set geom = ST_MakePoint(X::double,Y::double,Z::double);

epsg is a integer value of your SRS (epsg code)


Regards,

-- 
-----------------
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-----------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100812/796fe128/attachment.html>


More information about the postgis-users mailing list