Hey everyone, i’m trying to include some polygon blocked areas to the routing process. Unfortunately the calculated route is not respecting the blocked area.
Platform:
Android - Offline routing
Graphhopper version 0.13
Im using the current coordinates format:
[lat,lat,lat,lon,lon,lon]
hopper.getCHFactoryDecorator().setDisablingAllowed(true);
req.getHints().put(Parameters.CH.DISABLE, true);
req.getHints().put(Parameters.Routing.BLOCK_AREA ,blockedAreas);
After some debug i’ve been able to see the blocked area being properly loaded
return new BlockAreaWeighting(weighting, blockArea);
What am i missing?
Could I be providing the coordinates in the wrong projection?
Kind regards
This was a known issue and fixed in 1.0 or 2.0.
Hey @karussell, thank you so much for your answer.
I’ve updated to version 1.0 and still the same issue. I’m going to try now version 2.0.
I really hope that this isn’t a coordinates format or projection issue.
Do you know where to find some official documentation on blocked areas?
regards
It should be fixed in 1.0: https://github.com/graphhopper/graphhopper/pull/1917
If you still encounter problems please write a simple reproducer here and make sure you use the correct format (see the api docs)
Additionally I would recommend to use the customizable routing instead where you would also have the possibility to make the area restriction conditional (e.g. only for bigger roads in this area or similar) or only avoid an area or use it in the speed mode. And the block_area feature is planned to be deprecated (but currently is not).
Hey @karussell after checking the api docs i cannot find the proper format for polygons. Only for “circles”, “points” or “rectangles”.
Block road access via a point with the format latitude,longitude
or an area defined by a circle lat,lon,radius
or a rectangle lat1,lon1,lat2,lon2
. Separate multiple areas with a semicolon ;
.
I know that the polygon areas are supported because of this PR.
Anyway after some debug, i’m now sure that i’m sending the polygon coordinates in a wrong projection.
thank you again for you answer.
I’ll create a reproducer if i don’t manage to fix it.
Regards
1 Like
After changing to the proper projection it’s finally working.
The format for polygon blocked areas should be the same as the rectangle.
Regards
André
1 Like