[gdal-dev] WFS 1.1 and axis orientation - wrong coordinates interpretation

Even Rouault even.rouault at mines-paris.org
Thu Feb 9 14:22:50 EST 2012


Le jeudi 09 février 2012 20:00:03, Jachym Cepicky a écrit :
> Hi,
> 
> I think, OGR (and therefore MapServer too), is not taking care about
> axis orientation of incomming data, acting as WFS 1.1 client. Result is
> flipped data and I do not know, how the software recognizes, that axes
> order is different (apperently, it does not).
> 
> We have setuped generic WFS 1.1 server with MapServer (6.0.1). Data are
> published in WGS84.
> 
> With very simple request, you get the data and the axis order is Y,X
> (lat, lon) (imho correct)
> 
> http://gis.bnhelp.cz/ows/crwfs?service=wfs&version=1.1.0&request=getfeature
> &typename=okresy
> 
> Now, when try to get this data with OGR and convert them to e.g. Shapefile
> 
> ogr2ogr okresy.shp
> "WFS:http://gis.bnhelp.cz/ows/crwfs?service=wfs&version=1.1.0&request=getfe
> ature&typename=okresy"
> 
> Resulting shapefile has inverted coordinates  (wrong)

Jachym ,

As always with axis ordering issues, the situation is complex. If not already 
done, I'd encourage you to first carefully read 
http://gdal.org/ogr/drv_gml.html , and particularly the CRS section.

I've looked at your server output and I believe this is more a bug (well, this 
can be discussed) in MapServer than in OGR. The issue is that in its 
GetFeature output, MapServer indicates  srsName="EPSG:4326" but reports 
coordinates in lat, long order.

The GML driver assumes that SRS expressed in EPSG:XXXX form are in long, lat 
order (which was the convention used in WFS 1.0 where most servers didn't 
respect the EPSG advertized axis order). Whereas if they are expressed as 
urn:ogc:EPSG::XXXX (which is now the popular form for WFS 1.1), they are in 
the axis order expressed by EPSG, which is lat, long in the case of EPSG 4326. 
I had created http://trac.osgeo.org/mapserver/ticket/3576 about that some time 
ago.

When the GML driver recognizes that the coordinates of a SRS are in lat, long 
order in the GML, it will flip them by default so that the consuming 
application see them in the usual long, lat order. This can be overriden with 
the GML_INVERT_AXIS_ORDER_IF_LAT_LONG config option.

Best regards,

Even


More information about the gdal-dev mailing list