DWithin question (distance defintion in Mapserver)
Bart van den Eijnden
BEN at SYNCERA-ITSOLUTIONS.NL
Tue Nov 8 07:40:39 PST 2005
Hi Assefa,
thanks for the confirmation and the outline of flow.
Appears the problem was in our dataset. We had 2 files for the point data, and the one we were using had displaced points for some cases.
Thanks again.
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
>>> Yewondwossen Assefa <assefa at dmsolutions.ca> 8-11-2005 16:00 >>>
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