Description Usage Arguments Details Value Author(s) Examples
View source: R/polygonAdjacency.R
This function utilizes the 'spdep' and 'igraph' packages to evaluate several measures of spatial connectivity.
1 | polygonAdjacency(x, v='MUSYM', ...)
|
x |
a |
v |
name of the field in the attribute table to use when searching for 'common lines', see details |
... |
additional arguments passed to |
Pending.
A list
object containing:
An integer vector of feature IDs, that share a common boundary and attribute v.commonLines
. Sometimes referred to as "common soil lines".
A weighted adjacency matrix
D.E. Beaudette
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ## Not run:
library(spdep)
library(rgdal)
library(igraph)
library(sharpshootR)
# load some data
x <- readOGR(dsn='L:/CA630/FG_CA630_OFFICIAL.gdb', layer='ca630_a', stringsAsFactors=FALSE)
# remove NOTCOM, DA, and empty (non-NA) symbols
x <- x[which(! x$MUSYM
# compute spatial adjacency summary
res <- polygonAdjacency(x, v='MUSYM')
# graphical check: slow for large number of features
plot(x)
plot(x[res$commonLines, ], col='red', add=TRUE)
# save to SHP
writeOGR(x[res$commonLines, ], dsn='.',
layer='common-soil-lines', driver='ESRI Shapefile',
overwrite_layer=TRUE)
# plot spatial adjacency information
par(mar=c(0,0,0,0))
plotSoilRelationGraph(res$adjMat,
vertex.scaling.factor = 1)
plotSoilRelationGraph(res$adjMat, spanning.tree='max',
edge.scaling.factor=0.1, vertex.scaling.factor=1)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.