dgcellstogrid {dggridR} | R Documentation |
Return boundary coordinates for specified cells
Description
Returns the coordinates constituting the boundary of a specified set of cells. Duplicates are eliminated to reduce processing and storage requirements.
Usage
dgcellstogrid(dggs, cells, savegrid = NA, return_sf = TRUE)
Arguments
dggs |
A dggs object from dgconstruct() |
cells |
The cells to get the boundaries of |
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) |
return_sf |
logical. If |
Value
Returns an sf object.
If !is.na(savegrid)
, returns a filename.
Examples
library(dggridR)
data(dgquakes)
#Construct a grid with cells about ~1000 miles wide
dggs <- dgconstruct(spacing=1000,metric=FALSE)
dgquakes$cell <- dgGEO_to_SEQNUM(dggs,dgquakes$lat,dgquakes$lon)$seqnum
#Get grid cells for the earthquakes identified
grid <- dgcellstogrid(dggs, dgquakes$cell)
[Package dggridR version 3.1.0 Index]