Opened 20 years ago

Closed 19 years ago

#768 closed defect (fixed)

[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 (1)

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

Download all attachments as: .zip

Change History (8)

by jlacroix, 20 years ago

Attachment: wfs_filter_testcase.tar.gz added

wfs_filter_testcase.tar.gz test case.

comment:1 by dmorissette, 20 years ago

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?

comment:2 by sdlime, 20 years ago

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

comment:3 by jlacroix, 20 years ago

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.

comment:4 by dmorissette, 20 years ago

Milestone: 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?

comment:5 by assefa, 20 years ago

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.  

comment:6 by jlacroix, 20 years ago

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.

comment:7 by assefa, 19 years ago

Resolution: fixed
Status: newclosed
Corrected as described in commnet #6 (mapogcfilter r1.37)/

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