Is it possible to create a layer and then use its data for routing? For example, let's say I create a Crash Layer. Then I would like to avoid any Crash Markers from that layer when routing. Is this possible? |
tl;dr answer:I don't know but probably, and you'd have to do quite a lot of work yourself. Slightly more in-depth non-answer:OpenStreetMap is essentially just lots and lots of data. A "renderer" turns that data (usually stored in some sort of database) into a map, and other software (such as "Leaflet", used on osm.org) display those maps to the user, and can display other information overlaid over the top as extra layers (as happens on the OSM site when you show notes or data). Routers work with the data in a different way to calculate routes. They don't work with a graphical representation (the "map") but with an internal representation of the data that's designed so that they can make route calculations quickly. If you want those calculations to include some specific locations ("crash markers") you're going to have to include those locations in in the routing data that the router uses for its calculations. Various routers that can work with OSM data are described here. Each of these typically has more information available about it; I'd start by reading that. For example, you might find the technical information on this GraphHopper page useful.
permanent link
This answer is marked "community wiki".
1
So my understanding is that there's an underlying graph representation for the routers. This representation then has weights on the edges. Is there a way for me to modify the weights?
(21 Mar '14, 07:33)
mikepatt77
1
Yes there is an underlying graph representation for the routers. But OSM doesn't contain this graph, it contains only the raw data needed to generate it. Each router calculates its own graph. Consequently there is no general answer to your question because it depends on the specific router you are interested in. But with most open source routers it should be possible to add such a "layer".
(21 Mar '14, 07:38)
scai ♦
2
Searching this help facility for "network" or "graph" should get you some info about how to build such a graph from OSM data.
(23 Mar '14, 18:54)
Frederik Ramm ♦
|
You mean you want to tell a routing algorithm to avoid specific locations? Or what do you think a "layer" is? Or do you want to know if and how we can add such "crashes" to the OSM data?
Yes I would like to avoid specific locations. My understanding of a layer is that it is a set of markers that can go on top of a map view. Is that wrong?
Okay, no, that is not wrong, but likely not something which should be in the OMS data. It should only be fed privately to your routing engine. See SomeoneElse below.