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::{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);
// "Carrer de Calatrava, 68, 08017 Barcelone, Espagne"
println!("{:?}", res.unwrap());
Structs
Annotations pertaining to the geocoding result
Bounding-box metadata
Currency metadata
An instance of the Opencage Geocoding service
The top-level full JSON response returned by a forward-geocoding request
A forward geocoding result
HTTP status metadata
Sunrise and sunset metadata
Timestamp metadata
Timezone metadata
Statics
Use this constant if you don’t need to restrict a forward_full
call with a bounding box