1

this is a parameter i was passed

String[] fromPoint:["40.7127837,-74.0059413","33.9533487,-117.3961564"];
String[] toPoint:["38.6270025,-90.19940419999999","12.8445,80.1523"];

// this is code i was written, i was convert string to latlng and when i try to execute code i will get

-11-16 16:31:52.130 INFO 10956 --- [nio-8080-exec-2] c.g.maps.internal.OkHttpPendingResult : Retrying request. Retry #1 2018-11-16 16:31:52.568 INFO 10956 --- [nio-8080-exec-2] c.g.maps.internal.OkHttpPendingResult : Retrying request. Retry #2 2018-11-16 16:31:53.594 INFO 10956 --- [nio-8080-exec-2] c.g.maps.internal.OkHttpPendingResult : Retrying request. Retry #3 2018-11-16 16:31:54.907 INFO 10956 --- [nio-8080-exec-2] c.g.maps.internal.OkHttpPendingResult : Retrying request. Retry #4 2018-11-16 16:31:55.914 INFO 10956 --- [nio-8080-exec-2] c.g.maps.internal.OkHttpPendingResult : Retrying request. Retry #5 2018-11-16 16:31:57.544 INFO 10956 --- [nio-8080-exec-2] c.g.maps.internal.OkHttpPendingResult : Retrying request. Retry #6

String key = "Key";
LatLng[] fLatLong = getLatLong(fromPoint);
LatLng[] tLatLong = getLatLong(toPoint);
try{    
    GeoApiContext distCalcer = new GeoApiContext.Builder()
        .apiKey(key)
        .build();

    DistanceMatrixApiRequest req = DistanceMatrixApi.newRequest(distCalcer); 
    DistanceMatrix result = req.origins(fLatLong)
           .destinations(tLatLong)
           .await();
   DistanceMatrixElement[] row =  result.rows[0].elements;
   System.out.println(row[0].toString());

}catch(Exception e){
    e.getStackTrace();
}

please help thank you!

Mohammadreza Khatami
  • 1,444
  • 2
  • 13
  • 27

0 Answers0