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

Stephen Woodbridge woodbri at swoodbridge.com
Sat Feb 4 05:52:31 PST 2006


A slight variation on what Gregory already said:

SELECT * FROM AddGeometryColumn('public','mytable','the_geom', 26591, 
'POINT', 2);

UPDATE mytable set the_geom=setsrid(makepoint(longitudine,latitudine), 
26591);

CREATE INDEX mytable_gist ON mytable USING gist (the_geom);

VACUUM ANALYZE mytable;

If you really want the_geom to be UNIQUE then add that to the index, but 
you might want to check if the original table is unique on 
(longitudine,latitudine) first.

-Steve

Luca Penasa wrote:
> 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
> 




More information about the postgis-users mailing list