geolith/conflation/mod.rs
1//! GERS-based conflation for deduplicating OSM and Overture features.
2//!
3//! Overture Maps maintains a Global Entity Reference System (GERS) that
4//! links Overture features to their source OSM elements via bridge files.
5//! This module reads those bridge files and uses them to deduplicate
6//! features that appear in both OSM and Overture datasets.
7//!
8//! # Architecture
9//!
10//! - [`bridge::BridgeIndex`] — in-memory index loaded from a GERS bridge
11//! Parquet file, mapping OSM element IDs to GERS UUIDs.
12//! - [`dedup::GersDedup`] — thread-safe deduplication filter that checks
13//! OSM features against the bridge index and tracks statistics.
14//! - [`changelog::read_changelog`] — reads Overture changelog Parquet files
15//! to identify changed GERS IDs for incremental processing.
16//! - [`spatial::SpatialDedup`] — R-tree/H3 spatial dedup fallback for themes
17//! without GERS bridge files (places, POIs, landcover, water).
18pub mod bridge;
19pub mod changelog;
20pub mod dedup;
21pub mod spatial;
22
23pub use bridge::{BridgeIndex, OsmElementType, OsmRecordId};
24pub use changelog::{ChangeType, ChangelogEntry, read_changelog};
25pub use dedup::GersDedup;
26pub use spatial::{SpatialCandidate, SpatialDedupConfig, haversine_distance_m};
27
28/// Test helper: create a [`GersDedup`] from raw entries without a Parquet file.
29///
30/// Only available in test builds. Used by integration tests in `tests/conflation.rs`.
31#[cfg(test)]
32pub fn test_dedup_from_entries(entries: Vec<(u64, String)>) -> GersDedup {
33 let bridge = bridge::BridgeIndex::from_entries(entries);
34 GersDedup::new(bridge)
35}