Linework Evaluation
library(spdep)
library(rgdal)
library(igraph)
library(sharpshootR)
library(lattice)
library(Cairo)
# load active survey
# x <- readOGR(dsn='l:/CA630/FG_CA630_OFFICIAL.gdb', layer='ca630_a', stringsAsFactors=FALSE)
x <- readOGR(dsn='l:/CA792/ca792_spatial/FG_CA792_OFFICIAL.gdb', layer='ca792_a', stringsAsFactors=FALSE)
## OGR data source with driver: OpenFileGDB
## Source: "l:/CA792/ca792_spatial/FG_CA792_OFFICIAL.gdb", layer: "ca792_a"
## with 2397 features
## It has 6 fields
# remove NOTCOM, DA, and empty (non-NA) symbols
x <- x[which(! x$MUSYM %in% c('NOTCOM', 'DA', ' ', '', 'WATER', 'W')), ]
# create polygon adjacency matrix
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='l:/CA630/MapUnits', 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=0.9, edge.scaling.factor=0.1)
plotSoilRelationGraph(res$adjMat, spanning.tree='max', edge.scaling.factor=0.1, vertex.scaling.factor=1.5)
# compute diversity by map unit symbol
g <- plotSoilRelationGraph(res$adjMat, vertex.scaling.factor = 1, plot.style = 'none')
dotplot(sort(graph.diversity(g)))
This document is based on
aqp version and
soilDB version .