sf (version 0.6-0)

Ops.sfg: S3 Ops Group Generic Functions (multiply and add/subtract) for affine transformation

Description

Ops functions for simple feature geometry objects (constrained to multiplication and addition)

Usage

# S3 method for sfg
Ops(e1, e2)

Arguments

e1

object of class sfg

e2

numeric; in case of multiplication an n x n matrix, in case of addition or subtraction a vector of length n, with n the number of dimensions of the geometry

Value

object of class sfg

Examples

Run this code
# NOT RUN {
st_point(c(1,2,3)) + 4
st_point(c(1,2,3)) * 3 + 4
m = matrix(0, 2, 2)
diag(m) = c(1, 3)
# affine:
st_point(c(1,2)) * m + c(2,5)
# world in 0-360 range:
library(maps)
w = st_as_sf(map('world', plot = FALSE, fill = TRUE))
w2 = (st_geometry(w) + c(360,90)) %% c(360) - c(0,90)
plot(w2, axes = TRUE)
# }

Run the code above in your browser using DataCamp Workspace