etrsPropValue: Computes a single figure by each reference grid cell using...

Description Usage Arguments Value Examples

Description

Proportional calculation: the cell takes a calculated value depending on the values of the units falling inside and their share within the cell. This method seems very appropriate for countable variables. Cell value = Σ ( V i * Share i ) V i = Value of unit i, Share i = Share of unit i within the cell

Usage

1
2
etrsPropValue(the.etrs.grid = "EtrsGrid",
  the.surface = "SpatialPoygonsDataFrame", surface.value.col = "numeric")

Arguments

the.etrs.grid

An object of the class EtrsGrid

the.surface

An object of class EtrsSurfaface

Value

An EtrsSurface

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
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")),VALUE=c(20,10,50))
Source.Surface <-SpatialPolygonsDataFrame(sps,data = df)
Source.Surface.propcal<-etrsSurface(input.surface = Source.Surface,over.method.type = "PropCal",surface.value.col = 2,cell.size = 1000)
plot(Source.Surface.propcal,lty=3,lwd=1.2,border=3)
plot(EtrsTransform(Source.Surface),add=TRUE)
x.y.s.s <-coordinates(EtrsTransform(Source.Surface))
x.y.propcal <-coordinates(Source.Surface.propcal)
text(x.y.s.s[,1],x.y.s.s[,2],paste("ID=",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.s.s[,1],x.y.s.s[,2]-200,paste("VALUE =",Source.Surface@data$VALUE),col=4,cex = 1.5)
text(x.y.propcal[,1],x.y.propcal[,2]+100,Source.Surface.propcal@data$CELLVALUE,col=3)

etsakl/DasyMapR documentation built on May 16, 2019, 9:07 a.m.