Convert origin-destination coordinates into geographic desire lines

odc_to_sfc(odc)

Arguments

odc

A matrix containing coordinates representing line start and end points

Examples

(odc = od_coordinates(od_data_df, p = od::od_data_zones, sfnames = TRUE))
#>             x        y         x        y
#> 1   -1.544730 53.80928 -1.546024 53.79587
#> 3   -1.518710 53.79223 -1.546024 53.79587
#> 5   -1.546024 53.79587 -1.546024 53.79587
#> 6   -1.517695 53.77475 -1.546024 53.79587
#> 4   -1.564756 53.81763 -1.561391 53.80498
#> 5.1 -1.546024 53.79587 -1.561391 53.80498
#> 2   -1.561391 53.80498 -1.546024 53.79587
(l = odc_to_sfc(odc))
#> Geometry set for 7 features 
#> Geometry type: LINESTRING
#> Dimension:     XY
#> Bounding box:  xmin: -1.564756 ymin: 53.77475 xmax: -1.517695 ymax: 53.81763
#> CRS:           NA
#> First 5 geometries:
#> LINESTRING (-1.54473 53.80928, -1.546024 53.79587)
#> LINESTRING (-1.51871 53.79223, -1.546024 53.79587)
#> LINESTRING (-1.546024 53.79587, -1.546024 53.79...
#> LINESTRING (-1.517695 53.77475, -1.546024 53.79...
#> LINESTRING (-1.564756 53.81763, -1.561391 53.80...
plot(l)