flowcontig {cartograflow} | R Documentation |
From a layer of areal spatial features, compute an ordinal distance matrice
based on a k order criterion of adjacency or contiguity between origin and destination places .
The result is a neighbourhood graph that can be used for filtering flow values before flow mapping (flowmap)
flowcontig(bkg, code, k, algo)
bkg |
a layer of areal spatial features (eg. the map background) |
code |
spatial areal features code |
k |
order of adjacency or contiguity between two areal spatial features |
algo |
algorithm to use for ordinal distance calculation. Default is "Dijkstra's" algorithm. See Details. |
The (k=1,2,...,k) order of adjacency or contiguity, of an areal spatial features
background, is the number of spatial boundaries to be crossed between
a couple of origin-destination (ODs) places. The k number can be assimilated to a shortest path between two pair of nodes
Argument 'k' is to enter the number k of the contiguity matrix to be constructed ;
-kordre=1 : ODs places are adjacent, ie the flow have to cross only 1 boundary.
-kordre=2 : ODs places are distant from 2 borders
-kordre=k : ODs places are distant from k borders
The function returns also the (k) number of the layer
a contiguity matrice with the k orders of adjacency
library(cartograflow) library(sf) data(flowdata) map <- st_read(system.file("shape/MGP_TER.shp", package = "cartograflow")) graph_ckij_1 <- flowcontig(bkg = map, code = "EPT_NUM", k = 1, algo = "automatic") flowmap( tab = graph_ckij_1, fij = "ordre", origin.f = "i", destination.f = "j", bkg = map, code = "EPT_NUM", nodes.X = "X", nodes.Y = "Y", filter = FALSE )