Expand description
Rust SDK for the latlng.work geocoding and places API.
§Quick start
use latlng::LatlngClient;
#[tokio::main]
async fn main() -> latlng::Result<()> {
let client = LatlngClient::with_api_key("latlng_xxxxx")?;
let result = client.geocode("Eiffel Tower, Paris").await?;
if let Some(place) = result.first() {
println!("{}, {}", place.lat, place.lon);
}
Ok(())
}Use LatlngClient::anonymous for unauthenticated requests. Anonymous
requests are supported, but have lower rate limits.
Structs§
- Autosuggest
Request - Builder for
GET /autosuggestonhttps://suggest.latlng.work. - Autosuggest
Response - Response from the autosuggest API.
- Categories
Response - Response from
GET /v1/places/categories. - Category
- A place category and its approximate count.
- Client
Builder - Builder for
LatlngClient. - Coordinates
- Latitude/longitude pair used in places responses.
- Geocode
Request - Optional parameters for forward geocoding.
- Geocoding
Response - Response from a forward or reverse geocoding request.
- Geocoding
Result - A single forward or reverse geocoding result.
- Latlng
Client - Async client for the latlng API.
- Nearby
Request - Builder for
GET /v1/places/nearby. - Nearby
Response - Response from
GET /v1/places/nearby. - Place
- A place result returned by nearby, search, or autosuggest endpoints.
- Places
Client - Places API sub-client.
- Reverse
Request - Optional parameters for reverse geocoding.
- Search
Request - Builder for
GET /v1/places/search. - Search
Response - Response from
GET /v1/places/search.
Enums§
- Error
- Errors returned by the latlng SDK.
Constants§
- DEFAULT_
AUTOSUGGEST_ BASE_ URL - Default latlng autosuggest API base URL.
- DEFAULT_
BASE_ URL - Default latlng API base URL.
Type Aliases§
- Result
- Result type returned by this crate.