# Minimize distances

Setting the detail “distance” graphhopper calculates distances between points.
Sometimes a distance-object relates to 2 points.
But sometimes it relates to 3 or more points.

Is it possible to configure this, that these distance-objects always relate to just 2 points?

Can you describe in more detail what you are doing?

i created a simple example.
start of the route: 47.416763,15.290308
end of the route: 47.410432,15.28412
elevation=true
points_encoded=false
instructions=false
details=distance

i use these commands to create a route:

GHRequest request = new GHRequest();
request.setPoints(points);
request.setPathDetails(pathDetails);

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.
sample:
lets take distance-entry with id 1: [3, 4, 126.234]
startpoint-id=3
endpoint-id=4
distance=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]
startpoint-id=0
endpoint-id=3
distance=321.820…
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]

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