Crate google_geocoding[−][src]
Provides a strongly-typed asynchronous Rusty interface to the Google Geocoding API
Synchronous API (Basic)
You can do a simple look up of coordinates from an address:
use google_geocoding::geocode; for coordinates in geocode("1600 Amphitheater Parkway, Mountain View, CA").unwrap() { println!("{}", coordinates); }
Do a simple look up of an address from coordinates:
use google_geocoding::{WGS84, degeocode}; let coordinates = WGS84::try_new(37.42241, -122.08561, 0.0).unwrap(); for address in degeocode(coordinates).unwrap() { println!("{}", address); }
Note that it is recommended to use WGS84::try_new() as WGS84::new() will panic with invalid coordinates
Synchronous API (Advanced)
The GeocodeQuery and DegeocodeQuery objects can be used for more complex lookups
use google_geocoding::{GeocodeQuery, Language, Region, geocode}; let query = GeocodeQuery::new("1600 Amphitheater Parkway, Mountain View, CA") .language(Language::English) .region(Region::UnitedStates); for coordinates in geocode(query).unwrap() { println!("{}", coordinates); }
Asynchronous API
The Connection object can be used to build an asynchronous application
The official API documentation can be found at: [https://developers.google.com/maps/documentation/geocoding/intro]
Structs
AddressComponent |
One component of a separated address |
ApiSet |
An API set that deseriaizes as a JSON array and serializes with pipe spaces |
Connection |
Represents a connection to the Google geocoding API |
Coordinates |
WGS-84 coordinates that support serializing and deserializing |
DegeocodeQuery |
A query for an address |
FormattedAddress |
A human-readable address of this location. |
GeocodeQuery |
A query for coordinates |
Geometry |
Position information |
LanguageIter | |
PlaceId |
A unique identifier that can be used with other Google APIs. For example, you can use the place_id in a Places SDK request to get details of a local business, such as phone number, opening hours, user reviews, and more. See the place ID overview. |
RegionIter | |
Reply |
A reply from the Google geocoding API |
Viewport | |
WGS84 |
Geodetic position |
Enums
ComponentFilterRule |
A rule for a component filter |
Language |
Language that gets serialized as a language code |
LocationType |
What location Geometry refers to |
Place |
An address in one of various formats |
Region |
Country Code Top-Level Domain From https://icannwiki.org/Country_code_top-level_domain |
StatusCode |
Status codes for the geocode API |
Type |
The type of an address (eg street, intersection, etc) |
Functions
degeocode |
Get all the addresses associated with the specified coordinates |
geocode |
Get all the coordinates associated with the specified filter |