mosaik

The Unix principle for spatial analysis: each operator does only one thing, but that as well as possible. Each function takes and returns a mosaik, and an analysis is a combination of operators rather than a function of its own. New questions need new combinations, not new code, and every combination can be checked part by part and rerun from its record.

# install
remotes::install_github("resonantia-earth/mosaik")

Fields are drawn as noise, gradients, regular patterns, clusters or tessellations. Layers are modified by generic operators such as binarise, erode, distance or filter, so one operation serves forest, water or roads alike. The measured primitives are area, perimeter, adjacency, distance and dissimilarity; Shannon diversity, edge density or a whole morphological classification are combinations of them. Every step is recorded in the object, so a number can be traced back to how it was made.

# the share of the map that is forest
landscape |>
  mdf_filter(cover == 47, add = "forest") |>
  msr_area(layer = "forest") |>
  msr(equation = "area.self / sum(area.all) * 100",
      label = "pland", layer = "forest")
The land-cover layer of the example data
Start here

Getting started

A tour in order: draw a field, modify a layer, measure the primitives, compose a metric, and see every step recorded in the object.

SHDIEDPLAND
Interactive

Metric graph

42 FRAGSTATS metrics written in mosaik, each traced back to the primitives it is built from, with the code that computes it. Six more are in the graph, their code still to come.

Patches of one class and the holes they enclose
Article

Techniques

How the operations combine: recipes, named layers, metrics built on metrics, reducing, neighbourhoods, loops and provenance.

The MSPA test pattern
Worked analysis

MSPA, from operators

Morphological spatial pattern analysis rebuilt without a function written for it, matching the published classification cell for cell.

Reference

Every function

  • 3 the mosaik object
  • 6 draw fields
  • 28 modify layers
  • 6 measure
  • 10 utilities
  • 3 visualise
  • 2 data
Recipe library

What a map can say

Click any place on a map and see what the recipes say about it: its core, its ecotone, its isolation, what was converted.