Java - 谷歌地图 API - 两个地址之间的距离
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4142665/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java - Google maps API - distance between two addresses
提问by CrazyCoder
Using Google Maps API how to determine the driving distance between two locations ? Platform -Java
使用 Google Maps API 如何确定两个位置之间的行驶距离?平台-Java
采纳答案by RedBlueThing
You will need to use the Google Directions Web Service. You can make an HTTP request, specifying your two locations as parameters, and get back JSON (or XML) describing the directions between the two points.
您将需要使用Google 路线网络服务。您可以发出 HTTP 请求,将您的两个位置指定为参数,然后返回描述两点之间方向的 JSON(或 XML)。
N.B.The Google Maps terms of serviceexplicitly states that using the Google Maps Web Services without putting the results on a Google Map is prohibited.
注意,谷歌地图服务条款明确规定,禁止在未将结果放在谷歌地图上的情况下使用谷歌地图网络服务。
回答by Chris Broadfoot
Use the Directions API: http://code.google.com/apis/maps/documentation/directions/
使用路线 API:http: //code.google.com/apis/maps/documentation/directions/
The default travel mode is for driving.
默认的出行模式是驾驶。
Please read the terms of service: http://code.google.com/apis/maps/terms.html
请阅读服务条款:http: //code.google.com/apis/maps/terms.html
Particularly section 10.12 - which refers to using the results from this API. In short, you must display it in conjunction with a Google map.
特别是第 10.12 节 - 指的是使用此 API 的结果。简而言之,您必须将其与 Google 地图一起显示。
回答by loikkk
I'm new in Java and I had the same issue. That's why I've decided to make a Java library to provide theses information and more like route.
我是 Java 新手,遇到了同样的问题。这就是为什么我决定制作一个 Java 库来提供这些信息,更像是 route。
Here's the link. Tell me what do you think about it and if it was useful for your case.
这是链接。告诉我您对此有何看法以及它是否对您的案例有用。