[postgis-users] Create new column with other SRID

Stephen Woodbridge woodbri at swoodbridge.com
Fri Oct 31 09:28:36 PDT 2008


lisek lichu wrote:
> Hello i have a little problem creating a new column for my table and 
> inserting there new data.
> 
> I have a talbe:
> 
> CREATE TABLE "axes" (
> gid serial PRIMARY KEY,
> "name" varchar(100));
> SELECT AddGeometryColumn('','axes','the_geom','27492','LINESTRING',2);
> 
> and this table if full of data
> 
> now i want to add new column with another SRID like wgs84 srid = 4326
> 
> SELECT AddGeometryColumn('','axes','the_geom_wgs84','4326','LINESTRING',2);
> 
> and now i need to create a query that reads each row from column 
> the_geom, converts it by Transform(the_geom, 4326) and put into a new 
> kolumn the_geom_wgs84 in the same row.
> 
> Do You have an idea if it is possible?
> 
> I tried to do something like that:
> 
> SELECT AddGeometryColumn('','axes','the_geom_wgs84','4326','LINESTRING',2);
> INSERT INTO "axes" (the_geom_wgs84) VALUES (select 
> AsText(Transform(the_geom,4326)) from axes)

UPDATE axes set the_geom_wgs84=Transform(the_geom,4326);





More information about the postgis-users mailing list