Learn R Programming

windfarmGA (version 5.0.0)

hexa_area: Polygon to Hexagonal Grids

Description

The function takes a Simple Feature Polygon and a size argument and creates a list with an indexed matrix with coordinates and a Simple Feature object, that consists of hexagonal grids.

Usage

hexa_area(area, size = 500, plot_grid = FALSE)

Value

Returns a list with 2 elements. List element 1 will have the grid cell IDS, and the X and Y coordinates of the centers of each grid cell. List element 2 is the grid as Simple Feature Polygons, which is used for plotting purposes.

Arguments

area

Simple Feature polygon of the site

size

Cell size of the grid in metres

plot_grid

Draw the grid

See Also

Other Helper Functions: get_grids(), grid_area(), isSpatial(), permutations(), read_power_curve(), splitAt(), wind_from_series(), wind_from_uv(), windata_format()

Examples

Run this code
library(sf)
## Exemplary input Polygon with 2km x 2km:
Poly <- sf::st_as_sf(sf::st_sfc(
  sf::st_polygon(list(cbind(
    c(4498482, 4498482, 4499991, 4499991, 4498482),
    c(2668272, 2669343, 2669343, 2668272, 2668272)
  ))),
  crs = 3035
))
HexGrid <- hexa_area(Poly, 100, TRUE)

Run the code above in your browser using DataLab