Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

set_to_multipolygon

Get geometry for a set of H3 cells


Description

This function returns geometry associated with a set of H3 cells, as a single 'sfc_MULTIPOLYGON'.

Usage

set_to_multipolygon(h3_addresses = NULL, simple = TRUE)

Arguments

h3_addresses

Character vector or list of 15-character cell indices generated by H3.

simple

Logical; whether to return an 'sfc_MULTIPOLYGON' or an 'sf' object including the input cells.

Value

By default, object of type 'sfc_MULTIPOLYGON' of length 1.

Note

The geometry returned by this function will not be valid where the addresses supplied overlap at the same resolution. The main use case for this function appears to be visualising the outputs of 'polyfill()' and 'compact()'.

Examples

## Not run: 
# Give me the outline of the cells around Brisbane Town Hall at
# resolution 10 (not run as slow-ish)
bth <- sf::st_sfc(sf::st_point(c(153.023503, -27.468920)), crs = 4326)
bth_10 <- point_to_h3(bth, res = 10)
bth_patch <- get_kring(h3_address = bth_10, ring_size = 2)
bth_patch_sf <- set_to_multipolygon(bth_patch)

## End(Not run)

h3jsr

Access Uber's H3 Library

v1.2.2
Apache License (>= 2)
Authors
Lauren O'Brien [aut, cre] (<https://orcid.org/0000-0002-7336-2171>)
Initial release
2021-06-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.