Zee*_*bAs 10 android distance geolocation android-location
我需要找到从一个地方到另一个地方的估计开车时间.我有两个地方的纬度和经度,但我不知道该怎么做.是否有任何API.帮助谢谢.
Pra*_*tik 12
是的,您可以获得时间和距离值以及驾驶,步行等模式中的许多方向细节.所有你从谷歌方向api服务得到的
检查我们的链接
http://code.google.com/apis/maps/documentation/directions/
Location location1 = new Location("");
location1.setLatitude(lat);
location1.setLongitude(long);
Location location2 = new Location("");
location2.setLatitude(lat);
location2.setLongitude(long);
float distanceInMeters = location1.distanceTo(location2);
Run Code Online (Sandbox Code Playgroud)
编辑:
//For example spead is 10 meters per minute.
int speedIs10MetersPerMinute = 10;
float estimatedDriveTimeInMinutes = distanceInMeters / speedIs10MetersPerMinute;
Run Code Online (Sandbox Code Playgroud)
如果以上情况不适合您,请同时查看:
| 归档时间: |
|
| 查看次数: |
27449 次 |
| 最近记录: |