Description Usage Arguments Details Value See Also Examples
View source: R/osm_cleaning_functions.R
Fast search for the nearest point to another set of points
1 |
x |
a SF data frame of POINTS |
y |
a SF data frame of POINTS |
clusters |
a list of integers, default NULL |
If clusters is null will find the nearest y point for each x point
and return a list of two vectors indexes of y length(x) and a distances
length(x). If clusters is a list e.g. from cluster_junction then the
indexes are replaced with the matching indexes of clusters
Returns an list of ids and distances
Other OSM:
cluster_junction(),
line_segment_sf(),
nn_line(),
osm_consolidate(),
osm_get_junctions(),
osm_main_roads()
1 2 3 4 5 6 7 8 9 10 11 | ## Not run:
junctions = osm_get_junctions(osm)
junction_clusters = cluster_junction(junctions)
# Find the nearest junction
near_junction = nn_point(crash_junction, junctions)
# Find the nearest junction cluster
near_cluster = nn_point(crash_junction, junctions, clusters = junction_clusters$junction_ids)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.