Skip to content

Commit f9b41fe

Browse files
authored
Merge pull request #8 from SimpliRoute/add-profile-parameter
Add profile parameter
2 parents 526b583 + 3df5d4e commit f9b41fe

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/main/java/com/osrm/client/DistanceService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
import java.util.List;
44

55
public interface DistanceService {
6-
DistanceMatrix buildDistanceMatrix(List<GeoLocation> coordinates, double speedRate, String country, String token);
6+
DistanceMatrix buildDistanceMatrix(List<GeoLocation> coordinates, double speedRate, String country, String token, String profile);
77
}

src/main/java/com/osrm/client/OSRMClient.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public OSRMClient(String uri) throws EmptyUrlException {
2626
}
2727

2828

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

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

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

0 commit comments

Comments
 (0)