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.
Usage
calc_sedac_groads(
from = NULL,
locs = NULL,
locs_id = NULL,
radius = 1000,
fun = "sum",
geom = FALSE,
...
)Arguments
- from
SpatVector(1). Output of
process_sedac_groads.- locs
data.frame, characater to file path, SpatVector, or sf object.
- locs_id
character(1). Column within
locationsCSV file containing identifier for each unique coordinate location.- 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
sum).- geom
logical(1). Should the function return a
SpatVector? Default isFALSE. The coordinate reference system of theSpatVectoris that offrom.- ...
Placeholders.
Note
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://sedac.ciesin.columbia.edu/data/set/groads-global-roads-open-access-v1/metadata.
Examples
## NOTE: Example is wrapped in `\dontrun{}` as function requires a large
## amount of data which is not included in the package.
if (FALSE) { # \dontrun{
loc <- data.frame(id = "001", lon = -78.90, lat = 35.97)
calc_sedac_groads(
from = groads, # derived from process_sedac_groads() example
locs = loc,
locs_id = "id",
radius = 1000,
fun = "sum",
geom = FALSE
)
} # }