这个问题在这里已有答案:
我试图使用谷歌 Map API方向获得一些运输建议:
但谷歌只给我一个最近的公共汽车/火车 . 有没有什么方法可以获得至少3个关于如何到达定义点的最接近的建议?
我的回答看起来如此:只有一列火车
"start_location" : {
"lat" : 48.12606599999999,
"lng" : 11.663375
},
"transit_details" : {
"arrival_stop" : {
"location" : {
"lat" : 48.149852,
"lng" : 11.461872
},
"name" : "München-Pasing"
},
"arrival_time" : {
"text" : "20:31",
"time_zone" : "Europe/Berlin",
"value" : 1511033460
},
"departure_stop" : {
"location" : {
"lat" : 48.12606599999999,
"lng" : 11.663375
},
"name" : "München-Trudering"
},
"departure_time" : {
"text" : "20:03",
"time_zone" : "Europe/Berlin",
"value" : 1511031780
},
"headsign" : "Geltendorf",
"line" : {
"agencies" : [
{
"name" : "Deutsche Bahn AG",
"url" : "http://www.bahn.de/"
}
],
"short_name" : "S4",
"vehicle" : {
"icon" : "//maps.gstatic.com/mapfiles/transit/iw2/6/rail2.png",
"local_icon" : "//maps.gstatic.com/mapfiles/transit/iw2/6/de-sbahn.png",
"name" : "S-Bahn",
"type" : "COMMUTER_TRAIN"
}
},
"num_stops" : 13
},
"travel_mode" : "TRANSIT"
我也得到了步行指导 . 老实说,我想只乘坐公共汽车|地铁|火车方向;)
如果聪明的人能给我一个线索,我将非常感激:)
1 回答
按the documentation:设置
&alternatives=true
https://maps.googleapis.com/maps/api/directions/json?origin=Hauptbahnhof+M%C3%BCnchen&destination=Pasing,%2081241&mode=transit&transit_mode=train|tram|subway&alternatives=true&key=MY(private)API
为我返回4个结果 .