javascript - api 中的 Google map 旅行模式

标签 javascript php jquery google-maps google-maps-api-3

在新的谷歌地图中,​​有多种出行模式,如驾驶、骑自行车、步行和公交,但他们还添加了飞行模式。我可以在新的谷歌地图中选择飞行模式,但无法在谷歌地图 v3 api 中获得飞行旅行模式。我想在我的网站上显示两个城市之间的飞行距离,就像谷歌地图在谷歌地图上显示一样。

http://maps.googleapis.com/maps/api/directions/xml?sensor=false&origin=Lahore&destination=Multan&mode=driving

$base_url = 'http://maps.googleapis.com/maps/api/directions/xml?sensor=false';
$xml = simplexml_load_file("$base_url&origin=Lahore&destination=Multan");
echo $distance = (string)$xml->route->leg->distance->text;
echo $duration = (string)$xml->route->leg->duration->text

驾驶、步行和其他模式都可以工作,但飞行不工作。

最佳答案

唤醒和驾驶模式仅适用于 Google map api。飞行模式不可用。

检查这个link

关于javascript - api 中的 Google map 旅行模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19674613/

相关文章:

php - CArrayDataProvider 显示空值

javascript - Jquery Ajax 失败...随机成功

javascript - 滚动条消失了

asp.net - ASP.Net 缓存故障排除 - CacheDuration 属性似乎没有效果

javascript - 如何按回车键发表评论

javascript - 使用 Django 表单通过 AJAX 上传文件

javascript - s3 对象元数据 lambda 函数

javascript - 使可观察变量为空

javascript - Jquery 替换嵌套标签内的文本

php - 为什么这个简单的 PHP 代码不起作用,而 HTML 却可以?