getSpatialTiles-methods: Split a Spatial object into tiles

Description Usage Arguments Value Author(s) Examples

Description

Split a Spatial object into tiles

Usage

1
2
3
4
5
6
7
8
9
## S4 method for signature 'Spatial'
getSpatialTiles(
  obj,
  block.x,
  block.y = block.x,
  overlap.percent = 0,
  limit.bbox = TRUE,
  return.SpatialPolygons = TRUE
)

Arguments

obj

output of the GDALinfo.

block.x

size of the block in x dimension.

block.y

size of the block in y dimension.

overlap.percent

optional overlap percent between tiles.

limit.bbox

optional bounding box.

return.SpatialPolygons

logical specificies whether to return a data frame or Spatial Polygons.

Value

List of object result of clipping

Author(s)

Tom Hengl

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
library(sp)
data(meuse.grid)
gridded(meuse.grid) <- ~x+y
tl <- getSpatialTiles(meuse.grid, block.x=1000)
image(meuse.grid)
lines(as(tl, "SpatialLines"))
## all at once:
pix.lst <- tile(meuse.grid, block.x=1000)

  library(rgdal)
  ## raster files via rgdal:
  fn = system.file("pictures/SP27GTIF.TIF",
                   package = "rgdal")
  obj <- GDALinfo(fn)
  ras.lst <- getSpatialTiles(obj, block.x=1000)
  offset <- c(ras.lst$offset.y[1], ras.lst$offset.x[1])
  region.dim <- c(ras.lst$region.dim.y[1],
                  ras.lst$region.dim.x[1])
  ## read the first tile:
  SP27GTIF_T1 <- readGDAL(fn, offset=offset,
                          region.dim=region.dim)
  str(SP27GTIF_T1)

landmap documentation built on Oct. 14, 2021, 5:24 p.m.