findBoundaryLines: Finding the regional boundaries

Description Usage Arguments Details Value Author(s) References Examples

View source: R/bound.R

Description

Method for identifying points on the boundaries between regions (in most cases biases between countries)

Usage

1
findBoundaryLines(polygons, projOrig, projNew, regCode = "regCode")

Arguments

polygons

A SpatialPolygonsDataFrame with the polygons defining the boundaries of each separate region.

projOrig

The original projection of the boundaries

projNew

If a different projection is wanted for the output

regCode

the column name of regions in the data polygons

Details

This function finds the points defining the boundary between two polygons and passes a SpatialPointsDataFrame with these points back. The result in mainly used by findRegionalBias for estimation of regional biases. The function is based on the boundary between the polygons being defined by the same points.

Value

A SpatialPointsDataFrame with points defining the boundaries between regions.

Author(s)

Jon Olav Skoien

References

http://www.intamap.org/

Skoien, J. O., O. P. Baume, E. J. Pebesma, and G. B. M. Heuvelink. 2010. Identifying and removing heterogeneities between monitoring networks. Environmetrics 21(1), 66-84.

Examples

 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
data(meuse)
observations = data.frame(x = meuse$x,y = meuse$y,value = log(meuse$zinc))
coordinates(observations) = ~x+y
pBoundaries = spsample(observations, 10, "regular", bb = bbox(observations) +  
                         matrix(c(-400,-400,400,400),ncol=2),offset=c(0,0))
gridded(pBoundaries) = TRUE
cs = pBoundaries@grid@cellsize[1]/2

Srl = list()
nb = dim(coordinates(pBoundaries))[1]
for (i in 1:nb) {
  pt1 = coordinates(pBoundaries)[i,]
  x1 = pt1[1]-cs
  x2 = pt1[1]+cs
  y1 = pt1[2]-cs
  y2 = pt1[2]+cs

  boun = data.frame(x=c(x1,x2,x2,x1,x1),y=c(y1,y1,y2,y2,y1))
  coordinates(boun) = ~x+y
  boun = Polygon(boun)
  Srl[[i]] = Polygons(list(boun),ID = as.character(i))
}
pBoundaries = SpatialPolygonsDataFrame(SpatialPolygons(Srl),
                                       data = data.frame(ID=c(1:nb)))
observations$ID = over(observations, geometry(pBoundaries))
blines = findBoundaryLines(pBoundaries, regCode = "ID")

intamapInteractive documentation built on May 19, 2017, 11:06 a.m.

Search within the intamapInteractive package
Search all R packages, documentation and source code