movecomp: R function for comparing least-cost paths generated using...

movecompR Documentation

R function for comparing least-cost paths generated using different cost functions

Description

The function provides the facility to calculate LCPs using different cost functions and to plot them in the same visual output to allow comparability. See, for instance, fig. 14.2 in Parcero-Oubina C. et al, Footprints and Cartwheels on a Pixel Road: On the Applicability of GIS for the Modelling of Ancient (Roman) Routes (2019). In Verhagen P., Joyce J., Groenhuijzen M.R. (eds), Finding the Limits of the Limes. Modelling Demography, Economy and Transport on the Edge of the Roman Empire, Springer, 291-311.
Visit this LINK to access the package's vignette.

Usage

movecomp(
  dtm = NULL,
  origin,
  destin,
  studyplot = NULL,
  barrier = NULL,
  plot.barrier = FALSE,
  irregular.dtm = FALSE,
  choice,
  time = "h",
  move = 16,
  field = 0,
  cogn.slp = FALSE,
  sl.crit = 10,
  W = 70,
  L = 0,
  N = 1,
  V = 1.2,
  z = 9,
  return.base = FALSE,
  leg.pos = "topright",
  leg.cex = 0.75,
  transp = 0.5,
  add.chart = FALSE,
  oneplot = TRUE,
  export = FALSE
)

Arguments

dtm

Digital Terrain Model (RasterLayer class); if not provided, elevation data will be acquired online for the area enclosed by the 'studyplot' parameter (see movecost).

origin

location from which least-cost path(s) is calculated (SpatialPointsDataFrame class).

destin

location(s) to which least-cost path(s) is calculated (SpatialPointsDataFrame class).

studyplot

polygon (SpatialPolygonDataFrame class) representing the study area for which online elevation data are acquired (see movecost); NULL is default.

barrier

area where the movement is inhibited (SpatialLineDataFrame or SpatialPolygonDataFrame class) (see movecost).

plot.barrier

TRUE or FALSE (default) if the user wants or does not want the barrier to be plotted (see movecost).

irregular.dtm

TRUE or FALSE (default) if the input DTM features irregular margins (see movecost).

choice

character vector indicating the cost functions to be compared (for details on each of the following, see movecost):

-functions expressing cost as walking time-
t (default) uses the on-path Tobler's hiking function;
tofp uses the off-path Tobler's hiking function;
mp uses the Marquez-Perez et al.'s modified Tobler's function;
icmonp uses the Irmischer-Clarke's hiking function (male, on-path);
icmoffp uses the Irmischer-Clarke's hiking function (male, off-path);
icfonp uses the Irmischer-Clarke's hiking function (female, on-path);
icfoffp uses the Irmischer-Clarke's hiking function (female, off-path);
ug uses the Uriarte Gonzalez's walking-time cost function;
ma uses the Marin Arroyo's walking-time cost function;
alb uses the Alberti's Tobler hiking function modified for pastoral foraging excursions;
gkrs uses the Garmy, Kaddouri, Rozenblat, and Schneider's hiking function;
r uses the Rees' hiking function;
ks uses the Kondo-Seino's hiking function;
trp uses the Tripcevich's hiking function;

-functions for wheeled-vehicles-
wcs uses the wheeled-vehicle critical slope cost function;

-functions expressing abstract cost-
ree uses the relative energetic expenditure cost function;
b uses the Bellavia's cost function;
e uses the Eastman's cost function;

-functions expressing cost as metabolic energy expenditure-
p uses the Pandolf et al.'s metabolic energy expenditure cost function;
pcf uses the Pandolf et al.'s cost function with correction factor for downhill movements;
m uses the Minetti et al.'s metabolic energy expenditure cost function;
hrz uses the Herzog's metabolic energy expenditure cost function;
vl uses the Van Leusen's metabolic energy expenditure cost function;
ls uses the Llobera-Sluckin's metabolic energy expenditure cost function;
a uses the Ardigo et al.'s metabolic energy expenditure cost function;
h uses the Hare's metabolic energy expenditure cost function (for all the mentioned cost functions, see movecost).

time

time-unit to be used if Tobler's and other time-related cost functions are used; h' for hour, 'm' for minutes;

move

number of directions in which cells are connected: 4 (rook's case), 8 (queen's case), 16 (knight and one-cell queen moves; default).

field

value assigned to the cells coinciding with the barrier (0 by default) (see movecost.

cogn.slp

TRUE or FALSE (default) if the user wants or does not want the 'cognitive slope' to be used in place of the real slope (see movecost).

sl.crit

critical slope (in percent), typically in the range 8-16 (10 by default) (used by the wheeled-vehicle cost function; see movecost).

W

walker's body weight (in Kg; 70 by default; used by the Pandolf's and Van Leusen's cost function; see movecost).

L

carried load weight (in Kg; 0 by default; used by the Pandolf's and Van Leusen's cost function; see movecost).

N

coefficient representing ease of movement (1 by default) (see movecost).

V

speed in m/s (1.2 by default) (used by the Pandolf et al.'s, Pandolf et al.s with correction factor, Van Leusen's, and Ardigo et al.'s cost function; if set to 0, it is internally worked out on the basis of Tobler on-path hiking function (see movecost).

z

zoom level for the elevation data downloaded from online sources (from 0 to 15; 9 by default) (see movecost and get_elev_raster).

return.base

TRUE or FALSE (default) if the user wants or does not want the least-cost paths back to the origin to be calculated and plotted (as dashed lines).

leg.pos

set the position of the legend in the plotted cost allocation raster; 'topright' by default (other options: "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right", "center").

leg.cex

set the size of the labels used in the legend displayed in the rendered plot (0.75 by default).

transp

set the transparency of the slopeshade raster that is plotted over the DTM (0.5 by default).

add.chart

TRUE or FALSE (default) is the user wants or does not want boxplots visualising LCPs length/cost vs cost function to be rendered.

oneplot

TRUE (default) or FALSE if the user wants or does not want the plots displayed in a single window.

export

TRUE or FALSE (default) if the user wants or does not want the LCPs to be exported as a shapefile; the DTM is exported only if it was not provided by the user and downloaded by the function from online sources.

Details

Like movecost(), the function just requires an input DTM ('RasterLayer' class), and an origin and destination dataset ('SpatialPointsDataFrame' class). The cost functions to be used have to be entered into 'movecomp()' via a character vector fed via the choice parameter (see the examples below). If a DTM is not provided, movecomp() downloads elevation data from online sources for the area enclosed by the polygon fed via the studyplot parameter (see movecost for more details). Under the hood, movecomp() relies on movecost() and implements the same cost functions: see the help documentation of movecost() for further information.

movecomp() produces a plot representing the input DTM overlaid by a slopeshade raster, whose transparency can be adjusted using the 'transp' parameter. On the rendered plot, the LPCs ('SpatialLinesDataFrame' class) generated by the different input cost functions are given a different line type; a legend indicates which line type corresponds to which cost function. LCPs back to the origin can be calculated (and plotted) setting the parameter return.base to TRUE.

The function returns the LCPs and (if requested by the user) the LCPs back to the origin. If the DTM has been acquired online, it will be returned as well. The LCPs (and the LCPs back to the origin) will store three variables: the length of each path, the cost of each path, and an abbreviation corresponding to the cost function used to generate the LCPs. The mentioned data can be exported by setting the export parameter to TRUE.

If the users want to compare the distribution of the length of the LCPs generate by different cost functions, it suffices to set the add.chart parameter to TRUE. Two charts featuring boxplots will be rendered: one plotting the distribution of the LCPs length by cost function; one portaying the distribution of the cost by cost function.

The following example uses in-built datasets to compare the LCPs generated using two cost functions: the Tobler hiking function , the wheeled vehicle cost function, and the Pantolf. et al's cost function with correction factor. LCPs back to the origin location will be calculated as well. The origin and destination locations are close to Mt Etna (Sicily, Italy). Note that elevation data are acquired online for the area enclosed by the polygon fed via the studyplot parameter:

result <- movecomp(origin=Etna_start_location, destin=Etna_end_location, choice=c("t", "wcs", "pcf"), studyplot = Etna_boundary, return.base=TRUE)

Value

The function returns a list storing the following components

  • dtm: Digital Terrain Model ('RasterLayer' class); returned only if acquired online

  • LCPs: estimated least-cost paths ('SpatialLinesDataFrame' class); three variables are stored: 'length', 'cost', and 'funct'.

  • LCPs.back: estimated least-cost paths back to the origin ('SpatialLinesDataFrame' class); three variables are stored; see above.

See Also

movecost

Examples

# load a sample Digital Terrain Model
data(volc)


# load the sample destination locations on the above DTM
data(destin.loc)


# compare the LCPs generated using different walking-time cost functions (time in minutes)

result <- movecomp(volc, volc.loc, destin.loc, choice=c("t", "ug", "gkrs"), time="m", move=8)

# the distribution of the length and cost of the LCPs by cost function can be easily compared
# using the 'add.chart' parameter:
#result <- movecomp(volc, volc.loc, destin.loc, choice=c("t", "ug", "gkrs"), time="m",
#move=8, add.chart=T)



movecost documentation built on April 12, 2023, 12:37 p.m.