Ticket #768 (closed defect: fixed)

Opened 9 years ago

Last modified 9 years ago

[WFS Query] Tolerance apply to WFS query by shape.

Reported by: jlacroix Owned by: mapserverbugs
Priority: high Milestone: 4.4 release
Component: WFS Server Version: unspecified
Severity: normal Keywords:
Cc:

Description

When specifying a filter in a WFS query that is a polygon, the tolerance of the
server layer apply on the filter. With a round or rectangular query, the
TOLERANCE parameter does not apply. I think the WFS shape query should have the
same behavior than the rectangular query. 

With this query:
wget -O result.txt 
"http://127.0.0.1/cgi-bin/mswfs_gmap?VERSION=1.0.0&SERVICE=WFS&REQUEST=GetFeature&TYPENAME=popplace&FILTER=<Filter><AND><Intersect><PropertyName>Name</PropertyName><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>1600000.0,-80000.0
1600000.0,-100000.0 1660000.0,-100000.0 1660000.0,-80000.0
1600000.0,-80000.0</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersect><PropertyIsEqualTo><PropertyName>POP_RANGE</PropertyName><Literal>3</Literal></PropertyIsEqualTo></AND></Filter>"

I get points out of the filter, if you set the tolerance to 0 in the mapfile,
you won't.

I'll attach a test case.

Attachments

wfs_filter_testcase.tar.gz Download (25.6 KB) - added by jlacroix 9 years ago.
wfs_filter_testcase.tar.gz test case.

Change History

Changed 9 years ago by jlacroix

wfs_filter_testcase.tar.gz test case.

Changed 9 years ago by dmorissette

Julien: did you verify that if you remove the tolerance then the filter works
properly?  

If yes then we need to decide whether this is a documentation issue (i.e. tell
the users to not set tolerance in WFS layers), or if we want the WFS server code
to unset tolerance for polygons filters if it's set. I can see why tolerance
could be useful for point filters, but can anyone think of cases where it would
be useful for the administrator to set a tolerance on polygon filters?

Changed 9 years ago by sdlime

I can see why the client might want to, but not the server admin. Let me know if
this looks like a underlying query issue...

Steve

Changed 9 years ago by jlacroix

Yes, if you set the tolerance to 0 only points in the polygon will be return.
Personally I think that if you do a polygon query, only result inside the
polygon should be returned. However like Steve said, there's probably example
where this could apply that I not thought of.

I think the main problem is that we have a round an rectangle WFS query that
have defined behavior (only result inside) and a polygon WFS query that behaves
differently (use the tolerance). I think this is misleading.

Changed 9 years ago by dmorissette

  • milestone set to 4.4 release
I agree that to be consistent with bbox and others, the polygon filters should
also ignore the tolerance. So it seems that the best solution is to reset the
tolerance value in mapwfs.c if it is set, when a polygon filter is passed in a
GetFeature request. Do you agree with that Assefa? Can you do it or should
Julien do it?

BTW Assefa: In the WFS spec, can a polygon filter have a tolerance passed with
it? If yes then we should perhaps support that as well?

Changed 9 years ago by assefa

The spatial operators supported are the following :

  - bbox : no tolerance value can be set by the user. Uses underneath
querybyrect which does not use the tolernace value set on the layer

  - DWithin : the user can set a distance value (=tolernace) and can use a
geometry which can be Point, Line, Polygon. 
   for point : query function used is querybypoint with will use the distance
value that the user has set. If the distance value is 0 It will use the
tolerance set in the layer.
   for line and polygon : uses querybyshape that uses the layer's tolernace value
   
  - Intersect : the user can not set a tolerance. Only Line and Poylgon geometry
are supprted. Underneath It uses querybyshape that use's the layer's tolernace. 


 I agree that to be consistent :
 - we should disable the tolernace values on the layer when doing Intersect
 - we should use the Distance value when doing DWithin and if the distance is
<=0, we should disable any tolernace values set on the layer.


  I guess It is will be faster for me to do it. I would probably need Julien to
 test it or send me his test files.  

Changed 9 years ago by jlacroix

I attached a test case. (Is there anything missing in it?)
However if it is less complicated, I will be happy to test it for you.

Changed 9 years ago by assefa

  • status changed from new to closed
  • resolution set to fixed
Corrected as described in commnet #6 (mapogcfilter r1.37)/

Marking it as fixed.
Note: See TracTickets for help on using tickets.