[gdal-dev] ogr2ogr project/transform CRS in the same database table

Hector muro muro.hector at gmail.com
Tue Dec 1 12:22:09 PST 2020


Oh, I see. That's great.

But what if the Database does not have ST_Transform support? Could we still
achieve a similar approach by means of ogr2ogr?

(I should have mentioned this in my first email).

Thanks again!
Hector

On Tue, 1 Dec 2020 at 20:14, jratike80 <jukka.rahkonen at maanmittauslaitos.fi>
wrote:

> Hi,
>
> No, unfortunately it is not possible with one ogr2ogr command.
>
> You need two commands and you must use ogrinfo. Here an example about
> adding
> another geometry column and populating it with EPSG:3857 version of
> original
> EPSG:4326 geometries.
>
> ogrinfo PG:"host=localhost port=5432 dbname=test user=user
> password=password" -sql "alter table states add column geom2 geometry"
>
> ogrinfo PG:"host=localhost port=5432 dbname=test user=user
> password=password" -sql "update states set
> geom2=ST_Transform(wkb_geometry,3857)"
>
> You can do all that is possible with SQL also with ogrinfo.
>
>
> -Jukka Rahkonen-
>
>
>
> hectormauer wrote
> > Hi all,
> >
> > I was wondering if someone knew if it's possible to project or transform
> > within the same table in a database, using ogr2ogr.
> >
> > What I mean is, I have a table with fields: id, id2, geom_wkt_27700 and I
> > would like, using a single command to create an extra column
> > "geom_wkt_4326" for instance. It does not have to be of type geometry,
> but
> > could be text for instance.
> >
> > I guess the other plausible solution would be to create a temporary table
> > with that transformation on it and reference it to the first one by id
> for
> > instance.
> >
> > Any help is appreciated!
> >
> > Thanks,
> > Hector
> >
> > _______________________________________________
> > gdal-dev mailing list
>
> > gdal-dev at .osgeo
>
> > https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
>
>
>
> --
> Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20201201/1b299b33/attachment.html>


More information about the gdal-dev mailing list