downloadMIDAS: downloads tcd from the MIDAS server and decode to csv files

Description Usage Arguments Value Note Examples

Description

Function to download .tcd.bz2 traffic data file(s) from MIDAS using your obtained username and password for specified regional control centre(s) (rcc) and day(s). The function unzips and decodes .tcd file(s) BUT it requires the Highways England decoder (tcd to csv decoder) to be installed on your system.

MIDAS stores data in .tcd format (traffic counting data). decodeTCDtoCSV is mainly used in downloadMIDAScsv to automatically decode the downloaded file to csv.

Usage

1
2
3
4
5
6
7
8
downloadMIDAScsv(dest.dir, rcc, day, ...,
		protocol = "https", 
		tcd.format = ".tcd", zip.format = ".bz2", csv.format = ".csv", 
		remove.zip.file = TRUE, unzip = TRUE, 
		remove.tcd.file = TRUE, decode = FALSE, decoder.exe = NULL)

decodeTCDtoCSV(decoder.exe, dest.file, ...)
	

Arguments

dest.dir

character. directory where midas traffic data will be downloaded

rcc

character/numeric vector. regional control centre(s). e.g. "70" or if multiple files e.g. c("70",70") Currently, midas network divided into 8 regions (10,20,30,40,50,60,70,79)

day

character. day(s) of the traffic data to be downloaded of format "ddmmyy" e.g. "010414" or if multiple files c("010414", "020414")

...

(optional) additional arguments to system() in decodeTCDtoCSV

protocol

character. http/https. Default to "https"

tcd.format, zip.format, csv.format

character. file extensions. Defualt to ".tcd", ".bz2", and ".csv"

remove.zip.file

logical value. TRUE to remove the downloaded zipped file. FALSE to keep it in the directory. Default to TRUE

unzip

logical value. TRUE to unzip the downloaded file. FALSE not to. Default to TRUE

remove.tcd.file

logical value. TRUE to remove the unzipped tcd file after decoding it to csv. FALSE to keep it in the directory. Default to TRUE

decode

logical value. TRUE to decode tcd to csv using MIDAS decoder. FALSE not to. Default to FALSE. If TRUE, decoderEXEFile is needed

decoder.exe

full path of the .exe of the MIDAS TCD Decoder on your system (Highways England, 2016). Needed only if decode is TRUE

dest.file

full path of the decoded unzipped .tcd file

Value

.tcd.bz2 midas data file(s) in the directory folder if remove.zip.file is FALSE unzipped .tcd midas data file(s) in the directory folder if remove.tcd.file is FALSE unzipped decoded .csv midas data file(s) in the directory folder if decode = TRUE

.tcd.bz2 midas data file(s) in the directory folder if remove.zip.file is FALSE unzipped .tcd midas data file(s) in the directory folder if remove.tcd.file is FALSE unzipped decoded .csv midas data file(s) in the directory folder if decode = TRUE

unzipped decoded .csv midas data file in the directory folder (dest.file)

Note

these require cURL to be installed on PC (curl-7.40.0-win64.msi - restart after installation). Also, these require access to MIDAS system (username/password required). If using decodeTCDtoCSV or decode = TRUE downloadMIDAScsv, the decoder needs to be installed on your system which is a HATMS application: MIDAS TCD Decoder D: TCDtoCSVConsole.exe. Can be downloaded once access to the MIDAS system is granted from the Highways England.

Examples

1
2
3
4
5
6
#download one file
## Not run: downloadMIDAScsv(dest.dir = getwd(), 
			rcc = "70", day = "010410", decode=TRUE,
			decoder.exe = '"~/.TCDtoCSVConsole.exe"')

## End(Not run)

arwasayegh/mdep documentation built on May 20, 2019, 1:27 p.m.