simplify_network: Simplify a network

View source: R/geometrical_functions_sf.R

simplify_networkR Documentation

Simplify a network

Description

Simplify a network by applying two corrections: Healing edges and Removing mirror edges (experimental).

Usage

simplify_network(
  lines,
  digits = 3,
  heal = TRUE,
  mirror = TRUE,
  keep_shortest = TRUE,
  verbose = TRUE
)

Arguments

lines

A feature collection of linestrings

digits

An integer indicating the number of digits to keep in coordinates

heal

A boolean indicating if the healing operation must be performed

mirror

A boolean indicating if the mirror edges must be removed

keep_shortest

A boolean, if TRUE, then the shortest line is kept from mirror edges. if FALSE, then the longest line is kept.

verbose

A boolean indicating if messages and a progress bar should be displayed

Details

Healing is the operation to merge two connected linestring if the are intersecting at one extremity and do not intersect any other linestring. It helps to reduce the complexity of the network and thus can reduce calculation time. Removing mirror edges is the operation to remove edges that have the same extremities. If two edges start at the same point and end at the same point, they do not add information in the network and one can be removed to simplify the network. One can decide to keep the longest of the two edges or the shortest. NOTE: the edge healing does not consider lines directions currently!

Value

A feature collection of linestrings

Examples


data(mtl_network)
edited_lines <- simplify_network(mtl_network, digits = 3, verbose = FALSE)


JeremyGelb/spNetwork documentation built on May 24, 2024, 7:23 p.m.