Disable calc_points in Java on a per request basis


I am using Graphhopper 0.9.0 as the back engine for a routing REST API. In order to reduce the size of the Json response, I would like to optionally disable the points calculation so I just return the travel time and distance.

I have seen a request parameter on the Directions API that does this : calc_points. However, I don’t find any option on the java GHRequest in order to disable the points calculation.

Of course, I can just ignore the point list of the calculated path when sending my Json response, but I was wondering if the points calculation could be totally disabled on a per request basis, and thus maybe accelerate a little bit the routing calculation.

Thanks in advance.


I don’t know if it’s avalaible on your version but you can use : calc_points=false.

Hope this help you

If you mean via the Java API, can use GraphHopper.setEnableCalcPoints method.


Thank you both for your answers. Yeah, I meant the Java API. GraphHopper.setEnableCalcPoints method sounds interesting, I will take a look at it.

Hi again,

Just to let you know how I made it work.

In order to avoid potential multi-threading concurrency problems, I decided to use the request hints, instead of setting the default value on the hopper (myHopper.setEnableCalcPoints(false)) every time before calling the route method.

Also, in order to get an empty pointList in the response PathWrapper, I had to disable the ìnstructions as well.

So finally, I get something like this:

GHRequest req = new GHRequest(latOrigin, lonOrigin, latArrival, lonArrival)
req.getHints().put(Routing.CALC_POINTS, false);
req.getHints().put(Routing.INSTRUCTIONS, false);

Thanks for the help.