writeEpmSpatial {epm}R Documentation

Write epmGrid Spatial Object to Disk

Description

Writes the grid to disk for use in other GIS applications.

Usage

writeEpmSpatial(x, filename, ...)

Arguments

x

object of class epmGrid

filename

filename to be written to, with the appropriate file extension

...

additional arguments to be passed to st_write or writeRaster.

Details

For hexagonal grid systems, appending .shp to the filename will result in a shapefile, whereas appending .gpkg results in a geopackage file. See st_write for additional options. For square grid cells, appending .tif will result in a GeoTiff file being written to disk. If no extensions are included with the filename, then this function will default to geopackage files for hexagonal grids and GeoTiffs for square grids.

Value

the object is written to disk, nothing is returned.

Author(s)

Pascal Title

Examples


tamiasEPM
tamiasEPM2 <- createEPMgrid(tamiasPolyList, resolution = 50000,
cellType = 'square', method = 'centroid')
writeEpmSpatial(tamiasEPM, filename = paste0(tempdir(), '/tamiasGrid.shp'))
writeEpmSpatial(tamiasEPM, filename = paste0(tempdir(), '/tamiasGrid.gpkg'))
unlink(paste0(tempdir(), '/tamiasGrid.gpkg'))
# will automatically append .gpkg
writeEpmSpatial(tamiasEPM, filename = paste0(tempdir(), '/tamiasGrid')) 

writeEpmSpatial(tamiasEPM2, filename = paste0(tempdir(), '/tamiasGrid.tif'))
unlink(paste0(tempdir(), '/tamiasGrid.tif'))
# will automatically append .tif
writeEpmSpatial(tamiasEPM2, filename = paste0(tempdir(), '/tamiasGrid'))

# remove files generated by example
unlink(paste0(tempdir(), '/tamiasGrid', c('.dbf', '.gpkg', '.prj', '.shp', '.shx', '.tif')))


[Package epm version 1.1.2 Index]