tiling: Tiling raster or Spatial-class Grid or Pixels object

Description Usage Arguments Value Author(s) See Also Examples

View source: R/tiling.R

Description

Tiling raster or Spatial-class Grid or Pixels (data frame) object to smaller parts with optional overlap.

Usage

1
2
3
tiling(filename,tilesize=500,overlapping=50, aspoints= FALSE, 
       asfiles=FALSE,tilename="tile", format="GTiff", 
       tiles_folder=paste(getwd(),'tiles',sep='/'), parallel.processing=FALSE, cpus=6)

Arguments

filename

raster object, SpatialPixels* object, SpatialGrid* object or file path of raster object stored on the disk (can be read via readGDAL), for more details see raster. The resolution of object should be the same in x and y direction.

tilesize

tile size in cells in x direction. nx = ny is assumed, total number of tile cells is tilesize by tilesize.

overlapping

overlapping cells in each direction

aspoints

if TRUE tiles are in form of SpatialPointsDataFrame

asfiles

if TRUE tiles are stored on local drive as raster objects

tilename

prefix given to file names

format

file format, see writeRaster

tiles_folder

folder to be created for tiles storage

parallel.processing

if TRUE parralel processing is performed via sfLapply

cpus

number of proccesing units

Value

The list of tiles in raster format or in SpatialPointsDataFrame format if aspoints=TRUE

Author(s)

Milan Kilibarda [email protected]

See Also

pred.strk

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
data(regdata) 
str(regdata@sp) # DEM and TWI data for Serbia at 1 km resolution
dem=regdata@sp['dem']
library(sp)
spplot(dem,  col.regions=bpy.colors() )

str(dem)
# tiling dem in tiles 250x250 with 25 cells overlap
tiles = tiling(dem,tilesize=250,overlapping=25,aspoints=TRUE)
# number of tiles
length(tiles)

image(dem)
points(tiles[[1]] , pch='-' ,col ='green')
points(tiles[[2]], pch='.')

str(tiles[[1]])

meteo documentation built on May 2, 2019, 3:29 p.m.