Expand description
Shared OpenStreetMap-compatible fetch, cache, parse, and normalization utilities.
par-osm-rust is the data-source crate used by osm-to-bedrock and
osm-world. It owns network and cache concerns only: OSM/Overpass fetching,
optional Overture Maps fetching, source merge policy, raw cache management,
OSM XML/PBF parsing, SRTM tile downloads, and HGT elevation lookup. It
intentionally does not depend on Minecraft, WGPU, UI frameworks, renderer
types, or application UI state.
§High-level source orchestration
Use sources::fetch_map_data when an application wants one shared path for
OSM/Overpass plus optional Overture Maps data:
use par_osm_rust::filter::FeatureFilter;
use par_osm_rust::overture::{OvertureParams, OvertureTheme};
use par_osm_rust::sources::{
fetch_map_data, OvertureFailureMode, PoiSourceMode, SourceOptions,
};
let bbox = (38.0, -121.0, 38.01, -120.99); // south, west, north, east
let options = SourceOptions {
filter: FeatureFilter::default(),
overpass_url: None,
use_overpass_cache: true,
overture: OvertureParams {
enabled: true,
themes: vec![OvertureTheme::Place],
..OvertureParams::default()
},
poi_source_mode: PoiSourceMode::OverturePreferred,
overture_failure_mode: OvertureFailureMode::FallbackToOsm,
};
let mut progress = |_: f32, _: &str| {};
let result = fetch_map_data(bbox, &options, &mut progress)?;
println!("source status: {:?}", result.status);Important: sources::PoiSourceMode::OverturePreferred is the default POI
policy, but Overture is fetched only when overture::OvertureParams::enabled
is true. Default sources::SourceOptions performs an OSM/Overpass fetch
only.
§Lower-level modules
overpassbuilds safe Overpass QL queries and fetches raw OSM XML.osm_cachestores URL-aware raw Overpass XML cache entries.overtureinvokes the optionaloverturemapsCLI and normalizes GeoJSON.sourcesmerges OSM and Overture data with POI source policy and fallback.osmparses PBF/XML and writes normalized OSM XML.srtmandelevationdownload/read HGT elevation data.cacheresolves shared cache directories and migrates legacy caches.
Modules§
- cache
- Shared cache directory resolution and legacy cache migration.
- elevation
- SRTM HGT elevation data loading and bilinear interpolation.
- filter
- Feature filter controlling which OSM feature types are included in conversion.
- osm
- OSM PBF file parser.
- osm_
cache - Disk cache for raw Overpass XML responses.
- overpass
- Overpass API integration: QL query builder and HTTP fetch.
- overture
- Overture Maps integration via the
overturemapsPython CLI. - sources
- Shared source orchestration for OSM/Overpass plus optional Overture Maps data.
- srtm
- Auto-download of SRTM elevation tiles.