[gdal-dev] OGR-Driver GML axis order handling (GDAL, QGIS)

2012-12-13 Thread Jürgen Weichand

Hello List,

By default the OGR-Driver will swap the axis order to longitude, 
latitude for geographic coordinate systems.


Since OGR 1.8.0, the GML driver has coordinate system support. This is 
only reported when all the geometries of a layer have a srsName 
attribute, whose value is the same for all geometries. For srsName such 
as urn:ogc:def:crs:EPSG:, for geographic coordinate systems (as 
returned by WFS 1.1.0 for example), the axis order should be (latitude, 
longitude) as required by the standards, but this is unusual and can 
cause issues with applications unaware of axis order. So by default, the 
driver will swap the coordinates so that they are in the (longitude, 
latitude) order and report a SRS without axis order specified.

http://www.gdal.org/ogr/drv_gml.html


Example (1): urn:ogc:def:crs:EPSG::4326 - GML 3.2 (WGS 84)
Lat / Lon is swapped to Lon / Lat by the driver (result: correct import 
into QGIS).

http://www.weichand.de/tmp/wfs20gml32_epsg4326.gml

Example (2): urn:ogc:def:crs:EPSG::31468 - GML 3.2 (Gauß Krüger 12°)
North / East is NOT swapped to East / North (result: incorrect import 
into QGIS).

http://www.weichand.de/tmp/wfs20gml32_epsg31468.gml

Example (3): urn:ogc:def:crs:EPSG::25832 - GML 3.2 (ETRS89 UTM 32N)
Default: East / North (result: correct import into QGIS).
http://www.weichand.de/tmp/wfs20gml32_epsg25832.gml


Is there any reason why OGR 1.9.2 don’t swap the coordinates of 
projected systems (to East / North)?


Thanks in advance!
Juergen



Original Post @ 
http://gis.stackexchange.com/questions/43896/ogr-driver-gml-axis-order-handling-gdal-qgis

___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] OGR-Driver GML axis order handling (GDAL, QGIS)

2012-12-13 Thread Even Rouault
Le jeudi 13 décembre 2012 20:35:36, Jürgen Weichand a écrit :
 Hello List,
 
 By default the OGR-Driver will swap the axis order to longitude,
 latitude for geographic coordinate systems.
 
 Since OGR 1.8.0, the GML driver has coordinate system support. This is
 only reported when all the geometries of a layer have a srsName
 attribute, whose value is the same for all geometries. For srsName such
 as urn:ogc:def:crs:EPSG:, for geographic coordinate systems (as
 returned by WFS 1.1.0 for example), the axis order should be (latitude,
 longitude) as required by the standards, but this is unusual and can
 cause issues with applications unaware of axis order. So by default, the
 driver will swap the coordinates so that they are in the (longitude,
 latitude) order and report a SRS without axis order specified.
 http://www.gdal.org/ogr/drv_gml.html
 
 
 Example (1): urn:ogc:def:crs:EPSG::4326 - GML 3.2 (WGS 84)
 Lat / Lon is swapped to Lon / Lat by the driver (result: correct import
 into QGIS).
 http://www.weichand.de/tmp/wfs20gml32_epsg4326.gml
 
 Example (2): urn:ogc:def:crs:EPSG::31468 - GML 3.2 (Gauß Krüger 12°)
 North / East is NOT swapped to East / North (result: incorrect import
 into QGIS).
 http://www.weichand.de/tmp/wfs20gml32_epsg31468.gml
 
 Example (3): urn:ogc:def:crs:EPSG::25832 - GML 3.2 (ETRS89 UTM 32N)
 Default: East / North (result: correct import into QGIS).
 http://www.weichand.de/tmp/wfs20gml32_epsg25832.gml
 
 
 Is there any reason why OGR 1.9.2 don’t swap the coordinates of
 projected systems (to East / North)?

Yes, the reason is that it is not implemented...

There's a patch in http://trac.osgeo.org/gdal/ticket/4329 that should address 
this, but I'm not sure if this still applies cleanly to trunk, because it has 
perhaps rotten a bit.

I didn't apply since I was midly satisfied with the duplication of symbols. The 
ideal would be to have a single function that would address both 
oSRS.EPSGTreatsAsLatLong() and oSRS.EPSGTreatsAsNorthingEasting()  to avoid 
testing them in each area of the code that want to mess with axis ordering.

 
 Thanks in advance!
 Juergen
 
 
 
 Original Post @
 http://gis.stackexchange.com/questions/43896/ogr-driver-gml-axis-order-hand
 ling-gdal-qgis ___
 gdal-dev mailing list
 gdal-dev@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/gdal-dev
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev