Blocking between two nodes?

The new possibility of blocking sections over the block_area tag is a good approach to take account of construction sites. However, it may happen that opposing lanes, which lie side by side, are not always exactly hit.
In the OSM data, each node has a unique ID. Would it be possible to define a blocking between two nodes? Thus, much more precise results could be achieved.

Hi Mario,

the issue with OSM IDs is that they are not stable, they can change at any time and also AFAIK GraphHopper doesn’t store OSM IDs in the graph right now. This would be possible once GH stores the IDs.

Is your question about not hitting enough roads, e.g., block both lanes of a motorway or is your question about not blocking the other lane of a motorway, e.g., in case of a traffic jam?


Hello Robin,

In our application, we would generate the OSM data from our data base. The IDs would therefore always be consistent and stable. I consider the use of IDs as a direct and thus safer way. It would help us very much if we had an exact control over the blocked sections. The assignment via the geographical coordinates always entails an uncertainty.

Greeting, Mario

I do not fully understand the use case and the usage scenario. If you are e.g. navigating to the destination and now you know that there is a construction ahead you could implement a block_area via a bounding box or circle somehow. If you just have the OSM ID I’m not sure what this makes easier. If you know the blocked roads before import e.g. via a construction tag then we already block those roads (depending a bit if the construction is tagged via conditional restrictions)

However, it may happen that opposing lanes, which lie side by side, are not always exactly hit.

Why would you want to have one road blocked (e.g the road heading to south) and another opened (heading north) if you are heading north?

In our scenario, the road vectors are given for a defined area. Construction sites are still known for this area. There are construction sites that apply for a longer period of time and construction sites, which are only active for a certain period of time. The only intermittently active blockages can not be considered when reading the data. Therefore, the dynamic parameters must be used.

Especially in the urban area the streets are very close together. Therefore, the use of circles or rectangles is uncertain. This can always lead to the unintentional blocking of passable sections. The use of a point for the blocking of a line I think is also unsafe. Using the IDs solves the problem.

In our system, many routes have to be determined over the whole network. The blockages must fit in all directions so that no reduction or optimization is possible.

Here maybe an idea for solving my problem: If the identification of a node over the geographic coordinate is always exact, then another blocking type ‘line’ could be introduced. Start and destination point could be defined as coordinates. If the found nodes are linked by a vector, then this vector is blocked.

The problem is now, of course, the parameter equality to the bounding box …

If you are asking for the case where the OSM input does not change, then we could use AvoidEdgesWeighting or an already working internal URL parameter combined with the edges (or more general the ‘traversal keys’) returned from a map matching query.

Could you show an example for these possibilities?

Please have a look e.g. how AvoidEdgesWeighting is used like in the tests or in the round trip calculation. Or also see the usage of blockArea.blockedEdges like how it is filled in GraphEdgeIdFinder.parseBlockArea and used in GraphEdgeIdFinder.BlockArea.contains

Is there any hope that a dynamic blocking of lines will be possible via a URL invocation of the Directions API? This interface is already implemented and would be easy for us to change.

Hope dies last :wink: … we can write this requirement down but it is unlikely that it will be officially available without a contribution

The only realistic way, therefore, seems to be a direct use and adaptation of the GH in a JAVA environment. Correct?

Our experience in the JAVA development is unfortunately very low. We use almost only C# for our projects. Is it possible to contact a developer or service provider through this forum to implement our requirements?

Yes, after this post we got a few connections. Just DM me or contact us via Email.