Skip to contents

Calculate the minimum distance linestring connection from an sf POINT object to nodes of an sf LINESTRING object

Usage

polyg_line_nearest_node(
  input_points,
  input_lines,
  cast_substring = TRUE,
  ignore_equal = TRUE
)

Arguments

input_points

object of class sf or sfc with geometry type POINT or MULTIPOINT.

input_lines

object of class sf or sfc with geometry type LINESTRING or MULTILINESTRING.

cast_substring

logical; should the input linestring be cast to substring? Default is TRUE.

ignore_equal

logical; should output linestrings which are exactly equal to one or more elements in input_lines be ignored? Default is TRUE.

Value

An sf object of type LINESTRING containing the minimum distance linestring connections from each point in input_points to nodes in input_lines.

Details

For each point, the function computes the minimum distance to the intersection nodes of a set of linestrings and outputs the minimum distance linestrings. Empty linestrings as a result of equality between input_points and nodes in input_lines. If input_points or input_lines contain geometries of type MULTIPOINT or MULTILINESTRING, they are converted to POINT and LINESTRING respectively before computing.