polygonToCells | R Documentation |
Returns the h3 indexes for the input GeoJSON-like data structure
polygonToCells(polygons, resolution, isLatLng = TRUE)
polygons |
A list of polygons. Each polygon is list of matrices. |
resolution |
The resolution of the output cells |
isLatLng |
|
h3 indexes for the input GeoJSON-like data structure
## single polygon
polygon <- list(
list(
matrix(
c(
37.813318999983238, -122.4089866999972145,
37.7198061999978478, -122.3544736999993603,
37.8151571999998453, -122.4798767000009008
)
, ncol = 2
, byrow = TRUE
)
)
)
polygonToCells(polygon, resolution = 7L)
## poylgon with a hole
polygon <- list(
list(
matrix(
c(
37.813318999983238, -122.4089866999972145,
37.7198061999978478, -122.3544736999993603,
37.8151571999998453, -122.4798767000009008
)
, ncol = 2
, byrow = TRUE
),
matrix(
c(
37.813318999983238, -122.4089866999972145,
37.7198061999978478, -122.3544736999993603,
37.8151571999998453, -122.4498767000009008
)
, ncol = 2
, byrow = TRUE
)
)
)
polygonToCells(polygon, resolution = 7L)
## Many polygons
polygon <- list(
list(
matrix(
c(
37.813318999983238, -122.4089866999972145,
37.7198061999978478, -122.3544736999993603,
37.8151571999998453, -122.4798767000009008
)
, ncol = 2
, byrow = TRUE
)
),
list(
matrix(
c(
37.813318999983238, -122.4089866999972145,
37.7198061999978478, -122.3544736999993603,
37.8151571999998453, -122.4498767000009008
)
, ncol = 2
, byrow = TRUE
)
)
)
polygonToCells(polygon, resolution = c(7L, 7L))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.