Skip to content

Connect tower nodes of highways tagged as area=yes - #2805

Draft
easbar wants to merge 3 commits into
masterfrom
area_ways
Draft

easbar wants to merge 3 commits into
masterfrom
area_ways

Conversation

@easbar

@easbar easbar commented Apr 24, 2023

Copy link
Copy Markdown
Member

This PR shall add support for some simple cases of routing through pedestrian areas.

In OSM there are currently around 390k ways tagged as area=yes that carry a highway tag. There are another around 19k relations tagged as area=yes that carry a highway tag.

The textbook example for such an area we'd like to route through would be something like Glücksburger Platz in Hamburg, Germany:

image

This is a closed-ring way tagged as area=yes;highway=pedestrian that shares some nodes with adjacent roads/footways. As long as we treat it as a normal way tagged as highway=pedestrian, ignoring the area=yes tag, the route will simply go along the edge of the area, like this:

image

... which is of course not ideal. Note that the dashed line crossing the area is an administration boundary not a footway in this example.

Because GraphHopper is not the only router that doesn't offer support for area=yes, mappers often add artificial ways, even though some consider mapping for routers bad practice. Take a look at Gerhart-Hauptmann-Platz in Hamburg:

Satellite OSM
image image

In this case GraphHopper uses these extra ways to route across the plaza of course:

image

But obviously for many pedestrian areas such ways are missing and as far as I know it is not even the consensus among mappers that they should be mapped, or some might be even against mapping them.

So the question here is what we, as a routing engine, can do to support routing through such areas.

The examples I showed above are very simple, because (a) the corresponding areas are convex, i.e. all points of the area boundary can be connected with a straight line without leaving the area (at least this is true for all points on the boundary that connect the area with adjacent roads), and (b) there are only a few such points that are clearly separated from each other. In this case we can simply connect the points to add extra edges to the routing graph and the area will become 'routeable'. This is done in this PR. In case of the first example (Glücksburger Platz) it looks like this:

image

The grey lines represent routing graph edges, while the red arrows point to the six artificial edges we added to connect the four points of the area that are connected to adjacent roads/footways.

This results in a much more realistic route that no longer goes along the edge of the area:

image

For the second example (Gerhart-Hauptmann-Platz) the situation is already more complicated:

image

Here we added edges to connect the entry nodes of the area again, but since OSM already contained some extra ways that mappers added to make the area routeable the routing network becomes rather messy. Due to the way we snap coordinates to the route network this can lead to strange routes like this:

image

To fix this we would have to create extra nodes at points where these edges intersect, recognize areas for which there are such extra ways already and either ignore them or do not add more edges, or change our snapping approach. Unfortunately none of these solutions would be easy or even feasible for us.

Another problem is that many areas aren't convex, like Harald-Stender Platz:

image

In such cases the present simple approach might add too few extra edges. I think it would be feasible to apply some more sophisticated logic and create edges that follow shortest paths without leaving the area, even when the area is not convex. However, the bigger issue seems to be that often too many edges would be added and lead to a similar problem as the one mentioned above.

Even the simple approach might add too many edges. Take for example this pedestrian area, which does not really represent a 'plaza', but rather some kind of pedestrian 'lane':

image

In this case the routing graph will look like this (with this PR):

image

and quite obviously this dense net of edges leads to strange routes when we snap inside the area (for the same reasons mentioned above):

image

The situation becomes even worse when there are not only many tower nodes along the area border, but when areas share a common border. In this case basically every node becomes a tower node (because it belongs to two or more ways).

For example here there are many little pedestrian areas with complicated shapes that share common ways:

image

When we apply the simple logic in this PR we get a super dense routing graph with very many crossing edges:

image

In summary there seem to be:

  • areas that could easily be made routeable using the simple approach represented here
  • areas where adding more edges is unnecessary and even can result in too many crossed edges because mappers already added extra ways to make the area routeable
  • areas that are not convex where a more sophisticated approach would be needed to connect the different roads adjacent to the area
  • areas where even with the simple/conservative approach here we would add too many edges

The good news is that with this PR the total edge count only increases by around 0.5% (tested for Germany). As it stands it can lead to strange routes like the ones shown above, though. Overall, I am not really convinced this is a real improvement yet.

To reduce the number of extra edges and avoid the strange routes I mentioned we would probably need a (much) more sophisticated approach that only adds a small number of 'useful' edges and/or another snapping algorithm?

@easbar

easbar commented Apr 24, 2023

Copy link
Copy Markdown
Member Author

I think an important observation is that in OSM area=yes&highway=pedestrian/footway can both mean we are dealing with some kind of 'pedestrian lane/area' or a 'plaza':

image

In the screenshot we see area=yes ways highlighted in blue. Some encircle blocks of houses, while others (the one in the top right) represent a 'plaza'. We probably only want to add edges for the latter kind.

@karussell

karussell commented Apr 24, 2023 •

Copy link
Copy Markdown
Member

Do you still have the links for those areas on GH Maps?

Overall, I am not really convinced this is a real improvement yet.

I still really like it :D ... seems to be one part of a solution for #82 :)

that only adds a small number of 'useful' edges

Instead of connecting all tower nodes would it be possible to differentiate between useful towernodes where OSM ways "enter" or "leave" those areas from the unuseful towernodes that only exist due to the border of the area?

quite obviously this dense net of edges leads to strange routes when we snap inside the area (for the same reasons mentioned above)

Would this really happen that often in real world?

For example here there are many little pedestrian areas with complicated shapes that share common ways:

Maybe this is not really properly mapped and instead a single enclosing area should be used?

We probably only want to add edges for the latter kind

👍

@easbar

easbar commented Apr 24, 2023

Copy link
Copy Markdown
Member Author

Do you still have the links for those areas on GH Maps?

The screenshots should be clickable/provide links to the areas.

Would this really happen that often in real world?

I think it happens whenever we start or end a route within such an area (or both). We simply snap to the next edge and this might lead us into the wrong direction (make a detour that seems not plausible).

Maybe this is not really properly mapped and instead a single enclosing area should be used?

It looks like they used separate areas to map different surfaces or something?

@otbutz

otbutz commented Apr 25, 2023

Copy link
Copy Markdown
Contributor

Could we try to compute some kind of minimum network of support points for an area? At least for convex area polygons, routing through the centre of mass seems like a good place to start.

grafik

@otbutz

otbutz commented Apr 25, 2023

Copy link
Copy Markdown
Contributor

@Vectorial1024

Copy link
Copy Markdown
Contributor

Hi there! I have been redirected to this issue.

So far there are these cases:

  • convex pedestrian areas
  • concave pedestrian areas

Large area or not would not be a problem; hypothetically, we would just solve them the same way regardless of the size of the area.

The main problem is to enable routing through the areas (i.e., outside the area -> cross the area -> outside the area) . It seems to me routing within these areas is less of a concern (i.e. inside the area -> inside the area) .

I have no opinion about the exact methods on how to generate the extra edges (e.g. every node to every other node? find minimal support nodes? or other methods?)

However, I was thinking whether it is possible to tell GraphHopper to not snap to those generated edges. If that's possible, then we have the following benefits:

  • foot profile can still go through pedestrian areas
  • no more "sharp angle" paths inside pedestrian areas as found in this PR
  • preserves explicitly-mapped foot paths, in case OSM mappers believe those are somehow important to the map

@easbar

easbar commented Oct 29, 2025

Copy link
Copy Markdown
Member Author

I think it would be useful if we had a whole list of area examples where routing along artificial edges would be important (not just nice to have). Maybe like 10-100 examples. There is very likely some way to improve on the current situation, but honestly I am not convinced it is really worth it, yet.

@1ec5

1ec5 commented Nov 2, 2025

Copy link
Copy Markdown

I think an important observation is that in OSM area=yes&highway=pedestrian/footway can both mean we are dealing with some kind of 'pedestrian lane/area' or a 'plaza':

For what it’s worth, this straw poll back in September found a very clear consensus (among 30 participants) for a distinction between area:highway=* and highway=* area=yes that is based on whether travel within the area is expected to be mostly linear or non-linear, respectively. In other words, this example should be retagged as area:highway=footway footway=sidewalk, and highway=footway footway=sidewalk ways should be drawn through the remaining sides of these blocks. Not everyone agrees, but this is one of the more lopsided polls I’ve ever seen in the forum’s global tagging category.

The discussion also largely accepted the idea that manually mapped virtual ways are only for pathological cases, or besides that only a temporary crutch while we wait for the sort of improvement you’re making here.

@Vectorial1024

Copy link
Copy Markdown
Contributor

I just thought of something.

It seems a big outstanding problem is that pedestrian areas might already contain explicitly-mapped paths within them. Fabricating paths while these explicit paths exist would inflate the graph too much.

What if, we just detect whether there are explicitly-mapped paths inside the pedestrian areas. If these paths exist, then we just skip processing this pedestrian area? If the paths are explicitly mapped, then it might be the (hopefully local) OSM mapper knows something about the pedestrian area which caused them to draw out the explicit paths instead of deferring it to the router (e.g. GraphHopper) to generate/fabricate "default paths".

This branch was previously deployed

1 inactive deployment
benchmarks — 70c8178f Deployed Apr 24, 2023 by easbar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants