Description Usage Arguments Value Examples

Create a square or hexagonal grid over the bounding box of an sf or sfc object

1 2 3 4 |

`x` |
object of class sf or sfc |

`cellsize` |
target cellsize |

`offset` |
numeric of lengt 2; lower left corner coordinates (x, y) of the grid |

`n` |
integer of length 1 or 2, number of grid cells in x and y direction (columns, rows) |

`crs` |
object of class |

`what` |
character; one of: |

`square` |
logical; if |

Object of class `sfc`

(simple feature geometry list column) with, depending on `what`

and `square`

,
square or hexagonal polygons, corner points of these polygons, or center points of these polygons.

1 2 3 4 5 6 7 8 | ```
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)
``` |

sf documentation built on July 24, 2019, 5:05 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.