Description Usage Arguments Value Examples
The Maximum area criteria: the cell takes the value of the unit which covers most of the cell area. It should be a good option for uncountable variables
1 | etrsMaxArea(the.etrs.grid = "EtrsGrid", the.surface = "EtrsSurface")
|
the.etrs.grid |
An object of the class EtrsGrid |
the.surface |
an object of class EtrsSurfaface |
An EtrsSurface
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 | x <- round(runif(1, min = 4321000, max = 4322000), 1)
y <- round(runif(1, min = 3211000, max = 3212000), 1)
xy <- cbind(x, y)
size = round(runif(1,min = 1500,max = 1500),0)
pl1 <-Polygons(list(Polygon(cbind(c(x,x + size,x + size,x,x),c(y,y,y + size,y + size,y) ))),round(runif(1,min = 1,max = 100),0))
x <- x + size
pl2 <- Polygons(list(Polygon(cbind(c(x,x + size,x + size,x,x),c(y,y,y + 2 * size,y + 2 * size,y)))),round(runif(1,min = 1,max = 100),0))
x<-x-size
y<-y+size
pl3 <-Polygons(list(Polygon(cbind(c(x,x + size,x + size,x,x),c(y,y,y + size,y + size,y) ))),round(runif(1,min = 1,max = 100),0))
sps <- SpatialPolygons(list(pl1,pl2,pl3),proj4string = CRS("+init=epsg:2100"))
df <-data.frame(val=c("R5","R40","R80"),row.names = sapply(slot(sps, "polygons"), function(x) slot(x, "ID")))
Source.Surface <-SpatialPolygonsDataFrame(sps,data = df)
# Uses the default etrsSurface method
Source.Surface.MaxArea <- etrsSurface(input.surface = Source.Surface, over.method.type = "MaxArea", cell.size = 1000)
Source.Surface.MaxArea <-
etrsSurface(input.surface = Source.Surface, over.method.type = "MaxArea", cell.size = 1000)
Source.Surface<-EtrsTransform(Source.Surface)
plot(Source.Surface)
plot(Source.Surface.MaxArea,lty = 3,lwd = 1.2,border = 3,add=TRUE)
x.y.s.s <- coordinates(EtrsTransform(Source.Surface))
x.y.max <- coordinates(Source.Surface.MaxArea)
text(x.y.s.s[,1],x.y.s.s[,2],Source.Surface@data$val,col = 4,cex = 1.5)
text(x.y.s.s[,1],x.y.s.s[,2] - 100,paste("Feature=",rownames(Source.Surface@data)),col = 4,cex = 1.2)
text(x.y.max[,1],x.y.max[,2],Source.Surface.MaxArea@data$FEATURE,col=3)
title("The 3 regions in Etrs Grid using Max Area Intergration")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.