fm_transform: Object coordinate transformation

View source: R/crs.R

fm_transformR Documentation

Object coordinate transformation

Description

Handle transformation of various inla objects according to coordinate reference systems of crs (from sf::st_crs()), fm_crs, sp::CRS or INLA::inla.CRS class.

Usage

fm_transform(x, crs, ...)

## Default S3 method:
fm_transform(x, crs, ..., crs0 = NULL)

## S3 method for class 'NULL'
fm_transform(x, crs, ...)

## S3 method for class 'matrix'
fm_transform(x, crs, ..., passthrough = FALSE, crs0 = NULL)

## S3 method for class 'sf'
fm_transform(x, crs, ..., passthrough = FALSE)

## S3 method for class 'sfc'
fm_transform(x, crs, ..., passthrough = FALSE)

## S3 method for class 'sfg'
fm_transform(x, crs, ..., passthrough = FALSE)

## S3 method for class 'Spatial'
fm_transform(x, crs, ..., passthrough = FALSE)

## S3 method for class 'fm_mesh_2d'
fm_transform(x, crs = fm_crs(x), ..., passthrough = FALSE, crs0 = fm_crs(x))

## S3 method for class 'fm_lattice_2d'
fm_transform(x, crs = fm_crs(x), ..., passthrough = FALSE, crs0 = fm_crs(x))

## S3 method for class 'fm_segm'
fm_transform(x, crs = fm_crs(x), ..., passthrough = FALSE, crs0 = fm_crs(x))

## S3 method for class 'fm_list'
fm_transform(x, crs, ...)

## S3 method for class 'inla.mesh'
fm_transform(x, crs = fm_crs(x), ...)

## S3 method for class 'inla.mesh.lattice'
fm_transform(x, crs, ...)

## S3 method for class 'inla.mesh.segment'
fm_transform(x, crs, ...)

Arguments

x

The object that should be transformed from it's current CRS to a new CRS

crs

The target crs object

...

Potential additional arguments

crs0

The source crs object for spatial classes without crs information

passthrough

Default is FALSE. Setting to TRUE allows objects with no CRS information to be passed through without transformation. Use with care!

Value

A transformed object, normally of the same class as the input object.

See Also

fm_CRS()

Examples

fm_transform(
  rbind(c(0, 0), c(0, 90)),
  crs = fm_crs("sphere"),
  crs0 = fm_crs("longlat_norm")
)


fmesher documentation built on Nov. 2, 2023, 5:35 p.m.