points_to_od | R Documentation |
Takes a series of geographical points and converts them into a data.frame representing the potential flows, or 'spatial interaction', between every combination of points.
points_to_od(p, interzone_only = FALSE, ids_only = FALSE) points_to_odl(p, interzone_only = FALSE, ids_only = FALSE, crs = 4326)
p |
A spatial points object or a matrix of coordinates representing points |
interzone_only |
Should the result only include interzonal OD pairs, in which
the ID of the origin is different from the ID of the destination zone?
|
ids_only |
Should a data frame with only 2 columns (origin and destination IDs)
be returned? The default is |
crs |
The coordinate reference system of the output, if not known in |
points_to_odl()
generates the same output but returns
a geographic object representing desire lines in the class sf
.
library(sf) p = od_data_centroids[1:3, ] points_to_od(p) points_to_od(p, ids_only = TRUE) (l = points_to_odl(p, interzone_only = TRUE)) plot(l) (od = points_to_od(p, interzone_only = TRUE)) l2 = od_to_sf(od, od_data_centroids) l2$v = 1 (l2_oneway = od_oneway(l2)) plot(l2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.