Hi everyone,
My code blocks few edges by setting edge.set(avgSpeedEnc, 0);
LocationIndex locationIndex = hopper.getLocationIndex();
Snap query = locationIndex.findClosest(latitude ,longitude, EdgeFilter.ALL_EDGES);
int edgeId = query.getClosestEdge().getEdge();
//Modify the edge internal graph state
Graph graph = hopper.getGraphHopperStorage();
EdgeIteratorState edge = graph.getEdgeIteratorState(edgeId, Integer.MIN_VALUE);
FlagEncoder carEncoder = hopper.getEncodingManager().getEncoder("car");
DecimalEncodedValue avgSpeedEnc = hopper.getEncodingManager().getDecimalEncodedValue(EncodingManager.getKey(carEncoder.toString(), "average_speed"));
edge.set(avgSpeedEnc, 0);
Once I request the shortest route, the following (understandable) error happens.
java.lang.IllegalStateException: Speed cannot be 0 for unblocked edge, use access properties to mark edge blocked! Should only occur for shortest path calculation. See #242.
I read about FlagEncoder.setAccess method but I can’t find it in the latest version of the library.
Can you please introduce me the bit of code that blocks a particular edge (starting from the edgeId)?
Thank you in advance
Andrea