1. Working with LTA Datamall’s APIs

API Key

All API calls to the LTA Datamall, and thus all core functions in this package, require an API key. In layman terms, the API key is like a username/password with which you access the API. It helps the API developers to identify who is accessing the API, and to restrict access if they wish. As such, it is really important that you keep your API key private (don’t share it with anyone else or post it online!).

As such, in order to use this package, please sign up for an API key here. The process is quick, easy and straightforward.

You will notice that in the examples provided below, my API key is saved as Sys.getenv('LTA_DATAMALL_KEY'). This is one way to keep the API key private, and you can find out more about how to do this here.

API Documentation

Finally, please read this vignette alongside LTA’s documentation for their APIs, which you can find here. This will help you understand the outputs you are receiving from the APIs you are calling. By default, all functions in ltaer return all the data that the API returns, so you do not have to worry about missing out on any data from using this package.

Installing this package

This package is not available on CRAN (this is where you typically download R packages from when you run install.package('pkgname')). Due to a lack of time on my end, it is unlikely that ltaer will ever be made available on CRAN either. The only way you can get ltaer working on your RStudio is to use the following code:

install.packages('devtools')
devtools::install_github('shaunkhoo/ltaer')

This will download the ltaer package directly from my Github repository and into your RStudio. Thereafter, you simply load the package in the same way as any other package, by entering library(ltaer).

2. Bus Arrival Timings

Probably the most well-utilised API of the lot, the Bus Arrival API enables users to retrieve bus arrival timings for any bus stop in Singapore. There are some specific things to mention here about the API (you can also find this in the documentation):

  • For each bus service serving that bus stop, the bus arrival details (timing, coordinates, type, load etc) are reported for the next three buses. If there are only one or two ‘next buses’ left (usually around 11pm-1am), then the bus arrival details for those ‘next bus’ slots will be NA.
  • All bus services where the last bus has passed the chosen bus stop will no longer show up on the Bus Arrivals API for that bus stop. This usually happens around 12am-1am, except for NightRider services which end at 3am-4am.
  • If there are no bus services at all, then the API will return an empty JSON file.

There are some important differences between this package’s wrapper function, getBusTimings, and the API itself:

  • getBusTimings automatically calls all the API for all bus services for a given bus stop code. In the API, you can specify which service you want to check for each bus stop. I’ve dropped this option as R users can simply filter for the bus service number.
  • getBusTimings conveniently allows users to call the API for multiple bus stops. This is done by simply repeating the API call for all the bus stops specified. You simply need to pass in a vector of bus codes and getBusTimings will return you a dataframe containing all the data returned. The first column, BusStopCode, will help you distinguish between the various bus stops.
  • getBusTimings requires you to pass the bus stop code as a character string, and not as a numeric value. This is to avoid potential issues when the bus stop code has leading zeros, which R truncates automatically for numeric values.

I provide an example below of the output you can expect from getBusTimings.

library(ltaer)

bus_arrivals <- getBusTimings(c('07531', '09047', '11239'), api_key = Sys.getenv('LTA_DATAMALL_KEY'))

# Note that I've transposed the dataframe (the columns are the rows and vice versa) for clarity of presentation.
knitr::kable(t(bus_arrivals[1:3,]))
1 2 3
BusStopCode 07531 07531 07531
ServiceNo 170 23 48
Operator SBST SBST SBST
NextBus_OriginCode 01109 75009 84431
NextBus_DestinationCode 46239 75009 11379
NextBus_EstimatedArrival 2018-12-13T14:22:01+08:00 2018-12-13T14:16:20+08:00 2018-12-13T14:15:52+08:00
NextBus_Latitude 0 1.3037153333333333 1.302443
NextBus_Longitude 0 103.85254466666666 103.85419416666667
NextBus_VisitNumber 1 1 1
NextBus_Load SEA SEA SEA
NextBus_Feature WAB WAB WAB
NextBus_Type SD DD SD
NextBus2_OriginCode 01109 75009 84431
NextBus2_DestinationCode 46239 75009 11379
NextBus2_EstimatedArrival 2018-12-13T14:37:01+08:00 2018-12-13T14:28:45+08:00 2018-12-13T14:47:42+08:00
NextBus2_Latitude 0 1.3243753333333332 1.313636
NextBus2_Longitude 0 103.86776566666667 103.93390766666667
NextBus2_VisitNumber 1 1 1
NextBus2_Load SEA SEA SEA
NextBus2_Feature WAB WAB WAB
NextBus2_Type SD DD SD
NextBus3_OriginCode 01109 75009 NA
NextBus3_DestinationCode 46239 75009 NA
NextBus3_EstimatedArrival 2018-12-13T14:52:01+08:00 2018-12-13T14:40:04+08:00 NA
NextBus3_Latitude 0 1.335121 NA
NextBus3_Longitude 0 103.91848533333334 NA
NextBus3_VisitNumber 1 1 NA
NextBus3_Load SEA SEA NA
NextBus3_Feature WAB WAB NA
NextBus3_Type SD DD NA

3. Bus Services

This API returns service information for all buses currently in operation in Singapore. The data available here is similar to those you find on the information boards at each bus stop.

getBusServices is the wrapper function for this API, and takes in the API key as its only argument.

bus_services <- getBusServices(Sys.getenv('LTA_DATAMALL_KEY'))

# Note that I've transposed the dataframe (the columns are the rows and vice versa) for clarity of presentation.
knitr::kable(t(bus_services[1:9,]))
1 2 3 4 5 6 7 8 9
ServiceNo 118 118 118A 118B 119 12 12 12e 12e
Operator GAS GAS GAS GAS GAS GAS GAS GAS GAS
Direction 1 2 1 1 1 1 2 1 2
Category TRUNK TRUNK TRUNK TRUNK TRUNK TRUNK TRUNK EXPRESS EXPRESS
OriginCode 65009 97009 65199 96111 65009 77009 10499 77009 10499
DestinationCode 97009 65009 96119 65191 65009 10499 77009 10499 77009
AM_Peak_Freq 06-08 10 14-16 - 16-08 9 10 20-30 20-30
AM_Offpeak_Freq 08-15 10-12 - - 18-12 09-14 08-15 30 20-30
PM_Peak_Freq 10-12 05-11 - 30 17-12 9-10 08-14 20-30 20-30
PM_Offpeak_Freq 11-15 10-15 - - 15-17 11-13 10-14 20-30 20-30
LoopDesc Hougang St 21

4. Bus Routes

This API returns route information for all services currently in operation in Singapore. The data here is quite useful as they provide each bus stop code and stop sequence for each bus service, so you can plot out the full route for each bus service. While this is already quite useful, it would have been even better if route polylines were provided as well.

getBusRoutes is the wrapper function for this API, and takes in the API key as its only argument.

bus_routes <- getBusRoutes(Sys.getenv('LTA_DATAMALL_KEY'))

# Note that I've transposed the dataframe (the columns are the rows and vice versa) for clarity of presentation.
knitr::kable(t(bus_routes[1:9,]))
1 2 3 4 5 6 7 8 9
ServiceNo 10 10 10 10 10 10 10 10 10
Operator SBST SBST SBST SBST SBST SBST SBST SBST SBST
Direction 1 1 1 1 1 1 1 1 1
StopSequence 1 2 3 4 5 6 7 8 9
BusStopCode 75009 76059 76069 96289 96109 85079 85089 85069 85059
Distance 0 0.6 1.1 2.3 2.7 3.3 3.5 3.8 4.1
WD_FirstBus 0500 0502 0504 0508 0509 0511 0512 0513 0514
WD_LastBus 2300 2302 2304 2308 2310 2312 2313 2314 2315
SAT_FirstBus 0500 0502 0504 0508 0509 0511 0512 0513 0514
SAT_LastBus 2300 2302 2304 2309 2311 2313 2314 2315 2316
SUN_FirstBus 0500 0502 0503 0507 0508 0510 0511 0512 0513
SUN_LastBus 2300 2302 2304 2308 2309 2311 2312 2313 2314

5. Bus Stops

This API returns information for all bus stops currently being serviced by buses in Singapore, such as bus stop codes, coordinates and road names.

getBusStops is the wrapper function for this API, and takes in the API key as its only argument.

bus_stops <- getBusStops(Sys.getenv('LTA_DATAMALL_KEY'))
knitr::kable(bus_stops[1:10,])
BusStopCode RoadName Description Latitude Longitude
00481 Woodlands Rd BT PANJANG TEMP BUS PK 1.383764 103.7583
01012 Victoria St Hotel Grand Pacific 1.296848 103.8525
01013 Victoria St St. Joseph’s Ch 1.297710 103.8532
01019 Victoria St Bras Basah Cplx 1.296990 103.8530
01029 Nth Bridge Rd Cosmic Insurance Bldg 1.296673 103.8544
01039 Nth Bridge Rd Nth Bridge Commercial Cplx 1.298208 103.8555
01059 Victoria St Bugis Stn Exit B 1.300757 103.8561
01109 Queen St Queen St Ter 1.303586 103.8565
01112 Victoria St Opp Bugis Junction 1.300092 103.8552
01113 Victoria St Bugis Stn Exit A 1.301173 103.8561

6. Passenger Volume (Buses)

There are two APIs here that you can call - the first is for passenger volume for each bus stop, and the second is for passenger volume for each origin-destination bus stop pair. Here are the two wrapper functions for the respective APIs:

The wrappers for these two APIs require you to enter a date and your API key, and returns you the link which LTA provides to download the zipped CSV file of the data. Note that the date must be supplied in R’s Date format - you can see this from the first example below. If you do not supply any date into the function, it will revert to the default of 60 days prior to the current date, as indicated in the second example.

getBusPassengerVol(as.Date('01-10-2018', format = '%d-%m-%Y'), Sys.getenv('LTA_DATAMALL_KEY'))
## [1] "https://ltafarecard.s3.amazonaws.com/201810/transport_node_bus_201810.zip?x-amz-security-token=FQoGZXIvYXdzEKj%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDDs9sJmG2R1kOvvTEiKmAy%2FMWgoSlJW14ppRGybRxkSSObGKcJ5CaJSuYqBLDfHRh5CyexuVmEekqF76wyo%2Bi8r28IswUqjOJfcBpHQsxuz6XrSMq64ayrXWmf535hJPNQ%2BQWFGFEBBUvq74v9AGTiubjJeOvIi2kHL1DjdGZST%2FRdkHMjekyMAMVWa3KzCp%2F2iXUK4WHe4lXzvhZflwsj8CGu4Clp%2BkR%2Bm%2Ba8RyVKzXum7cDCmoFw61LPg9porIoWcYZIO6U5lxWdB%2Bhx2jWQA6ngPXXx%2Bk3rQ6af0Zg1HpHpQDv%2B3T1N7%2Bu%2FVV%2BY2zHrR9P3NydG1Igagwcnemjjs2%2FRCJkfFKCG%2FbEoyXnIqOMMeveFdo82TjTOpU6QWc%2BmMya9RWdKjgqX9ZqRMcK9UdqlH2BhE1YZco6UgldvA93r0Cj96Wxh6ynVQkAQdMXsm18UWERPRkjIjP61R%2B1VVC7WX5rSXbklt9R0Do2xGwbs2wNFTAtwqZws9ZVov%2FGB0HdUZV63qu8aRcPbOf2VpLxMdO6LAeuJq3949bsmJbxl878202HPOZbMyuDmmQAarBMwCUKKjxx%2BAF&AWSAccessKeyId=ASIAU6UAMAS4GJEXOG3T&Expires=1544682214&Signature=zKj4%2BwsIPu9R3G%2BazKVGiYvA8%2Bs%3D"
getBusPassengerVol_od(Sys.Date()-60, Sys.getenv('LTA_DATAMALL_KEY'))
## [1] "https://ltafarecard.s3.amazonaws.com/201810/origin_destination_bus_201810.zip?x-amz-security-token=FQoGZXIvYXdzEKj%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDPP44Fpb5XhQWPY44yKmA8GqvArQ9M8RfgajsIukmQJcU22uG7vcaUjIz8mtCnE0UYrJmYP%2FOXTLzVYdhuvP5UOMdQ1EyKYg6sZqKwMe163pOxOXq6E4N0aj1NSooAqg1Zyv%2FccjIxqHbJKkXxVOvOmHCDKtsXTSw6ZxUXKzsOUQlPfKv8WqGw0B9%2F3fI6bhLAs9ON9kx%2BZng4Bic1KkAR%2BGvjYJ6vowxxe97XmSlYrQxsCK7h1oYvwvcfpKobg3EPscgDdDDKHtNGfU7lh4xtD9Poca9bffiR2i%2F5elw2hAzjg%2B9VNShbGGHNNEecO0ikxD935gf2s%2F7%2BgUWDgrKhNK2BpdXuiKDrhmoKAjLfXmuqSy4J4IM%2FA0xXDKYjZ%2BBU38HnfWEcCOj6GE%2BA4GO2OBR0S6fC9dx7As5XOaeitmcSxWKWlSi8cxRWBCyrR8Aa4Y%2F%2FagaKp6FCTsetsskZNaG6SDddRDuDNhYuwwm0AODgTTup1WB0O6yXf73mW9blamdcRjZq9aMyH1nb%2FM1617ACSmUvg0uJ3Su0elRzJCovGr4yYIpgq3q%2BwLB7cybeEEDBXtKLfvx%2BAF&AWSAccessKeyId=ASIAU6UAMAS4CALQQWG2&Expires=1544682214&Signature=p6DO7yPYNBdAejPrpiSJrV18LpE%3D"

7. Passenger Volume (Trains)

Similar to the APIs for buses, these APIs provide the same data but for trains instead. Here are the two wrapper functions for the respective APIs:

getTrainPassengerVol(as.Date('01-10-2018', format = '%d-%m-%Y'), Sys.getenv('LTA_DATAMALL_KEY'))
## [1] "https://ltafarecard.s3.amazonaws.com/201810/transport_node_train_201810.zip?x-amz-security-token=FQoGZXIvYXdzEKj%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDEAmycT6%2FQZMnn0wXyKmAwEKcDlnfVjtaIOtnrVN32ao%2BCrDm0ndL6bYWsjX7EDqta93QxfswTUCORPED1OkwnqEYyptRF%2FWPl11Jim2eCqW%2Fgi9fIE1EPjpj05hwdBLluNermu3BcI6Kl4RaCwZAL29SrOb5sTYwuEU4InrbXK6DxPa1x70pyD5tKOls0KlLTrog53DVHHRQylDwSj0NFbNfjcIkGZ3QwvHhjIHl227g%2BBK9medf0m6BQFU7PzpAtImpaM3Yn7GHif1HxO%2FO8vgEgtHz8GlsBU3eyrOQbtLzjfaAzpIiaXSa7p%2BCxQcEVyi01wAmNDu8SsuTP2BdQuViZatvm5w6VvcApJ%2FlVz6iet19%2BjJE0hEK9tsCKCGhvXdoHp1VqbUFzT9T9W91aLI2Fj9Usa6ZCsL74HvkilLm%2FAJZmwIZcPtRm4SYSlxSvyIeCBD64qlt7NsEPz7o47KZlWV0q3PxipG7pJTXBDnRfGhrNLvkf65Q2xnNyLgEUN4wdSAA5KdCa3bG7AZUrRs5d4vc4nTy2RjK04xy8fwAfT0FsOjhEQ0JTm%2BICHc3YoYtCuIKKjxx%2BAF&AWSAccessKeyId=ASIAU6UAMAS4BJFABNOO&Expires=1544682215&Signature=9o%2F4kZjaPEH4kOit%2Fu%2BK1NjRgsI%3D"
getTrainPassengerVol_od(Sys.Date()-60, Sys.getenv('LTA_DATAMALL_KEY'))
## [1] "https://ltafarecard.s3.amazonaws.com/201810/origin_destination_train_201810.zip?x-amz-security-token=FQoGZXIvYXdzEKj%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDMhRqygMvchMlPj8mCKmA2YjV0x2nmDGyJaQtIEtJQyxNVQK1qVqwUIt4VrgrJk9AN0ihODEVI6XB%2F9X%2BS7nyPius7qZkWd7qm9GTyP64YjeQFZElrmgyQcNJNFus9QBvHup0zAVqDCHzl6I8x4m5C%2BOX8WmSpY0BENa69WksrIHIbEXz0YCNEY57xPirp1Dv7y8A5KILhUROAoO8OGXAhM0ksUiylnsMW6DFShsRnn1i4smvh4ACB60JAACV7hgdX2d%2FZ6J%2BGHMYq8ok5z9%2FIn7L1HkqnOSkimeIVZdZct0vNxdMttIxP4%2BseVcvUhwnXz%2BWBqpHa4u%2F7r3ZC%2B4PiRMzos5FZpL9ciKCCGnD8tOHdeglbS%2FOMDex3Xbun7BwZK%2Bdj3xrwQQqpZgAeKGnaRPIKV5Hy7o7rf9BcvHYtCsuLK4YSdNFeUKTaI%2F1ljuL%2FQCIxGuxZm1M%2FJZPmQ1A3HLQRIqkxfJkqMRRKkDfRht%2BNjZiyxsSoaldSpAF2ByZ2y6e1vHKd3AR2RafZDi%2F6Cx5KqOhzwaZZg4yqFiPjEXN5bV9ufvDaIzvELI1JPoN6pHrtR3KLfvx%2BAF&AWSAccessKeyId=ASIAU6UAMAS4MEDVQUGY&Expires=1544682215&Signature=0uZS%2FtwWjZyqNXpZrmPoxEHIAPE%3D"

8. Taxi Availability

This API returns the coordinates for all available taxis that are available for hire in Singapore (excludes hired and ‘busy’ taxis).

getTaxiAvail is the wrapper function for this API, and takes in the API key as its only argument.

taxi_avail <- getTaxiAvail(Sys.getenv('LTA_DATAMALL_KEY'))
knitr::kable(taxi_avail[1:10,])
Longitude Latitude
103.8214 1.28492
103.8301 1.30292
103.8853 1.29799
103.8430 1.31979
103.9735 1.36243
103.8573 1.30692
103.8947 1.38884
103.8315 1.44209
103.8852 1.32585
103.8585 1.31639

9. Train Service Alerts

This API returns information about train service unavailability during scheduled operating hours - which refers to unexpected train service delays or breakdowns. Unfortunately (or otherwise…) I did not get a chance to test this fully since there were no train alerts whenever I called the API, but it should return all the information in a dataframe format.

getTrainAlerts is the wrapper function for this API, and takes in the API key as its only argument.

getTrainAlerts(Sys.getenv('LTA_DATAMALL_KEY'))
## Successful API call for train service alerts data. Processing...
## Normal train service reported. No service alerts available.

10. Carpark Availability

This API returns the number of available parking lots, as obtained from HDB, LTA, and URA carpark data. This covers almost all carparks in housing estates and quite a few carparks in the CBD area. Calling this API returns the coordinates and description for each carpark as well as the number of available parking lots.

getCarparkAvail is the wrapper function for this API, and takes in the API key as its only argument.

carpark_avail <- getCarparkAvail(Sys.getenv('LTA_DATAMALL_KEY'))
knitr::kable(head(carpark_avail))
CarParkID Area Development Location AvailableLots LotType Agency lat lng
1 Marina Suntec City 1.29375 103.85718 630 C LTA 1.29375 103.8572
2 Marina Marina Square 1.29115 103.85728 929 C LTA 1.29115 103.8573
3 Marina Raffles City 1.29382 103.85319 248 C LTA 1.29382 103.8532
4 Marina The Esplanade 1.29011 103.85561 633 C LTA 1.29011 103.8556
5 Marina Millenia Singapore 1.29251 103.86009 544 C LTA 1.29251 103.8601
6 Marina Singapore Flyer 1.28944 103.86311 107 C LTA 1.28944 103.8631

11. ERP Rates

This API returns information about the Electronic Road Pricing (ERP) rates for all vehicle types across all timings and for all zones. Calling this API returns information about the ERP rate by vehicle type, timing, and zone ID.

getERPRates is the wrapper function for this API, and takes in the API key as its only argument.

erp_rates <- getERPRates(Sys.getenv('LTA_DATAMALL_KEY'))
knitr::kable(head(erp_rates))
VehicleType DayType StartTime EndTime ZoneID ChargeAmount EffectiveDate
Heavy Goods Vehicles/Small Buses Weekdays 08:05 08:55 AY1 1.5 2018-11-17
Heavy Goods Vehicles/Small Buses Weekdays 09:00 22:30 AY1 0 2018-11-17
Very Heavy Goods Vehicles/Big Buses Weekdays 08:05 08:55 AY1 2 2018-11-17
Very Heavy Goods Vehicles/Big Buses Weekdays 09:00 22:30 AY1 0 2018-11-17
Heavy Goods Vehicles/Small Buses Weekdays 08:00 08:05 AY1 0.75 2018-11-17
Heavy Goods Vehicles/Small Buses Weekdays 08:55 09:00 AY1 0.75 2018-11-17

12. Estimated Travel Times

This API returns the estimated travel times for each segment in the expressway - you will usually find this information displayed on the electronic billboards before entering major expressways in SIngapore.

getEstTravelTime is the wrapper function for this API, and takes in the API key as its only argument.

est_travel_time <- getEstTravelTime(Sys.getenv('LTA_DATAMALL_KEY'))
knitr::kable(head(est_travel_time))
Name Direction FarEndPoint StartPoint EndPoint EstTime
AYE 1 TUAS CHECKPOINT AYE/MCE INTERCHANGE TELOK BLANGAH RD 2
AYE 1 TUAS CHECKPOINT TELOK BLANGAH RD LOWER DELTA RD 1
AYE 1 TUAS CHECKPOINT LOWER DELTA RD NORMANTON PARK 4
AYE 1 TUAS CHECKPOINT NORMANTON PARK NORTH BUONA VISTA RD 1
AYE 1 TUAS CHECKPOINT NORTH BUONA VISTA RD CLEMENTI RD 2
AYE 1 TUAS CHECKPOINT CLEMENTI RD WEST COAST RD 1

13. Faulty Traffic Lights

This API returns alerts of traffic lights that are either currently faulty or undergoing scheduled maintenance. Calling the API returns information of the alarm ID, node ID, fault type, time of fault, expected end of maintenance, and message. Note that faulty traffic lights are fairly uncommon so you can expect the API to return nothing occasionally.

getFaultyTrafficLights is the wrapper function for this API, and takes in the API key as its only argument.

faulty_lights <- getFaultyTrafficLights(Sys.getenv('LTA_DATAMALL_KEY'))
## Successful API call for faulty traffic lights alerts. Processing page 1...
## API call successful. No faulty traffic lights alert at the present time.

14. Road Openings

This API returns information on all planned road openings, and provides data on the start and end dates, the department or company in charge of the road opening, and the name of the new road.

getRoadOpenings is the wrapper function for this API, and takes in the API key as its only argument.

road_openings <- getRoadOpenings(Sys.getenv('LTA_DATAMALL_KEY'))
knitr::kable(head(road_openings))
EventID StartDate EndDate SvcDept RoadName Other
RMAPP-201812-0349 2019-01-02 2019-01-22 SP POWERGRID LTD - DISTRIBUTION RENEWAL PROJECTS ADAM ROAD For details, please call 69166987
RMINRM-201812-0383 2018-12-17 2018-12-29 LAND TRANSPORT AUTHORITY ADMIRALTY ROAD
RMAPP-201811-0800 2019-01-08 2019-01-28 SP POWERGRID LTD - DISTRIBUTION RENEWAL PROJECTS ADMIRALTY ROAD EAST For details, please call 69166981
RMAPP-201812-0029 2018-12-17 2018-12-31 STARHUB LTD - TS ADMIRALTY STREET For details, please call 68256436
RMAPP-201812-0130 2018-12-31 2019-01-20 SP POWERGRID LTD - GAS DIVISION ALJUNIED AVENUE 1 For details, please call 69165943
RMAPP-201812-0130 2018-12-31 2019-01-20 SP POWERGRID LTD - GAS DIVISION ALJUNIED AVENUE 2 For details, please call 69165943

15. Road Works

This API returns information on all current or scheduled road works, and returns data on the start and end dates, the department or company in charge of the road opening, and the name of the road where work is being performed.

getRoadWorks is the wrapper function for this API, and takes in the API key as its only argument.

road_openings <- getRoadOpenings(Sys.getenv('LTA_DATAMALL_KEY'))
knitr::kable(head(road_openings))
EventID StartDate EndDate SvcDept RoadName Other
RMAPP-201812-0349 2019-01-02 2019-01-22 SP POWERGRID LTD - DISTRIBUTION RENEWAL PROJECTS ADAM ROAD For details, please call 69166987
RMINRM-201812-0383 2018-12-17 2018-12-29 LAND TRANSPORT AUTHORITY ADMIRALTY ROAD
RMAPP-201811-0800 2019-01-08 2019-01-28 SP POWERGRID LTD - DISTRIBUTION RENEWAL PROJECTS ADMIRALTY ROAD EAST For details, please call 69166981
RMAPP-201812-0029 2018-12-17 2018-12-31 STARHUB LTD - TS ADMIRALTY STREET For details, please call 68256436
RMAPP-201812-0130 2018-12-31 2019-01-20 SP POWERGRID LTD - GAS DIVISION ALJUNIED AVENUE 1 For details, please call 69165943
RMAPP-201812-0130 2018-12-31 2019-01-20 SP POWERGRID LTD - GAS DIVISION ALJUNIED AVENUE 2 For details, please call 69165943

16. Traffic Imges

This API returns links to images of live traffic conditions along the major expressways and Woodlands and Tuas checkpoints, as well as the coordinates of the traffic cameras.

getTrafficImages is the wrapper function for this API, and takes in the API key as its only argument.

traffic_images <- getTrafficImages(Sys.getenv('LTA_DATAMALL_KEY'))
knitr::kable(head(traffic_images))
CameraID Latitude Longitude ImageLink
1001 1.295313 103.8711 https://s3-ap-southeast-1.amazonaws.com/mtpdm/2018-12-13/14-18/1001_1413_20181213141601_57d865.jpg
1002 1.319541 103.8786 https://s3-ap-southeast-1.amazonaws.com/mtpdm/2018-12-13/14-18/1002_1413_20181213141600_f3237a.jpg
1003 1.323957 103.8729 https://s3-ap-southeast-1.amazonaws.com/mtpdm/2018-12-13/14-18/1003_1413_20181213141600_3467a2.jpg
1004 1.319536 103.8751 https://s3-ap-southeast-1.amazonaws.com/mtpdm/2018-12-13/14-18/1004_1413_20181213141600_9f7145.jpg
1005 1.363520 103.9054 https://s3-ap-southeast-1.amazonaws.com/mtpdm/2018-12-13/14-18/1005_1413_20181213141600_fcef8a.jpg
1006 1.357099 103.9020 https://s3-ap-southeast-1.amazonaws.com/mtpdm/2018-12-13/14-18/1006_1413_20181213141600_6b7d8e.jpg

17. Traffic Incidents

This API returns information about current traffic incidents happening on the roads, such as accidents, vehicle breakdowns, traffic diversions etc. The coordinates of the incident as well as a brief message are also returned from the API for each traffic incident.

getTrafficIncidents is the wrapper function for this API, and takes in the API key as its only argument.

traffic_incidents <- getTrafficIncidents(Sys.getenv('LTA_DATAMALL_KEY'))
knitr::kable(head(traffic_incidents))
Type Latitude Longitude Message
Vehicle breakdown 1.348262 103.8587 (13/12)14:13 Vehicle breakdown on CTE (towards AYE) before Braddell Rd/Lor Chuan Exit.
Vehicle breakdown 1.421364 103.7714 (13/12)14:02 Vehicle breakdown on BKE (towards PIE) after SLE Exit.
Roadwork 1.280289 103.8500 (13/12)13:34 Roadworks on Boon Tat Street (towards Boon Tat Link) after Robinson Road. Avoid right lane.
Roadwork 1.359928 103.8441 (13/12)13:29 Roadworks on Bishan Street 22 (towards Bishan Street 25) after Marymount Road. Avoid left lane.
Roadwork 1.378802 103.8746 (13/12)13:28 Roadworks on Ang Mo Kio Avenue 5 (towards Seletar Green Avenue) after Yio Chu Kang Road.
Roadwork 1.377466 103.7304 (13/12)13:27 Roadworks on KJE (towards BKE) at Sungei Tengah Rd Exit.

18. Traffic Speed Bands

This API returns information on current traffic speeds on expressways and major arterial roads, and these speeds are expressed in speed bands.

getTrafficSpeedBands is the wrapper function for this API, and takes in the API key as its only argument.

traffic_speed_bands <- getTrafficSpeedBands(Sys.getenv('LTA_DATAMALL_KEY'))
knitr::kable(head(traffic_speed_bands))
LinkID RoadName RoadCategory SpeedBand MinimumSpeed MaximumSpeed Location
103098943 CHOA CHU KANG AVENUE 3 D 4 30 39 1.3805895432850994 103.74201730473243 1.3800400299576012 103.74120855605975
103076063 WOODLANDS ROAD B 6 50 59 1.399027473240379 103.7553182996927 1.3986609754803143 103.75518194323922
103030883 HOUGANG AVENUE 4 D 3 20 29 1.3742439017982357 103.88529975827204 1.3738695600842703 103.8852253844054
104003992 CLEMENTI AVENUE 6 F 5 40 49 1.3163287378822295 103.76133268167833 1.3152605534502255 103.76088573773033
103110036 HARVEY ROAD E 3 20 29 1.333534171783063 103.88445104036495 1.334480240662004 103.88423757172991
103089006 PIONEER ROAD NORTH B 3 20 29 1.3468683821422813 103.69025703809406 1.3466193981361332 103.6903389382926

19. VMS / EMAS

This API returns all traffic advisories about current traffic conditions that are displayed on the Electronic Monitoring Advisory System (EMAS) signboards along expressways and major roads, as well as the coordinates of each EMAS signboard.

getVMS is the wrapper function for this API, and takes in the API key as its only argument.

vms <- getVMS(Sys.getenv('LTA_DATAMALL_KEY'))
knitr::kable(head(vms))
EquipmentID Latitude Longitude Message
AVMS_0004 1.303921 103.8779 DRIVE SAFELY,SPEED CAMERAS,IN TUNNEL
AVMS_0009 1.322413 103.8811 ROAD WORKS,KPE(TPE),TPE(PIE) EXIT
AVMS_0001 1.307320 103.8753
EVMS_RD10 1.295480 103.8760 DRIVE SAFELY,SPEED CAMERAS,IN TUNNEL
EVMS_RQ10 1.324836 103.8720
AVMS_0006 1.311716 103.8752 ROAD WORKS,KPE(TPE),TPE(PIE) EXIT