generateGrid: Generates a grid in a given local CRS that is, by default,...

View source: R/generateGrid.R

generateGridR Documentation

Generates a grid in a given local CRS that is, by default, returned as SpatialPolygonsDataFrame in WGS84.

Description

Implementation of a simple grid generation function producing a SpatialPolygonsDataFrame to be used as target in geomerge.

Usage

generateGrid(extent, size, local.crs, makeWGS84 = TRUE, silent = FALSE)

Arguments

extent

SpatialPolygonsDataFrame that defines the (minimum) extent of the grid to be generated.

size

size of the grid cells in m.

local.crs

definition of the local (projected) CRS the grid is spanned in. Has to be class "CRS" (from sp).

makeWGS84

Boolean switch indicating whether or not the grid is returned in WGS84. Default = TRUE.

silent

Boolean switch to suppress any (non-critical) warnings and messages. Default = FALSE.

Value

Returns an object of SpatialPolygonsDataFrame that spans the grid with spatial resolution given by size.

Author(s)

Karsten Donnay and Andrew M. Linke.

References

Andrew M. Linke, Karsten Donnay. (2017). "Scale Variability Misclassification: The Impact of Spatial Resolution on Effect Estimates in the Geographic Analysis of Foreign Aid and Conflict." Paper presented at the International Studies Association Annual Meeting, February 22-25 2017, Baltimore.

See Also

geomerge-package, geomerge

Examples

require(sp)
data(geomerge)

# Generate grid with 10 km cell size in local CRS for Nigeria
states.grid <- generateGrid(states,10000,local.crs=CRS("epsg:26391"),silent=TRUE)

geomerge documentation built on Oct. 20, 2023, 5:08 p.m.