EVOLUTION-MANAGER
Edit File: valid.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: Check validity or make an invalid geometry valid</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 valid {sf}"><tr><td>valid {sf}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Check validity or make an invalid geometry valid</h2> <h3>Description</h3> <p>Checks whether a geometry is valid, or makes an invalid geometry valid </p> <h3>Usage</h3> <pre> st_is_valid(x, ...) ## S3 method for class 'sfc' st_is_valid(x, ..., NA_on_exception = TRUE, reason = FALSE) ## S3 method for class 'sf' st_is_valid(x, ...) ## S3 method for class 'sfg' st_is_valid(x, ...) st_make_valid(x) ## S3 method for class 'sfg' st_make_valid(x) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>object of class <code>sfg</code>, <code>sfg</code> or <code>sf</code></p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>passed on to sfc method</p> </td></tr> <tr valign="top"><td><code>NA_on_exception</code></td> <td> <p>logical; if TRUE, for polygons that would otherwise raise a GEOS error (exception, e.g. for a POLYGON having more than zero but less than 4 points, or a LINESTRING having one point) return an <code>NA</code> rather than raising an error, and suppress warning messages (e.g. about self-intersection); if FALSE, regular GEOS errors and warnings will be emitted.</p> </td></tr> <tr valign="top"><td><code>reason</code></td> <td> <p>logical; if <code>TRUE</code>, return a character with, for each geometry, the reason for invalidity, <code>NA</code> on exception, or <code>"Valid Geometry"</code> otherwise.</p> </td></tr> </table> <h3>Details</h3> <p><code>st_make_valid</code> uses the <code>lwgeom_makevalid</code> method also used by the PostGIS command <code>ST_makevalid</code> if the GEOS version linked to is smaller than 3.8.0, and otherwise the version shipped in GEOS. </p> <h3>Value</h3> <p><code>st_is_valid</code> returns a logical vector indicating for each geometries of <code>x</code> whether it is valid. </p> <p>Object of the same class as <code>x</code> </p> <h3>Examples</h3> <pre> p1 = st_as_sfc("POLYGON((0 0, 0 10, 10 0, 10 10, 0 0))") st_is_valid(p1) st_is_valid(st_sfc(st_point(0:1), p1[[1]]), reason = TRUE) library(sf) x = st_sfc(st_polygon(list(rbind(c(0,0),c(0.5,0),c(0.5,0.5),c(0.5,0),c(1,0),c(1,1),c(0,1),c(0,0))))) suppressWarnings(st_is_valid(x)) y = st_make_valid(x) st_is_valid(y) y %>% st_cast() </pre> <hr /><div style="text-align: center;">[Package <em>sf</em> version 0.9-5 <a href="00Index.html">Index</a>]</div> </body></html>