File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed
src/main/java/com/osrm/client Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -28,16 +28,13 @@ public static void main(String[] args) throws EmptyUrlException {
2828
2929 String profile = "car" ;
3030
31- String options = "{\" metrics\" : \" time,distance\" }" ;
32-
3331 CostMatricesRequest request = CostMatricesRequest .builder ()
3432 .speedRate (speedRate )
3533 .country (country )
3634 .locations (locations )
3735 .token (token )
3836 .profile (profile )
39- .metrics ("time,distance" )
40- //.metrics("time")
37+ .returnDistanceMatrix (true )
4138 .build ();
4239
4340 CostMatrices matrices = client .getCostMatrices (request );
Original file line number Diff line number Diff line change @@ -53,7 +53,10 @@ public CostMatrices getCostMatrices(CostMatricesRequest request) {
5353 paramsString = addParamString (paramsString , "country" , request .getCountry ());
5454 paramsString = addParamString (paramsString , "start_time" , request .getStartTime ());
5555 paramsString = addParamString (paramsString , "vehicleSubType" , request .getVehicleSubType ());
56- paramsString = addParamString (paramsString , "metrics" , request .getMetrics ());
56+
57+ final String metricsParam = request .isReturnDistanceMatrix () ? "time,distance" : "time" ;
58+
59+ paramsString = addParamString (paramsString , "metrics" , metricsParam );
5760 //TODO:423 pending implement vehicular restriction
5861
5962 RequestBody body = RequestBody .create (mediaType , "loc=" + paramsString );
Original file line number Diff line number Diff line change @@ -16,5 +16,5 @@ public class CostMatricesRequest {
1616 private final String startTime ;
1717 private final String vehicleSubType ;
1818 private final String restrictionOption ;
19- private final String metrics ;
19+ private final boolean returnDistanceMatrix ;
2020}
You can’t perform that action at this time.
0 commit comments