我想找到两个地点之间的距离。我有经度和纬度,我可以计算欧氏距离。但我想找到道路距离。我的意思是,我想计算从源头到目的地时我正在进行的道路距离。在这种情况下如何计算?
答案 0 :(得分:7)
最简单的方法是使用Google Directions API获取路线,这会为您提供路线上所有点的列表(以及总距离)。
退房:http://code.google.com/apis/maps/documentation/directions/
如果你不确定怎么做,请告诉我,我会为你发布一些代码,这些代码将从谷歌获取指示并提取你需要的数据。
更新 - 根据要求提供的代码
private void GetDistance(GeoPoint src, GeoPoint dest) {
StringBuilder urlString = new StringBuilder();
urlString.append("http://maps.googleapis.com/maps/api/directions/json?");
urlString.append("origin=");//from
urlString.append( Double.toString((double)src.getLatitudeE6() / 1E6));
urlString.append(",");
urlString.append( Double.toString((double)src.getLongitudeE6() / 1E6));
urlString.append("&destination=");//to
urlString.append( Double.toString((double)dest.getLatitudeE6() / 1E6));
urlString.append(",");
urlString.append( Double.toString((double)dest.getLongitudeE6() / 1E6));
urlString.append("&mode=walking&sensor=true");
Log.d("xxx","URL="+urlString.toString());
// get the JSON And parse it to get the directions data.
HttpURLConnection urlConnection= null;
URL url = null;
url = new URL(urlString.toString());
urlConnection=(HttpURLConnection)url.openConnection();
urlConnection.setRequestMethod("GET");
urlConnection.setDoOutput(true);
urlConnection.setDoInput(true);
urlConnection.connect();
InputStream inStream = urlConnection.getInputStream();
BufferedReader bReader = new BufferedReader(new InputStreamReader(inStream));
String temp, response = "";
while((temp = bReader.readLine()) != null){
//Parse data
response += temp;
}
//Close the reader, stream & connection
bReader.close();
inStream.close();
urlConnection.disconnect();
//Sortout JSONresponse
JSONObject object = (JSONObject) new JSONTokener(response).nextValue();
JSONArray array = object.getJSONArray("routes");
//Log.d("JSON","array: "+array.toString());
//Routes is a combination of objects and arrays
JSONObject routes = array.getJSONObject(0);
//Log.d("JSON","routes: "+routes.toString());
String summary = routes.getString("summary");
//Log.d("JSON","summary: "+summary);
JSONArray legs = routes.getJSONArray("legs");
//Log.d("JSON","legs: "+legs.toString());
JSONObject steps = legs.getJSONObject(0);
//Log.d("JSON","steps: "+steps.toString());
JSONObject distance = steps.getJSONObject("distance");
//Log.d("JSON","distance: "+distance.toString());
String sDistance = distance.getString("text");
int iDistance = distance.getInt("value");
}
这将返回两点之间的距离,您可以更改函数以将其作为字符串或整数返回,只返回sDistance或iDistance。
希望这对您有所帮助,如果您需要更多帮助,请告诉我。
答案 1 :(得分:5)
使用google地图距离矩阵API http://code.google.com/apis/maps/documentation/distancematrix/。
答案 2 :(得分:1)
由于您已经在使用Google地图,请查看the driving directions api。
(BTW,谷歌地图API v3?我会假设是)
对于一对lat / lng点,您可以请求行车路线
在API3中,它看起来像这样:
var directionsService = new google.maps.DirectionsService();
var start = from; // A Google LatLng point or an address,
// see their API for further details
var end = to; // A Google LatLng point or an address,
//see their API for further details
var request = {
origin: start,
destination: end,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function (response, status) {
//Check if status Ok
//Distance will be in response.routes[0].legs[0].distance.text
});
验证响应状态是否正常,然后确保存在路由集合。如果是,则有结果,您可以通过以下方式访问“距离”文本元素:
response.routes[0].legs[0].distance.text
希望有所帮助。
答案 3 :(得分:0)
我看到有几个人已正确回答,但看看这个答案。使用谷歌地图方向api非常有用的API。 Google Maps Direction Api usage
答案 4 :(得分:0)
肯尼的改进答案对我有用,我根据我修改了一些东西。引入LatLng而不是geopoint。我发布的工作代码是Kenny的答案的修改版本。所有学分都归于肯尼而不是我!
重点:
以字符串格式传递地址。例如:多伦多
复制此功能:
private void GetDistance(String src, String dest) {
String s = src.replaceAll("\\s","+");
String d = dest.replaceAll("\\s","+");
StringBuilder urlString = new StringBuilder();
urlString.append("http://maps.googleapis.com/maps/api/directions/json?");
urlString.append("origin=");
urlString.append((s));
urlString.append("&destination=");
urlString.append((d));
urlString.append("&mode=driving&sensor=true");
Log.d("xxx", "URL=" + urlString.toString());
// get the JSON And parse it to get the directions data.
HttpURLConnection urlConnection = null;
URL url = null;
try {
url = new URL(urlString.toString());
urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestMethod("GET");
urlConnection.setDoOutput(true);
urlConnection.setDoInput(true);
urlConnection.connect();
InputStream inStream = urlConnection.getInputStream();
BufferedReader bReader = new BufferedReader(new InputStreamReader(inStream));
String temp, response = "";
while ((temp = bReader.readLine()) != null) {
//Parse data
response += temp;
}
//Close the reader, stream & connection
bReader.close();
inStream.close();
urlConnection.disconnect();
//Sortout JSONresponse
JSONObject object = (JSONObject) new JSONTokener(response).nextValue();
JSONArray array = object.getJSONArray("routes");
Log.d("xxx", "array: " + array.toString());
//Routes is a combination of objects and arrays
JSONObject routes = array.getJSONObject(0);
Log.d("xxx", "routes: " + routes.toString());
//String summary = routes.getString("summary");
//Log.d("JSON","summary: "+summary);
JSONArray legs = routes.getJSONArray("legs");
Log.d("xxx", "legs: " + legs.toString());
JSONObject steps = legs.getJSONObject(0);
Log.d("JSON", "steps: " + steps.toString());
JSONObject distance = steps.getJSONObject("distance");
Log.d("xxx", "distance: " + distance.toString());
String sDistance = distance.getString("text");
int iDistance = distance.getInt("value");
Log.d("SEE THE DIST : ", "" + sDistance + iDistance);
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
}
由于此函数执行网络操作,我们必须使用AsyncTask,如下所示:
private class Task extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
GetDistance(from, to);
return null;
}
}
LOG CAT:
01-05 17:01:08.657 3736-3820/in.test D/xxx: URL=http://maps.googleapis.com/maps/api/directions/json?origin=MP+Chowk+Thane+West+Thane,+Maharashtra+400080+&destination=Ghatkopar+West,+Mumbai,+Maharashtra,+India&mode=driving&sensor=true
01-05 17:01:08.687 3736-3736/in.test W/IInputConnectionWrapper: beginBatchEdit on inactive InputConnection
01-05 17:01:08.687 3736-3736/in.test W/IInputConnectionWrapper: endBatchEdit on inactive InputConnection
01-05 17:01:08.797 3736-3778/in.test V/RenderScript: Application requested CPU execution
01-05 17:01:08.807 3736-3778/in.test V/RenderScript: 0xb97768c0 Launching thread(s), CPUs 4
01-05 17:01:09.097 3736-3820/in.test D/xxx: array: [{"bounds":{"northeast":{"lat":19.1885561,"lng":72.9686183},"southwest":{"lat":19.0842303,"lng":72.9075409}},"copyrights":"Map data ©2016 Google","legs":[{"distance":{"text":"15.8 km","value":15818},"duration":{"text":"26 mins","value":1562},"end_address":"Ghatkopar West, Mumbai, Maharashtra, India","end_location":{"lat":19.0908134,"lng":72.9076817},"start_address":"MP Chowk, Thane West, Thane, Maharashtra 400080, India","start_location":{"lat":19.1855772,"lng":72.9556247},"steps":[{"distance":{"text":"27 m","value":27},"duration":{"text":"1 min","value":6},"end_location":{"lat":19.185599,"lng":72.9558468},"html_instructions":"Head <b>northeast<\/b> on <b>MP Chowk<\/b> toward <b>SG Barve Rd<\/b>","polyline":{"points":"{dbtBsch|L?AA?AA?AA??AAAAA?A?A?AAA?A?A?A?A?A?A@A?A@A?A@A?A@A"},"start_location":{"lat":19.1855772,"lng":72.9556247},"travel_mode":"DRIVING"},{"distance":{"text":"0.9 km","value":870},"duration":{"text":"3 mins","value":165},"end_location":{"lat":19.1883648,"lng":72.963413},"html_instructions":"Exit the roundabout onto <b>Lal Bahadur Shastri Marg<\/b><div style=\"font-size:0.9em\">Pass by Wagle Estate Post Office (on the left)<\/div>","polyline":{"points":"_ebtBaeh|LWoAOcAEe@A_AA{AMcBEQC]COOqAk@sDcAaE_@_Ac@}@[o@o@aAk@w@k@w@e@{@s@{AWm@"},"start_location":{"lat":19.185599,"lng":72.9558468},"travel_mode":"DRIVING"},{"distance":{"text":"2.4 km","value":2448},"duration":{"text":"5 mins","value":316},"end_location":{"lat":19.16823,"lng":72.96618509999999},"html_instructions":"Turn <b>right<\/b> to merge onto <b>NH 3<\/b><div style=\"font-size:0.9em\">Partial toll road<\/div>","polyline":{"points":"gvbtBiti|LQYIOCEGKXEZGp@QvM}CnAWLCNCL?X?jFsAp@QlGaBt@Qh@Of@Mz@WXIRI`@MNGRKrB_AxCqAbCaAz@]^Mb@Mr@Ob@IbDg@v@O|B]XEvAW~@OLAPCN?Z?r@@tG^r@Df@F`@HzDt@lAZl@RrAr@bAn@vC`BtD~B"},"start_location":{"lat":19.1883648,"lng":72.963413},"travel_mode":"DRIVING"},{"distance":{"text":"5.6 km","value":5599},"duration":{"text":"5 mins","value":320},"end_location":{"lat":19.1249579,"lng":72.9390226},"html_instructions":"Keep <b>right<\/b> to stay on <b>NH 3<\/b><div style=\"font-size:0.9em\">Partial toll road<\/div>","maneuver":"keep-right","polyline":{"points":"mx~sBuej|LnEnCnElCXNXNtFhDtFhDnc@jW|AbAtL|GZPTN@@@?B@DD@?DB`@X@?rN|I|BtAb@T~X~NzNtHd_@vRhHtDNJh@ZrCzAh@XxAt@lAn@zo@l\\p@ZdCjA~Bz@fGjB"},"start_location":{"lat":19.16823,"lng":72.96618509999999},"travel_mode":"DRIVING"},{"distance":{"text":"1.5 km","value":1518},"duration":{"text":"2 mins","value":95},"end_location":{"lat":19.1122651,"lng":72.93371189999999},"html_instructions":"Keep <b>left<\/b> to stay on <b>NH 3<\/b>","maneuver":"keep-left","polyline":{"points":"_jvsB{{d|LtCt@v@VxAj@jKjDj@Pt`@zLrKfD~HhC"},"start_location":{"lat":19.1249579,"lng":72.9390226},"travel_mode":"DRIVING"},{"distance":{"text":"2.4 km","value":2371},"duration":{"text":"2 mins","value":139},"end_location":{"lat":19.0923682,"lng":72.9255933},"html_instructions":"Keep <b>right<\/b> to stay on <b>NH 3<\/b>","maneuver":"keep-right","polyline":{"points":"uzssBuzc|LrQlFd@Nd@N|XrInBn@zBp@vQpF`F|AjVpH~PfFzAh@"},"start_location":{"lat":19.1122651,"lng":72.93371189999999},"travel_mode":"DRIVING"},{"distance":{"text":"0.9 km","value":921},"duration":{"text":"1 min","value":54},"end_location":{"lat":19.0849757,"lng":72.9217895},"html_instructions":"Continue straight to stay on <b>NH 3<\/b>","maneuver":"straight","polyline":{"points":"i~osB}gb|LZJ|NlEXHTHn@R|@VvAb@tC~@b@NTHh@TB?TJNHZNTL`@T`@Vr@f@d@^`E~C"},"start_location":{"lat":19.0923682,"lng":72.9255933},"travel_mode":"DRIVING"},{"distance":{"text":"0.1 km","value":132},"duration":{"text":"1 min","value":18},"end_location":{"lat":19.0842303,"lng":72.92085449999999},"html_instructions":"Take the exit on the <b>right<\/b> toward <b>Link Rd<\/b>","maneuver":"ramp-right","polyline":{"points":"cpnsBepa|LBV@@@@rBlBDDBDDF@FFT"},"start_location":{"lat":19.0849757,"lng":72.9217895},"travel_mode":"DRIVING"},{"distance":{"text":"0.3 km","value":275},"duration":{"text":"1 min","value":47},"end_location":{"lat":19.0862782,"lng":72.9194201},"html_i
01-05 17:01:09.107 3736-3820/in.test D/xxx: routes: {"bounds":{"northeast":{"lat":19.1885561,"lng":72.9686183},"southwest":{"lat":19.0842303,"lng":72.9075409}},"copyrights":"Map data ©2016 Google","legs":[{"distance":{"text":"15.8 km","value":15818},"duration":{"text":"26 mins","value":1562},"end_address":"Ghatkopar West, Mumbai, Maharashtra, India","end_location":{"lat":19.0908134,"lng":72.9076817},"start_address":"MP Chowk, Thane West, Thane, Maharashtra 400080, India","start_location":{"lat":19.1855772,"lng":72.9556247},"steps":[{"distance":{"text":"27 m","value":27},"duration":{"text":"1 min","value":6},"end_location":{"lat":19.185599,"lng":72.9558468},"html_instructions":"Head <b>northeast<\/b> on <b>MP Chowk<\/b> toward <b>SG Barve Rd<\/b>","polyline":{"points":"{dbtBsch|L?AA?AA?AA??AAAAA?A?A?AAA?A?A?A?A?A?A@A?A@A?A@A?A@A"},"start_location":{"lat":19.1855772,"lng":72.9556247},"travel_mode":"DRIVING"},{"distance":{"text":"0.9 km","value":870},"duration":{"text":"3 mins","value":165},"end_location":{"lat":19.1883648,"lng":72.963413},"html_instructions":"Exit the roundabout onto <b>Lal Bahadur Shastri Marg<\/b><div style=\"font-size:0.9em\">Pass by Wagle Estate Post Office (on the left)<\/div>","polyline":{"points":"_ebtBaeh|LWoAOcAEe@A_AA{AMcBEQC]COOqAk@sDcAaE_@_Ac@}@[o@o@aAk@w@k@w@e@{@s@{AWm@"},"start_location":{"lat":19.185599,"lng":72.9558468},"travel_mode":"DRIVING"},{"distance":{"text":"2.4 km","value":2448},"duration":{"text":"5 mins","value":316},"end_location":{"lat":19.16823,"lng":72.96618509999999},"html_instructions":"Turn <b>right<\/b> to merge onto <b>NH 3<\/b><div style=\"font-size:0.9em\">Partial toll road<\/div>","polyline":{"points":"gvbtBiti|LQYIOCEGKXEZGp@QvM}CnAWLCNCL?X?jFsAp@QlGaBt@Qh@Of@Mz@WXIRI`@MNGRKrB_AxCqAbCaAz@]^Mb@Mr@Ob@IbDg@v@O|B]XEvAW~@OLAPCN?Z?r@@tG^r@Df@F`@HzDt@lAZl@RrAr@bAn@vC`BtD~B"},"start_location":{"lat":19.1883648,"lng":72.963413},"travel_mode":"DRIVING"},{"distance":{"text":"5.6 km","value":5599},"duration":{"text":"5 mins","value":320},"end_location":{"lat":19.1249579,"lng":72.9390226},"html_instructions":"Keep <b>right<\/b> to stay on <b>NH 3<\/b><div style=\"font-size:0.9em\">Partial toll road<\/div>","maneuver":"keep-right","polyline":{"points":"mx~sBuej|LnEnCnElCXNXNtFhDtFhDnc@jW|AbAtL|GZPTN@@@?B@DD@?DB`@X@?rN|I|BtAb@T~X~NzNtHd_@vRhHtDNJh@ZrCzAh@XxAt@lAn@zo@l\\p@ZdCjA~Bz@fGjB"},"start_location":{"lat":19.16823,"lng":72.96618509999999},"travel_mode":"DRIVING"},{"distance":{"text":"1.5 km","value":1518},"duration":{"text":"2 mins","value":95},"end_location":{"lat":19.1122651,"lng":72.93371189999999},"html_instructions":"Keep <b>left<\/b> to stay on <b>NH 3<\/b>","maneuver":"keep-left","polyline":{"points":"_jvsB{{d|LtCt@v@VxAj@jKjDj@Pt`@zLrKfD~HhC"},"start_location":{"lat":19.1249579,"lng":72.9390226},"travel_mode":"DRIVING"},{"distance":{"text":"2.4 km","value":2371},"duration":{"text":"2 mins","value":139},"end_location":{"lat":19.0923682,"lng":72.9255933},"html_instructions":"Keep <b>right<\/b> to stay on <b>NH 3<\/b>","maneuver":"keep-right","polyline":{"points":"uzssBuzc|LrQlFd@Nd@N|XrInBn@zBp@vQpF`F|AjVpH~PfFzAh@"},"start_location":{"lat":19.1122651,"lng":72.93371189999999},"travel_mode":"DRIVING"},{"distance":{"text":"0.9 km","value":921},"duration":{"text":"1 min","value":54},"end_location":{"lat":19.0849757,"lng":72.9217895},"html_instructions":"Continue straight to stay on <b>NH 3<\/b>","maneuver":"straight","polyline":{"points":"i~osB}gb|LZJ|NlEXHTHn@R|@VvAb@tC~@b@NTHh@TB?TJNHZNTL`@T`@Vr@f@d@^`E~C"},"start_location":{"lat":19.0923682,"lng":72.9255933},"travel_mode":"DRIVING"},{"distance":{"text":"0.1 km","value":132},"duration":{"text":"1 min","value":18},"end_location":{"lat":19.0842303,"lng":72.92085449999999},"html_instructions":"Take the exit on the <b>right<\/b> toward <b>Link Rd<\/b>","maneuver":"ramp-right","polyline":{"points":"cpnsBepa|LBV@@@@rBlBDDBDDF@FFT"},"start_location":{"lat":19.0849757,"lng":72.9217895},"travel_mode":"DRIVING"},{"distance":{"text":"0.3 km","value":275},"duration":{"text":"1 min","value":47},"end_location":{"lat":19.0862782,"lng":72.9194201},"html_i
01-05 17:01:09.107 3736-3820/in.test D/xxx: legs: [{"distance":{"text":"15.8 km","value":15818},"duration":{"text":"26 mins","value":1562},"end_address":"Ghatkopar West, Mumbai, Maharashtra, India","end_location":{"lat":19.0908134,"lng":72.9076817},"start_address":"MP Chowk, Thane West, Thane, Maharashtra 400080, India","start_location":{"lat":19.1855772,"lng":72.9556247},"steps":[{"distance":{"text":"27 m","value":27},"duration":{"text":"1 min","value":6},"end_location":{"lat":19.185599,"lng":72.9558468},"html_instructions":"Head <b>northeast<\/b> on <b>MP Chowk<\/b> toward <b>SG Barve Rd<\/b>","polyline":{"points":"{dbtBsch|L?AA?AA?AA??AAAAA?A?A?AAA?A?A?A?A?A?A@A?A@A?A@A?A@A"},"start_location":{"lat":19.1855772,"lng":72.9556247},"travel_mode":"DRIVING"},{"distance":{"text":"0.9 km","value":870},"duration":{"text":"3 mins","value":165},"end_location":{"lat":19.1883648,"lng":72.963413},"html_instructions":"Exit the roundabout onto <b>Lal Bahadur Shastri Marg<\/b><div style=\"font-size:0.9em\">Pass by Wagle Estate Post Office (on the left)<\/div>","polyline":{"points":"_ebtBaeh|LWoAOcAEe@A_AA{AMcBEQC]COOqAk@sDcAaE_@_Ac@}@[o@o@aAk@w@k@w@e@{@s@{AWm@"},"start_location":{"lat":19.185599,"lng":72.9558468},"travel_mode":"DRIVING"},{"distance":{"text":"2.4 km","value":2448},"duration":{"text":"5 mins","value":316},"end_location":{"lat":19.16823,"lng":72.96618509999999},"html_instructions":"Turn <b>right<\/b> to merge onto <b>NH 3<\/b><div style=\"font-size:0.9em\">Partial toll road<\/div>","polyline":{"points":"gvbtBiti|LQYIOCEGKXEZGp@QvM}CnAWLCNCL?X?jFsAp@QlGaBt@Qh@Of@Mz@WXIRI`@MNGRKrB_AxCqAbCaAz@]^Mb@Mr@Ob@IbDg@v@O|B]XEvAW~@OLAPCN?Z?r@@tG^r@Df@F`@HzDt@lAZl@RrAr@bAn@vC`BtD~B"},"start_location":{"lat":19.1883648,"lng":72.963413},"travel_mode":"DRIVING"},{"distance":{"text":"5.6 km","value":5599},"duration":{"text":"5 mins","value":320},"end_location":{"lat":19.1249579,"lng":72.9390226},"html_instructions":"Keep <b>right<\/b> to stay on <b>NH 3<\/b><div style=\"font-size:0.9em\">Partial toll road<\/div>","maneuver":"keep-right","polyline":{"points":"mx~sBuej|LnEnCnElCXNXNtFhDtFhDnc@jW|AbAtL|GZPTN@@@?B@DD@?DB`@X@?rN|I|BtAb@T~X~NzNtHd_@vRhHtDNJh@ZrCzAh@XxAt@lAn@zo@l\\p@ZdCjA~Bz@fGjB"},"start_location":{"lat":19.16823,"lng":72.96618509999999},"travel_mode":"DRIVING"},{"distance":{"text":"1.5 km","value":1518},"duration":{"text":"2 mins","value":95},"end_location":{"lat":19.1122651,"lng":72.93371189999999},"html_instructions":"Keep <b>left<\/b> to stay on <b>NH 3<\/b>","maneuver":"keep-left","polyline":{"points":"_jvsB{{d|LtCt@v@VxAj@jKjDj@Pt`@zLrKfD~HhC"},"start_location":{"lat":19.1249579,"lng":72.9390226},"travel_mode":"DRIVING"},{"distance":{"text":"2.4 km","value":2371},"duration":{"text":"2 mins","value":139},"end_location":{"lat":19.0923682,"lng":72.9255933},"html_instructions":"Keep <b>right<\/b> to stay on <b>NH 3<\/b>","maneuver":"keep-right","polyline":{"points":"uzssBuzc|LrQlFd@Nd@N|XrInBn@zBp@vQpF`F|AjVpH~PfFzAh@"},"start_location":{"lat":19.1122651,"lng":72.93371189999999},"travel_mode":"DRIVING"},{"distance":{"text":"0.9 km","value":921},"duration":{"text":"1 min","value":54},"end_location":{"lat":19.0849757,"lng":72.9217895},"html_instructions":"Continue straight to stay on <b>NH 3<\/b>","maneuver":"straight","polyline":{"points":"i~osB}gb|LZJ|NlEXHTHn@R|@VvAb@tC~@b@NTHh@TB?TJNHZNTL`@T`@Vr@f@d@^`E~C"},"start_location":{"lat":19.0923682,"lng":72.9255933},"travel_mode":"DRIVING"},{"distance":{"text":"0.1 km","value":132},"duration":{"text":"1 min","value":18},"end_location":{"lat":19.0842303,"lng":72.92085449999999},"html_instructions":"Take the exit on the <b>right<\/b> toward <b>Link Rd<\/b>","maneuver":"ramp-right","polyline":{"points":"cpnsBepa|LBV@@@@rBlBDDBDDF@FFT"},"start_location":{"lat":19.0849757,"lng":72.9217895},"travel_mode":"DRIVING"},{"distance":{"text":"0.3 km","value":275},"duration":{"text":"1 min","value":47},"end_location":{"lat":19.0862782,"lng":72.9194201},"html_instructions":"Continue onto <b>Link Rd<\/b><div style=\"font-size:0.9em\">Pass by A 3 (on the left)<\/div>","polyline":{"points":"mknsBija|LIRoDtB{BpAcB`A"
01-05 17:01:09.117 3736-3820/in.test D/JSON: steps: {"distance":{"text":"15.8 km","value":15818},"duration":{"text":"26 mins","value":1562},"end_address":"Ghatkopar West, Mumbai, Maharashtra, India","end_location":{"lat":19.0908134,"lng":72.9076817},"start_address":"MP Chowk, Thane West, Thane, Maharashtra 400080, India","start_location":{"lat":19.1855772,"lng":72.9556247},"steps":[{"distance":{"text":"27 m","value":27},"duration":{"text":"1 min","value":6},"end_location":{"lat":19.185599,"lng":72.9558468},"html_instructions":"Head <b>northeast<\/b> on <b>MP Chowk<\/b> toward <b>SG Barve Rd<\/b>","polyline":{"points":"{dbtBsch|L?AA?AA?AA??AAAAA?A?A?AAA?A?A?A?A?A?A@A?A@A?A@A?A@A"},"start_location":{"lat":19.1855772,"lng":72.9556247},"travel_mode":"DRIVING"},{"distance":{"text":"0.9 km","value":870},"duration":{"text":"3 mins","value":165},"end_location":{"lat":19.1883648,"lng":72.963413},"html_instructions":"Exit the roundabout onto <b>Lal Bahadur Shastri Marg<\/b><div style=\"font-size:0.9em\">Pass by Wagle Estate Post Office (on the left)<\/div>","polyline":{"points":"_ebtBaeh|LWoAOcAEe@A_AA{AMcBEQC]COOqAk@sDcAaE_@_Ac@}@[o@o@aAk@w@k@w@e@{@s@{AWm@"},"start_location":{"lat":19.185599,"lng":72.9558468},"travel_mode":"DRIVING"},{"distance":{"text":"2.4 km","value":2448},"duration":{"text":"5 mins","value":316},"end_location":{"lat":19.16823,"lng":72.96618509999999},"html_instructions":"Turn <b>right<\/b> to merge onto <b>NH 3<\/b><div style=\"font-size:0.9em\">Partial toll road<\/div>","polyline":{"points":"gvbtBiti|LQYIOCEGKXEZGp@QvM}CnAWLCNCL?X?jFsAp@QlGaBt@Qh@Of@Mz@WXIRI`@MNGRKrB_AxCqAbCaAz@]^Mb@Mr@Ob@IbDg@v@O|B]XEvAW~@OLAPCN?Z?r@@tG^r@Df@F`@HzDt@lAZl@RrAr@bAn@vC`BtD~B"},"start_location":{"lat":19.1883648,"lng":72.963413},"travel_mode":"DRIVING"},{"distance":{"text":"5.6 km","value":5599},"duration":{"text":"5 mins","value":320},"end_location":{"lat":19.1249579,"lng":72.9390226},"html_instructions":"Keep <b>right<\/b> to stay on <b>NH 3<\/b><div style=\"font-size:0.9em\">Partial toll road<\/div>","maneuver":"keep-right","polyline":{"points":"mx~sBuej|LnEnCnElCXNXNtFhDtFhDnc@jW|AbAtL|GZPTN@@@?B@DD@?DB`@X@?rN|I|BtAb@T~X~NzNtHd_@vRhHtDNJh@ZrCzAh@XxAt@lAn@zo@l\\p@ZdCjA~Bz@fGjB"},"start_location":{"lat":19.16823,"lng":72.96618509999999},"travel_mode":"DRIVING"},{"distance":{"text":"1.5 km","value":1518},"duration":{"text":"2 mins","value":95},"end_location":{"lat":19.1122651,"lng":72.93371189999999},"html_instructions":"Keep <b>left<\/b> to stay on <b>NH 3<\/b>","maneuver":"keep-left","polyline":{"points":"_jvsB{{d|LtCt@v@VxAj@jKjDj@Pt`@zLrKfD~HhC"},"start_location":{"lat":19.1249579,"lng":72.9390226},"travel_mode":"DRIVING"},{"distance":{"text":"2.4 km","value":2371},"duration":{"text":"2 mins","value":139},"end_location":{"lat":19.0923682,"lng":72.9255933},"html_instructions":"Keep <b>right<\/b> to stay on <b>NH 3<\/b>","maneuver":"keep-right","polyline":{"points":"uzssBuzc|LrQlFd@Nd@N|XrInBn@zBp@vQpF`F|AjVpH~PfFzAh@"},"start_location":{"lat":19.1122651,"lng":72.93371189999999},"travel_mode":"DRIVING"},{"distance":{"text":"0.9 km","value":921},"duration":{"text":"1 min","value":54},"end_location":{"lat":19.0849757,"lng":72.9217895},"html_instructions":"Continue straight to stay on <b>NH 3<\/b>","maneuver":"straight","polyline":{"points":"i~osB}gb|LZJ|NlEXHTHn@R|@VvAb@tC~@b@NTHh@TB?TJNHZNTL`@T`@Vr@f@d@^`E~C"},"start_location":{"lat":19.0923682,"lng":72.9255933},"travel_mode":"DRIVING"},{"distance":{"text":"0.1 km","value":132},"duration":{"text":"1 min","value":18},"end_location":{"lat":19.0842303,"lng":72.92085449999999},"html_instructions":"Take the exit on the <b>right<\/b> toward <b>Link Rd<\/b>","maneuver":"ramp-right","polyline":{"points":"cpnsBepa|LBV@@@@rBlBDDBDDF@FFT"},"start_location":{"lat":19.0849757,"lng":72.9217895},"travel_mode":"DRIVING"},{"distance":{"text":"0.3 km","value":275},"duration":{"text":"1 min","value":47},"end_location":{"lat":19.0862782,"lng":72.9194201},"html_instructions":"Continue onto <b>Link Rd<\/b><div style=\"font-size:0.9em\">Pass by A 3 (on the left)<\/div>","polyline":{"points":"mknsBija|LIRoDtB{BpAcB`A
01-05 17:01:09.117 3736-3820/in.test D/xxx: distance: {"text":"15.8 km","value":15818}
01-05 17:01:09.117 3736-3820/in.test D/SEE THE DIST :: 15.8 km15818
感谢KENNY!