dgcellstogrid | R Documentation |
Returns the coordinates constituting the boundary of a specified set of cells. Duplicates are eliminated to reduce processing and storage requirements.
dgcellstogrid(dggs, cells, savegrid = NA, return_sf = TRUE)
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 |
Returns an sf object.
If !is.na(savegrid)
, returns a filename.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.