Learn R Programming

GSIF (version 0.3-1)

make.3Dgrid: Methods to prepare 3D prediction locations

Description

Generates a list of objects of type "SpatialPixelsDataFrame" with longitude, latitude and altitude coordinates (these names are used by default for compatibility with the geosamples-class).

Usage

## S3 method for class 'SpatialPixelsDataFrame':
make.3Dgrid(obj, 
      proj4s = get("ref_CRS", envir = GSIF.opts), 
      pixsize = get("cellsize", envir = GSIF.opts)[2], 
      resampling_method = "bilinear", 
      NAflag = get("NAflag", envir = GSIF.opts), 
      stdepths = get("stdepths", envir = GSIF.opts), 
      tmp.file = TRUE, show.output.on.console = TRUE, ...)
## S3 method for class 'RasterBrick':
make.3Dgrid(obj, 
      proj4s = get("ref_CRS", envir = GSIF.opts), 
      pixsize = get("cellsize", envir = GSIF.opts)[2], 
      resampling_method = "bilinear", 
      NAflag = get("NAflag", envir = GSIF.opts), 
      stdepths = get("stdepths", envir = GSIF.opts), 
      tmp.file = TRUE, show.output.on.console = TRUE, ...)

Arguments

obj
object of class "SpatialPixelsDataFrame" or "RasterBrick"
proj4s
character; proj4string describing the target coordinate system
pixsize
grid cell size in decimal degrees (set by default at 1/1200 (0.0008333333 or 100 m around equator)
resampling_method
character; resampling method to be passed the reprojection algorithm
NAflag
character; missing value flag
stdepths
numeric; list of standard depths
tmp.file
logical; specifies whether a temporary file name should be generated
show.output.on.console
logical; specifies whether to print out the progress
...
optional arguments that can be passed to the reprojetion algorithm

Value

  • The output is list of objects of class "SpatialPixelsDataFrame" where the number of elements in the list corresponds to the number of standard depths.

encoding

latin1

References

  • Bivand, R.S., Pebesma, E.J., andG�mez{Gomez}-Rubio, V., (2008)http://www.asdar-book.org/{Applied Spatial Data Analysis with R}. Springer, 378 p.
  • FWTools (http://fwtools.maptools.org)
  • Raster package (http://CRAN.R-project.org/package=raster)

See Also

spc, geosamples-class, plotKML::reproject

Examples

Run this code
## grids Ebergotzen:
library(plotKML)
library(rgdal)

data(eberg_grid)
gridded(eberg_grid) <- ~x+y
proj4string(eberg_grid) <- CRS("+init=epsg:31467")
##  convert to spatial components:
formulaString <- ~ PRMGEO6+DEMSRT6+TWISRT6+TIRAST6
eberg_spc <- spc(eberg_grid, formulaString)
# create 3D locations in the original coordinate system:
eberg_3Dxy <- sp3D(eberg_spc@predicted)
# wrapper function to create 3D locations in the default WGS84 system:
eberg_3D <- make.3Dgrid(eberg_spc@predicted)
image(eberg_3D[[1]]["PC1"])
## downscale 100 m resolution imagery to 25 m:
data(eberg_grid25)
gridded(eberg_grid25) <- ~x+y
proj4string(eberg_grid25) <- CRS("+init=epsg:31467")
eberg_grid25@data <- cbind(eberg_grid25@data, 
    gdalwarp(eberg_grid, pixsize=eberg_grid25@grid@cellsize[1], 
    GridTopology=eberg_grid25@grid, resampling_method="cubicspline")@data)
## this function requires FWTools!

Run the code above in your browser using DataLab