Skip to contents

Wrapper function for sf::st_relate(). Computes a sparse index list of contiguities for an sf POLYGON object.

Usage

polyg_contiguity(polygons_input, contiguity = "queen", fill_empty = FALSE)

Arguments

polygons_input

object of class sf, sfc or sfg with geometry type POLYGON or MULTIPOLYGON.

contiguity

character; either "queen", "rook" or "bishop". Default is "queen".

fill_empty

logical; should empty indices be filled? Default is FALSE.

Value

A sparse index list of contiguities.

Details

Wrapper for sf::st_relate() with DE9-IM predicate F***T**** for queen contiguity, F***1**** for rook contiguity and F***0**** for bishop contiguity. Setting fill_empty to TRUE guarantees at least one index per polygon by adding self-neighboring.