I have been thinking about developing a commerical routing application
and a function that I might be able to use along with other mapserver
users is a new query function:
oLayer->queryPointClosest(oPoint, count);
where you would find the "count" closest objects on the layer. The
math
for would/could be:
keep the max distance of the closest points and check the distance to
the extents of complex objects and skip if greater
1) points: are obvious
2) lines: project oPoint onto line segment(s), check if between end
points, otherwise distance to end points
3) polygons: is it a hit? then dist=0.0 else treat like polyline
above.
This would allow spatial searches for things like find the nearest
store, find the nearest transformer, find the nearest intersection,
etc.
For a routing applications it might be nice to say: from a location
find
the nearest exit/entrance to I-95. This would imply the ability to add
a
filter like:
oLayer->queryPointClosestFiltered(oPoint, count, oFilter);
where oFilter would be a filter object maybe like:
filter {
ColumnName = "NAME";
filterType = {STRCMP|STRCMPI|REGEX|EQ|NE|LT|GT|etc};
filterPattern = "text or regex"
...
andFilter = poFilter; // additional and/or filters
orFilter = poFilter;
}
This is intended to give the idea, not the implementation :) I would
be
interested in your thoughts on this.