Learn R Programming

vetools (version 1.3-28)

get.Grid.size: Build a grid around an object of class "SpatialPolygonsDataFrame"

Description

Construct a grid that contains the shape (object of class "SpatialPolygonsDataFrame") and is spaced by a given distance.

Usage

get.Grid.size(shape, origin.grid, x.res = 0.05, y.res = 0.05, plot = FALSE)

Arguments

shape
Object of class "SpatialPolygonsDataFrame"
origin.grid
External grid constructed by this same function. See Details
x.res
Longitudinal separation in degrees, defaults to 0.05 degrees
y.res
Latitudinal separation in degrees, defaults to 0.05 degrees
plot
Boolean. Shows the constructed grid over the shape

Value

ncol
Number of columns of the grid
nrow
Number of rows of the grid
longs
Longitudinal position for each column of the grid
lats
Latitudinal position for each row of the grid
x.res
Longitudinal resolution used
y.res
Latitudinal resolution used

Details

About the origin.grid parametre. Say there is the need to work on a nation-wide scale. For this you construct a grid over the whole shapes constituting the country, naming is extremal or external grid. Now to study in detail a given state it is recomemded to construct a smaller grid covering only state of interest and not the whole nation. Doing this it is necesary to asure that the smaller grid intersects the external grid. Providing the parametre commandorigin.grid constructs a small grid over the given shape but that overlaps exactly with the external grid commandorigin.grid. An example that illustrates the above could be:
# External grid
VE <- get.shape.state(get.shape.state()$Abb)
External.Grid <- get.Grid.size(VE, plot=F, x.res=1, y.res=1)
# Small grid over a state
NE <- get.shape.state(c("MI","NE"))
Small.Grid <- get.Grid.size(NE, External.Grid, plot=T, x.res=0.25, y.res=0.25)

grid.pngGrid overlay example

See Also

get.shape.venezuela, get.shape.state, get.shape.range.

Examples

Run this code

Run the code above in your browser using DataLab