bbox_sp: Bounding boxes as spatial objects

Description Usage Arguments Value Author(s) Examples

Description

Bounding boxes of raster (class Raster*) objects will be converted either to SpatialPointsDataFrame or SpatialPointsDataFrame.

This function extract the corners including the bounding box of the input raster or extension and writes either four spatial points or a rectangle as polygon.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
bbox_sp(raster, ...)

## S4 method for signature 'Extent'
bbox_sp(raster, proj4 = "", geom = "point", ...)

## S4 method for signature 'RasterLayer'
bbox_sp(raster, geom = "point", ...)

## S4 method for signature 'RasterStack'
bbox_sp(raster, geom = "point", ...)

## S4 method for signature 'RasterBrick'
bbox_sp(raster, geom = "point", ...)

Arguments

raster

An object of class Raster* or Extent.

...

Further arguments passed among methods (not yet used).

proj4

Character vector indicating the proj4string (required only for inputs of class Extent).

geom

Character value indicating the geometry of output (either point or polygon).

Value

Either a SpatialPointsDataFrame or a SpatialPolygonsDataFrame object.

Author(s)

Lukas Trübenbach and Miguel Alvarez (kamapu78@gmail.com).

Examples

1
2
3
4
5
6
require(raster)

r <- raster(system.file("external/test.grd", package="raster"))
plot(r)
plot(bbox_sp(r, "polygon"), border="darkgreen", lwd=3, add=TRUE)
plot(bbox_sp(r, "point"), col="red", pch=16, cex=3, add=TRUE)

kamapu/spatialist documentation built on April 13, 2021, 5:18 a.m.