ptitle / epm

An R package for the calculation of taxonomic, phenotypic and phylogenetic metrics across grid cells.
GNU General Public License v3.0
12 stars 3 forks source link

Export the result to GeoTIFF #1

Closed firmanhadi closed 3 years ago

firmanhadi commented 3 years ago

Dear @ptitle,

Thank you for creating the package. I would like to ask how to export the result (epmGrid) to GeoTIFF for plotting in QGIS. Thank you.

Regards,

Firman.

ptitle commented 3 years ago

I'm planning on writing a small dedicated function for this to be included in the package, but in the meantime, if the epm object is called xx:

# if this is a hexagonal grid epm object
sf::st_write(xx[[1]][attributes(xx)$metric], 'epmSpatial.shp')

# if this is a square grid epm object
terra::writeRaster(xx[[1]][attributes(xx)$metric], '~/Downloads/epmSpatial.tif')