Module opencage

Source
Expand description

The OpenCage Geocoding provider.

Geocoding methods are implemented on the Opencage struct. Please see the API documentation for details. Note that rate limits apply to the free tier: there is a rate-limit of 1 request per second, and a quota of calls allowed per 24-hour period. The remaining daily quota can be retrieved using the remaining_calls() method. If you are a paid tier user, this value will not be updated, and will remain None.

§A Note on Coordinate Order

This provider’s API documentation shows all coordinates in [Latitude, Longitude] order. However, Geocoding requires input Point coordinate order as [Longitude, Latitude] (x, y), and returns coordinates with that order.

§Example

use geocoding_async::{Opencage, Point, Reverse};

let mut oc = Opencage::new("dcdbf0d783374909b3debee728c7cc10".to_string());
oc.parameters.language = Some("fr");
let p = Point::new(2.12870, 41.40139);
let res = oc.reverse(&p).await;
// "Carrer de Calatrava, 68, 08017 Barcelone, Espagne"
println!("{:?}", res.unwrap());

Structs§

Annotations
Annotations pertaining to the geocoding result
Bounds
Bounding-box metadata
Currency
Currency metadata
Opencage
An instance of the Opencage Geocoding service
OpencageResponse
The top-level full JSON response returned by a forward-geocoding request
Parameters
Results
A forward geocoding result
Status
HTTP status metadata
Sun
Sunrise and sunset metadata
Timestamp
Timestamp metadata
Timezone
Timezone metadata
UnixTime
Primitive unix timestamp

Statics§

NOBOX
Use this constant if you don’t need to restrict a forward_full call with a bounding box

Functions§

deserialize_string_or_int