[mapserver-users] distance measuring & street highlight

Stephen Woodbridge woodbri at swoodbridge.com
Fri Dec 7 18:17:10 EST 2001


David,

While the problem is straight forward in its definition it is not a
trivial problem to do the routing. I have played with this a little and
if time permits I plan to do a full implementation is the future. At any
rate here is basically what you have to do:

You need your data organized differently than you typically do for
display a map. You need a topological network ie: What you need is a
list of every point in the database and a list of other points each is
connected to.

Then you grab a starting point and get the list of points it connects
to, then foreach point you check to see if it is the end point if not
then you recusively call yourself with the new point. There are few more
details here but I think this is enough to get the idea. This routine
basically does a recusive search of the network seeking the endpoint.

Once you have a complete path it should be easy to put it in a temporary
shape file and ask mapserver to display it as a highlight.

A straight forward recusive routine would get overloaded with number of
points in something like the Tiger/Line dataset, so you would have to
come up with a strategy for pruning options or directing the path or or
filtering choices by road class. Some other optiona are to build a
variation on this that does hiarchitical routing at a macro level, like
what are the counties a travel thought, than does the street level
routing to get you from county to county. Have n small tasks is much
more efficent than one task n times as large, best the the problem size
is at least an n-square problem. 

Also Tiger data does NOT have info on street directionality, so route
might send you the wrong way down a one-way street or tell you to get on
a highway going the wrong direction, etc.

There might be some other ways to do this, I would be interested in
anyone thoughts and ideas on it. I have already spent a significant
amount of time researching this problem and building simple prototypes
that work with very simple data sets.

-Steve

David Armstrong wrote:
> 
> I would like to know if anyone has been able to do distance calculation ,
> and street highlighting with mapserver
> 
> my question is this
> i would wish to select 2 points on the map then calculate the shortest route
> between these points and then highlight the streets along the path showing
> the direction etc
> 
> any ideas !
> 
> Regards
> Dave



More information about the mapserver-users mailing list