flowcontig: Builds an ordinal distance matrices from a spatial features...

View source: R/flowcontig.R

flowcontigR Documentation

Builds an ordinal distance matrices from a spatial features background

Description

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)

Usage

flowcontig(bkg, code, k, algo)

Arguments

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.

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 ;
-ordre=1 : ODs places are adjacent, ie the flow have to cross only 1 boundary
-ordre=2 : ODs places are distant from 2 borders
-ordre=k : ODs places are distant from k borders
The function returns also the (k) number of the layer

Value

a contiguity matrice with the k orders of adjacency

Examples

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
)


cartograflow documentation built on Oct. 18, 2023, 1:07 a.m.