Expand description
Configurable, sortable spatio-temporal hashes, good for STAC items.
§Examples
use stac_hash::Hasher;
use chrono::{Utc, TimeZone};
let start_datetime = Utc.with_ymd_and_hms(2026, 1, 1, 0, 0, 0).unwrap();
let end_datetime = Utc.with_ymd_and_hms(2027, 1, 1, 0, 0, 0).unwrap();
let hasher = Hasher::global(start_datetime, end_datetime).unwrap();
let hash = hasher.hash(start_datetime, (-105., 40.)).unwrap();
// Later datetimes sort after earlier ones
let hash_later = hasher.hash(end_datetime, (-105., 40.)).unwrap();
assert!(hash < hash_later);
// Latitudes and longitudes sort as well
let hash_right = hasher.hash(start_datetime, (-104., 40.)).unwrap();
assert!(hash < hash_right);
let hash_above = hasher.hash(start_datetime, (-105., 41.)).unwrap();
assert!(hash < hash_above);Structs§
- Hasher
- A structure for creating sortable spatio-temporal hashes with millisecond temporal precision.
- Point
- A simple WGS84 point structure.
Enums§
Type Aliases§
- Result
- Crate-specific result type.