Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/com/osrm/client/DistanceService.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import java.util.List;

public interface DistanceService {
DistanceMatrix buildDistanceMatrix(List<GeoLocation> coordinates, double speedRate, String country, String token);
DistanceMatrix buildDistanceMatrix(List<GeoLocation> coordinates, double speedRate, String country, String token, String profile);
}
6 changes: 3 additions & 3 deletions src/main/java/com/osrm/client/OSRMClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public OSRMClient(String uri) throws EmptyUrlException {
}


public OSRMDistanceResponse getDistanceMatrix(List<GeoLocation> locations, double speedRate, String country, String token) throws OptimizationDistanceMatrixException {
public OSRMDistanceResponse getDistanceMatrix(List<GeoLocation> locations, double speedRate, String country, String token, String profile) throws OptimizationDistanceMatrixException {
OSRMDistanceResponse osrmDistanceResponse;

Builder requestBuilder = new Builder();
Expand All @@ -53,7 +53,7 @@ public OSRMDistanceResponse getDistanceMatrix(List<GeoLocation> locations, doubl
RequestBody body = RequestBody.create(mediaType, "loc=" + paramsString);

Request request = new Request.Builder()
.url(this.uri + "/table")
.url(this.uri + "/table/" + profile)
.post(body)
.addHeader("Content-Type", "application/x-www-form-urlencoded")
.addHeader("Authorization", token)
Expand All @@ -63,7 +63,7 @@ public OSRMDistanceResponse getDistanceMatrix(List<GeoLocation> locations, doubl
Response response = client.newCall(request).execute();
osrmDistanceResponse = OSRMDistanceResponse.fromJSON(response.body().string());
}
catch(IOException e) {
catch(Exception e) {
System.out.print(e.getMessage());
throw new OptimizationDistanceMatrixException("Error while connecting to osrm server");
}
Expand Down