Opened 8 years ago

Last modified 8 years ago

#4228 new defect

WFS 1.1.0 server and client axis order fixies

Reported by: jachym Owned by: sdlime
Priority: high Milestone: 6.2 release
Component: WFS Client Version: svn-trunk (development)
Severity: normal Keywords: WFS, 1.1.0
Cc: sdlime, mko

Description

According to all sources, WFS 1.1 server and client implementation has some issues, regarding axis order.

In the text I do assume, that "normal" axis order is "x,y", where "x", stands for "horizontal" and "y" for vertical. By "inverted axis order" I do mean, that coordinates pair is given in the form "y,x" (or lat,long for certain types of SRSs).

Current behaviour:

  • MapServer WFS 1.1.0 client does not send BBOX coordinates in propper order (if needed) "miny,minx,maxy,maxx" for some SRSs.
  • MapServer WFS 1.1.0 client does not append information about used BBOX CRS, like "....&BBOX=10,50,20,60,epsg:4326&...."
  • MapServer WFS 1.1.0 client does not understand, that axis order of GML file send back from the server has inverted axis order
  • MapServer WFS 1.1.0 server does not use layer's SRS, when no information about BBOX srs is given.

This patch fixes all above:

  • It fixes the correct BBOX request form in maplayerwfs.c, so that if WFS 1.1.0 and SRS with inverted axis order is used, axis are inverted
  • It also appends information about used SRS to end of the BBOX
  • If WFS 1.1.0 and proper SRS, it configurates OGR, so it deals with data with inverted axis order
  • If the server obtains WFS 1.1.0 request with BBOX parameter, which does NOT include information about BBOX's used SRS, it takes the layer's default.

Files modified:

  • mapfile.h - added definition of msIsAxisInverted function.
  • mapfile.c - changed definition of msIsAxisInverted, removed "static"
  • mapwfslayer.c - BBOX in the GET request modified, so that axis are inverted when they should be and information about used SRS is appended to the BBOX
  • mapwfslayer.c - Added OGR configuration options GML_INVERT_AXIS_ORDER_IF_LAT_LONG and GML_CONSIDER_EPSG_AS_URN when needed, so that the data are readable with MapServer
  • mapwfs.c - default value of bbox SRS is set to layers's projection.

NOTE: msIsAxisInverted should IMHO be used all through MapServer instead of sometimes used pj_islatlong. That's why it's definition is added to the mapfile.h file

NOTE: It has been long time ago, since I touched any C-code. And even then, I never was really familiar with it. So please, review the patch, attached to this ticket.

Attachments (2)

ms_wfs-1.1.0.patch (4.3 KB) - added by jachym 8 years ago.
WFS 1.1.0 axis order fixes.
ms_wfs-1.1.0-v02.patch (4.4 KB) - added by jachym 8 years ago.
New version of the patch: adds "&SRSNAME=" parameter to the URL in the layerwfs

Download all attachments as: .zip

Change History (5)

Changed 8 years ago by jachym

Attachment: ms_wfs-1.1.0.patch added

WFS 1.1.0 axis order fixes.

comment:1 Changed 8 years ago by jratike80

Hi,

Did you take into account that CRS would be safest to give always in urn-style like urn:ogc:def:crs:EPSG::4326? At least Geoserver interprets that short EPSG:4326 means the same with WFS 1.0.0 and WFS 1.1.0 and axes flipping happens only when version is 1.1.0 and long srsName format is used.

About BBOX, WFS 1.1.0 standard says that the key-value pair BBOX without fifth (CRS) parameter must default to EPSG:4326 (lat-lon order). This is different from WFS 1.0.0 and for example Geoserver folks say it is ridiculous to break backward compability and therefore Geoserver does not follow the standard in this case. I am not sure about the BBOX default CRS when it is used inside Filter element; it may default to the layer default CRS then. Anyway, with WFS 1.1.0 it is best to give always the exact CRS and give it in the long format.

comment:2 Changed 8 years ago by mko

Cc: mko added

comment:3 Changed 8 years ago by jachym

jratike80: Yes, it appends not the short form ("EPSG:4326"), but the long one "urn:ogc:def:crs:EPSG::4326".

Changed 8 years ago by jachym

Attachment: ms_wfs-1.1.0-v02.patch added

New version of the patch: adds "&SRSNAME=" parameter to the URL in the layerwfs

Note: See TracTickets for help on using tickets.