Skip to content

gbif/occurrence-cube

Repository files navigation

Occurrence Cube

DOI

Occurrence Cube provides user defined functions (UDF) to aggregate species occurrence data with Structured Query Language (SQL). They avoid users having to write complex aggregation queries themselves. The functions are especially relevant when creating species occurrence cubes and can be used in the SQL download API.

Found a bug or have a suggestion? Submit it as an issue.

Example

The following query counts the number of species occurrences from Belgium for each cell in the EEA reference grid. The user defined function GBIF_EEARGCode() simplifies this query.

SELECT
  GBIF_EEARGCode(
    1000,             -- Size of the grid cell (1 km)
    decimalLatitude,  -- Latitude of the occurrence
    decimalLongitude, -- Longitude of the occurrence
    0.0               -- Spatial uncertainty (0 m)
  ) AS eeaCellCode,
  count(*) AS occurrences
FROM
  occurrence
WHERE
  countryCode = 'BE'
GROUP BY
  eeaCellCode

Resources

Licence

Occurrence Cube is licensed under the Apache License, Version 2.0 or the MIT license, at your option.

Acknowledgements

B3 logoFunded by the European Union

The GBIF development of species occurrence cubes is part of (Biodiversity Building Blocks for policy) Work Package 2, led by the Research Institute for Nature and Forest (INBO) and funded by the European Union’s Horizon Europe Research and Innovation Programme (ID No 101059592).