Match two sets of lines based on similarity
This function is a wrapper around gDistance that matches lines based on the Hausdorff distance
line_match(l1, l2, threshold = 0.01, return_sp = FALSE)
l1 |
A spatial object |
l2 |
A spatial object |
threshold |
The threshold for a match - distances greater than this will not count as matches |
return_sp |
Should the function return a spatial result (FALSE by default) |
Other lines:
angle_diff()
,
geo_toptail()
,
is_linepoint()
,
line2df()
,
line2points()
,
line_bearing()
,
line_breakup()
,
line_midpoint()
,
line_sample()
,
line_segment()
,
line_via()
,
mats2line()
,
n_sample_length()
,
n_vertices()
,
onewaygeo()
,
points2line()
,
toptail_buff()
,
toptailgs()
,
update_line_geometry()
## Not run: x1 <- 2:4 x2 <- 3:5 match(x1, x2) # how the base function works l1 <- flowlines[2:4, ] l2 <- routes_fast[3:5, ] (lmatches <- line_match(l1, l2)) # how the stplanr version works l2matched <- l2[lmatches[!is.na(lmatches)], ] plot(l1) plot(l2, add = TRUE) plot(l2matched, add = TRUE, col = "red") # showing matched routes l2matched2 <- line_match(l1, l2, return_sp = TRUE) identical(l2matched, l2matched2) # decreasing the match likelihood via the threshold line_match(l1, l2, threshold = 0.003) ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.