Struct geocoding::openstreetmap::Openstreetmap
source · [−]pub struct Openstreetmap { /* private fields */ }
Expand description
An instance of the Openstreetmap geocoding service
Implementations
sourceimpl Openstreetmap
impl Openstreetmap
sourcepub fn new_with_endpoint(endpoint: String) -> Self
pub fn new_with_endpoint(endpoint: String) -> Self
Create a new Openstreetmap geocoding instance with a custom endpoint.
Endpoint should include a trailing slash (i.e. “https://nominatim.openstreetmap.org/”)
sourcepub fn forward_full<T>(
&self,
params: &OpenstreetmapParams<'_, T>
) -> Result<OpenstreetmapResponse<T>, GeocodingError> where
T: Float + Debug,
for<'de> T: Deserialize<'de>,
pub fn forward_full<T>(
&self,
params: &OpenstreetmapParams<'_, T>
) -> Result<OpenstreetmapResponse<T>, GeocodingError> where
T: Float + Debug,
for<'de> T: Deserialize<'de>,
A forward-geocoding lookup of an address, returning a full detailed response
Accepts an OpenstreetmapParams
struct for specifying
options, including whether to include address details in the response and whether to filter
by a bounding box.
Please see the documentation for details.
This method passes the format
parameter to the API.
Examples
use geocoding::{Openstreetmap, InputBounds, Point};
use geocoding::openstreetmap::{OpenstreetmapParams, OpenstreetmapResponse};
let osm = Openstreetmap::new();
let viewbox = InputBounds::new(
(-0.13806939125061035, 51.51989264641164),
(-0.13427138328552246, 51.52319711775629),
);
let params = OpenstreetmapParams::new(&"UCL CASA")
.with_addressdetails(true)
.with_viewbox(&viewbox)
.build();
let res: OpenstreetmapResponse<f64> = osm.forward_full(¶ms).unwrap();
let result = res.features[0].properties.clone();
assert!(result.display_name.contains("Gordon Square"));
Trait Implementations
sourceimpl Default for Openstreetmap
impl Default for Openstreetmap
sourceimpl<T> Forward<T> for Openstreetmap where
T: Float + Debug,
for<'de> T: Deserialize<'de>,
impl<T> Forward<T> for Openstreetmap where
T: Float + Debug,
for<'de> T: Deserialize<'de>,
sourcefn forward(&self, place: &str) -> Result<Vec<Point<T>>, GeocodingError>
fn forward(&self, place: &str) -> Result<Vec<Point<T>>, GeocodingError>
A forward-geocoding lookup of an address. Please see the documentation for details.
This method passes the format
parameter to the API.
sourceimpl<T> Reverse<T> for Openstreetmap where
T: Float + Debug,
for<'de> T: Deserialize<'de>,
impl<T> Reverse<T> for Openstreetmap where
T: Float + Debug,
for<'de> T: Deserialize<'de>,
Auto Trait Implementations
impl !RefUnwindSafe for Openstreetmap
impl Send for Openstreetmap
impl Sync for Openstreetmap
impl Unpin for Openstreetmap
impl !UnwindSafe for Openstreetmap
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more