Getting landcover data

In this example, we will look at landcover data, specifically the proportion of urban/built area in Europe; the entire dataset is very large to fit in memory, as it has a resolution of about 1 kilometre squared. Therefore, we will take advantage of the ability to only load the part that matters by passing the limits of a bounding box.

using SimpleSDMLayers
urban = SimpleSDMPredictor(EarthEnv, LandCover, 9; left=-11.0, right=31.1, bottom=29.0, top=71.1)
SDM predictor → 5052×5052 grid with 25522704 UInt8-valued cells
  Latitudes	(29.00416666666667, 71.09583333333336)
  Longitudes	(-10.995833333333337, 31.09583333333333)

This dataset is returning data as UInt8 (as it represents a proportion of the pixel occupied by the type), but this is not something that can be plotted efficiently. So in the next step, we will manipulate this object a little bit to have something more workable.

urban = convert(Float32, urban)
SDM response → 5052×5052 grid with 25522704 Float32-valued cells
  Latitudes	(29.00416666666667, 71.09583333333336)
  Longitudes	(-10.995833333333337, 31.09583333333333)

We will replace the values of 0 by nothing, to only see the pixels with some urban cover:

replace!(urban, zero(eltype(urban)) => nothing)
SDM response → 5052×5052 grid with 627615 Float32-valued cells
  Latitudes	(29.00416666666667, 71.09583333333336)
  Longitudes	(-10.995833333333337, 31.09583333333333)

With this done, we can plot the results:

using Plots
heatmap(urban, c=:berlin)