How can I block specific osm relation?

In Israel in the West Bank, Israeli citizens are not allowed to enter what’s called “Area A”. But graphhopper still navigates through it. There’s an osm relation called Area A which is of type “boundary” for that, OSM Relataion Area A.
How can I prevent graphhopper from navigating through that relation?
Thanks!

You can export those relations from OSM and import them as polygons. Then you restrict access for all roads that have a junction node in these polgons. See e.g. the /change endpoint (ChangeGraphHelper) or the spatial rules on how this can work.

1 Like

Ah, Great!
So I have a jsonFeture for the area, but I don’t want to use change, because currently it requires turning off ch(which I guess will harm performance…)
How can I create a spatial rule for a specific region?
I understand it should be possible, but couldn’t figure out how…

Thank you!

I wasn’t able to find fine documentation on spatial rules.
It’s easy to create one, but I have no idea how to make graphhopper use it on specific regions…

Btw,
changeGraph does not support Polygon.
I discovered it in the hard way.

Sorry, I meant this only for an example that you can use to implement something similar. As we currently do not support blocking access from an OSM relation.

The /change endpoint will be likely removed: https://github.com/graphhopper/graphhopper/issues/1931

Another code example might be to find all border edges and make them inaccesible: https://github.com/graphhopper/graphhopper/blob/master/core/src/main/java/com/graphhopper/routing/lm/LandmarkStorage.java#L457

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Powered by Discourse