Question in relation to knowing that my sequenced address list is being followed.
The information lists I have access to and long/lat which is currently being input into graphhopper;
Longitude | Latitude | Address |
---|---|---|
174.817698160307 | -41.2211847808856 | 3 Padnell Crescent Paparangi, Wellington |
174.817793223927 | -41.2210084429783 | 5 Padnell Crescent Paparangi, Wellington |
174.818039507498 | -41.2212552486597 | 4 Padnell Crescent Paparangi, Wellington |
etc |
From this input how do I know the distance between each point? How is it able to be access within order that I input them.
eg.
Longitude | Latitude | Address | Distance |
---|---|---|---|
174.817698160307 | -41.2211847808856 | 3 Padnell Crescent Paparangi, Wellington | 21m |
174.817793223927 | -41.2210084429783 | 5 Padnell Crescent Paparangi, Wellington | 15m |
174.818039507498 | -41.2212552486597 | 4 Padnell Crescent Paparangi, Wellington | 33m |
etc |
Then from that how do I go about processing the shortest distance using Graphhopper?
eg.
Longitude | Latitude | Address | Distance |
---|---|---|---|
174.818039507498 | -41.2212552486597 | 4 Padnell Crescent Paparangi, Wellington | 10m |
174.817698160307 | -41.2211847808856 | 3 Padnell Crescent Paparangi, Wellington | 21m |
174.817793223927 | -41.2210084429783 | 5 Padnell Crescent Paparangi, Wellington | 10m |
etc |
I’m currently using the following to get distance
InstructionList il = path.getInstructions();
// iterate over every turn instruction
for(Instruction instruction : il) {
System.out.println(instruction.getDistance() + " Meters");
}
Should I be using Matrix API?
Matrix API
// Hint: create this thread safe instance only once in your application to allow the underlying library to cache the costly initial https handshake
GraphHopperMatrixWeb matrixClient = new GraphHopperMatrixWeb();
matrixClient.setKey(“[YOUR_KEY]”);GHMRequest ghmRequest = new GHMRequest();
ghmRequest.addOutArray(“distances”);
ghmRequest.addOutArray(“times”);
ghmRequest.setVehicle(“car”);// init points for a symmetric matrix
List allPoints = …;
ghmRequest.addAllPoints(allPoints);// or init e.g. a one-to-many matrix:
ghmRequest.addFromPoint(from);
for(GHPoint to : toList) {
ghmRequest.addToPoint(to);
}MatrixResponse response = matrixClient.route(ghmRequest);
GHMResponse singleRsp = response.get(fromIndex, toIndex);
singleRsp.getDistance();