[][src]Struct google_maps::geocoding::reverse::ReverseRequest

pub struct ReverseRequest { /* fields omitted */ }

Use this structure's methods to build your Reverse Geocoding API request. Address lookup from latitude/longitude.

Methods

impl ReverseRequest[src]

pub fn build(&mut self) -> &mut ReverseRequest[src]

Builds the query string for the Google Maps Geocoding API based on the input provided by the client.

impl ReverseRequest[src]

pub fn get(&self) -> Result<GeocodingResponse, Error>[src]

Performs the HTTP get request and returns the response to the caller.

impl ReverseRequest[src]

pub fn new(key: String, latlng: LatLng) -> ReverseRequest[src]

Initializes the builder pattern for a Geolocation API query with the required, non-optional parameters.

Arguments:

  • key - Your application's Google Cloud API key.

  • latlng - The latitude and longitude values specifying the location for which you wish to obtain the closest, human-readable address.

impl ReverseRequest[src]

pub fn with_language(&mut self, language: Language) -> &mut ReverseRequest[src]

Specifies the language in which to return results.

Arguments:

  • language - The language in which to return results.

Description

  • See the list of supported languages. Google often updates the supported languages, so this list may not be exhaustive.

  • If language is not supplied, the geocoder attempts to use the preferred language as specified in the Accept-Language header, or the native language of the domain from which the request is sent.

  • The geocoder does its best to provide a street address that is readable for both the user and locals. To achieve that goal, it returns street addresses in the local language, transliterated to a script readable by the user if necessary, observing the preferred language. All other addresses are returned in the preferred language. Address components are all returned in the same language, which is chosen from the first component.

  • If a name is not available in the preferred language, the geocoder uses the closest match.

  • The preferred language has a small influence on the set of results that the API chooses to return, and the order in which they are returned. The geocoder interprets abbreviations differently depending on language, such as the abbreviations for street types, or synonyms that may be valid in one language but not in another. For example, utca and tér are synonyms for street and square respectively in Hungarian.

Example:

  • Set language for result:
.with_language(Language::French)

impl ReverseRequest[src]

pub fn with_location_type(
    &mut self,
    location_type_element: LocationType
) -> &mut ReverseRequest
[src]

Restricts the results from the geocoder to the specified location type(s).

Arguments:

  • location_type - A single location-type filter.

Description:

A filter of one or more location types. If the parameter contains multiple location types, the API returns all addresses that match any of the types. A note about processing: The location_type parameter does not restrict the search to the specified location type(s). Rather, the location_type acts as a post-search filter: the API fetches all results for the specified latlng, then discards those results that do not match the specified location type(s).

  • LocationType::RoofTop returns only the addresses for which Google has location information accurate down to street address precision.

  • LocationType::RangeInterpolated returns only the addresses that reflect an approximation (usually on a road) interpolated between two precise points (such as intersections). An interpolated range generally indicates that rooftop geocodes are unavailable for a street address.

  • LocationType::GeometricCenter returns only geometric centers of a location such as a polyline (for example, a street) or polygon (region).

  • LocationType::Approximate returns only the addresses that are characterized as approximate.

If both result_type and location_type filters are present then the API returns only those results that match both the result_type and the location_type values. If none of the filter values are acceptable, the API returns ZERO_RESULTS.

Examples:

  • A single location-type filter. This example restricts results to roof- top results:
.with_location_type(LocationType::RoofTop)
  • Multiple location type filters may be stacked together. This example restricts results to roof-top and range-interpolated:
.with_location_type(LocationType::RoofTop)
.with_location_type(LocationType::RangeInterpolated)

pub fn with_location_types(
    &mut self,
    location_type_slice: &[LocationType]
) -> &mut ReverseRequest
[src]

Restricts the results from the geocoder to the specified location type(s).

Description

A filter of one or more location types. If the parameter contains multiple location types, the API returns all addresses that match any of the types.

If both result_type and location_type filters are present then the API returns only those results that match both the result_type and the location_type values. If none of the filter values are acceptable, the API returns ZERO_RESULTS.

Example:

  • Alternatively, multiple location type filters may be passed in a single method call by passing a Vec. This example restricts results to roof-top and range-interpolated:
.with_location_types(&vec![
    LocationType::RoofTop,
    LocationType::RangeInterpolated,
])

impl ReverseRequest[src]

pub fn with_result_type(
    &mut self,
    result_type_element: PlaceType
) -> &mut ReverseRequest
[src]

Restricts the results from the geocoder to the specified result type(s).

Arguments:

  • result_type - A single result type filter.

Description:

A filter of one or more result types. If the parameter contains multiple result types, the API returns all addresses that match any of the types. A note about processing: The result_type parameter does not restrict the search to the specified location type(s). Rather, the result_type acts as a post-search filter: the API fetches all results for the specified latlng, then discards those results that do not match the specified result type(s). The following values are supported:

  • PlaceType::StreetAddress indicates a precise street address.

  • PlaceType::Route indicates a named route (such as "US 101").

  • PlaceType::Intersection indicates a major intersection, usually of two major roads.

  • PlaceType::Political indicates a political entity. Usually, this type indicates a polygon of some civil administration.

  • PlaceType::Country indicates the national political entity, and is typically the highest order type returned by the Geocoder.

  • PlaceType::AdministrativeAreaLevel1 indicates a first-order civil entity below the country level. Within the United States, these administrative levels are states. Not all nations exhibit these administrative levels. In most cases, PlaceType::AdministrativeAreaLevel1 short names will closely match ISO 3166-2 subdivisions and other widely circulated lists; however this is not guaranteed as our geocoding results are based on a variety of signals and location data.

  • PlaceType::AdministrativeAreaLevel2 indicates a second-order civil entity below the country level. Within the United States, these administrative levels are counties. Not all nations exhibit these administrative levels.

  • PlaceType::AdministrativeAreaLevel3 indicates a third-order civil entity below the country level. This type indicates a minor civil division. Not all nations exhibit these administrative levels.

  • PlaceType::AdministrativeAreaLevel4 indicates a fourth-order civil entity below the country level. This type indicates a minor civil division. Not all nations exhibit these administrative levels.

  • PlaceType::AdministrativeAreaLevel5 indicates a fifth-order civil entity below the country level. This type indicates a minor civil division. Not all nations exhibit these administrative levels.

  • PlaceType::ColloquialArea indicates a commonly-used alternative name for the entity.

  • PlaceType::Locality indicates an incorporated city or town political entity.

  • PlaceType::Sublocality indicates a first-order civil entity below a locality. For some locations may receive one of the additional types: PlaceType::SublocalityLevel1 to PlaceType::SublocalityLevel5. Each sublocality level is a civil entity. Larger numbers indicate a smaller geographic area.

  • PlaceType::Neighborhood indicates a named neighborhood.

  • PlaceType::Premise indicates a named location, usually a building or collection of buildings with a common name.

  • PlaceType::Subpremise indicates a first-order entity below a named location, usually a singular building within a collection of buildings with a common name.

  • PlaceType::PostalCode indicates a postal code as used to address postal mail within the country.

  • PlaceType::NaturalFeature indicates a prominent natural feature.

  • PlaceType::Airport indicates an airport.

  • PlaceType::Park indicates a named park.

  • PlaceType::PointOfInterest indicates a named point of interest. Typically, these "POI"s are prominent local entities that don't easily fit in another category, such as "Empire State Building" or "Eiffel Tower".

If both result_type and location_type filters are present then the API returns only those results that match both the result_type and the location_type values. If none of the filter values are acceptable, the API returns ZERO_RESULTS.

Examples:

  • A single result type filter. This example restricts results to the neighbourhood:
.with_result_type(PlaceType::Neighborhood)
  • Multiple component filters may be stacked together. This example restricts results to a neighborhood and a locality:
.with_result_type(PlaceType::Neighborhood)
.with_result_type(PlaceType::Locality)

pub fn with_result_types(
    &mut self,
    result_type_slice: &[PlaceType]
) -> &mut ReverseRequest
[src]

Restricts the results from the geocoder to the specified result type(s).

Description

A filter of one or more result types. If the parameter contains multiple results types, the API returns all addresses that match any of the types.

If both result_type and location_type filters are present then the API returns only those results that match both the result_type and the location_type values. If none of the filter values are acceptable, the API returns ZERO_RESULTS.

Example:

  • Alternatively, multiple result type filters may be passed in a single method call by passing a Vec. This example restricts results a neighborhood and a locality:
.with_components(&vec![
    PlaceType::Neighborhood,
    PlaceType::Locality,
])

Trait Implementations

impl Clone for ReverseRequest[src]

impl Debug for ReverseRequest[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.