Learn R Programming

ramps (version 0.6-12)

genUSStateGrid: Generating a Grid over a US State

Description

This function generate a grid of points over a US state with given increment size or resolution.

Usage

genUSStateGrid(state, incr = NULL, resolution = NULL)

Arguments

state
the name of a US state.
incr
a numeric vector of length 2 specifying the increment in longitude and latitude.
resolution
a numeric vector of length 2 specifying the size of the grid in longitude and latitude.

Value

  • A data.frame:
  • lonlongitude of the grid point.
  • latlatitude of the grid point.
  • idthe id number of the county in which the grid point is located.
  • countythe name of the county in which the grid point is located.

See Also

genUSStateSites

Examples

Run this code
mygrid <- genUSStateGrid('iowa', resolution=c(8, 4))
map('state', 'iowa')
points(mygrid)

Run the code above in your browser using DataLab