The Google Maps Directions API
主要的網址:
https://maps.googleapis.com/maps/api/directions/output?parameters
範例網址:
https://maps.googleapis.com/maps/api/directions/json?mode=transit&language=zh-TW&alternatives=true&departure_time=now&origin=台中火車站&destination=台北火車站
Output
- json
- xml
Parameters
必要參數
- origin (起點)
- 地址
- 位置ID 需要前置
place_id:
- 文字經緯度
- destination (迄點)
同 origin - key (API KEY,雖然是必要參數,但只要沒使用到特定參數的話,就可以不給)
選擇性參數
- mode (交通方式)
driving
(default) indicates standard driving directions using the road network.walking
bicycling
transit
- waypoints (必須經過特定地點)
array - alternatives (提供替代路線)
boolean - avoid (避免特定區域)
tolls
highways
ferries
indoor - language (語言)
zh-TW Chinese (Traditional) - units
- region
- departure_time (搭乘時間)
- arrival_time (抵達時間)
- transit_mode (大眾運輸模式,
transit_mode=train|tram|subway
)
bus
subway
train
tram
rail - transit_routing_preference (大眾運輸設定)
less_walking (少走點)
fewer_transfers (少轉乘)
URL 限制在2000 char
Google Maps Android API utility library
Google Maps Android API Utility Library
Encoded Polyline Algorithm Format