tcmat.create: Creation of a transport costs matrix

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

Creation of a transport costs matrix (airline distance, car travel time)

Usage

1
2
3
4
5
tcmat.create(origins.id, origins.addr, 
destinations.id, destinations.addr, 
tc.type = "airline", tc.unit = "km", 
or.addr.format = "stradr", de.addr.format = "stradr",
tc.constant = 0, query.delay = 0, show_proc = FALSE)

Arguments

origins.id

ID of the origins

origins.addr

Address of the origins, either street addresses (e.g. "Markgrafenstrasse 68, Freiburg, Germany") or coordinates (X_LON;X_LAT, e.g.: "7,82218;47,99387")

destinations.id

ID of the destinations

destinations.addr

Address of the destinations, either street addresses (e.g. "Markgrafenstrasse 68, Freiburg, Germany") or coordinates (X_LON;X_LAT, e.g.: "7,82218;47,99387")

tc.type

Type of transportat costs: "airline" (airline distance) or "street" (car travel time)

tc.unit

If tc.type = "airline": unit of distance ("m", "km" or "miles")

or.addr.format

Origins address format. Default: "stradr" (street addresses))

de.addr.format

Destinations address format. Default: "stradr" (street addresses))

tc.constant

Adding a constant to the calculated/queried values (default: 0)

query.delay

Delay within OSM geocoding querys (unit: seconds, default: 0)

show_proc

Logical argument that indicates if the function prints messages about the state of process during the work

Details

Creation of a tcmat list object (Transport costs matrix) for further use in huff and mcimat.create. Included geocoding of street addresses (from geocode_OSM in tmaptools) and travel time query (from ormsTable in osrm) or the calculation of airline distances (from dist.mat in REAT).

Value

A tcmat list (invisible) containing the following components:

coords_origins

A data.frame containing the coordinates (lat, lon) of the origins

coords_destinations

A data.frame containing the coordinates (lat, lon) of the destinations

tcmat

A data.frame containing the transport costs matrix

tc.mode

A list containing information about the transportation costs matrix

Note

This function is wrapper of the functions geocode_OSM (for geocoding street addresses using OSM Nominatim) from the tmaptools package (Tennekes 2018), osrmTable (for creating travel time matrices between points while interfacing the table OSRM service) from the osrm package (Giraud 2018) and dist.mat (for creating airline distances between points) from the REAT package (Wieland 2018). The OSM-related functions rely on the usage of a running OSRM service! For more information, see the related package documentations.

Author(s)

Thomas Wieland

References

Giraud, T. (2018): osrm: Interface Between R and the OpenStreetMap-Based Routing Service OSRM. R package version 3.1.1. https://CRAN.R-project.org/package=osrm.

Tennekes, M. (2018): tmaptools: Thematic Map Tools. R package version 2.0-1. https://CRAN.R-project.org/package=tmaptools.

Wieland, T. (2017): “Market Area Analysis for Retail and Service Locations with MCI”. In: The R Journal, 9, 1, p. 298-323. https://journal.r-project.org/archive/2017/RJ-2017-020/RJ-2017-020.pdf.

Wieland, T. (2018): “Competitive locations of grocery stores in the local supply context - The case of the urban district Freiburg-Haslach”. In: European Journal of Geography, 9, 3, p. 98-115.

Wieland, T. (2019): REAT: Regional Economic Analysis Toolbox. R package version 3.0.0. https://CRAN.R-project.org/package=REAT.

See Also

huff, mcimat.create

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
data(HaslachSurvey)
# survey raw data (Store choices and purchases)
data(HaslachDistricts)
# IDs and information about customer origins
data(HaslachStores)
# IDs and information about destinations (grocery stores)

## Not run: 
tcmat_haslach_airline <- tcmat.create(origins.id = HaslachDistricts$WO, 
origins.addr = HaslachDistricts$WO_Adr, destinations.id = HaslachStores$LM, 
destinations.addr = HaslachStores$LM_Adr_zus, 
tc.type = "airline", tc.unit = "km",
addr.format = "stradr", tc.constant = 0, show_proc = TRUE)
# Creation of a transport costs matrix with airline distances
# saving as list object "tcmat_haslach_airline"
# Needs internet access and accesses OpenStreetMap server(s)
# If server not available, the function will produce an error

tcmat_haslach_drvtime <- tcmat.create(origins.id = HaslachDistricts$WO, 
origins.addr = HaslachDistricts$WO_Adr, destinations.id = HaslachStores$LM, 
destinations.addr = HaslachStores$LM_Adr_zus,
tc.type = "street", addr.format = "stradr", 
tc.constant = 0, show_proc = TRUE)
# Creation of a transport costs matrix with car driving times
# saving as list object "tcmat_haslach_drvtime"
# Needs internet access and accesses OpenStreetMap server(s)
# If server not available, will produce an error

## End(Not run)

MCI2 documentation built on Aug. 2, 2019, 5:04 p.m.