snap_points_to_lines {stppSim}R Documentation

Snapping point to network

Description

Snaps points to the nearest segment of a network data.

Usage

snap_points_to_lines(points, lines,
verbose = FALSE)

Arguments

points

point data (sf object)

lines

line/street/road network (sf object)

verbose

Whether to output processing messages.

Details

Function snaps points (within 300m) to the nearest segment on a network. The remaining points outside 300m buffer are returned in their original locations (Credit: Michal Kvasnicka)

Value

Point (sf object) with adjusted coordinates to fit on the network data

Examples


#get line and point data
#load(file = system.file("extdata", "camden.rda",
#package="stppSim"))
lines <- stppSim:::lines
pts <- stppSim:::pts
my_points <- snap_points_to_lines(points=pts,
lines=lines,
verbose = FALSE)

#preview result
#ggplot()+
#geom_sf(data = lines, col = 'red')+
#geom_sf(data = pts, shape = 1)

[Package stppSim version 1.3.2 Index]