Learn R Programming

inlabru (version 2.1.9)

stransform: Coordinate transformation for spatial objects

Description

This is a wrapper for the spTransform function provided by the sp package. Given a spatial object (or a list thereof) it will transform the coordinate system according to the parameter crs. In addition to the usual spatial objects this function is also capables of transforming inla.mesh objects that are equipped with a coordinate system.#'

Usage

stransform(splist, crs)

Arguments

splist

list of Spatial* objects

crs

Coordinate reference system to change to

Value

List of Spatial* objects

Examples

Run this code
# NOT RUN {
# Load Gorilla data
data("gorillas", package = "inlabru")

# Take the mesh and transform it to latitude/longitude
tmesh = stransform(gorillas$mesh, crs = CRS("+proj=longlat"))

# Compare original and transformed mesh

multiplot(ggplot() + gg(gorillas$mesh) + ggtitle("Original mesh"),
          ggplot() + gg(tmesh) + ggtitle("Transformed mesh"))
# }

Run the code above in your browser using DataLab