This function takes a matrix with 4 columns representing origin and destination coordinates and returns a data frame with 3 columns with the ID of each linestring, plus the coordinates representing origin and destination coordinates. Essentially the function is a pivot, converting from wide to long format, to feed into other functions for creating geographic desire lines.
od_coordinates_ids(odc)
od_coordinates_ids(od_coordinates(od_data_df, p = od_data_zones, sfnames = TRUE))
#> id x y
#> 1 1 -1.544730 53.80928
#> 2 1 -1.546024 53.79587
#> 3 2 -1.518710 53.79223
#> 4 2 -1.546024 53.79587
#> 5 3 -1.546024 53.79587
#> 6 3 -1.546024 53.79587
#> 7 4 -1.517695 53.77475
#> 8 4 -1.546024 53.79587
#> 9 5 -1.564756 53.81763
#> 10 5 -1.561391 53.80498
#> 11 6 -1.546024 53.79587
#> 12 6 -1.561391 53.80498
#> 13 7 -1.561391 53.80498
#> 14 7 -1.546024 53.79587