bmander / graphserver

An open source multimodal trip planning engine
http://bmander.github.com/graphserver
Other
122 stars 60 forks source link

link_nearby_stops() in graph compiler: Improve bounding #7

Open abyrd opened 14 years ago

abyrd commented 14 years ago

The link option currently links each station to all other stations within a hardcoded 0.05 degrees. This can make a huge number of links with lengths farther than most people would walk, enough to exceed physical memory and swap to a grinding halt.

This 0.1 degree 'square' bounding box can be quite large, and is not really square since longitude lines converge toward the poles. A more appropriate goal would be to link to all other stations within a radius of x meters.

Bounding box range could be a command line parameter, or better yet have both a lat and long component derived from a walk radius (itself a command line parameter) and a geographic location (either the centroid of all stops, or at each stop individually). In the iteration over all candidate stops within the bounding box, check if the 'obstructed' distance 'dd' is < x meters before deciding whether to link or not.

The bounding box specified in degrees must be bigger than x meters at the stop's geographic position.

Also: For a stop A (outer loop) and a candidate stop for linking B (inner loop), this function creates both edges A->B and B->A. However, the outer loop is iterating over all stops, so B->A would be created anyway. Is this redundant or am I missing something?

abyrd commented 14 years ago

Fixed in andrewbyrd/graphserver. Observations posted on graphserver wiki.