distanceToPoint RFC

Lowell Filak lfilak at MEDINACO.ORG
Wed Sep 1 09:48:05 EDT 2004


Hello all.
Given an address point somewhere in 2D space and several centerline line
shapes related to the point only by the road name, I have been looking
for some way to use mapscript functions to detect which line shape is
closest to the point.
At first I thought distanceToShape was the answer but then after looking
at the source code it appears that distanceToShape will actually extend
the line shape in both directions (if necessary) to determine the
"perpendicular" distance to the shape.
In addition, because the operation is a mathematical calculation, and
does not actually construct anything, the point where the distance
vector intersects the line does not have a known x & y.
Am I reading the source correctly?
The current plan is to identify the polygon shape in which the point
resides, identify the line shape(s) comprising that polygon which match
the points roadname, & then calculate a vector between each point of
each line shape and the starting point to see which line is the closest
and which direction is travelled to reach it.
Am I missing an alternate method that is readily available?

Thanks for any suggestions.

Lowell



More information about the mapserver-users mailing list