2
votes

only one question that i did not understand complety is that, on the page of google distance matrix, in the example of :

requesting distance and duration from Vancouver, BC, Canada and from Seattle, WA, USA, to San Francisco, CA, USA and to Victoria, BC, Canada.

in that part, what does it mean BC, WA etc. And in the request

http://maps.googleapis.com/maps/api/distancematrix/json?origins=Vancouver+BC|Seattle&destinations=San+Francisco|Victoria+BC&mode=bicycling&language=fr-FR&sensor=false

Why Vancouver+BC and why not Seatle + WA.

And the most important question is that if i want to work with latidute and longitude, not with name of places, how can i do this?

1

1 Answers

0
votes

Have a look at the answer i posted on this thread:

android google map finding distance

It uses the Google directions API but you still get the data you require, and uses Lat/Lon for the request. You would also need to add:

JSONObject duration = steps.getJSONObject("duration");

        String sDuration = duration.getString("text");
        int iDuration = duration.getInt("value");

in order to get the duration, make sure you put it after JSONObject steps = legs.getJSONObject(0);