1
我想從Python中的Google地圖繪製一張簡單的地圖。我用gmplot並按照https://pypi.python.org/pypi/gmplot/1.0.5Python gmplot'centerLat'沒有被定義
的例子下面的代碼是上
的Python 2.7.11 ::阿納康達2.4.1(64位) 和
IPython的版本4.0.1
import gmplot
gmap = gmplot.GoogleMapPlotter(37.428, -122.145, 16)
而且我得到以下錯誤
---------------------------------------------------------------------------
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
我知道變量center_lat被初始化而不是centerLat,這就是導致問題的原因。我對嗎?如果是這樣,我該如何解決這個問題?在python中繪製Google地圖的最佳模塊是什麼?
在此先感謝
謝謝,這解決了我的問題。不過,我有一個混合版本。在Ipython中,我可以運行gmplot-1.1.0,但在Jupyter上我有舊版本。我會谷歌一點。再次感謝! – Sebas