[−][src]Struct geocoding::openstreetmap::Openstreetmap
An instance of the Openstreetmap geocoding service
Implementations
impl Openstreetmap
[src]
pub fn new() -> Self
[src]
Create a new Openstreetmap geocoding instance using the default endpoint
pub fn new_with_endpoint(endpoint: String) -> Self
[src]
Create a new Openstreetmap geocoding instance with a custom endpoint.
Endpoint should include a trailing slash (i.e. "https://nominatim.openstreetmap.org/")
pub fn forward_full<T>(
&self,
params: &OpenstreetmapParams<T>
) -> Result<OpenstreetmapResponse<T>, GeocodingError> where
T: Float,
T: Deserialize<'de>,
[src]
&self,
params: &OpenstreetmapParams<T>
) -> Result<OpenstreetmapResponse<T>, GeocodingError> where
T: Float,
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(&"University College London") .with_addressdetails(true) .with_viewbox(&viewbox) .build(); let res: OpenstreetmapResponse<f64> = osm.forward_full(¶ms).unwrap(); let result = res.features[0].properties.clone(); assert_eq!( result.display_name, "University College London, Euston Road, Holborn, Somers Town, London Borough of Camden, London, Greater London, England, NW1 2FB, United Kingdom", );
Trait Implementations
impl Default for Openstreetmap
[src]
impl<T> Forward<T> for Openstreetmap where
T: Float,
T: Deserialize<'de>,
[src]
T: Float,
T: Deserialize<'de>,
fn forward(&self, place: &str) -> Result<Vec<Point<T>>, GeocodingError>
[src]
A forward-geocoding lookup of an address. Please see the documentation for details.
This method passes the format
parameter to the API.
impl<T> Reverse<T> for Openstreetmap where
T: Float,
T: Deserialize<'de>,
[src]
T: Float,
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,