Returns the osmid of the graph node closest (in planar distance) to each
supplied coordinate.
Arguments
- g
An osm_graph.
- x, y
Numeric vectors of coordinates in the graph's CRS.
References
osmnxr is an R port of OSMnx. If you use it, please cite:
Boeing, G. (2025). Modeling and analyzing urban networks and amenities with OSMnx. Geographical Analysis, 57(4), 567–577. doi:10.1111/gean.70009
Examples
g <- example_osm_graph()
ox_nearest_nodes(g, x = 0, y = 0)
#> [1] 1