pub struct Openstreetmap { /* private fields */ }
Expand description

An instance of the Openstreetmap geocoding service

Implementations

Create a new Openstreetmap geocoding instance using the default endpoint

Create a new Openstreetmap geocoding instance with a custom endpoint.

Endpoint should include a trailing slash (i.e. “https://nominatim.openstreetmap.org/”)

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(&params).unwrap();
let result = res.features[0].properties.clone();
assert!(result.display_name.contains("Gordon Square"));

Trait Implementations

Returns the “default value” for a type. Read more

A forward-geocoding lookup of an address. Please see the documentation for details.

This method passes the format parameter to the API.

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

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more