# Landcover consensus

In this example, we will create a consensus map of landcover for Corsica based on the EarthEnv data, and measure the variation within each pixel using the variance. The first step is to load the packages we need, and create a bounding box:

```
using SimpleSDMLayers
using Plots
bbox = (left=8.25, right=10.0, bottom=41.2, top=43.2)
```

(left = 8.25, right = 10.0, bottom = 41.2, top = 43.2)

First, we will download all values for our layers:

`lc = convert.(Float32, SimpleSDMPredictor(EarthEnv, LandCover, 1:12; full=false, bbox...))`

12-element Array{SimpleSDMResponse{Float32},1}: SDM response → 240×210 grid with 50400 Float32-valued cells SDM response → 240×210 grid with 50400 Float32-valued cells SDM response → 240×210 grid with 50400 Float32-valued cells SDM response → 240×210 grid with 50400 Float32-valued cells SDM response → 240×210 grid with 50400 Float32-valued cells SDM response → 240×210 grid with 50400 Float32-valued cells SDM response → 240×210 grid with 50400 Float32-valued cells SDM response → 240×210 grid with 50400 Float32-valued cells SDM response → 240×210 grid with 50400 Float32-valued cells SDM response → 240×210 grid with 50400 Float32-valued cells SDM response → 240×210 grid with 50400 Float32-valued cells SDM response → 240×210 grid with 50400 Float32-valued cells

To perform the actual analysis, we will define a `shannon`

function, which will return the entropy of the land use categories:

```
function shannon(x)
v = filter(n -> n>zero(eltype(x)), x)
length(v) == 0 && return NaN
v = v ./ sum(v)
return -sum(v.*log2.(v))
end
```

shannon (generic function with 1 method)

We can then apply these functions using the `mosaic`

method:

```
consensus = mosaic(x -> last(findmax(x)), lc)
entropy = mosaic(shannon, lc)
```

SDM response → 210×240 grid with 50400 Float32-valued cells Latitudes (41.20476190476191, 43.19523809523811) Longitudes (8.25364583333333, 9.99635416666667)

```
p1 = plot(consensus, c=:terrain, frame=:none)
p2 = plot(entropy, c=:bamako, frame=:none)
plot(p1, p2)
```