Learn R Programming

geozoning (version 1.0.0)

smoothingZone: smoothingZone

Description

smoothingZone

Usage

smoothingZone(z, width, boundary, disp = TRUE)

Arguments

z

zone to be modified (SpatialPolygon)

width

smoothing parameter in gBuffer if dilatation is followed by erosion

boundary

union of all zones of the corrected map (result of correctBoundaryMap())

disp

logical, if TRUE, display the value of "widthExt" in case of dilatation->erosion, otherwise display "widthInt" in case of erosion->dilatation

Value

a zone (SpatialPolygon)

Details

function that returns a new smoothed zones. Attention: this function is just a tool for a better visualisation of the map, if it doesn't work properly, please choose another value of the width parameter.

Examples

Run this code
# NOT RUN {
seed=1
map=genMap(DataObj=NULL,seed=seed,disp=FALSE,krig=2,typeMod="Exp",nPointsK=500)
criti = correctionTree(qProb = c(0.5), map = map)
Z = criti$zk[[1]][[1]]$zonePolygone
lab = criti$zk[[1]][[1]]$lab
# zones' correction
res = correctBoundaryMap(Zi = Z, map = map)
Z = res$Z
# map boundary after correction
boundary = Z[[1]]
for(i in 2:length(Z)){
  boundary = rgeos::gUnion(boundary, Z[[i]])
}
# plot map
plotM(map = map, Z = Z, lab = lab, byLab = FALSE)
# smoothing
zone = Z[[2]]
newZone = smoothingZone(z = zone, width = 0.05, boundary = boundary)
sp::plot(zone)
sp::plot(newZone)
# }

Run the code above in your browser using DataLab