Skip to content

reverse_geocode async

reverse_geocode(
    query_position: Position,
    *,
    config_overrides: Optional[AsyncGeoPlacesClientConfig] = None,
    query_radius: Optional[DistanceMeters] = None,
    max_results: Optional[int] = None,
    filter: Optional[ReverseGeocodeFilter] = None,
    additional_features: Optional[ReverseGeocodeAdditionalFeatureList] = None,
    language: Optional[LanguageTag] = None,
    political_view: Optional[CountryCode] = None,
    intended_use: Optional[ReverseGeocodeIntendedUse] = None,
    key: Optional[ApiKey] = None,
    heading: Optional[Heading] = None,
    address_names_mode: Optional[ReverseGeocodeAddressNamesMode] = None,
) -> ReverseGeocodeResponse

ReverseGeocode converts geographic coordinates into a human-readable address or place. You can obtain address component, and other related information such as place type, category, street information. The Reverse Geocode API supports filtering to on place type so that you can refine result based on your need. Also, The Reverse Geocode API can also provide additional features such as time zone information and the inclusion of political views.

For more information, see Reverse Geocode in the Amazon Location Service Developer Guide.

Parameters:

  • query_position (Position) –

    The position in World Geodetic System (WGS 84) format: [longitude, latitude] for which you are querying nearby results for. Results closer to the position will be ranked higher then results further away from the position

  • query_radius (Optional[DistanceMeters], default: None ) –

    The maximum distance in meters from the QueryPosition from which a result will be returned. For GrabMaps customers, ap-southeast-1 and ap-southeast-5 regions support only up to a maximum value of 100,000.

  • max_results (Optional[int], default: None ) –

    An optional limit for the number of results returned in a single call.

    Default value: 1

  • filter (Optional[ReverseGeocodeFilter], default: None ) –

    A structure which contains a set of inclusion/exclusion properties that results must possess in order to be returned as a result.

  • additional_features (Optional[ReverseGeocodeAdditionalFeatureList], default: None ) –

    A list of optional additional parameters, such as time zone that can be requested for each result. For GrabMaps customers, ap-southeast-1 and ap-southeast-5 regions support only the TimeZone value.

  • language (Optional[LanguageTag], default: None ) –

    A list of BCP 47 compliant language codes for the results to be rendered in. If there is no data for the result in the requested language, data will be returned in the default language for the entry. For GrabMaps customers, ap-southeast-1 and ap-southeast-5 regions support only the following codes: en, id, km, lo, ms, my, pt, th, tl, vi, zh

  • political_view (Optional[CountryCode], default: None ) –

    The alpha-2 or alpha-3 character code for the political view of a country. The political view applies to the results of the request to represent unresolved territorial claims through the point of view of the specified country. Not supported in ap-southeast-1 and ap-southeast-5 regions for GrabMaps customers.

  • intended_use (Optional[ReverseGeocodeIntendedUse], default: None ) –

    Indicates if the query results will be persisted in customer infrastructure. Defaults to SingleUse (not stored).

    When storing ReverseGeocode responses, you must set this field to Storage to comply with the terms of service. These requests will be charged at a higher rate. Please review the user agreement and service pricing structure to determine the correct setting for your use case.

  • key (Optional[ApiKey], default: None ) –

    Optional: The API key to be used for authorization. Either an API key or valid SigV4 signature must be provided when making a request.

  • heading (Optional[Heading], default: None ) –

    The heading in degrees from true north in a navigation context. The heading is measured as the angle clockwise from the North direction.

    Example: North is 0 degrees, East is 90 degrees, South is 180 degrees, and West is 270 degrees.

  • address_names_mode (Optional[ReverseGeocodeAddressNamesMode], default: None ) –

    Specifies how address names are returned. When set to Administrative, the service returns the official administrative names for address components. Administrative currently applies only to addresses in the United States.

Raises:

Source code in docs_src/capo_geo_places/_services/async_geo_places.py
async def reverse_geocode(
    self,
    query_position: "capo_geo_places.types.position.Position",
    *,
    config_overrides: Optional[AsyncGeoPlacesClientConfig] = None,
    query_radius: Optional[
        "capo_geo_places.types.distance_meters.DistanceMeters"
    ] = None,
    max_results: Optional[int] = None,
    filter: Optional[
        "capo_geo_places.types.reverse_geocode_filter.ReverseGeocodeFilter"
    ] = None,
    additional_features: Optional[
        "capo_geo_places.types.reverse_geocode_additional_feature_list.ReverseGeocodeAdditionalFeatureList"
    ] = None,
    language: Optional["capo_geo_places.types.language_tag.LanguageTag"] = None,
    political_view: Optional[
        "capo_geo_places.types.country_code.CountryCode"
    ] = None,
    intended_use: Optional[
        "capo_geo_places.types.reverse_geocode_intended_use.ReverseGeocodeIntendedUse"
    ] = None,
    key: Optional["capo_geo_places.types.api_key.ApiKey"] = None,
    heading: Optional["capo_geo_places.types.heading.Heading"] = None,
    address_names_mode: Optional[
        "capo_geo_places.types.reverse_geocode_address_names_mode.ReverseGeocodeAddressNamesMode"
    ] = None,
) -> "capo_geo_places.types.reverse_geocode_response.ReverseGeocodeResponse":
    """<p> <code>ReverseGeocode</code> converts geographic coordinates into a human-readable address or place. You can obtain address component, and other related information such as place type, category, street information. The Reverse Geocode API supports filtering to on place type so that you can refine result based on your need. Also, The Reverse Geocode API can also provide additional features such as time zone information and the inclusion of political views.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/location/latest/developerguide/reverse-geocode.html">Reverse Geocode</a> in the <i>Amazon Location Service Developer Guide</i>.</p>

    Args:
        query_position: <p>The position in World Geodetic System (WGS 84) format: [longitude, latitude] for which you are querying nearby results for. Results closer to the position will be ranked higher then results further away from the position</p>
        query_radius: <p> The maximum distance in meters from the QueryPosition from which a result will be returned. For <a href="https://docs.aws.amazon.com/location/latest/developerguide/GrabMaps.html">GrabMaps</a> customers, <code>ap-southeast-1</code> and <code>ap-southeast-5</code> regions support only up to a maximum value of 100,000. </p>
        max_results: <p> An optional limit for the number of results returned in a single call.</p> <p>Default value: 1</p>
        filter: <p>A structure which contains a set of inclusion/exclusion properties that results must possess in order to be returned as a result.</p>
        additional_features: <p> A list of optional additional parameters, such as time zone that can be requested for each result. For <a href="https://docs.aws.amazon.com/location/latest/developerguide/GrabMaps.html">GrabMaps</a> customers, <code>ap-southeast-1</code> and <code>ap-southeast-5</code> regions support only the <code>TimeZone</code> value. </p>
        language: <p> A list of <a href="https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry">BCP 47</a> compliant language codes for the results to be rendered in. If there is no data for the result in the requested language, data will be returned in the default language for the entry. For <a href="https://docs.aws.amazon.com/location/latest/developerguide/GrabMaps.html">GrabMaps</a> customers, <code>ap-southeast-1</code> and <code>ap-southeast-5</code> regions support only the following codes: <code>en, id, km, lo, ms, my, pt, th, tl, vi, zh</code> </p>
        political_view: <p> The alpha-2 or alpha-3 character code for the political view of a country. The political view applies to the results of the request to represent unresolved territorial claims through the point of view of the specified country. Not supported in <code>ap-southeast-1</code> and <code>ap-southeast-5</code> regions for <a href="https://docs.aws.amazon.com/location/latest/developerguide/GrabMaps.html">GrabMaps</a> customers. </p>
        intended_use: <p> Indicates if the query results will be persisted in customer infrastructure. Defaults to <code>SingleUse</code> (not stored). </p> <note> <p>When storing <code>ReverseGeocode</code> responses, you <i>must</i> set this field to <code>Storage</code> to comply with the terms of service. These requests will be charged at a higher rate. Please review the <a href="https://aws.amazon.com/location/sla/">user agreement</a> and <a href="https://aws.amazon.com/location/pricing/">service pricing structure</a> to determine the correct setting for your use case.</p> </note>
        key: <p>Optional: The API key to be used for authorization. Either an API key or valid SigV4 signature must be provided when making a request.</p>
        heading: <p>The heading in degrees from true north in a navigation context. The heading is measured as the angle clockwise from the North direction.</p> <p>Example: North is <code>0</code> degrees, East is <code>90</code> degrees, South is <code>180</code> degrees, and West is <code>270</code> degrees.</p>
        address_names_mode: <p>Specifies how address names are returned. When set to <code>Administrative</code>, the service returns the official administrative names for address components. <code>Administrative</code> currently applies only to addresses in the United States.</p>

    Raises:
        capo_geo_places.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this action.</p>
        capo_geo_places.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception or failure.</p>
        capo_geo_places.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_geo_places.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an AWS service.</p>
        capo_geo_places.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_geo_places.types.reverse_geocode_request.ReverseGeocodeRequest]",
    ) -> AsyncOperationResponse[
        "capo_geo_places.types.reverse_geocode_response.ReverseGeocodeResponse"
    ]:
        import capo_geo_places._operations.places_service.reverse_geocode

        (
            output,
            http_response,
        ) = await capo_geo_places._operations.places_service.reverse_geocode.async_reverse_geocode(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_geo_places.types.reverse_geocode_request.ReverseGeocodeRequest",
    ) -> dict[str, Any]:
        import capo_geo_places.types.reverse_geocode_request

        return capo_geo_places.types.reverse_geocode_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_geo_places.types.reverse_geocode_response.ReverseGeocodeResponse",
    ) -> dict[str, Any]:
        import capo_geo_places.types.reverse_geocode_response

        return capo_geo_places.types.reverse_geocode_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "ReverseGeocode",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_geo_places.types.reverse_geocode_request.ReverseGeocodeRequest = {
        "query_position": query_position
    }
    if query_radius is not None:
        input_["query_radius"] = query_radius
    if max_results is not None:
        input_["max_results"] = max_results
    if filter is not None:
        input_["filter"] = filter
    if additional_features is not None:
        input_["additional_features"] = additional_features
    if language is not None:
        input_["language"] = language
    if political_view is not None:
        input_["political_view"] = political_view
    if intended_use is not None:
        input_["intended_use"] = intended_use
    if key is not None:
        input_["key"] = key
    if heading is not None:
        input_["heading"] = heading
    if address_names_mode is not None:
        input_["address_names_mode"] = address_names_mode

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output