.map_coord()
defines coordinates and weights (marks) for utilisation distribution (UD) estimation.
Usage
.map_coord(.map, .coord, .discretise)
.map_coord.SpatRaster(.map)
.map_coord.dt(.map, .coord, .discretise)
Arguments
- .map
The
terra::SpatRaster
used to represent the UD. This can beNULL
if.coord
is provided and.discretise = FALSE
.- .coord
A
matrix
,data.frame
ordata.table::data.table
with x and y coordinates, in columns namedx
andy
orcell_x
andcell_y
(see Details). (.coord
is coerced to adata.table::data.table
.) Additional columns (timestep
andmark
), as supported by.map_mark()
are permitted. Other columns are ignored.- .discretise
A
logical
variable that defines whether or not to discretise coordinates (i.e., redefine coordinates on.map
). This is necessarilyTRUE
in the wrapper functionmap_pou()
but optional formap_dens()
.
Value
The function returns a data.table::data.table
with four columns:
id
—a vector of coordinate IDs (if.discretise = TRUE
,id
represents grid cells on.map
);x
,y
—numeric
vectors that define coordinates (if.discretise = TRUE
,x
andy
represent cell coordinates on.map
);mark
—anumeric
vector of weights, normalised to sum to one;
Details
.map_coord()
function defines a data.table::data.table
that includes coordinate IDs (id
), coordinates (x
and y
) and associated weights (mark
) for UD estimation. The function wraps .map_coord.SpatRaster()
and .map_coord.dt()
.
If
.coord
isNULL
,.map_coord.SpatRaster()
is used. This function extracts adata.table::data.table
of coordinates from.map
(in nonNA
regions) viaterra::as.data.frame(..., na.rm = TRUE)
. The values on.map
are taken as weights and must sum to one.If
.coord
is supplied,.map_coord.dt()
is used.x
andy
and/orcell_x
andcell_y
columns are expected. If.discretise = TRUE
,cell_x
andcell_y
are used preferentially. Irrespective of whether or notx
andy
orcell_x
andcell_y
are specified, coordinates are redefined on.map
and coordinate IDs are defined as grid cell IDs on.map
. If.discretise = FALSE
,x
andy
coordinates are used preferentially. Coordinates remain unchanged and IDs are defined from the set of unique coordinate pairs. For each ID, weights are calculated by.map_mark()
.
See also
.map_coord()
is used by map_pou()
and map_dens()
.