[gdal-dev] Changing coordinate axis order with ogr2ogr

Jens Fitzke fitzke at lat-lon.de
Mon Nov 2 05:45:01 PST 2015


Hi,

I'm having trouble changing the axis order of geometry coordinates while being
transfered by ogr2ogr from a GML file to PostGIS.

I think I have read most of the relevant stuff about this...

http://trac.osgeo.org/gdal/wiki/rfc20_srs_axes
http://www.gdal.org/drv_gml.html
http://trac.osgeo.org/gdal/wiki/FAQVector#HowdoIflipcoordinateswhentheyarenotintheexpectedorder

... and postings like
http://osgeo-org.1560.x6.nabble.com/gdal-dev-Ogr2ogr-flip-coordinates-td3742960.html

... and tried many variations of the GML driver options and things like (as
suggested in the wiki page mentioned above)

-s_srs "+proj=latlong +datum=WGS84 +axis=neu +wktext" -t_srs "+proj=latlong
+datum=WGS84 +axis=enu +wktext"

or

-s_srs /tmp/epsg4326_longlat.txt -t_srs /tmp/epsg4326.txt

where the axis order in the two files is inverted

but I never received a result like it could be achieved by using
ST_FlipCoordinates(geom) in PostGIS.

It is of course OK to do the trick within PostGIS after data loading, but I'd
love to do it within the ogr2ogr data transfer, for simpleness, elegance and
efficiency.

I guess I might be doing something wrong here...

Any ideas?

Thanks,

Jens



More information about the gdal-dev mailing list