[gdal-dev] a postgis table to another

Stephen Woodbridge woodbri at swoodbridge.com
Sun Nov 16 06:32:24 PST 2014

On 11/16/2014 8:01 AM, Ahmet Temiz wrote:
> Hello
> Is it possible to export (CREATE  )a postgis table to another in
> different projection?
> regards

There are a few ways that I can think of to do this:

1. add another column to the table with the project you want. Then 
export using that column, maybe using a view.

2. just define a view the does the reprojection to what you want and 
export that.

select st_addgeometrycolumn("mytable", "geom_4326", 2, 
update mytable set geom_4326=st_transform(geom, 4325);

pgsql2shp ... -g geom_4326 mydb mytable -f outfile.shp

create view table_4326 as select ..., st_transform(geom, 4326) as geom;
pgsql2shp ... -f outfile.shp table_4326

3. you can export a table using a SQL command and you couls do the 
reprojection using that.

pgsql2shp ... -f outfile.shp  "select ..., st_transform(geom, 4326) as geom"


More information about the gdal-dev mailing list