pub struct OsmAdapter {
pub id: &'static str,
pub overpass_endpoint: String,
pub tile_endpoint: String,
}Expand description
Consent-gated OpenStreetMap Overpass adapter.
Fields§
§id: &'static str§overpass_endpoint: String§tile_endpoint: StringImplementations§
Source§impl OsmAdapter
impl OsmAdapter
Sourcepub fn new(
id: &'static str,
overpass_endpoint: &str,
tile_endpoint: &str,
) -> Self
pub fn new( id: &'static str, overpass_endpoint: &str, tile_endpoint: &str, ) -> Self
Creates a default OsmAdapter.
Sourcepub fn adapter_id(&self) -> &'static str
pub fn adapter_id(&self) -> &'static str
Adapter identifier.
Sourcepub fn build_fetch_request(
&self,
bbox: (f64, f64, f64, f64),
time_range: (u64, u64),
registry: &NetworkDisclosureRegistry,
) -> Result<AdapterHttpRequest, String>
pub fn build_fetch_request( &self, bbox: (f64, f64, f64, f64), time_range: (u64, u64), registry: &NetworkDisclosureRegistry, ) -> Result<AdapterHttpRequest, String>
Construct a valid application/x-www-form-urlencoded Overpass QL request.
bbox is (west, south, east, north) in WGS84 degrees.
Sourcepub fn fetch_region_vector_features(
&self,
bbox: (f64, f64, f64, f64),
time_range: (u64, u64),
registry: &NetworkDisclosureRegistry,
) -> Result<Vec<OsmVectorFeature>, String>
pub fn fetch_region_vector_features( &self, bbox: (f64, f64, f64, f64), time_range: (u64, u64), registry: &NetworkDisclosureRegistry, ) -> Result<Vec<OsmVectorFeature>, String>
Fetch and reconstruct full OSM vector features using the native transport.
For browser callers use the WASM async adapter transport, then call
OsmAdapter::parse_vector_features on the response body.
Sourcepub fn parse_vector_features(
&self,
body: &str,
) -> Result<Vec<OsmVectorFeature>, String>
pub fn parse_vector_features( &self, body: &str, ) -> Result<Vec<OsmVectorFeature>, String>
Parse Overpass JSON into points, lines, closed areas, and assembled multipolygons.
The Overpass query must include out geom so way/relation member geometry is present.
Trait Implementations§
Source§impl DataAdapter for OsmAdapter
impl DataAdapter for OsmAdapter
Source§fn adapter_id(&self) -> &'static str
fn adapter_id(&self) -> &'static str
"osm_adapter".
Source§fn build_fetch_request(
&self,
bbox: (f64, f64, f64, f64),
time_range: (u64, u64),
registry: &NetworkDisclosureRegistry,
) -> Result<AdapterHttpRequest, String>
fn build_fetch_request( &self, bbox: (f64, f64, f64, f64), time_range: (u64, u64), registry: &NetworkDisclosureRegistry, ) -> Result<AdapterHttpRequest, String>
Build the Overpass/MVT request via the inherent helper.
Source§fn needs_fetch_body(&self) -> bool
fn needs_fetch_body(&self) -> bool
OSM vector data needs the response body.
Source§fn handle_fetch_body(&self, body: &str) -> Result<(), String>
fn handle_fetch_body(&self, body: &str) -> Result<(), String>
Parse the response body as vector features (errors propagate).
Source§fn parse_response(&self, body: &str) -> Result<Vec<NQuin>, String>
fn parse_response(&self, body: &str) -> Result<Vec<NQuin>, String>
Parse the body into feature NQuins via parse_features.
Source§fn primary_endpoint(&self) -> &str
fn primary_endpoint(&self) -> &str
The Overpass API endpoint.
Source§fn estimate_tile_count(&self, bbox: (f64, f64, f64, f64)) -> u32
fn estimate_tile_count(&self, bbox: (f64, f64, f64, f64)) -> u32
1 Overpass query + z15 MVT tiles.
Source§fn fetch_region(
&self,
bbox: (f64, f64, f64, f64),
time_range: (u64, u64),
registry: &NetworkDisclosureRegistry,
) -> Result<(), String>
fn fetch_region( &self, bbox: (f64, f64, f64, f64), time_range: (u64, u64), registry: &NetworkDisclosureRegistry, ) -> Result<(), String>
fetch_region_async.Source§fn requires_specialized_fetch_path(&self) -> bool
fn requires_specialized_fetch_path(&self) -> bool
Source§fn fetch_region_features(
&self,
bbox: (f64, f64, f64, f64),
time_range: (u64, u64),
registry: &NetworkDisclosureRegistry,
) -> Result<Vec<NQuin>, String>
fn fetch_region_features( &self, bbox: (f64, f64, f64, f64), time_range: (u64, u64), registry: &NetworkDisclosureRegistry, ) -> Result<Vec<NQuin>, String>
NQuins: build the
consent-gated request, execute it, and run parse_response on the body.
A caller can then route the quins into the graph. (WASM callers fetch via
fetch_region_async and call parse_response on the returned body.)Auto Trait Implementations§
impl Freeze for OsmAdapter
impl RefUnwindSafe for OsmAdapter
impl Send for OsmAdapter
impl Sync for OsmAdapter
impl Unpin for OsmAdapter
impl UnsafeUnpin for OsmAdapter
impl UnwindSafe for OsmAdapter
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more