Same as DGGS Calculator defines a function to attach a value for every given cell, DGGS Selectors are functional way to define a set of Cells.
The most generic selector is a function that get a cell and return Boolean to indicate if that cell should be selected. Here is an example of a Selector that select cells around a given point:
However, because DGGS cells usually describe a phenomena (or a place) on earth, we can define a selector using the power of DGGS Structure.
Instead of returning a Boolean for every cell, the function can return an enum CellCover { None, Partial, Complete } .
Here is an example of the same Selector, using CellCover , that allow more efficient evaluation of the selector.
Now, that we cover the basic of Selectors, lets see the built in selectors provided with the DGGS SDK:
Indexing based Selectorsbasic selectors are convenient functions wrapping DGGS Indexing basic functions.
geometry based selectors allow you to select cells that intersects a given geometry such as a polygon, or a set of cells.
Conditions are basically "Where is it" questions, that allow us to select cells by checking the comparing the DGGS Values. recall that DGGS.Calculator can provide statistics for a give selectors which can help in evaluating those expressions.
Iterative based SelectorsSome selectors can be defined using iterative algorithm like shortest path using a custom distance function. These algorithm can be expressed using Selectors.
Due to the iterative nature of this algorithms, it is very hard to partially evaluate some of those algorithm and leverage optimization based onthe DGGS Structure.
Boolean SelectorsDGGS Selectors can be combined together by using Boolean operators such as And, Or and Not;
|