spatialEco (version 1.3-0)

asc.from.raster: Raster conversion functions for adehabitat, raster and sp packages

Description

Raster conversion functions for adehabitat, raster and sp packages

Usage

asc.from.raster(x)

raster.from.asc(x, projs = NA)

asc.from.sp(x)

sp.from.asc(x, projs = sp::CRS(as.character(NA)))

as.asc( x, xll = 1, yll = 1, cellsize = 1, type = c("numeric", "factor"), lev = levels(factor(x)) )

Arguments

x

is an object of class 'asc', 'RasterLayer' or 'SpatialGridDataFrame'. For the function as.asc, a matrix

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 "numeric" or "factor"

lev

if type = "factor", either a vector giving the labels of the factor levels, or the name of a file giving the correspondence table of the map see adehabitat as.asc helpfile details

Value

Returns an object of class requested.

Examples

Run this code
# NOT RUN {
library(sp)
library(raster)

#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)) )

# }

Run the code above in your browser using DataCamp Workspace