我正在尝试查找通过googleMaps js API在公交路线上停靠的站点的名称/坐标 我在travelMode公交中使用了DirectionsService函数,以下是示例输出:
{
"arrival_stop": {},
"arrival_time": {},
"departure_stop": {},
"departure_time": {},
"headsign": "Green Westbound to Bankhead Station",
"line": {},
"num_stops": 1
}
当公交路线从a到b并在c处停靠时,directionsService会告诉我停靠点的数量(num_stops),但不告诉他们其名称或坐标。在本机iOS App中可以。 Web API尚不支持此功能,还是我错过了某些东西?
是否还有其他人正在与支持该功能的其他路由服务合作?
答案 0 :(得分:0)
原来here API可以提供以下信息:
curl \
-X GET \
-H 'Content-Type: *' \
--get 'https://transit.api.here.com/v3/route.json' \
--data-urlencode 'dep=52.521504,13.41126' \
--data-urlencode 'arr=52.515829,13.45395' \
--data-urlencode 'time=2018-11-19T07:30:00' \
--data-urlencode 'app_id=devportal-demo-20180625' \
--data-urlencode 'app_code=9v2BkviRwi9Ot26kp2IysQ' \
--data-urlencode 'routing=tt'
将返回这样的json(摘录)
"Journey": {
"duration": "PT6M",
"Stop": [
{
"dep": "2018-11-19T07:51:00",
"Stn": {
"id": "vbb_900100704",
"name": "S+U Alexanderplatz [U5]",
"x": 13.41311,
"y": 52.521607
}
},
{
"dep": "2018-11-19T07:53:00",
"Stn": {
"id": "vbb_900100017",
"name": "U Schillingstr.",
"x": 13.421893,
"y": 52.520313
}
},
{
"dep": "2018-11-19T07:55:00",
"Stn": {
"id": "vbb_900120006",
"name": "U Strausberger Platz",
"x": 13.432212,
"y": 52.518029
}
}
]
}