Skip to main content

oxigeo_terrain/
lib.rs

1//! Advanced terrain analysis and DEM processing for OxiGeo.
2//!
3//! This crate provides comprehensive terrain analysis capabilities including:
4//! - **Derivatives**: slope, aspect, curvature, hillshade, TPI, TRI, roughness
5//! - **Hydrology**: flow direction, flow accumulation, watershed delineation, stream networks
6//! - **Visibility**: viewshed analysis, line of sight
7//! - **Geomorphometry**: landform classification, convergence, openness
8//!
9//! # Features
10//!
11//! - `derivatives`: Terrain derivatives (slope, aspect, etc.)
12//! - `hydrology`: Hydrological analysis
13//! - `visibility`: Viewshed and line of sight
14//! - `geomorphometry`: Landform classification
15//! - `parallel`: Parallel processing with Rayon
16//!
17//! # Examples
18//!
19//! ```rust,ignore
20//! use oxigeo_terrain::derivatives::{slope_horn, SlopeUnits};
21//! use scirs2_core::prelude::*;
22//!
23//! let dem = Array2::from_elem((100, 100), 100.0_f32);
24//! let slope = slope_horn(&dem, 10.0, SlopeUnits::Degrees, None)?;
25//! ```
26//!
27//! # Performance
28//!
29//! Most algorithms support optional parallelization through the `parallel` feature.
30//! For large DEMs, consider using parallel variants for improved performance.
31
32#![cfg_attr(not(feature = "std"), no_std)]
33#![warn(missing_docs)]
34
35pub mod error;
36
37#[cfg(feature = "derivatives")]
38pub mod derivatives;
39
40#[cfg(feature = "hydrology")]
41pub mod hydrology;
42
43#[cfg(feature = "visibility")]
44pub mod visibility;
45
46#[cfg(feature = "geomorphometry")]
47pub mod geomorphometry;
48
49#[cfg(all(feature = "derivatives", feature = "hydrology"))]
50pub mod morphometry;
51
52#[cfg(feature = "derivatives")]
53pub mod radiation;
54
55#[cfg(feature = "mesh")]
56pub mod mesh;
57
58// Re-exports
59pub use error::{Result, TerrainError};
60
61#[cfg(feature = "derivatives")]
62pub use derivatives::{
63    AspectAlgorithm, CurvatureType, HillshadeAlgorithm, RoughnessMethod, SlopeAlgorithm,
64    SlopeUnits, aspect, curvature, hillshade, roughness, slope, tpi, tri,
65};
66
67#[cfg(feature = "hydrology")]
68pub use hydrology::{
69    CatchmentInfo, ChannelSegment, FlowAlgorithm, SnapPolicy, ThresholdMode, delineate_catchments,
70    extract_channel_network, extract_streams, fill_sinks, fill_sinks_iterative,
71    fill_sinks_priority_flood, flow_accumulation, flow_accumulation_dinf, flow_direction,
72    flow_direction_d8, flow_direction_dinf, strahler_order, strahler_order_from_d8,
73    watershed_from_point,
74};
75
76#[cfg(feature = "visibility")]
77pub use visibility::{line_of_sight, viewshed_binary, viewshed_cumulative};
78
79#[cfg(feature = "geomorphometry")]
80pub use geomorphometry::{
81    LandformClass, classify_iwahashi_pike, classify_weiss, convergence_index, negative_openness,
82    positive_openness,
83};
84
85#[cfg(all(feature = "derivatives", feature = "hydrology"))]
86pub use morphometry::{CurvatureResult, compute_curvature, compute_twi};
87
88#[cfg(feature = "derivatives")]
89pub use radiation::{
90    SolarOptions, SolarPosition, SolarRadiationResult, hillshade_at, solar_position,
91    solar_radiation,
92};
93
94#[cfg(feature = "mesh")]
95pub use mesh::{TerrainTin, tin_from_dem};