calc_sedac_groads {amadeus} | R Documentation |
Calculate roads covariates
Description
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 |
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 |
logical(1). Should the function return a |
... |
Placeholders. |
Value
a data.frame or SpatVector object
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.
Author(s)
Insang Song
See Also
Examples
## 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)
calc_sedac_groads(
from = groads, # derived from process_sedac_groads() example
locs = loc,
locs_id = "id",
radius = 1000,
fun = "sum",
geom = FALSE
)
## End(Not run)