Documentation
¶
Overview ¶
Package eooaoo computes auditable, point-based Extent of Occurrence (EOO) and Area of Occupancy (AOO) metrics using GDAL/PROJ.
Calculations normalize input coordinates to WGS84, preserve record provenance, project to an explicit equal-area analysis CRS, compute the convex-hull EOO, and evaluate occupied square-grid cells for AOO. The default AOO cell side is 2 km. Results record software, GDAL and PROJ versions, projection definitions, grid metadata, warnings and an input hash for reproducibility.
Two analysis strategies are available: ProjectionLocalLAEA, a local Lambert Azimuthal Equal Area projection centred on the distribution, and ProjectionIUCNCEA, a World Cylindrical Equal Area compatibility-oriented mode matching the projection documented by the IUCN EOO Calculator materials. ProjectionIUCNCEA does not imply IUCN certification.
The package computes spatial metrics only. It does not assign IUCN Red List categories and does not decide whether occurrence records are biologically suitable for an assessment.
Index ¶
- Constants
- func ExportGeoJSON(gpkg, dir string) error
- func GDALVersion() string
- func PROJVersion() string
- func WriteGeoPackage(path string, r Result) (err error)
- func WriteMapHTML(path, geojsonDir string, r Result) error
- type AOOResult
- type Cell
- type Config
- type EOOResult
- type Point
- type Projection
- type ProjectionComparison
- type ProjectionDelta
- type Result
- type UsedPoint
Examples ¶
Constants ¶
const ( // ProjectionLocalLAEA selects a local Lambert Azimuthal Equal Area projection // centred on the assessment distribution. ProjectionLocalLAEA = "local-laea" // ProjectionIUCNCEA selects the World Cylindrical Equal Area strategy used for // methodological comparison with the projection documented by the IUCN EOO Calculator. ProjectionIUCNCEA = "iucn-cea" )
const MaxPoints = 100000
MaxPoints is the maximum number of occurrence records accepted by one calculation.
const Version = "0.1.0"
Version is the public software version reported in calculation results.
Variables ¶
This section is empty.
Functions ¶
func ExportGeoJSON ¶
ExportGeoJSON uses GDAL RFC7946 conversion (including antimeridian splitting). Splitting requires GDAL 3.8 or newer; earlier versions emit a single ring that spans the antimeridian instead of a MultiPolygon. Segmentization at 250 m is for display; authoritative areas are in the report and GeoPackage, never recomputed from the densified WGS84 display geometries.
func PROJVersion ¶
func PROJVersion() string
PROJVersion identifies the loaded native coordinate transformation library.
func WriteGeoPackage ¶
WriteGeoPackage stores exact analysis-plane geometries with their CRS. It refuses to overwrite an existing destination.
func WriteMapHTML ¶
WriteMapHTML creates a single HTML report with the GeoJSON data embedded in the document. MapLibre GL JS and the demonstration basemap are loaded from the network when the file is opened; occurrence/EOO/AOO data stay embedded.
Types ¶
type AOOResult ¶
type AOOResult struct {
AreaKM2 float64 `json:"area_km2"`
OccupiedCells int `json:"occupied_cells"`
CellSizeM float64 `json:"cell_size_m"`
ReferenceScale bool `json:"iucn_2km_scale"`
GridMode string `json:"grid_mode"`
Origin [2]float64 `json:"origin_m"`
Candidates int `json:"candidate_origins"`
MinCells int `json:"min_cells"`
MaxCells int `json:"max_cells"`
CompleteTranslationSearch bool `json:"complete_translation_search"`
Orientation string `json:"orientation"`
BoundaryRule string `json:"boundary_rule"`
}
AOOResult contains the occupied-cell result and the grid-search metadata used to obtain it for the fixed orientation of the analysis CRS axes.
type Cell ¶
type Cell struct {
Column int64 `json:"column"`
Row int64 `json:"row"`
UniquePoints int `json:"unique_points"`
Bounds [4]float64 `json:"bounds_m"`
}
Cell describes one occupied AOO cell in analysis-CRS metres.
type Config ¶
type Config struct {
InputCRS string `json:"input_crs,omitempty"`
// ProjectionStrategy is local-laea (default) or iucn-cea.
ProjectionStrategy string `json:"projection_strategy,omitempty"`
// Center is [longitude, latitude] in WGS84. Nil selects a spherical mean.
// It is only valid with local-laea.
Center *[2]float64 `json:"center,omitempty"`
CellSizeM float64 `json:"cell_size_m,omitempty"`
// GridMode is auto, exact, sampled, or fixed. Orientation is never rotated.
GridMode string `json:"grid_mode,omitempty"`
GridSteps int `json:"grid_steps,omitempty"`
Origin [2]float64 `json:"origin_m"`
}
Config controls coordinate interpretation, analysis projection and AOO grid search. Zero values select the documented defaults: EPSG:4326 input, local-laea, 2,000 m cells, auto grid search and 10 sampled steps when fallback is needed.
type EOOResult ¶
type EOOResult struct {
RawAreaKM2 *float64 `json:"raw_area_km2"`
AssessmentAreaKM2 float64 `json:"assessment_area_km2"`
Status string `json:"status"`
AdjustedToAOO bool `json:"adjusted_to_aoo"`
HullWKT string `json:"hull_wkt,omitempty"`
}
EOOResult contains raw convex-hull EOO and the assessment value after the explicit rule that assessment EOO must not be smaller than AOO.
type Point ¶
type Point struct {
X float64 `json:"lon"`
Y float64 `json:"lat"`
ID string `json:"id,omitempty"`
Taxon string `json:"taxon,omitempty"`
Properties map[string]any `json:"properties,omitempty"`
}
Point is one occurrence record. X/Y use traditional GIS axis order: longitude/easting and latitude/northing. JSON uses the canonical public field names lon/lat. Properties are retained for provenance; records at identical coordinates are merged only geometrically, never discarded.
type Projection ¶
type Projection struct {
Strategy string `json:"strategy"`
Reference string `json:"reference"`
InputCRS string `json:"input_crs"`
InputWKT string `json:"input_wkt"`
AnalysisPROJ string `json:"analysis_proj"`
AnalysisWKT string `json:"analysis_wkt"`
Center [2]float64 `json:"center_lon_lat"`
CenterMethod string `json:"center_method"`
MaxAngularDistanceDeg float64 `json:"max_angular_distance_deg"`
AxisOrder string `json:"axis_order"`
}
Projection records the effective input and analysis CRS definitions and the information needed to reproduce the projection choice.
type ProjectionComparison ¶
type ProjectionComparison struct {
SchemaVersion string `json:"schema_version"`
SoftwareVersion string `json:"software_version"`
InputSHA256 string `json:"input_sha256"`
LocalLAEA Result `json:"local_laea"`
IUCNCEA Result `json:"iucn_cea"`
Delta ProjectionDelta `json:"delta_iucn_cea_minus_local_laea"`
Note string `json:"note"`
}
ProjectionComparison contains summary results for both supported projection strategies plus their signed differences. It exposes projection sensitivity; it does not select a universally preferred strategy.
func CompareProjections ¶
func CompareProjections(ctx context.Context, points []Point, config Config) (ProjectionComparison, error)
CompareProjections runs the same normalized records and grid configuration through the local LAEA and IUCN-compatible World Cylindrical Equal Area strategies. The delta is always iucn-cea minus local-laea.
type ProjectionDelta ¶
type ProjectionDelta struct {
EOORawKM2 *float64 `json:"eoo_raw_km2"`
EOORawPercent *float64 `json:"eoo_raw_percent"`
EOOAssessmentKM2 float64 `json:"eoo_assessment_km2"`
EOOAssessmentPercent *float64 `json:"eoo_assessment_percent"`
AOOKM2 float64 `json:"aoo_km2"`
AOOPercent *float64 `json:"aoo_percent"`
AOOOccupiedCells int `json:"aoo_occupied_cells"`
}
ProjectionDelta reports iucn-cea minus local-laea differences for the same normalized records and grid configuration. Percentage fields are nil when a baseline is zero or the corresponding raw EOO is unavailable.
type Result ¶
type Result struct {
SchemaVersion string `json:"schema_version"`
SoftwareVersion string `json:"software_version"`
GDALVersion string `json:"gdal_version"`
PROJVersion string `json:"proj_version"`
Taxon string `json:"taxon,omitempty"`
InputSHA256 string `json:"input_sha256"`
InputRecords int `json:"input_records"`
UniqueCoordinates int `json:"unique_coordinates"`
DuplicateRecords int `json:"duplicate_records"`
Config Config `json:"config"`
Projection Projection `json:"projection"`
EOO EOOResult `json:"eoo"`
AOO AOOResult `json:"aoo"`
Warnings []string `json:"warnings"`
Cells []Cell `json:"cells,omitempty"`
Points []UsedPoint `json:"points,omitempty"`
}
Result is the reproducible calculation record returned by Calculate. Cells and Points are omitted by Summary and by default CLI/API responses.
func Calculate ¶
Calculate accepts exactly one assessment unit (taxon). Context cancellation is checked between transforms and inside the grid search. All input is strict: no silent dropping, imputing missing coordinates to zero, or auto-swapping axes.
Example ¶
package main
import (
"context"
"fmt"
eooaoo "github.com/lsbjordao/go-iucn-eoo-aoo"
)
func main() {
points := []eooaoo.Point{
{X: -43.2, Y: -22.9, ID: "demo-001", Taxon: "Mimosa demonstrativa"},
}
result, err := eooaoo.Calculate(context.Background(), points, eooaoo.Config{})
if err != nil {
panic(err)
}
fmt.Println(result.AOO.AreaKM2)
fmt.Println(result.EOO.RawAreaKM2 == nil)
}
Output: 4 true
type UsedPoint ¶
type UsedPoint struct {
Longitude float64 `json:"lon"`
Latitude float64 `json:"lat"`
X float64 `json:"x_m"`
Y float64 `json:"y_m"`
// InputIndices are zero-based positions in the input slice.
InputIndices []int `json:"input_indices"`
Records []Point `json:"records"`
}
UsedPoint is one unique normalized WGS84 coordinate together with its analysis-plane coordinate and complete source-record provenance.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
eoo-aoo
command
|
|
|
examples
|
|
|
library
command
|
|
|
internal
|
|
|
input
Package input reads strict coordinate tables and WGS84 point GeoJSON.
|
Package input reads strict coordinate tables and WGS84 point GeoJSON. |
|
server
Package server exposes a bounded, stateless HTTP interface for local stacks.
|
Package server exposes a bounded, stateless HTTP interface for local stacks. |