gpt4 book ai didi

android - 谷歌地图 API : how can I get the departure platforms for public transport?

转载 作者:行者123 更新时间:2023-11-29 00:54:11 26 4
gpt4 key购买 nike

我想在我的 Android 应用中显示公共(public)交通工具的出发站台,例如火车。

数据是可用的,因为使用谷歌地图网站向我显示了火车从哪些平台出发,但我还没有设法从 DirectionsResult 对象中检索到这些数据。

有人知道怎么做吗?

更新:尝试使用 postman 检索数据导致以下对象,如您所见,没有火车步的出发站台数据,而此数据在 google map 网站或应用程序本身中可用。

{
"geocoded_waypoints": [
{
"geocoder_status": "OK",
"place_id": "ChIJeblWZV1vxkcRbk1MYz1wjbg",
"types": [
"bus_station",
"establishment",
"point_of_interest",
"train_station",
"transit_station"
]
},
{
"geocoder_status": "OK",
"place_id": "ChIJIxbYDbcJxkcRQtHfOo0b58o",
"types": [
"bus_station",
"establishment",
"point_of_interest",
"subway_station",
"train_station",
"transit_station"
]
}
],
"routes": [
{
"bounds": {
"northeast": {
"lat": 52.3793179,
"lng": 5.1124581
},
"southwest": {
"lat": 52.0894115,
"lng": 4.8996663
}
},
"copyrights": "Map data ©2019",
"legs": [
{
"arrival_time": {
"text": "10:25am",
"time_zone": "Europe/Amsterdam",
"value": 1560846300
},
"departure_time": {
"text": "9:58am",
"time_zone": "Europe/Amsterdam",
"value": 1560844680
},
"distance": {
"text": "39.5 km",
"value": 39518
},
"duration": {
"text": "27 mins",
"value": 1620
},
"end_address": "Amsterdam Centraal, Stationsplein, 1012 AB Amsterdam, Netherlands",
"end_location": {
"lat": 52.3781611,
"lng": 4.8998801
},
"start_address": "Utrecht Central Station, Stationshal 12 12, 3511 CE Utrecht, Netherlands",
"start_location": {
"lat": 52.0894115,
"lng": 5.1124581
},
"steps": [
{
"distance": {
"text": "1 m",
"value": 0
},
"duration": {
"text": "1 min",
"value": 0
},
"end_location": {
"lat": 52.0894115,
"lng": 5.1124581
},
"html_instructions": "Walk to Utrecht Central Station",
"polyline": {
"points": "yu||H{oe^"
},
"start_location": {
"lat": 52.0894115,
"lng": 5.1124581
},
"steps": [
{
"distance": {
"text": "1 m",
"value": 0
},
"duration": {
"text": "1 min",
"value": 0
},
"end_location": {
"lat": 52.0894115,
"lng": 5.1124581
},
"polyline": {
"points": "yu||H{oe^"
},
"start_location": {
"lat": 52.0894115,
"lng": 5.1124581
},
"travel_mode": "WALKING"
}
],
"travel_mode": "WALKING"
},
{
"distance": {
"text": "39.5 km",
"value": 39518
},
"duration": {
"text": "27 mins",
"value": 1620
},
"end_location": {
"lat": 52.3792931,
"lng": 4.8996663
},
"html_instructions": "Train towards Alkmaar",
"polyline": {
"points": "ww||Hu{d^u@eDA@qb@td@eJz^ac@ry@ijEr}IouAltCeWlo@}PhYyQvQkQ`KmRdFo[|Bi^qA_oJ}dBmOaBiVHeZhG}VnNubEhkDusB~eBwuAhmA_fA|bAk\\t]waAx{@cWnOmT`Ii@Ru[lRaGXyF}BqGyKiTadA_L}MuYc@{]kMgJbBsGpH{Nhs@uGfw@O~i@cNvk@DB"
},
"start_location": {
"lat": 52.0897216,
"lng": 5.1092273
},
"transit_details": {
"arrival_stop": {
"location": {
"lat": 52.3792931,
"lng": 4.8996663
},
"name": "Amsterdam Centraal"
},
"arrival_time": {
"text": "10:25am",
"time_zone": "Europe/Amsterdam",
"value": 1560846300
},
"departure_stop": {
"location": {
"lat": 52.0897216,
"lng": 5.1092273
},
"name": "Utrecht Central Station"
},
"departure_time": {
"text": "9:58am",
"time_zone": "Europe/Amsterdam",
"value": 1560844680
},
"headsign": "Alkmaar",
"line": {
"agencies": [
{
"name": "NS",
"phone": "011 31 30 751 5155",
"url": "http://www.ns.nl/"
}
],
"name": "Alkmaar <-> Maastricht IC800",
"short_name": "Intercity",
"vehicle": {
"icon": "//maps.gstatic.com/mapfiles/transit/iw2/6/rail2.png",
"name": "Train",
"type": "HEAVY_RAIL"
}
},
"num_stops": 2,
"trip_short_name": "828"
},
"travel_mode": "TRANSIT"
},
{
"distance": {
"text": "1 m",
"value": 0
},
"duration": {
"text": "1 min",
"value": 0
},
"end_location": {
"lat": 52.3781611,
"lng": 4.8998801
},
"html_instructions": "Walk to Amsterdam Centraal, Stationsplein, 1012 AB Amsterdam, Netherlands",
"polyline": {
"points": "obu~Hg_|\\"
},
"start_location": {
"lat": 52.3781611,
"lng": 4.8998801
},
"steps": [
{
"distance": {
"text": "1 m",
"value": 0
},
"duration": {
"text": "1 min",
"value": 0
},
"end_location": {
"lat": 52.3781611,
"lng": 4.8998801
},
"polyline": {
"points": "obu~Hg_|\\"
},
"start_location": {
"lat": 52.3781611,
"lng": 4.8998801
},
"travel_mode": "WALKING"
}
],
"travel_mode": "WALKING"
}
],
"traffic_speed_entry": [],
"via_waypoint": []
}
],
"overview_polyline": {
"points": "yu||H{oe^}@dSu@eDsb@vd@eJz^ac@ry@y`H`sNeWlo@}PhYyQvQkQ`KmRdFo[|Bi^qA_oJ}dBmOaBiVHeZhG}VnNubEhkDusB~eBwuAhmA_fA|bAk\\t]waAx{@cWnOmT`Ii@Ru[lRaGXyF}BqGyKiTadA_L}MuYc@{]kMgJbBsGpH{Nhs@uGfw@O~i@cNvk@DB`Fi@"
},
"summary": "",
"warnings": [
"Walking directions are in beta. Use caution – This route may be missing sidewalks or pedestrian paths."
],
"waypoint_order": []
}
],
"status": "OK"

最佳答案

很遗憾,目前无法通过 Directions API 获得此信息。 Google 问题跟踪器中有一个添加 2016 年创建的登机平台信息的功能请求:

https://issuetracker.google.com/issues/35829155

Google 似乎没有为这项任务设置高优先级。请随意在 Google 问题跟踪器中为功能请求加注星标以添加您的投票。希望有一天 Google 会实现它。

关于android - 谷歌地图 API : how can I get the departure platforms for public transport?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56450943/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com