extract_spatial_information {TDLM}R Documentation

Extract distances and surface areas from a spatial object

Description

This function returns a matrix of distances between locations (in kilometer) along with a vector surface areas of the locations (in square kilometer).

Usage

extract_spatial_information(geometry, id = NULL, show_progress = FALSE)

Arguments

geometry

a spatial object that can be handled by the sf package.

id

name or number of the column to use as rownames and colnames for the output distance matrix (optional, NULL by default). A vector with length equal to the number of locations can also be used.

show_progress

a boolean indicating if a progress bar should be displayed.

Details

The geometry must be projected in a valid coordinate reference system. It will be reprojected in degrees longitude/latitude to compute the great-circle distances between centroids' locations with an internal function and to compute the surface area with the function st_area from the sf package.

Value

A list composed of two elements. The first element is a squared matrix representing the great-circle distance (in kilometer) between locations. The second element is a vector containing the surface area of each location (in square kilometer).

Note

The outputs are based on the locations contained in geometry and sorted in the same order. An optional id can also be provided to be used as names for the outputs.

Author(s)

Maxime Lenormand (maxime.lenormand@inrae.fr)

See Also

calib_param() extract_opportunities() check_format_names()

Examples

data(county)

res <- extract_spatial_information(county, id = "ID")

dim(res$distance)

length(res$surface)


[Package TDLM version 1.0.0 Index]