8.0 Set a No-Go Zone

Hello, when I was using version 8.0. How Do I Use an API Call to Set a No-Go Zone? How to set up a no-go zone if it is a point? If it’s a region, how do I set it up? If the center of the circle is a circle, how to set it?
GHRequest req = new GHRequest(39.668969,116.068905, 39.757418,116.157294).
setProfile(“car”).
setAlgorithm(Parameters.Algorithms.ALT_ROUTE).
setLocale(Locale.CHINA);
//How to set up a no-go zone???
req.?( No-Go Zone)
Please, thank you

You can use an area and block this in the custom model: https://github.com/graphhopper/graphhopper/blob/master/docs/core/custom-models.md#areas

A circle is not possible but you can use a polygon and instead of limiting the speed you would use

{
  "priority" : [{ "if": "in_area1", "multiply_by": "0"  }]
}

Sorry, I didn’t make it clear
I want to set an area that cannot be passed through. This area is a circular area. How do I set this area?
I make the call through Java calls

A circular area is not possible but you can use a polygon that comes close using GHUtility.createCircle

I want to set an area that cannot be passed through.

Yes, see the linked Java example and replace “speed” with “priority” etc. like this:

customModel.addToPriority(If("in_area1", MULTIPLY, "0"));

Hello, thank you very much for your answer.
However, I also want to ask you, if it is a waypoint, then how do you design it? Or how to set up the route area?

sorry ,According to what you said, it can be set without any errors, but the planned route will still pass through the restricted area


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