dgearthgrid {dggridR}R Documentation

Return the coordinates constituting the boundary of cells for the entire Earth

Description

Note: If you have a high-resolution grid this may take a very long time to execute.

Usage

dgearthgrid(dggs, savegrid = NA, return_sf = TRUE)

Arguments

dggs

A dggs object from dgconstruct().

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 FALSE, a long-format data frame giving the coordinates of the vertices of each cell is returned. This is is considerably faster and more memory efficient than creating an sf data frame.

Value

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

Examples


library(dggridR)
dggs         <- dgconstruct(res=20)
res          <- dg_closest_res_to_spacing(dggs,spacing=1000,round='down',metric=FALSE)
dggs         <- dgsetres(dggs,res)
gridfilename <- dgearthgrid(dggs,savegrid=tempfile(fileext=".shp")) #Save directly to a file


[Package dggridR version 3.1.0 Index]