Module geocoding::opencage [] [src]

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::{Opencage, Point, Reverse};

let oc = Opencage::new("dcdbf0d783374909b3debee728c7cc10".to_string());
let p = Point::new(2.12870, 41.40139);
let res = oc.reverse(&p);
// "Carrer de Calatrava, 68, 08017 Barcelona, Spain"
println!("{:?}", res.unwrap());

Structs

Annotations

Annotations pertaining to the geocoding result

Bounds

Bounding-box metadata

Currency

Currency metadata

InputBounds

Used to specify a bounding box to search within when forward-geocoding

Opencage

An instance of the Opencage Geocoding service

OpencageResponse

The top-level full JSON response returned by a forward-geocoding request

Results

A forward geocoding result

Status

HTTP status metadata

Sun

Sunrise and sunset metadata

Timestamp

Timestamp metadata

Timezone

Timezone metadata

XRatelimitRemaining