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?

asked 20 Mar '14, 22:03

mikepatt77's gravatar image

accept rate: 0%

edited 21 Mar '14, 00:21

aseerel4c26's gravatar image

aseerel4c26 ♦

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?

(20 Mar '14, 22:29) aseerel4c26 ♦

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?

(20 Mar '14, 23:03) mikepatt77

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.

(21 Mar '14, 00:05) aseerel4c26 ♦

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 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".

answered 20 Mar '14, 23:25

SomeoneElse's gravatar image

SomeoneElse ♦
accept rate: 16%

wikified 20 Mar '14, 23:25


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

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 ♦

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 ♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 20 Mar '14, 22:03

question was seen: 2,042 times

last updated: 23 Mar '14, 18:54

powered by OSQA