This function is deprecated.
Please use the `potential` package instead
(https://riatelab.github.io/potential/).
Plot a layer of smoothed data. It can also compute a ratio of potentials.
This function is a wrapper around the quickStewart
function in
SpatialPosition
package.
The SpatialPosition package also provides:
vignettes to explain the computation of potentials;
more customizable inputs and outputs (custom distance matrix, raster output...);
other functions related to spatial interactions (Reilly and Huff catchment areas).
smoothLayer(
x,
spdf,
df,
spdfid = NULL,
dfid = NULL,
var,
var2 = NULL,
typefct = "exponential",
span,
beta,
resolution = NULL,
mask = NULL,
nclass = 8,
breaks = NULL,
col = NULL,
border = "grey20",
lwd = 1,
legend.pos = "bottomleft",
legend.title.txt = "Potential",
legend.title.cex = 0.8,
legend.values.cex = 0.6,
legend.values.rnd = 0,
legend.frame = FALSE,
add = FALSE
)
an sf object, a simple feature collection.
a SpatialPolygonsDataFrame.
a data frame that contains the values to compute If df is missing spdf@data is used instead.
name of the identifier variable in spdf, default to the first column of the spdf data frame. (optional)
name of the identifier variable in df, default to the first column of df. (optional)
name of the numeric variable used to compute potentials.
name of the numeric variable used to compute potentials. This variable is used for ratio computation (see Details).
character; spatial interaction function. Options are "pareto"
(means power law) or "exponential".
If "pareto" the interaction is defined as: (1 + alpha * mDistance) ^ (-beta).
If "exponential" the interaction is defined as:
exp(- alpha * mDistance ^ beta).
The alpha parameter is computed from parameters given by the user
(beta
and span
).
numeric; distance where the density of probability of the spatial interaction function equals 0.5.
numeric; impedance factor for the spatial interaction function.
numeric; resolution of the output SpatialPointsDataFrame (in map units).
sf object or SpatialPolygonsDataFrame; mask used to clip contours of potentials.
numeric; a targeted number of classes (default to 8). Not used if breaks is set.
numeric; a vector of values used to discretize the potentials.
a vector of colors. Note that if breaks is specified there must be one less colors specified than the number of break.
color of the polygons borders.
borders width.
position of the legend, one of "topleft", "top", "topright", "right", "bottomright", "bottom", "bottomleft", "left" or a vector of two coordinates in map units (c(x, y)). If legend.pos is "n" then the legend is not plotted.
title of the legend.
size of the legend title.
size of the values in the legend.
number of decimal places of the values in the legend.
whether to add a frame to the legend (TRUE) or not (FALSE).
whether to add the layer to an existing plot (TRUE) or not (FALSE).
An invisible
sf object (MULTIPOLYGONs) is returned (see quickStewart
).
If var2 is provided the ratio between the potentials of var (numerator) and var2 (denominator) is computed.
# install.packages('potential')