flowdist {cartograflow} | R Documentation |
From a layer of areal spatial features, compute and threshold a continuous distance matrix. The result is either a matrice of distances between ODs, or a flow matrix based on the distance travelled between ODs ; both can be used for filtering flow before flow mapping (flowmap)
flowdist(tab, dist.method, result)
tab |
the input flow dataset |
dist.method |
distance calculation algorithm, default is euclidian calculation |
result |
Choose Building a "flowdist" or a simple "dist" matrice. See Details |
– result = "dist" is the simple resulting distance matrice.
– result = "flowdist" is the resulting distance matrice with additional calculated parameters.
– It is also possible to filter flow by a level of distance travelled.
(1) A flowdata set with continuous distances calculations. See dist.method parameter
(2) A flowdata set with movement from euclidian distances calculations
library(cartograflow)
library(sf)
data(flowdata)
map <- st_read(system.file("shape/MGP_TER.shp", package = "cartograflow"))
tabflow <- flowjointure(
geom = "area", bkg = map, DF.flow = flows, origin = "i",
destination = "j", id = "EPT_NUM", x = "X", y = "Y"
)
# Format long with only origin, destination and distance parameters:
tab.distance <- flowdist(tabflow, dist.method = "euclidian", result = "dist")
# Format long with with all parameters: coordinates, distance, mouvement
tab.distance <- flowdist(tabflow, dist.method = "euclidian", result = "flowdist")