Skip to content

Commit cd56d08

Browse files
add start_time parameter
1 parent c20548e commit cd56d08

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
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, String profile);
6+
DistanceMatrix buildDistanceMatrix(List<GeoLocation> coordinates, double speedRate, String country, String token, String profile, String startTime);
77
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static void main(String[] args) throws EmptyUrlException {
2727

2828
String profile = "car";
2929

30-
OSRMDistanceResponse response = client.getDistanceMatrix(locations, speedRate, country, token, profile);
30+
OSRMDistanceResponse response = client.getDistanceMatrix(locations, speedRate, country, token, profile, null);
3131

3232
System.out.println(response);
3333
}

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

Lines changed: 5 additions & 1 deletion
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, String profile) throws OptimizationDistanceMatrixException {
29+
public OSRMDistanceResponse getDistanceMatrix(List<GeoLocation> locations, double speedRate, String country, String token, String profile, String startTime) throws OptimizationDistanceMatrixException {
3030
OSRMDistanceResponse osrmDistanceResponse;
3131

3232
Builder requestBuilder = new Builder();
@@ -50,6 +50,10 @@ public OSRMDistanceResponse getDistanceMatrix(List<GeoLocation> locations, doubl
5050
paramsString += "&speedRate=" + speedRate;
5151
paramsString += "&country=" + country;
5252

53+
if (startTime != null & !startTime.isEmpty()) {
54+
paramsString += "&start_time=" + startTime;
55+
}
56+
5357
RequestBody body = RequestBody.create(mediaType, "loc=" + paramsString);
5458

5559
Request request = new Request.Builder()

0 commit comments

Comments
 (0)