EVOLUTION-MANAGER
Edit File: Ops.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: S3 Ops Group Generic Functions for simple feature geometries</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for Ops {sf}"><tr><td>Ops {sf}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>S3 Ops Group Generic Functions for simple feature geometries</h2> <h3>Description</h3> <p>S3 Ops Group Generic Functions for simple feature geometries </p> <h3>Usage</h3> <pre> ## S3 method for class 'sfg' Ops(e1, e2) ## S3 method for class 'sfc' Ops(e1, e2) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>e1</code></td> <td> <p>object of class <code>sfg</code> or <code>sfc</code></p> </td></tr> <tr valign="top"><td><code>e2</code></td> <td> <p>numeric, or object of class <code>sfg</code>; in case <code>e1</code> is of class <code>sfc</code> also an object of class <code>sfc</code> is allowed</p> </td></tr> </table> <h3>Details</h3> <p>in case <code>e2</code> is numeric, +, -, *, /, </p> <p>If <code>e1</code> is of class <code>sfc</code>, and <code>e2</code> is a length 2 numeric, then it is considered a two-dimensional point (and if needed repeated as such) only for operations <code>+</code> and <code>-</code>, in other cases the individual numbers are repeated; see commented examples. </p> <h3>Value</h3> <p>object of class <code>sfg</code> </p> <h3>Examples</h3> <pre> 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) w3 = st_wrap_dateline(st_set_crs(w2 - c(180,0), 4326)) + c(180,0) plot(st_set_crs(w3, 4326), axes = TRUE) (mp <- st_point(c(1,2)) + st_point(c(3,4))) # MULTIPOINT (1 2, 3 4) mp - st_point(c(3,4)) # POINT (1 2) opar = par(mfrow = c(2,2), mar = c(0, 0, 1, 0)) a = st_buffer(st_point(c(0,0)), 2) b = a + c(2, 0) p = function(m) { plot(c(a,b)); plot(eval(parse(text=m)), col=grey(.9), add = TRUE); title(m) } lapply(c('a | b', 'a / b', 'a & b', 'a %/% b'), p) par(opar) sfc = st_sfc(st_point(0:1), st_point(2:3)) sfc + c(2,3) # added to EACH geometry sfc * c(2,3) # first geometry multiplied by 2, second by 3 nc = st_transform(st_read(system.file("gpkg/nc.gpkg", package="sf")), 32119) # nc state plane, m b = st_buffer(st_centroid(st_union(nc)), units::set_units(50, km)) # shoot a hole in nc: plot(st_geometry(nc) / b, col = grey(.9)) </pre> <hr /><div style="text-align: center;">[Package <em>sf</em> version 0.9-5 <a href="00Index.html">Index</a>]</div> </body></html>