def get_map(self): """Displays a google map oO""" tmap = Map() tmap.zoom = 12 # San Francisco top_left = (37.793508, -122.511978) bottom_right = (37.742485, -122.369156) tmap.center = ((top_left[0] + bottom_right[0]) / 2, (top_left[1] + bottom_right[1]) / 2) pin_icon = Icon(id='pin', image="http://gmaps-samples.googlecode.com/svn/trunk/markers/blue/blank.png" ) for gps in self.application.pins: point = (gps[0], gps[1], 'derp', pin_icon.id) tmap.setpoint(point) for gps in self.application.hotspots: point = (gps[0], gps[1], 'derp') tmap.setpoint(point) gmap = PyMap(key='AIzaSyA59m0VtN62qf7Gu_c-_PSX_Eiw_t2vzBA', maplist=[tmap]) gmap.addicon(pin_icon) mapcode = gmap.showhtml() return mapcode
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
tmap = Map() tmap.zoom = 3 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