Learn R Programming

PROJ (version 0.6.0)

proj_trans_create: Create a transformation object

Description

Creates a transformation object that transforms coordinates in a wk pipeline.

Usage

proj_trans_create(source_crs, target_crs, use_z = NA, use_m = NA)

Value

A PROJ transformation object

Arguments

source_crs, target_crs

Source/Target CRS definition, coerced with wk::wk_crs_proj_definition()

use_z, use_m

Used to declare the output type. Use TRUE to ensure the output has that dimension, FALSE to ensure it does not, and NA to leave the dimension unchanged.

Examples

Run this code
(trans <- proj_trans_create("EPSG:4326", "EPSG:3857"))
wk::wk_transform(wk::xy(1:5, 1:5), trans)

library(wk)
(invtrans <- wk_trans_inverse(trans))

h <- 1852 * 60
## the stretch of Mercator to a square
wk::wk_transform(wk::xy(c(-h * 180, 0, h * 180), c(-h * 180,0, h * 180)), invtrans)

Run the code above in your browser using DataLab