Usage
smooth_map(shp, var = NULL, nrow = NA, ncol = NA, N = 250000,
unit = "km", unit.size = 1000, smooth.raster = TRUE, nlevels = 5,
style = ifelse(is.null(breaks), "pretty", "fixed"), breaks = NULL,
bandwidth = NA, cover.type = NA, cover = NULL, cover.threshold = 0.6,
weight = 1, extracting.method = "full", buffer.width = NA,
to.Raster = FALSE)
Arguments
shp
shape object of class Spatial
or Raster
. Spatial points, polygons, and grids are supported. Spatial lines are not. var
variable name. Not needed for SpatialPoints
. If missing, the first variable name is taken. nrow
number of rows in the raster that is used to smooth the shape object. Only applicable if shp is not a SpatialGrid(DataFrame)
or
ncol
number of rows in the raster that is used to smooth the shape object. Only applicable if shp is not a SpatialGrid(DataFrame)
or
N
preferred number of points in the raster that is used to smooth the shape object. Only applicable if shp is not a SpatialGrid(DataFrame)
or
unit
unit specification. Needed when calculating density values. When set to NA
, the densities values are based on the dimensions of the raster (defined by nrow
and ncol
). See also unit.size
.
unit.size
size of the unit in terms of coordinate units. The coordinate system of many projections is approximately in meters while thematic maps typically range many kilometers, so by default unit="km"
and unit.size=1000
(meaning 1 kilome
smooth.raster
logical that determines whether 2D kernel density smoothing is applied to the raster shape object. Not applicable when shp
is a SpatialPoints
object. nlevels
preferred number of levels
style
method to cut the color scale: e.g. "fixed", "equal", "pretty", "quantile", or "kmeans". See the details in classIntervals
. breaks
in case style=="fixed"
, breaks should be specified
bandwidth
single numeric value or vector of two numeric values that specifiy the bandwidth of the kernal density estimator. By default, it is 1/50th of the shortest side in units (specified with unit.size
).
cover.type
character value that specifies the type of raster cover, in other words, how the boundaries are specified. Options: "original"
uses the same boundaries as shp
(default for polygons), "smooth"
calculates a smooth boun
cover
SpatialPolygons
shape that determines the covered area in which the contour lines are placed. If specified, cover.type
is ignored.cover.threshold
numeric value between 0 and 1 that determines which part of the estimated 2D kernal density is returned as cover. Only applicable when cover.type="smooth"
.
weight
single number that specifies the weight of a single point. Only applicable if shp
is a SpatialPoints
object. extracting.method
Method of how coordinates are extracted from the dasymetric polygons. Options are: "full"
(default), "grid"
, and "single"
. See details. For the slowest method "full"
,
buffer.width
Buffer width of the iso lines to cut dasymetric polygons. Should be small enough to let the polygons touch each other without space in between. However, too low values may cause geometric errors.
to.Raster
should the "raster" output (see output
) be a RasterLayer
? By default, it is returned as a Spatia