Map Routing, a la Google Maps?

前端 未结 9 1261
生来不讨喜
生来不讨喜 2021-02-06 23:59

I\'ve always been intrigued by Map Routing, but I\'ve never found any good introductory (or even advanced!) level tutorials on it. Does anybody have any pointers, hints, etc?

相关标签:
9条回答
  • 2021-02-07 00:06

    I've yet to find a good tutorial on routing but there are lots of code to read:

    There are GPL routing applications that use Openstreetmap data, e.g. Gosmore which works on Windows (+ mobile) and Linux. There are a number of interesting [applications using the same data, but gosmore has some cool uses e.g. interface with websites.

    The biggest problem with routing is bad data, and you never get good enough data. So if you want to try it keep your test very local so you can control the data better.

    0 讨论(0)
  • 2021-02-07 00:09

    Take a look at the open street map project to see how this sort of thing is being tackled in a truely free software project using only user supplied and licensed data and have a wiki containing stuff you might find interesting.

    A few years back the guys involved where pretty easy going and answered lots of questions I had so I see no reason why they still aren't a nice bunch.

    0 讨论(0)
  • 2021-02-07 00:11

    Another thought occurs to me regarding the cost of each traversal, but would increase the time and processing power required to compute.

    Example: There are 3 ways I can take (where I live) to go from point A to B, according to the GoogleMaps. Garmin units offer each of these 3 paths in the Quickest route calculation. After traversing each of these routes many times and averaging (obviously there will be errors depending on the time of day, amount of caffeine etc.), I feel the algorithms could take into account the number of bends in the road for high level of accuracy, e.g. straight road of 1 mile will be quicker than a 1 mile road with sharp bends in it. Not a practical suggestion but certainly one I use to improve the result set of my daily commute.

    0 讨论(0)
  • 2021-02-07 00:12

    From my experience of working in this field, A* does the job very well. It is (as mentioned above) faster than Dijkstra's algorithm, but is still simple enough for an ordinarily competent programmer to implement and understand.

    Building the route network is the hardest part, but that can be broken down into a series of simple steps: get all the roads; sort the points into order; make groups of identical points on different roads into intersections (nodes); add arcs in both directions where nodes connect (or in one direction only for a one-way road).

    The A* algorithm itself is well documented on Wikipedia. The key place to optimise is the selection of the best node from the open list, for which you need a high-performance priority queue. If you're using C++ you can use the STL priority_queue adapter.

    Customising the algorithm to route over different parts of the network (e.g., pedestrian, car, public transport, etc.) of favour speed, distance or other criteria is quite easy. You do that by writing filters to control which route segments are available, when building the network, and which weight is assigned to each one.

    0 讨论(0)
  • 2021-02-07 00:13

    A* is actually far closer to production mapping algorithms. It requires quite a bit less exploration compared to Dijikstra's original algorithm.

    0 讨论(0)
  • 2021-02-07 00:16

    Barry Brumitt, one of the engineers of Google maps route finding feature, wrote a post on the topic that may be of interest:

    The road to better path-finding 11/06/2007 03:47:00 PM

    0 讨论(0)
提交回复
热议问题