EVOLUTION-MANAGER
Edit File: SpatialPolygons-class.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: Class "SpatialPolygons"</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 SpatialPolygons-class {sp}"><tr><td>SpatialPolygons-class {sp}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Class "SpatialPolygons"</h2> <h3>Description</h3> <p> class to hold polygon topology (without attributes) </p> <h3>Objects from the Class</h3> <p>Objects can be created by calls to the function <a href="SpatialPolygons.html">SpatialPolygons</a> </p> <h3>Slots</h3> <dl> <dt><code>polygons</code>:</dt><dd><p>Object of class <code>"list"</code>; list elements are all of class <a href="Polygons-class.html">Polygons-class</a></p> </dd> <dt><code>plotOrder</code>:</dt><dd><p>Object of class <code>"integer"</code>; integer array giving the order in which objects should be plotted </p> </dd> <dt><code>bbox</code>:</dt><dd><p>Object of class <code>"matrix"</code>; see <a href="Spatial-class.html">Spatial-class</a> </p> </dd> <dt><code>proj4string</code>:</dt><dd><p>Object of class <code>"CRS"</code>; see <a href="CRS-class.html">CRS-class</a></p> </dd> </dl> <h3>Extends</h3> <p>Class <code>"Spatial"</code>, directly. </p> <h3>Methods</h3> <p>Methods defined with class "SpatialPolygons" in the signature: </p> <dl> <dt>[</dt><dd><p><code>signature(obj = "SpatialPolygons")</code>: select subset of (sets of) polygons; NAs are not permitted in the row index</p> </dd> <dt>plot</dt><dd><p><code>signature(x = "SpatialPolygons", y = "missing")</code>: plot polygons in SpatialPolygons object</p> </dd> <dt>summary</dt><dd><p><code>signature(object = "SpatialPolygons")</code>: summarize object</p> </dd> <dt>rbind</dt><dd><p><code>signature(object = "SpatialPolygons")</code>: rbind-like method</p> </dd> </dl> <h3>plot method arguments</h3> <p>The <code>plot</code> method for spatial polygons takes the following arguments: </p> <dl> <dt>x</dt><dd><p>a SpatialPolygons object</p> </dd> <dt>col</dt><dd><p>a vector of colour values</p> </dd> <dt>border</dt><dd><p>default <code>par("fg")</code>; the colour to draw the border</p> </dd> <dt>add</dt><dd><p>default FALSE; if TRUE, add to existing plot</p> </dd> <dt>xlim, ylim</dt><dd><p>default NULL; ranges for the plotted ‘x’ and ‘y’ values</p> </dd> <dt>xpd</dt><dd><p>default NULL; controls clipping, see <code><a href="../../graphics/html/par.html">par</a></code></p> </dd> <dt>density</dt><dd><p>default NULL; the density of shading lines, in lines per inch, see <code><a href="../../graphics/html/polygon.html">polygon</a></code></p> </dd> <dt>angle</dt><dd><p>default 45; the slope of shading lines, given as an angle in degrees (counter-clockwise), see <code><a href="../../graphics/html/polygon.html">polygon</a></code></p> </dd> <dt>pbg</dt><dd><p>default NULL, set to <code>par("bg")</code> by default “transparent”; the colour to paint holes</p> </dd> <dt>axes</dt><dd><p>default FALSE; draw axes</p> </dd> <dt>lty</dt><dd><p>default <code>par("lty")</code>; border line type</p> </dd> <dt>...</dt><dd><p>other arguments passed through</p> </dd> <dt>setParUsrBB</dt><dd><p>default FALSE; see <code><a href="Spatial-class.html">Spatial-class</a></code> for further details</p> </dd> <dt>usePolypath</dt><dd><p>default NULL to set from option value; use <code><a href="../../graphics/html/polypath.html">polypath</a></code> for hole-handling in plot</p> </dd> <dt>rule</dt><dd><p>default NULL to set from option value; character value specifying the path fill mode, see <code><a href="../../graphics/html/polypath.html">polypath</a></code></p> </dd> </dl> <p>The options for <code>usePolypath</code> and <code>rule</code> may be retrieved with <code>get_Polypath</code> (default TRUE on package load) and <code>get_PolypathRule</code> (default “winding” on package load), and set with <code>set_Polypath</code> and <code>set_PolypathRule</code> </p> <p>The class definitions used for polygons in <span class="pkg">sp</span> do not accord with those of the simple features specification of the Open Geospatial Consortium. The <span class="pkg">rgeos</span> package, an interface to Geometry Engine – Open Source (GEOS), uses this specification, in which each hole (interior ring) must be associated with its containing exterior ring. In order to avoid introducing incompatible changes into the class definition of Polygons objects, a comment has been added as a single character string to each such object. Here we can trust the data source to assign the hole status correctly, and use the simple function <code><a href="../../rgeos/html/createSPComment.html">createSPComment</a></code> to add such comments to each Polygons member of the polygons slot of this SpatialPolygons object. Exterior rings are coded zero, while interior rings are coded with the 1-based index of the exterior ring to which they belong. SpatialPolygons objects created by reading using <code><a href="../../rgdal/html/readOGR.html">readOGR</a></code> from <span class="pkg">rgdal</span> have the comments set on input, as OGR also uses SFS. </p> <p>Refer to Bivand et al. (2013), pages 47-48 and 132-133 for a further discussion. </p> <h3>Note</h3> <p><code>rbind</code> calls the function <code><a href="SpatialPolygons.html">SpatialPolygons</a></code>, where it is checked that all IDs are unique. If <code>rbind</code>-ing <code>SpatialPolygons</code> without unique IDs, it is possible to set the argument <code>makeUniqueIDs = TRUE</code>, although it is preferred to change these explicitly with <code><a href="spChFIDs-methods.html">spChFIDs</a></code>. </p> <h3>Author(s)</h3> <p> Roger Bivand </p> <h3>References</h3> <p>Roger Bivand, Edzer Pebesma and Virgilio Gomez-Rubio, 2013. Applied spatial data analysis with R, Second edition. Springer, NY. <a href="https://asdar-book.org/">https://asdar-book.org/</a></p> <h3>See Also</h3> <p><code><a href="SpatialPolygons.html">SpatialPolygons</a></code> </p> <h3>Examples</h3> <pre> # simple example, from vignette("sp"): Sr1 = Polygon(cbind(c(2,4,4,1,2),c(2,3,5,4,2))) Sr2 = Polygon(cbind(c(5,4,2,5),c(2,3,2,2))) Sr3 = Polygon(cbind(c(4,4,5,10,4),c(5,3,2,5,5))) Sr4 = Polygon(cbind(c(5,6,6,5,5),c(4,4,3,3,4)), hole = TRUE) Srs1 = Polygons(list(Sr1), "s1") Srs2 = Polygons(list(Sr2), "s2") Srs3 = Polygons(list(Sr3, Sr4), "s3/4") SpP = SpatialPolygons(list(Srs1,Srs2,Srs3), 1:3) plot(SpP, col = 1:3, pbg="white") grd <- GridTopology(c(1,1), c(1,1), c(10,10)) polys <- as(grd, "SpatialPolygons") plot(polys) text(coordinates(polys), labels=row.names(polys)) </pre> <hr /><div style="text-align: center;">[Package <em>sp</em> version 1.4-2 <a href="00Index.html">Index</a>]</div> </body></html>