EVOLUTION-MANAGER
Edit File: st_relate.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: Compute DE9-IM relation between pairs of geometries, or match...</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 st_relate {sf}"><tr><td>st_relate {sf}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Compute DE9-IM relation between pairs of geometries, or match it to a given pattern</h2> <h3>Description</h3> <p>Compute DE9-IM relation between pairs of geometries, or match it to a given pattern </p> <h3>Usage</h3> <pre> st_relate(x, y, pattern = NA_character_, sparse = !is.na(pattern)) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>object of class <code>sf</code>, <code>sfc</code> or <code>sfg</code></p> </td></tr> <tr valign="top"><td><code>y</code></td> <td> <p>object of class <code>sf</code>, <code>sfc</code> or <code>sfg</code></p> </td></tr> <tr valign="top"><td><code>pattern</code></td> <td> <p>character; define the pattern to match to, see details.</p> </td></tr> <tr valign="top"><td><code>sparse</code></td> <td> <p>logical; should a sparse matrix be returned (TRUE) or a dense matrix?</p> </td></tr> </table> <h3>Value</h3> <p>In case <code>pattern</code> is not given, <code>st_relate</code> returns a dense <code>character</code> matrix; element [i,j] has nine characters, referring to the DE9-IM relationship between x[i] and y[j], encoded as IxIy,IxBy,IxEy,BxIy,BxBy,BxEy,ExIy,ExBy,ExEy where I refers to interior, B to boundary, and E to exterior, and e.g. BxIy the dimensionality of the intersection of the the boundary of x[i] and the interior of y[j], which is one of 0,1,2,F, digits denoting dimensionality, F denoting not intersecting. When <code>pattern</code> is given, a dense logical matrix or sparse index list returned with matches to the given pattern; see <a href="geos_binary_ops.html">st_intersection</a> for a description of the returned matrix or list. See also <a href="https://en.wikipedia.org/wiki/DE-9IM">https://en.wikipedia.org/wiki/DE-9IM</a> for further explanation. </p> <h3>Examples</h3> <pre> p1 = st_point(c(0,0)) p2 = st_point(c(2,2)) pol1 = st_polygon(list(rbind(c(0,0),c(1,0),c(1,1),c(0,1),c(0,0)))) - 0.5 pol2 = pol1 + 1 pol3 = pol1 + 2 st_relate(st_sfc(p1, p2), st_sfc(pol1, pol2, pol3)) sfc = st_sfc(st_point(c(0,0)), st_point(c(3,3))) grd = st_make_grid(sfc, n = c(3,3)) st_intersects(grd) st_relate(grd, pattern = "****1****") # sides, not corners, internals st_relate(grd, pattern = "****0****") # only corners touch st_rook = function(a, b = a) st_relate(a, b, pattern = "F***1****") st_rook(grd) # queen neighbours, see \url{https://github.com/r-spatial/sf/issues/234#issuecomment-300511129} st_queen <- function(a, b = a) st_relate(a, b, pattern = "F***T****") </pre> <hr /><div style="text-align: center;">[Package <em>sf</em> version 0.9-5 <a href="00Index.html">Index</a>]</div> </body></html>