DWithin question (distance defintion in Mapserver)

Yewondwossen Assefa assefa at DMSOLUTIONS.CA
Tue Nov 8 10:00:35 EST 2005


Hi There,

The DWithin is transformed into a querybyshape with a tolernace set 
using the distance parameter of the request.

A querybyshape is working like this from what I can see in the code :
   - shape 1 is your query shape
   - shape 2 : is the shape of the layer

  1) shape1 is point, shape 2 is either point/line/polygon

     - shape 2 is a point : msDistancePointToPoint (distance between the 
2 points)
     - shape 2 is a line : msDistancePointToSegment (distance from the 
nearest point on the segment. Each segment of the line is considered.)
     - shape 2 is a polygon : msDistancePointToSegment

   2) shape 1 is a line

      * shape 2 is a point : msDistancePointToPoint
      * shape 2 is a line :   check if they intersect and then 
msDistanceSegmentToSegment (nearesr points on the segments)
      * shape 2 is a polygon : check if contains and then check for 
intersecton and then msDistanceSegmentToSegment

   3) shape 1 is a polygon :

      * shape 2 is a point : msDistancePointToShape
      * shape 2 is a line : contains and then interects and then 
msDistanceSegmentToSegment
      * shape 2 is a polygon : contains and then interects and then 
msDistanceSegmentToSegment

   I think the way the query works fits the definition of distannce form 
OGC.

Later,


Bart van den Eijnden wrote:
> Hi list,
> 
> in my application I am trying to look up which polygon contains a certain point. Since Mapserver WFS does not support Contains, I currently use DWithin.
> 
> How does the DWithin internally work? I now have a situation in which the wrong polygon is picked, which makes me suspect it works with calculating the distance from the polygon's centroid, and not the smallest distance towards one of the polygons borders. What does the OGC spec say about this? If I read the OGC Simple Features for SQL I read a different definition for distance:
> 
> Distance(anotherGeometry:Geometry):Double*Returns the shortest distance between any two points in
> the two geometries as calculated in the spatial reference system of this Geometry.
> 
> Btw, I never got an intersect of a point with a polygon layer to work, which was my first plan to solve this.
> 
> Any help appreciated. Thanks in advance.
> 
> Best regards,
> Bart
> 
> Bart van den Eijnden
> Syncera IT Solutions
> Postbus 270
> 2600 AG  DELFT
> 
> tel.nr.: 015-7512436
> email: BEN at Syncera-ITSolutions.nl
> 
> 

-- 
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst

Email: assefa at dmsolutions.ca
http://www.dmsolutions.ca/

Phone: (613) 565-5056 (ext 14)
Fax:   (613) 565-0925
----------------------------------------------------------------



More information about the mapserver-users mailing list