dgrectgrid: Return the coordinates constituting the boundary of cells...

View source: R/dggridR.R

dgrectgridR Documentation

Return the coordinates constituting the boundary of cells within a specified region

Description

Note: This may generate odd results for very large rectangles, because putting rectangles on spheres is weird... as you should know, if you're using this package.

Usage

dgrectgrid(
  dggs,
  minlat = -1,
  minlon = -1,
  maxlat = -1,
  maxlon = -1,
  cellsize = 0.1,
  savegrid = NA
)

Arguments

dggs

A dggs object from dgconstruct()

minlat

Minimum latitude of region of interest

minlon

Minimum longitude of region of interest

maxlat

Maximum latitude of region of interest

maxlon

Maximum longitude of region of interest

cellsize

Distance, in degrees, between the sample points used to generate the grid. Small values yield long generation times while large values may omit cells.

savegrid

If savegrid is set to a file path, then a shapefile containing the grid is written to that path and the filename is returned. No other manipulations are done. Default: NA (do not save grid, return it)

Value

Returns an sf object. If !is.na(savegrid), returns a filename.

Examples

library(dggridR)
dggs <- dgconstruct(spacing=1000,metric=FALSE,resround='down')

#Get grid cells for the conterminous United States
grid <- dgrectgrid(dggs,
               minlat=24.7433195, minlon=-124.7844079,
               maxlat=49.3457868, maxlon=-66.9513812)

dggridR documentation built on Jan. 22, 2023, 1:15 a.m.