README.md

Overview

This package can be used to connect transportation data from TDX (Transport Data eXchange) in a neat and efficient way. TDX platform is supported by Ministry of Transportation and Communications (MOTC) in Taiwan, which provides lots of API for the members download the transportation data. Before using the function provided in this package, the authentication key is a must, which can be applied from TDX platform. After being a member of TDX, you will soon get the Client Id and Client Secret, please check out in the API key Dashboard.

Installation

Please install the package from Github (ChiaJung-Yeh/NYCU_TDX). If you are Python user, please refer to here for Python package via PyPi.

install.packages("devtools")
devtools::install_github("ChiaJung-Yeh/NYCU_TDX")
library(TDX)

Usage

All functions provided in this package are summarized in the table below.

資料 資料細目 資料型態 函式 軌道 軌道站點 點 `Rail_Station()` 軌道路線站點 `Rail_StationOfLine()` 軌道站點出口 `Rail_StationExit()` 軌道路線線型 線 `Rail_Shape()` 軌道班表 文字 `Rail_TimeTable()` 軌道票價 `Rail_ODFare()` 軌道站間旅行時間 `Rail_TravelTime()` 公車 公車站點 點 `Bus_StopOfRoute()` 公車路線 文字 `Bus_Route()` 公車路線線型 線 `Bus_Shape()` 公車班表 文字 `Bus_Schedule()` 公車站間旅行時間 `Bus_TravelTime()` 公車票價 `Bus_RouteFare()` 公車車輛 `Bus_Vehicle()` 公車動態 點 `Bus_RealTime()` 自行車 公共自行車站點 `Bike_Station()` 自行車路網 線 `Bike_Shape()` 公共自行車站點歷史動態 文字 `Bike_Remain_His()` 臺北市公共自行車租借紀錄 `Bike_OD_His()` 航空與航運 航空班表 `Air_Schedule()` 港口點位 點 `Ship_Port()` 航運航線 文字 `Ship_Route()` 航線靠港順序 `Ship_StopOfRoute()` 高速公路 高快速公路線型 線 `Freeway_Shape()` 高速公路 etag 與 VD 文字 `Freeway_History()` 停車場 停車場點位資訊 點 `Car_Park()` 觀光點位 景點、餐廳、旅館點位 `Tourism()` 道路路網 道路路網線型 線 `Road_Network()` 地理編碼 地理編碼服務 點 `Geocoding()` 人口 人口(含各年齡層與性別資料) 文字 `Population()` 所得 所得(各村里) `Income()` 行政區 行政區疆域 面 `District_Shape()` GTFS 公共運輸標準格式 文字 `gtfs()`

Data retrieving process requires an access token to obtain the data from TDX platform. Most function in this package should use function get_token() in advance to obtain the token by entering your Client ID and Client Secret first. Note that the access token will expire in 1 day.

Take retrieving MRT stations of Taipei Metro System for example. The code is shown below. Here the argument CLIENT_ID and CLIEN_SECRET is the authentication key applied from TDX.

# get the access token first
access_token=get_token("CLIENT_ID", "CLIEN_SECRET")

# retrieve Taipei MRT station
TRTC_station=Rail_Station(access_token, "TRTC")

# historical data
# TRTC_station=Rail_Station(access_token, "TRTC", dates="2023-01-01")

head(TRTC_station)

The result is shown as followings.

## #---TRTC Station Downloaded---#

##   StationUID StationID StationName                       StationAddress
## 1  TRTC-BL01      BL01        頂埔 236040新北市土城區中央路4段51之6號B3
## 2  TRTC-BL02      BL02        永寧   236036新北市土城區中央路3段105號B1
## 3  TRTC-BL03      BL03        土城   236017新北市土城區金城路1段105號B1
## 4  TRTC-BL04      BL04        海山       236023新北市土城區海山路39號B2
## 5  TRTC-BL05      BL05    亞東醫院  220056新北市板橋區南雅南路2段17號B1
## 6  TRTC-BL06      BL06        府中 220052新北市板橋區縣民大道1段193號B1
##   BikeAllowOnHoliday LocationCity LocationCityCode LocationTown
## 1               TRUE       新北市              NWT       土城區
## 2               TRUE       新北市              NWT       土城區
## 3               TRUE       新北市              NWT       土城區
## 4               TRUE       新北市              NWT       土城區
## 5               TRUE       新北市              NWT       板橋區
## 6               TRUE       新北市              NWT       板橋區
##   LocationTownCode PositionLon PositionLat
## 1         65000130    121.4187    24.95935
## 2         65000130    121.4361    24.96682
## 3         65000130    121.4443    24.97313
## 4         65000130    121.4488    24.98545
## 5         65000010    121.4525    24.99828
## 6         65000010    121.4593    25.00847

Usages of other functions can be found in the TDX Guide website.

Support

This package takes advantage of API service provided by TDX, MOTC.

Contact

For questions, bugs, and other discussion, please feel free to contact the package maintainer, Chia Jung, Yeh. Email: chia-jung.yeh@sydney.edu.au



ChiaJung-Yeh/NYCU_TDX documentation built on Aug. 28, 2024, 10:43 p.m.