Description Value Slots Examples
The EtrsSourceSurface class holds the basic information for Source surface represanation in ETRS-LAEA grid form
An EtrsSourceSurface Object
SpatialPolygonsDataFrame.
the input surface plus new data columns
over.method.type
character. MaxArea for categorical data PropCal for numeric #'values
cell.size
numeric. Indexing the column of data frame that contains the value of #'interest
CELLVALUE
character. The size of the cell (the new map unit)
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 | # test Source Surface -------------------------------------------------------
x <- round(runif(1, min = 4320200, max = 4322000), 1)
y <- round(runif(1, min = 3210000, max = 3212000), 1)
xy <- cbind(x, y)
size = round(runif(1,min = 1500,max = 2000),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))
sps <-
SpatialPolygons(list(pl1,pl2),proj4string = CRS("+init=epsg:3035"))
df <-
data.frame(AREA = sapply(slot(sps, "polygons"), function(x)
slot(x, "area")),VALUE=c(10,20),row.names = sapply(slot(sps, "polygons"), function(x)
slot(x, "ID")))
sps<-SpatialPolygonsDataFrame(sps,data = df)
sps.source<-etrsSourceSurface(input.surface = sps,over.method.type = "PropCal",surface.value.col = 2,cell.size = 500)
plot(sps,border=2,lwd=3,col=rgb(.4,sps@data$VALUE/100,0,.25))
text(coordinates(sps)[,1],coordinates(sps)[,2],paste("VALUE=",sps@data$VALUE,sep=" "),cex=1)
text(coordinates(sps)[,1],coordinates(sps)[,2]+100,paste("ID=",row.names(sps@data),sep=" "),cex=1.2)
plot(sps.source,add=TRUE,lty=3,border=4)
text(coordinates(sps.source)[,1],coordinates(sps.source)[,2],sps.source@data$CELLVALUE,col=4)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.