Learn R Programming

windfarmGA (version 2.3.0)

plot_leaflet: Plot a Wind Farm with leaflet

Description

Plot a resulting wind farm on a leaflet map.

Usage

plot_leaflet(result, Polygon1, which = 1, orderitems = TRUE, GridPol)

Arguments

result

The resulting matrix of the function genetic_algorithm or windfarmGA

Polygon1

The Polygon for the wind farm area.

which

A numeric value, indicating which best individual to plot. The default is 1 (the best resulting wind farm).

orderitems

A logical value indicating whether the results should be ordered by energy values (TRUE) or chronologically (FALSE).

GridPol

The output grid polygon of the grid_area or hexa_area functions.

Value

Returns a leaflet map.

Examples

Run this code
# NOT RUN {
load(file = system.file("extdata/resulthex.rda", package = "windfarmGA"))
load(file = system.file("extdata/polygon.rda", package = "windfarmGA"))

## Plot the best wind farm on a leaflet map (ordered by energy values)
plot_leaflet(result = resulthex, Polygon1 = polygon, which = 1)

## Plot the last wind farm (ordered by chronology).
plot_leaflet(result = resulthex, Polygon1 = polygon, orderitems = FALSE,
         which = 1)
         
load(file = system.file("extdata/resultrect.rda", package = "windfarmGA"))
## Plot the best wind farm on a leaflet map with the rectangular Grid
Grid <- grid_area(polygon, resol = 150, prop = 0.4)
plot_leaflet(result = resultrect, Polygon1 = polygon, which = 1, 
         GridPol = Grid[[2]])

## Plot the last wind farm with hexagonal Grid
Grid <- hexa_area(polygon, size = 75)
plot_leaflet(result = resulthex, Polygon1 = polygon, which = 1, 
         GridPol = Grid[[2]])
# }

Run the code above in your browser using DataLab