2016-03-27 4 views
1

Ich versuche, eine einfache Karte aus Google Maps in Python zu plotten. Ich benutze gmplot und folgen dem Beispiel auf https://pypi.python.org/pypi/gmplot/1.0.5Python gmplot 'centerLat' ist nicht definiert

Der folgende Code ist auf

Python 2.7.11 :: Anaconda 2.4.1 (64-Bit) und

IPython Version 4.0.1

import gmplot 
gmap = gmplot.GoogleMapPlotter(37.428, -122.145, 16) 

und ich bekomme die folgenden Fehler

--------------------------------------------------------------------------- 
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 

Ich verstehe, dass die Variable center_lat anstelle von centerLat initialisiert wird und dass das Problem verursacht. Habe ich recht? Wenn ja, wie kann ich das lösen? Was ist das beste Modul um Karten von Google in Python zu plotten?

Vielen Dank im Voraus

Antwort

2

ist ein Bug Es (falsche Variablen Namen, suchen Sie Linie 18):

  • centerLatcenter_latcenter_lng

Referenz sollte

  • centerLng sein sollte :https://github.com/vgm64/gmplot/commit/744ab878a17d31dc95bec3e31e9fac54fb6f216b

    Lösung:
    Update auf Version gmplot-1.1.0

  • +0

    Danke, das mein Problem gelöst. Ich habe jedoch eine Mischung aus Versionen. In Ipython kann ich gmplot-1.1.0 ausführen, aber auf Jupyter habe ich die ältere Version. Ich google ein bisschen. Danke noch einmal! – Sebas