MCPcopy Index your code
hub / github.com/googlemaps/google-maps-services-python / reverse_geocode

Function reverse_geocode

googlemaps/geocoding.py:78–116  ·  view source on GitHub ↗

Reverse geocoding is the process of converting geographic coordinates into a human-readable address. :param latlng: The latitude/longitude value or place_id for which you wish to obtain the closest, human-readable address. :type latlng: string, dict, list, or tuple :pa

(client, latlng, result_type=None, location_type=None,
                    language=None)

Source from the content-addressed store, hash-verified

76
77
78def reverse_geocode(client, latlng, result_type=None, location_type=None,
79 language=None):
80 """
81 Reverse geocoding is the process of converting geographic coordinates into a
82 human-readable address.
83
84 :param latlng: The latitude/longitude value or place_id for which you wish
85 to obtain the closest, human-readable address.
86 :type latlng: string, dict, list, or tuple
87
88 :param result_type: One or more address types to restrict results to.
89 :type result_type: string or list of strings
90
91 :param location_type: One or more location types to restrict results to.
92 :type location_type: list of strings
93
94 :param language: The language in which to return results.
95 :type language: string
96
97 :rtype: list of reverse geocoding results.
98 """
99
100 # Check if latlng param is a place_id string.
101 # place_id strings do not contain commas; latlng strings do.
102 if convert.is_string(latlng) and ',' not in latlng:
103 params = {"place_id": latlng}
104 else:
105 params = {"latlng": convert.latlng(latlng)}
106
107 if result_type:
108 params["result_type"] = convert.join_list("|", result_type)
109
110 if location_type:
111 params["location_type"] = convert.join_list("|", location_type)
112
113 if language:
114 params["language"] = language
115
116 return client._request("/maps/api/geocode/json", params).get("results", [])

Callers

nothing calls this directly

Calls 1

_requestMethod · 0.80

Tested by

no test coverage detected