Plotting from geocode consistently errors
See original GitHub issueRunning the example code
gmplot.GoogleMapPlotter.from_geocode("San Francisco")
used to work exactly as described.
Now it consistently errors list index out of range
Swapping for lat/lon version works fine (gmplot.GoogleMapPlotter(37.766956, -122.438481, 13))
Full error
IndexError Traceback (most recent call last) <ipython-input-130-02f152c69777> in <module>() ----> 1 a_map = gmplot.GoogleMapPlotter.from_geocode(“San Francisco”)
/Users/scottieb/anaconda/envs/GDAL/lib/python3.6/site-packages/gmplot/gmplot.py in from_geocode(cls, location_string, zoom) 32 33 @classmethod —> 34 def from_geocode(cls, location_string, zoom=13): 35 lat, lng = cls.geocode(location_string) 36 return cls(lat, lng, zoom)
/Users/scottieb/anaconda/envs/GDAL/lib/python3.6/site-packages/gmplot/gmplot.py in geocode(self, location_string) 40 geocode = requests.get( 41 ‘http://maps.googleapis.com/maps/api/geocode/json?address=“%s”’ % location_string) —> 42 geocode = json.loads(geocode.text) 43 latlng_dict = geocode[‘results’][0][‘geometry’][‘location’] 44 return latlng_dict[‘lat’], latlng_dict[‘lng’]
IndexError: list index out of range
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (2 by maintainers)

Top Related StackOverflow Question
the fix is at : https://github.com/vgm64/gmplot/issues/58#issuecomment-430849353
Fixed in #111.