Calculate and summarise selected metrics of building footprint polygons within zones.

fs_nnindex(X, zone = NULL, zoneField = NULL, unit = NULL)

# S3 method for sp
fs_nnindex(X, zone = NULL, zoneField = NULL, unit = NULL)

# S3 method for sf
fs_nnindex(X, zone = NULL, zoneField = NULL, unit = NULL)

# S3 method for sfc
fs_nnindex(X, zone = NULL, zoneField = NULL, unit = NULL)

Arguments

X

Spatial object with building footprints or their centroid locations.

zone

A spatial polygon object of sf or sp type. If omitted all observations in X are assumed to be within one zone and the area of the minimum bounding circle is used for the nearest neighbour index.

zoneField

(Optional) Column name of unique identifiers in zone to use. If omitted, the 'zoneID' will be numbered 1:nrow(zone).

unit

character or units object to define distance. Default NULL will attempt to coerce units to meters.

Value

data.table of zonal indices and values

Details

The nearest neighbour index (NNI) is a measure of spatial clustering. It compares the observed mean neighbour distances with a hypothetical maximum of dispersed observations given the area of the zone. Note that NNI is sensitive to changes in the zone area.

$$ NNI_z = \frac{\bar{NND_z}}{(0.5 * \sqrt{\frac{A_z}{n_z}}})$$, where z is the zone, A is the area, NND is the mean nearest neighbour distance, and n is the count. The value of NNI can range from 0 (fully disperse) to 2.15 (clustered), with values of 1 indicating spatial randomness.

The function uses fs_nndist to calculate the distance between centroids of the building footprints within the same spatial zone indicated by zone.

Note that this function is provided as a standalone calculation. The summary measure can be executed from within calculate_footstats by specifying what='nndist' and how='nnindex'.