View source: R/calculate_covariates.R
calculate_groads | R Documentation |
Prepared groads data is clipped with the buffer polygons
of radius
. The total length of the roads are calculated.
Then the density of the roads is calculated by dividing
the total length from the area of the buffer. terra::linearUnits()
is used to convert the unit of length to meters.
calculate_groads(
from = NULL,
locs = NULL,
locs_id = NULL,
radius = 1000,
fun = "sum",
geom = FALSE,
...
)
from |
SpatVector(1). Output of |
locs |
data.frame, characater to file path, SpatVector, or sf object. |
locs_id |
character(1). Column within |
radius |
integer(1). Circular buffer distance around site locations. (Default = 1000). |
fun |
function(1). Function used to summarize the length of roads
within sites location buffer (Default is |
geom |
FALSE/"sf"/"terra".. Should the function return with geometry?
Default is |
... |
Placeholders. |
a data.frame or SpatVector object
Unit is km / sq km. The returned data.frame
object contains a
$time
column to represent the temporal range covered by the
dataset. For more information, see https://earthdata.nasa.gov/data/catalog/sedac-ciesin-sedac-groads-v1-1.00.
Insang Song
process_groads
## NOTE: Example is wrapped in `\dontrun{}` as function requires a large
## amount of data which is not included in the package.
## Not run:
loc <- data.frame(id = "001", lon = -78.90, lat = 35.97)
calculate_groads(
from = groads, # derived from process_groads() example
locs = loc,
locs_id = "id",
radius = 1000,
fun = "sum",
geom = FALSE
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.