Description Usage Arguments Details Value Author(s) See Also Examples
Tiles objects of class "Spatial*"
or "RasterLayer*"
into regular blocks.
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## S4 method for signature 'SpatialPointsDataFrame'
tile(x, y, block.x, ...)
## S4 method for signature 'SpatialPixelsDataFrame'
tile(x, y, block.x, ...)
## S4 method for signature 'SpatialPolygonsDataFrame'
tile(x, y, block.x, tmp.file = TRUE,
program, show.output.on.console = FALSE, ...)
## S4 method for signature 'SpatialLinesDataFrame'
tile(x, y, block.x, tmp.file = TRUE,
program, show.output.on.console = FALSE, ...)
## S4 method for signature 'RasterLayer'
tile(x, y, block.x, tmp.file = TRUE,
program, show.output.on.console = FALSE, ...)
|
x |
object of class |
y |
list of |
block.x |
numeric; size of block in meters or corresponding mapping units |
tmp.file |
logical; specifies whether to generate a temporary file |
program |
character; location of the auxiliary program in the system |
show.output.on.console |
logical; specifies whether to print the progress of a function |
... |
optional arguments that can be passed to the |
When working with objects of type "SpatialLinesDataFrame"
, "SpatialPolygonsDataFrame"
and or "RasterLayer"
, the function looks for FWTools binary files ogr2ogr
and warp
. FWTools is a separate program and must be installed separately.
Returns a list of objects of the same class as the input object.
Tomislav Hengl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ## spatial pixels:
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)
## Not run: ## lines:
library(plotKML)
data(eberg_contours)
line.lst <- tile(eberg_contours, block.x=5000)
spplot(line.lst[[1]][2])
## polygons:
data(eberg_zones)
## this one requires ogr2ogr function:
pol.lst <- tile(eberg_zones, block.x=5000)
spplot(pol.lst[[1]][1])
## raster files via rgdal:
library(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)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.