Selectors

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:
  1. Indexing - selectors that wraps basic DGGS iterators.
  2. Geometries - selectors that are defined using a vector geometries
  3. Values - selectors that are defined using conditions on DGGS.Calculators
  4. Iterative - selectors that are definied using ordered iteratorion over cells. Algorithm like: floodfill and shortest path
  5. Boolean operations - selectors that are defined by combining existing DGGS.Selectors

Indexing based Selectors

basic selectors are convenient functions wrapping DGGS Indexing basic functions.
 


Geometry based Selectors

geometry based selectors allow you to select cells that intersects a given geometry such as a polygon, or a set of cells.

 

Values based Selectors

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 Selectors

Some 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 Selectors

DGGS Selectors can be combined together by using Boolean operators such as And, Or and Not;

 



Comments