[][src]Struct geocoding::geoadmin::GeoAdmin

pub struct GeoAdmin { /* fields omitted */ }

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]

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(&params).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]

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]

fn reverse(&self, point: &Point<T>) -> Result<Option<String>, GeocodingError>[src]

A reverse lookup of a point. More detail on the format of the returned String can be found here

This method passes the format parameter to the API.

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.