Skip to content

Creating neutral landscapes

The purpose of this vignette is to demonstrate how we can use the NeutralLandscapes package to generate random spatial structures.

This functionality is supported through an extension, which is only active when the NeutralLandscapes package is loaded.

julia
using SpeciesDistributionToolkit
using CairoMakie
using NeutralLandscapes 

This is simply achieved through an overload of the SDMLayer constructor, taking a neutral landscape maker, and a size:

julia
L = SDMLayer(DiamondSquare(), (100, 100))
🗺️  A 100 × 100 layer with 10000 Float64 cells
   Projection: +proj=longlat +datum=WGS84 +no_defs

Code for the figure
julia
heatmap(L)

If we have a layer already, it can be used in place of the size argument, in which case the mask of the layer is also preserved. This is useful to rapidly fill layers with the same structure with random data.

Finally, the SDMLayer constructor, when used this way, accepts keyword arguments like the crs of the layer, as well as its x and y fields.