i created a simple example.
start of the route: 47.416763,15.290308
end of the route: 47.410432,15.28412
i use these commands to create a route:
GHRequest request = new GHRequest();
GHResponse ghResponse = graphHopper.route(request);
WebHelper.jsonObject(ghResponse, instructions, calcPoints, enableElevation, pointsEncoded, took)
this creates the following json: sample.json (924 Bytes)
Because i use “details=distance”, a distance-node was created.
This array-node has 6 entries.
Each entry has 3 values:
the id of the startpoint-coordinate
the id of the endpoint-coordinate
the distance from the startpoint to the endpoint.
Sometimes the endpoint is the point directly after the startpoint.
But in other situation there are additional points between startpoint and endpoint.
lets take distance-entry with id 1: [3, 4, 126.234]
As you can see, the endpoint is the point that is directly after the startpoint.
So this distance-entry includes 2 points.
lets take distance-entry with id=0: [0, 3, 321.82056903180285]
So this distance-entry includes 4 points: 0,1,2 and 3
i would like to get a distance-array with entries, that always has just 2 points.
so instead of distance-entry [0, 3, 321.82056903180285]
i would like to get 3 entries like
[0, 1, 53.15],[1, 2, 250.04],[2, 3, 18.3]