R/od-funs.R
odc_to_sf.Rd
Convert origin-destination coordinates into geographic desire lines
odc_to_sf(odc, d = NULL, crs = 4326)
(odc = od_coordinates(od_data_df, p = 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_sf(odc))
#> Simple feature collection with 7 features and 0 fields
#> Geometry type: LINESTRING
#> Dimension: XY
#> Bounding box: xmin: -1.564756 ymin: 53.77475 xmax: -1.517695 ymax: 53.81763
#> Geodetic CRS: WGS 84
#> geometry
#> 1 LINESTRING (-1.54473 53.809...
#> 2 LINESTRING (-1.51871 53.792...
#> 3 LINESTRING (-1.546024 53.79...
#> 4 LINESTRING (-1.517695 53.77...
#> 5 LINESTRING (-1.564756 53.81...
#> 6 LINESTRING (-1.546024 53.79...
#> 7 LINESTRING (-1.561391 53.80...
plot(l)
lsfc = odc_to_sfc(odc)