EVOLUTION-MANAGER
Edit File: st_make_grid.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: Create a regular tesselation over the bounding box of an sf...</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_make_grid {sf}"><tr><td>st_make_grid {sf}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Create a regular tesselation over the bounding box of an sf or sfc object</h2> <h3>Description</h3> <p>Create a square or hexagonal grid covering the geometry of an sf or sfc object </p> <h3>Usage</h3> <pre> st_make_grid( x, cellsize = c(diff(st_bbox(x)[c(1, 3)]), diff(st_bbox(x)[c(2, 4)]))/n, offset = st_bbox(x)[c("xmin", "ymin")], n = c(10, 10), crs = if (missing(x)) NA_crs_ else st_crs(x), what = "polygons", square = TRUE, flat_topped = FALSE ) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>object of class <a href="sf.html">sf</a> or <a href="sfc.html">sfc</a></p> </td></tr> <tr valign="top"><td><code>cellsize</code></td> <td> <p>target cellsize</p> </td></tr> <tr valign="top"><td><code>offset</code></td> <td> <p>numeric of length 2; lower left corner coordinates (x, y) of the grid</p> </td></tr> <tr valign="top"><td><code>n</code></td> <td> <p>integer of length 1 or 2, number of grid cells in x and y direction (columns, rows)</p> </td></tr> <tr valign="top"><td><code>crs</code></td> <td> <p>object of class <code>crs</code>; coordinate reference system of the target of the target grid in case argument <code>x</code> is missing, if <code>x</code> is not missing, its crs is inherited.</p> </td></tr> <tr valign="top"><td><code>what</code></td> <td> <p>character; one of: <code>"polygons"</code>, <code>"corners"</code>, or <code>"centers"</code></p> </td></tr> <tr valign="top"><td><code>square</code></td> <td> <p>logical; if <code>FALSE</code>, create hexagonal grid</p> </td></tr> <tr valign="top"><td><code>flat_topped</code></td> <td> <p>logical; if <code>TRUE</code> generate flat topped hexagons, else generate pointy topped</p> </td></tr> </table> <h3>Details</h3> <p>to obtain a grid covering the bounding box of a set of geometries, pass <code>st_as_sfc(st_bbox(x))</code> for argument <code>x</code> </p> <h3>Value</h3> <p>Object of class <code>sfc</code> (simple feature geometry list column) with, depending on <code>what</code> and <code>square</code>, square or hexagonal polygons, corner points of these polygons, or center points of these polygons. </p> <h3>Examples</h3> <pre> plot(st_make_grid(what = "centers"), axes = TRUE) plot(st_make_grid(what = "corners"), add = TRUE, col = 'green', pch=3) sfc = st_sfc(st_polygon(list(rbind(c(0,0), c(1,0), c(1,1), c(0,0))))) plot(st_make_grid(sfc, cellsize = .1, square = FALSE)) plot(sfc, add = TRUE) # non-default offset: plot(st_make_grid(sfc, cellsize = .1, square = FALSE, offset = c(0, .05 / (sqrt(3)/2)))) plot(sfc, add = TRUE) </pre> <hr /><div style="text-align: center;">[Package <em>sf</em> version 0.9-5 <a href="00Index.html">Index</a>]</div> </body></html>