def showmap(lat, lng): from pymaps import Map, PyMap, Icon # import the libraries # Create a map - pymaps allows multiple maps in an object tmap = Map() tmap.zoom = 3 # Latitude and lognitude - see the getcords function # to see how we convert from traditional D/M/S to the DD type # used by Googel Maps # lat = 0.0 # long = 0.0 # # # These coordinates are for Hong Kong # dlat = "22 15 0 N" # dlong = "114 10 60 E" # # dlat = dlat.split(" ") # dlong = dlong.split(" ") # # # Convert the coordinates # lat = getcords(float(dlat[0]), float(dlat[1]), float(dlat[2]), dlat[3]) # lng = getcords(float(dlong[0]), float(dlong[1]), float(dlong[2]), dlong[3]) # Inserts html into the hover effect pointhtml = "Hello!" # Add the point to the map icon = Icon() point = (lat, lng, pointhtml, icon.id) tmap.setpoint(point) tmap.center = (1.757537, 144.492188) # Put your own googl ekey here GOOGLE_KEY = 0 gmap = PyMap(key=GOOGLE_KEY, maplist=[tmap]) gmap.addicon(icon) # pymapjs exports all the javascript required to build the map! mapcode = gmap.pymapjs() # Do what you want with it - pass it to the template or print it! return mapcode
def showmap(): # Create a map - pymaps allows multiple maps in an object tmap = Map() tmap.zoom = 3 # Latitude and lognitude - see the getcords function # to see how we convert from traditional D/M/S to the DD type # used by Googel Maps lat = 0.0 long = 0.0 # These coordinates are for Hong Kong dlat = "22 15 0 N" dlong = "114 10 60 E" dlat = dlat.split(" ") dlong = dlong.split(" ") # Convert the coordinates lat = getcords(float(dlat[0]), float(dlat[1]), float(dlat[2]), dlat[3]) long = getcords(float(dlong[0]), float(dlong[1]), float(dlong[2]), dlong[3]) # Inserts html into the hover effect pointhtml = "Hello!" pointicon = Icon() # Add the point to the map point = (lat, long, pointhtml, pointicon) tmap.setpoint(point) tmap.center = (1.757537, 144.492188) # Put your own googl ekey here gmap = PyMap(key="AIzaSyAKoLUaFGp_Eyl9ioFgZ2ARoHBz4nL1PXE", maplist=[tmap]) gmap.addicon(pointicon) # pymapjs exports all the javascript required to build the map! mapcode = gmap.pymapjs() # Do what you want with it - pass it to the template or print it! return mapcode
def showmap(): # Create a map - pymaps allows multiple maps in an object tmap = Map() tmap.zoom = 3 # Latitude and lognitude - see the getcords function # to see how we convert from traditional D/M/S to the DD type # used by Googel Maps lat = 0.0 long = 0.0 # These coordinates are for Hong Kong dlat = "22 15 0 N" dlong = "114 10 60 E" dlat = dlat.split(" ") dlong = dlong.split(" ") # Convert the coordinates lat = getcords(float(dlat[0]), float(dlat[1]), float(dlat[2]), dlat[3]) long = getcords(float(dlong[0]), float(dlong[1]), float(dlong[2]), dlong[3]) # Inserts html into the hover effect pointhtml = "Hello!" pointicon = Icon() # Add the point to the map point = (lat, long, pointhtml, pointicon) tmap.setpoint(point) tmap.center = (1.757537,144.492188) # Put your own googl ekey here gmap = PyMap(key="AIzaSyAKoLUaFGp_Eyl9ioFgZ2ARoHBz4nL1PXE", maplist=[tmap]) gmap.addicon(pointicon) # pymapjs exports all the javascript required to build the map! mapcode = gmap.pymapjs() # Do what you want with it - pass it to the template or print it! return mapcode
for row, l in enumerate(reader): if row==0: #print "\t".join(l) pass else: #print "\t",l[1],l[2] pointhtml = l[0] point = (l[1], l[2], pointhtml, row) tmap.setpoint(point) gmap = PyMap(key="ABCDEFG", maplist=[tmap]) #gmap.addicon(icon) # pymapjs exports all the javascript required to build the map! mapcode = gmap.pymapjs() print "<html><head>" print mapcode print "</head>" print """<body onload="load()" onunload="GUnload()"> <div id="map" style="width: 760px; height: 460px"></div> </body> </html>"""from pymaps import Map, PyMap import csv reader = csv.reader(open('http://scraperwiki.com/scrapers/export/swimming-attempt/'), delimiter=',', quotechar='"') tmap = Map() tmap.zoom = 3