[postgis-users] Create a geometry column from 2 colums of the same table

Gregory S. Williamson gsw at globexplorer.com
Sat Feb 4 04:32:36 PST 2006


Well, we use a different SRID (4326) but a sample bit of SQL (from a perl script -- forgive anh transcription errors as I have stripped out "\" symbols and may cause a typo. This sample is from postGIS 1.0, postgres 8.0.

First I create a column for the geometry:
SELECT * FROM AddGeometryColumn('public','mytable','req_pnts', 4326, 'POINT', 3);

And then I update it with:
UPDATE mytable SET req_pnts = GeomFromEWKT('SRID=4326;POINT(' || mytable.x || ' ' || mytable.y || ' ' || mytable.z || ')');

You'd need to substitute your SRID and pay attention to the actual x/y values; don't use the "z" coordinate if you don't need it; if you use a straight 2-D geometry change the last "3" in the AddGeometryColumn to a "2".

HTH,

Greg Williamson
DBA
GlobeXplorer LLC

-----Original Message-----
From:	postgis-users-bounces at postgis.refractions.net on behalf of Luca Penasa
Sent:	Sat 2/4/2006 4:35 AM
To:	PostGIS Users Discussion
Cc:	
Subject:	[postgis-users] Create a geometry column from 2 colums of the same table
I have 2 column into my table:

latitudine | longitudine
------------+-------------
    5104803 |     1663919
    5104548 |     1663044
        ......     |        ......   

and i want to create a unique geometry column (called the_geom):
POINT(5104803 1663919). The SRID is 26591 (Gauss-Boaga projection)..
any idea?
 
 
 --
 Email.it, the professional e-mail, gratis per te: http://www.email.it/f
 
 Sponsor:
 Grande Offerta di Benvenuto Cassine di Pietra:
* 36 bottiglie di ottimo vino veneto direttamente a casa tua!
* 
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=3923&d=4-2
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

!DSPAM:43e491a2320831270013900!







More information about the postgis-users mailing list