[−][src]Struct geocoding::geoadmin::GeoAdmin
An instance of the GeoAdmin geocoding service
Implementations
impl GeoAdmin
[src]
pub fn new() -> Self
[src]
Create a new GeoAdmin geocoding instance using the default endpoint
pub fn new_with_endpoint(endpoint: String) -> Self
[src]
Create a new GeoAdmin geocoding instance with a custom endpoint.
Endpoint should include a trailing slash (i.e. "https://api3.geo.admin.ch/rest/services/api/")
pub fn forward_full<T>(
&self,
params: &GeoAdminParams<T>
) -> Result<GeoAdminForwardResponse<T>, GeocodingError> where
T: Float,
T: Deserialize<'de>,
[src]
&self,
params: &GeoAdminParams<T>
) -> Result<GeoAdminForwardResponse<T>, GeocodingError> where
T: Float,
T: Deserialize<'de>,
A forward-geocoding search of a location, returning a full detailed response
Accepts an GeoAdminParams
struct for specifying
options, including what origins to 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::{GeoAdmin, InputBounds, Point}; use geocoding::geoadmin::{GeoAdminParams, GeoAdminForwardResponse}; let geoadmin = GeoAdmin::new(); let bbox = InputBounds::new( (2600967.75, 1197426.0), (2600969.75, 1197428.0), ); let params = GeoAdminParams::new(&"Seftigenstrasse Bern") .with_origins("address") .with_bbox(&bbox) .build(); let res: GeoAdminForwardResponse<f64> = geoadmin.forward_full(¶ms).unwrap(); let result = &res.results[0]; assert_eq!( result.attrs.label, "Seftigenstrasse 264 <b>3084 Wabern</b>", );
Trait Implementations
impl Default for GeoAdmin
[src]
impl<T> Forward<T> for GeoAdmin 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 type
, origins
, limit
and sr
parameter to the API.
impl<T> Reverse<T> for GeoAdmin where
T: Float,
T: Deserialize<'de>,
[src]
T: Float,
T: Deserialize<'de>,
Auto Trait Implementations
impl !RefUnwindSafe for GeoAdmin
impl Send for GeoAdmin
impl Sync for GeoAdmin
impl Unpin for GeoAdmin
impl !UnwindSafe for GeoAdmin
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>,