movealloc {movecost} | R Documentation |
R function for calculating slope-dependant walking-cost allocation to origins
Description
The function provides the facility to carry out a cost allocation analysis. Given a number of origin locations,
a cost allocation raster is produced; each cell of the cost allocation raster is given an integer indicating to which origin
a cell is closer in terms of cost. Needless to say, the cost can be conceptualized in terms of either walking time or
energy expenditure, and is function of the terrain slope.
Visit this LINK to access the package's vignette.
Usage
movealloc(
dtm = NULL,
origin,
studyplot = NULL,
funct = "t",
time = "h",
move = 16,
cogn.slp = FALSE,
sl.crit = 10,
W = 70,
L = 0,
N = 1,
V = 1.2,
z = 9,
isolines = FALSE,
breaks = NULL,
cont.lab = TRUE,
cex.breaks = 0.6,
leg.alloc = FALSE,
leg.pos = "topright",
cex.leg = 0.75,
transp = 0.5,
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 |
origin |
locations (two at least) in relation to which the cost allocation is carried out (SpatialPointsDataFrame class). |
studyplot |
polygon (SpatialPolygonDataFrame class) representing the study area for which online elevation data are acquired (see |
funct |
cost function to be used (for details on each of the following, see -functions expressing cost as walking time- -functions for wheeled-vehicles- -functions expressing abstract cost- -functions expressing cost as metabolic energy expenditure- |
time |
time-unit expressed by the isoline(s) 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). |
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 |
sl.crit |
critical slope (in percent), typically in the range 8-16 (10 by default) (used by the wheeled-vehicle cost function; see |
W |
walker's body weight (in Kg; 70 by default; used by the Pandolf's and Van Leusen's cost function; see |
L |
carried load weight (in Kg; 0 by default; used by the Pandolf's and Van Leusen's cost function; see |
N |
coefficient representing ease of movement (1 by default) (see |
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 |
z |
zoom level for the elevation data downloaded from online sources (from 0 to 15; 9 by default) (see |
isolines |
TRUE or FALSE (default) is the user wants or does not want cost isolines/contours around the origins to be calculated and plotted. |
breaks |
contours' (i.e., isolines') interval; if no value is supplied, the interval is set by default to 1/10 of the range of values of the cost surface accumulated around the origins. |
cont.lab |
if set to TRUE (default) display the labels of the cost contours. |
cex.breaks |
set the size of the labels attached to the cost contours (0.6 by default). |
leg.alloc |
if set to TRUE, display the legend in the plotted cost allocation raster; FALSE by default. |
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"). |
cex.leg |
set the size of the labels used in the legend displayed in the plotted allocation raster (0.75 by default). |
transp |
set the transparency of the slopeshade raster that is plotted over the cost allocation raster (0.5 by default). |
export |
TRUE or FALSE (default) if the user wants or does not want the output to be exported; if TRUE, the isolines (i.e. the contours) and the allocation boundaries will be exported as a shapefile; the cost allocation raster will be exported as 'GeoTiff'; the DTM is exported only if it was not provided by the user and downloaded by the function from online sources; all the exported files (excluding the DTM) will bear a suffix corresponding to the cost function selected by the user. |
Details
The function requires an input DTM ('RasterLayer' class) and a dataset ('SpatialPointsDataFrame' class) containing the
origin locations. If a DTM is not provided, movealloc()
will download elevation data from online sources (see movecost
for more details).
Under the hood, movealloc()
relies on the movecost()
function and implements the same cost functions:
see the help documentation of movecost()
for further information.
Internally, what movealloc()
does is producing an accumulated cost surface around each individual origin location; those
accumulated cost surfaces are then stacked together, and then the function looks at each pixel in the stack of surfaces and
returns 1 if the first stacked surface has the smallest pixel value, or 2 if the second stacked surface has the smallest pixel value, and so on for bigger stacks.
movealloc()
produces a plot featuring a slopeshade image that is overlaid by the cost allocation raster and by a polygon layer
where each polygon represents the limits of each allocation zone. A legend can be optionally added to the plot via the leg.alloc
parameter (FALSE by default).
Isolines (i.e., contour lines) around each origin location can be optionally plotted via the 'isolines' parameter (FALSE by default).
The DTM, the cost allocation raster, the cost allocation polygons, and the isolines (if requested by the user by setting the isolines
parameter to TRUE), can
be exported by setting the 'export' parameter to TRUE. All the exported files (excluding the DTM) will bear a suffix corresponding to the cost function selected by the user.
Value
The function returns a list storing the following components
dtm: Digital Terrain Model ('RasterLayer' class)
cost.allocation.raster: raster of the cost allocation ('RasterLayer' class)
isolines: contour lines representing the accumulated cost around the origins ('SpatialLinesDataFrame' class); returned if the 'isolines' parameter is set to TRUE
alloc.boundaries: polygons representing the allocation zones ('SpatialPolygonsDataFrame' class)
See Also
Examples
# load a sample Digital Terrain Model
data(volc)
# load the sample locations on the above DTM
data(destin.loc)
#carry out a cost allocation analysis using the Tobler's off-path hiking function,
#setting the time to minutes and the isolines (i.e., contours) interval to 1 minute;
#only 3 locations are used
#result <- movealloc(dtm=volc, origin=destin.loc[c(3,7,9),], funct="tofp", time="m",
#breaks=1, isolines=TRUE)
#same as above, using all the locations and the Kondo-Seino's cost function
#result <- movealloc(dtm=volc, origin=destin.loc, funct="ks", time="m",
#breaks=1, isolines=TRUE)