Created
August 10, 2012 15:29
-
-
Save datagistips/3315054 to your computer and use it in GitHub Desktop.
Sextante QGIS - R script for analysing neighbord relationships below a certain distance threshold
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##[datagistips]=group | |
##polygons=vector | |
##distance=number 10 | |
##output=output vector | |
library("spdep") | |
nb = poly2nb(polygons, snap=distance) | |
polygons[["nNeigh"]] = card(nb) | |
polygons[["neighGroup"]] = n.comp.nb(nb)[["comp.id"]] | |
output = polygons |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment