rasterize.gdal: High performance rasterize function using gdalUtils.

Description Usage Arguments Value Examples

Description

This function rasterize a vector data by gdal binary utils. This is a wrap function of gdalUtils::gdal_rasterize.

Usage

1
rasterize.gdal(obj, field, res = 10000, extent = NULL)

Arguments

obj

a Spatial*DataFrame objects.

field

character.The column name of the variable to be transferred

res

numeric.Resolution of the output raster

extent

extent object.Spatial extent of output raster.If missing, the extent of x will be used.

Value

RasterLayer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
###############################
# rasterize points
###############################
library(raster)
r <- raster(ncols=36, nrows=18)
n <- 1000
x <- runif(n) * 360 - 180
y <- runif(n) * 180 - 90
xy <- cbind(x, y)
# with a SpatialPointsDataFrame
vals <- 1:n
p <- data.frame(xy, name=vals)
coordinates(p) <- ~x+y
## If you are using windows,you must set local GDAL installation options before running function####'
install.gdal()
r2 <- rasterize.gdal(p, field = 'name', res =res(r)[1],extent=extent(r))

seifer08ms/ROzone2 documentation built on May 29, 2019, 5:53 p.m.