Description Usage Arguments Details Value Author(s) Examples
View source: R/asc.from.raster.R
asc.from.raster
and asc.from.sp
extracts data
from objects of class 'RasterLayer' (raster package) and
class 'SpatialGridDataFrame' (sp package) into an object of
class 'asc' (SDMTools & adehabitat packages).
raster.from.asc
and sp.from.asc
does the
reverse.
as.asc
creates an object of class
'asc' (SDMTools & adehabitat packages) from a matrix of
data. Code & helpfile associated with as.asc
were
modified from adehabitat package.
1 2 3 4 5 6 7 8 9 10 | asc.from.raster(x)
raster.from.asc(x, projs = NA)
asc.from.sp(x)
sp.from.asc(x, projs = CRS(as.character(NA)))
as.asc(x, xll = 1, yll = 1, cellsize = 1, type = c("numeric", "factor"),
lev = levels(factor(x)))
|
x |
is an object of class 'asc', 'RasterLayer' or
'SpatialGridDataFrame'. For the function |
projs |
is a CRS projection string of the Proj4 package |
xll |
the x coordinate of the center of the lower left pixel of the map |
yll |
the y coordinate of the center of the lower left pixel of the map |
cellsize |
the size of a pixel on the studied map |
type |
a character string. Either |
lev |
if |
These functions provide capabilities of using scripts / functions from many packages including adehabitat (plus e.g, SDMTools), sp (plus e.g., maptools, rgdal) and raster.
Returns an object of class requested.
Jeremy VanDerWal jjvanderwal@gmail.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #create a simple object of class 'asc'
tasc = as.asc(matrix(rep(x=1:10, times=1000),nr=100)); print(tasc)
str(tasc)
#convert to RasterLayer
traster = raster.from.asc(tasc)
str(traster)
#convert to SpatialGridDataFrame
tgrid = sp.from.asc(tasc)
str(tgrid)
#create a basic object of class asc
tasc = as.asc(matrix(rep(x=1:10, times=1000),nr=100)); print(tasc)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.