ox_nearest_edges: Find the nearest edge to a point

View source: R/simplify.R

ox_nearest_edgesR Documentation

Find the nearest edge to a point

Description

Returns, for each supplied coordinate, the graph edge closest in planar distance.

Usage

ox_nearest_edges(g, x, y)

Arguments

g

An osm_graph.

x, y

Numeric vectors of coordinates in the graph's CRS.

Value

An sf subset of g$edges, one row per input point.

Examples

g <- example_osm_graph()
ox_nearest_edges(g, x = 50, y = 0)

osmnxr documentation built on Oct. 20, 2026, 1:07 a.m.