dneigh {elsa} | R Documentation |
This function identifies the neighbours features (points or polygons) given the specified distance (in kilometer for geographic coordinates, i.e., if longlat=TRUE; and in the map unit for projected datasets, i.e., if longlat = FALSE) and builds a list of neighbours.
The neighd function returns a list including distance of each feature to neighbourhood locations.
dneigh(x,d1,d2,longlat,method,...)
neighd(x,d1,d2,longlat,...)
x |
a SpatialPoints, or SpatialPolygons or a matrix (or data.frame) of point coordinates or a SpatialPoints object |
d1 |
lower local distance bound (if longlat = TRUE, in kilometer; otherwise in the spatial unit of the dataset, e.g., meter) |
d2 |
upper local distance bound (if longlat = TRUE, in kilometer; otherwise in the spatial unit of the dataset, e.g., meter) |
longlat |
TRUE if point coordinates are longitude-latitude |
method |
if x is SpatialPolygons, specifies the method to identify the neighbour polygons; see details |
... |
additional arguments; see details |
The function is mostly based on dnearneigh
(for points), and poly2nb
(for polygons), implemented in the spdep package by Roger Bivand.
When x
is SpatialPolygons, there is two methods (can be specified through method
) to identify the neighbour polygons. The default method ('bound') seeks the polygons that has one or more points in their boundaries within the specified distance (d
), while the method 'centroid' considers any polygon with a centriod within the given distance.
One additional argument is queen (default is TRUE), can beused only when x is SpatialPolygons, and method='bound', if TRUE, a single shared boundary point meets the contiguity condition, if FALSE, more than one shared point is required.
neighd
for SpatialPolygons returns distances of each polygon to centroids of neighbor polygons.
An object of class neighbours
Babak Naimi naimi.b@gmail.com
Naimi, B., Hamm, N. A., Groen, T. A., Skidmore, A. K., Toxopeus, A. G., & Alibakhshi, S. (2019). ELSA: Entropy-based local indicator of spatial association. Spatial statistics, 29, 66-88.
#