Reputation: 337
I am trying to plot a simple map from google maps in Python. I use gmplot and follow the example on https://pypi.python.org/pypi/gmplot/1.0.5
The following code is on
Python 2.7.11 :: Anaconda 2.4.1 (64-bit) and
Ipython version 4.0.1
import gmplot
gmap = gmplot.GoogleMapPlotter(37.428, -122.145, 16)
And I get the following error
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-d299e195e0e8> in <module>()
1 import gmplot
2
----> 3 gmap = gmplot.GoogleMapPlotter(37.428, -122.145, 16)
/home/sebastia/Documents/gmplot-1.0.5/gmplot/gmplot.pyc in __init__(self, center_lat, center_lng, zoom)
17
18 def __init__(self, center_lat, center_lng, zoom):
---> 19 self.center = (float(centerLat), float(centerLng))
20 self.zoom = int(zoom)
21 self.grids = None
NameError: global name 'centerLat' is not defined
I understand the variable center_lat is initialized instead of centerLat and that is what causes the problem. Am I right? If so, how can I solve this? What is the best module to plot maps from google in python?
Thanks in advance
Upvotes: 1
Views: 2029
Reputation: 1529
There is a bug (wrong variables name, look line 18):
centerLat
should be center_lat
centerLng
should be center_lng
Reference: https://github.com/vgm64/gmplot/commit/744ab878a17d31dc95bec3e31e9fac54fb6f216b
Solution:
Update to version gmplot-1.1.0
Upvotes: 2