api中的Google Map旅行模式

时间:2013-10-30 05:36:11

标签: 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

驾驶,步行和其他模式正在运行,但飞行不起作用。

1 个答案:

答案 0 :(得分:0)

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

选中此link