polyfill: Get all hexagons with centers contained in a given polygon.

View source: R/polyfill.R

polyfillR Documentation

Get all hexagons with centers contained in a given polygon.

Description

Get all hexagons with centers contained in a given polygon.

Usage

polyfill(polygon, res = 7)

## S3 method for class 'matrix'
polyfill(polygon, res = 7)

## S3 method for class 'sfc_POLYGON'
polyfill(polygon, res = 7)

## S3 method for class 'sfc_MULTIPOLYGON'
polyfill(polygon, res = 7)

## S3 method for class 'sf'
polyfill(polygon, res = 7)

Arguments

polygon

geo-coordinates of polygon as lat/lng pairs (matrix) or object of class sf or sfc

res

resolution between 0 and 15

Value

character vector of H3 indexes

Examples

nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"),  quiet = TRUE) %>%
  sf::st_transform(4326)
h3_indexes <- polyfill(nc[1, ], res = 7)

crazycapivara/h3-r documentation built on Aug. 10, 2022, 1:17 p.m.