line_calc: Line data calculation

Description Usage Arguments Value Examples

View source: R/line_calc.R

Description

Computes three different summary statistics: (1) TotalArea total area of each polygon; (2) TotalLength total length of a multilinestring object within a polygon (3) Ratio ratio between TotalLength and TotalArea i.e. the ratio between the total length and total area of a higher-order geography polygon.

Usage

1
line_calc(line_layer, higher_geo_lay, unique_id_code, crs)

Arguments

line_layer

multilinestring object of class sf, sfc or sfg.

higher_geo_lay

multipologon object of class sf, sfc or sfg.

unique_id_code

a string; indicating a unique ID column of higher_geo_lay, used as the summary areas.

crs

coordinate reference system: integer with the EPSG code, or character based on proj4string.

Value

a tibble data frame object containing four columns:

the unique_id_code of higher_geo_lay

the total area of each polygon in higher_geo_lay (TotalArea)

the total length of line_layer features (TotalLength)

the ratio between the total length of line_layer and the the total area of higher_geo_lay polygon (Ratio).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Run line_calc() using the packages' dummy data sets.
## The data sets are georeferenced on wgs84. However, a planar system is used to measure areas.
## For the examples provided here, points and polygons relate to the United Kingdom.
## So the British National Grid is used.

## Not run:
#outcome <- line_calc(
# line_layer = lines,
# higher_geo_lay = pol_large,
# unique_id_code = "large_pol_",
# crs = "epsg:27700")
## End(Not run)

extRatum documentation built on Jan. 18, 2021, 5:07 p.m.

Related to line_calc in extRatum...