Hi,
I am trying to make a GHRequest with a custom model containing an area to avoid, but I am not fully sure of how obtaining the desired result.
I guess it is something related to the graph preparation or speed/hybrid mode or the profile weighting.
My code is the following.
GHRequest req = new GHRequest(39.3309657322564, 16.239947664138324, 39.33230086519411, 16.23923098056929)
.setProfile("car").putHint(Parameters.CH.DISABLE, true).setLocale(Locale.ITALY);
CustomModel model = new CustomModel();
Coordinate[] shell = new Coordinate[5];
shell[0] = new Coordinate(16.2399070658626, 39.331077386134275);
shell[1] = new Coordinate(16.23982586931115, 39.33093084038301);
shell[2] = new Coordinate(16.239379288278197, 39.3311018103963);
shell[3] = new Coordinate(16.23943793023202, 39.33125533413365);
shell[4] = new Coordinate(16.2399070658626, 39.331077386134275);
GeometryFactory geometryFactory = new GeometryFactory();
Polygon polygon = geometryFactory.createPolygon(shell);
JsonFeature area = new JsonFeature("avoid", "Polygon", null, polygon, new HashMap<String, Object>());
model.getAreas().put("avoid", area);
model.setDistanceInfluence(0);
model.getPriority().put("area_avoid", 0.0);
req.putHint(CustomModel.KEY, model);
GHResponse response = hopper.route(req);