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

Function latlng

googlemaps/convert.py:58–81  ·  view source on GitHub ↗

Converts a lat/lon pair to a comma-separated string. For example: sydney = { "lat" : -33.8674869, "lng" : 151.2069902 } convert.latlng(sydney) # '-33.8674869,151.2069902' For convenience, also accepts lat/lon pair as a string, in which case it's return

(arg)

Source from the content-addressed store, hash-verified

56
57
58def latlng(arg):
59 """Converts a lat/lon pair to a comma-separated string.
60
61 For example:
62
63 sydney = {
64 "lat" : -33.8674869,
65 "lng" : 151.2069902
66 }
67
68 convert.latlng(sydney)
69 # '-33.8674869,151.2069902'
70
71 For convenience, also accepts lat/lon pair as a string, in
72 which case it's returned unchanged.
73
74 :param arg: The lat/lon pair.
75 :type arg: string or dict or list or tuple
76 """
77 if is_string(arg):
78 return arg
79
80 normalized = normalize_lat_lng(arg)
81 return "%s,%s" % (format_float(normalized[0]), format_float(normalized[1]))
82
83
84def normalize_lat_lng(arg):

Callers 2

location_listFunction · 0.85
boundsFunction · 0.85

Calls 3

is_stringFunction · 0.85
normalize_lat_lngFunction · 0.85
format_floatFunction · 0.85

Tested by

no test coverage detected