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

Function geocode

googlemaps/geocoding.py:22–75  ·  view source on GitHub ↗

Geocoding is the process of converting addresses (like ``"1600 Amphitheatre Parkway, Mountain View, CA"``) into geographic coordinates (like latitude 37.423021 and longitude -122.083739), which you can use to place markers or position the map. :param address: The address to geo

(client, address=None, place_id=None, components=None, bounds=None, region=None,
            language=None)

Source from the content-addressed store, hash-verified

20
21
22def geocode(client, address=None, place_id=None, components=None, bounds=None, region=None,
23 language=None):
24 """
25 Geocoding is the process of converting addresses
26 (like ``"1600 Amphitheatre Parkway, Mountain View, CA"``) into geographic
27 coordinates (like latitude 37.423021 and longitude -122.083739), which you
28 can use to place markers or position the map.
29
30 :param address: The address to geocode.
31 :type address: string
32
33 :param place_id: A textual identifier that uniquely identifies a place,
34 returned from a Places search.
35 :type place_id: string
36
37 :param components: A component filter for which you wish to obtain a
38 geocode, for example: ``{'administrative_area': 'TX','country': 'US'}``
39 :type components: dict
40
41 :param bounds: The bounding box of the viewport within which to bias geocode
42 results more prominently.
43 :type bounds: string or dict with northeast and southwest keys.
44
45 :param region: The region code, specified as a ccTLD ("top-level domain")
46 two-character value.
47 :type region: string
48
49 :param language: The language in which to return results.
50 :type language: string
51
52 :rtype: list of geocoding results.
53 """
54
55 params = {}
56
57 if address:
58 params["address"] = address
59
60 if place_id:
61 params["place_id"] = place_id
62
63 if components:
64 params["components"] = convert.components(components)
65
66 if bounds:
67 params["bounds"] = convert.bounds(bounds)
68
69 if region:
70 params["region"] = region
71
72 if language:
73 params["language"] = language
74
75 return client._request("/maps/api/geocode/json", params).get("results", [])
76
77
78def reverse_geocode(client, latlng, result_type=None, location_type=None,

Callers

nothing calls this directly

Calls 1

_requestMethod · 0.80

Tested by

no test coverage detected