transSampLoc: Re-project sample locations into simulation projection

View source: R/def_grid2.R

transSampLocR Documentation

Re-project sample locations into simulation projection

Description

transform samppts to raster projection matching coordinate reference system of the simulation landscape.

Usage

transSampLoc(
  samppts = NULL,
  range.epsg = 4326,
 
    raster.proj = "+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=37.5 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"
)

Arguments

samppts

a dataframe with 5 cols: pop, abbrev, lat, long, and N

range.epsg

epsg number for the projection in which the points are encoded (default 4326 -> wgs84)

raster.proj

proj4 string for the underlying raster

Details

Takes a dataframe of sample locations in a projection given by range.epsg (for example, range.epsg = 4326 corresponds to WGS84; see https://epsg.io) and reprojects into the projection given in raster.proj. Depends on the sf package to make the conversion.

Value

Feature collection with location of sampled populations converted to the coordinate reference system used in the simulation landscape

See Also

ashSetupLandscape, def_grid_pred2, getpophist2.cells, https://epsg.io

Examples

library(holoSimCell)
rs <- raster::brick(system.file("extdata/rasters/ccsm_160kmExtent_maxent.tif", package = "holoSimCell"))
newrs <- newLandscapeDim(rs,0.45)
samps <- transSampLoc(pts, range.epsg=4326, raster.proj=crs(rs)@projargs)
land <- def_grid_pred2(pred=newrs, samps=samps, raster.proj=crs(rs)@projargs)


stranda/holoSimCell documentation built on Aug. 4, 2023, 1:12 p.m.