Is there a way to calculate the maximum distance between two polylines? I'm currently using the sf package to get the minimum distance, but I also need the maximum distance see the example below.
pts1<- data.frame(
x= c(-103.485342, -103.482808),
y = c(31.348758, 31.376947))
) %>%
sf::st_as_sf(coords = c("x","y"))
st_crs(pts1)<- "+init=epsg:2257"
pts2<- data.frame(
x= c(-103.492822, -103.484231),
y = c(31.348181, 31.377191))
) %>%
sf::st_as_sf(coords = c("x","y"))
st_crs(pts2)<- "+init=epsg:2257"
a <- pts1 %>% st_coordinates() %>% st_linestring()
b<- pts2 %>% st_coordinates() %>% st_linestring()
min_dist<-st_distance(a,b,by_element = T)
max_dist<- ???
Thanks