当前位置: 首页>>代码示例>>Python>>正文


Python pygmaps.maps函数代码示例

本文整理汇总了Python中pygmaps.maps函数的典型用法代码示例。如果您正苦于以下问题:Python maps函数的具体用法?Python maps怎么用?Python maps使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了maps函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: map_individuals

 def map_individuals(self):
     import pygmaps
     from matplotlib import colors as matcol
     colormap = plt.cm.get_cmap()
     import random 
     r = random.sample(range(len(set(self.labels))), len(set(self.labels)))
     rand = []
     for i in range(len(self.labels)):
         rand.append(r[self.labels[i]]/float(self.clusters))
     for color in set(self.colors):
         first = True
         num_paths = 0
         for i in range(len(self.colors)):
             if self.colors[i] == color:
                 num_paths += 1
                 start_lat = self.data[i]['trip_start_location'][1]
                 start_lon = self.data[i]['trip_start_location'][0]
                 end_lat = self.data[i]['trip_end_location'][1]
                 end_lon = self.data[i]['trip_end_location'][0]
                 if first:
                     mymap = pygmaps.maps(start_lat, start_lon, 10)
                     first = False
                 path = [(start_lat, start_lon), (end_lat, end_lon)]
                 mymap.addpath(path, matcol.rgb2hex(colormap(rand[i])))
         if num_paths > 1:
             mymap.draw('./mycluster' + str(color) + '.html')
         else:
             mymap.draw('./onemycluster' + str(color) + '.html') #clusters with only one trip
开发者ID:nephraim,项目名称:e-mission-server,代码行数:28,代码来源:featurization.py

示例2: show_map

def show_map(location):
    '''
    show_map(dict) -> str (HTML with map)
    
    Use pygmaps (as a class modified in this project) to draw map
    and overlay icon on location (latitude, longitude) 
    and a circle with the accuracy
    Overlay the weather stations near location
    Generates an HTML file that is returned
    '''
    zoom = 15    
    mymap = pygmaps.maps(float(location['latitude']),float(location['longitude']),zoom)
    mymap.addpoint(float(location['latitude']),float(location['longitude']),'house')
    mymap.addcircle(float(location['latitude']),float(location['longitude']),float(location['accuracy']),"#0000FF")
    # add nearest weather stations
    stations = find_weather_stations_near(location)
    for number in range(len(stations)):
        station = stations[number]    
        if station:
            mymap.addpoint(float(station['latitude']), float(station['longitude']), 'station')
        else:
            print "[show_map] No weather station to display"
    mymap.draw('./templates/mymap.html')
    f = open('./templates/mymap.html','r')
    fmap = Markup(f.read())
    return fmap
开发者ID:MiX1964,项目名称:wforecast,代码行数:26,代码来源:weather_forecast.py

示例3: getMap

def getMap(file, path, zoom):
    if (debug >= 1):
        print('Entering getMap:')
    if (debug >= 2):
        print('File passed in:' + str(file))
        print('Path passed in:' + str(path))
        print('Zoom Level passed in::' + str(zoom))

    # with open(file, 'r') as f:
    #     while (True):
    #         lineIn =

    f = open(file, 'r')

    lineIn = skipHash(f)

    c1, c2 = latLong(lineIn)
    if (debug >= 2):
        print('\tCoordinates: ' + str(c1) + ' - ' + str(c2))
    mymap = pygmaps.maps(c1, c2, zoom)

    lineIn = f.readline()
    counter = 1
    while lineIn:
        c1, c2 = latLong(lineIn)
        if not (c1 == 0) and not (c2 == 0):
            mymap.addpoint(c1, c2, "#0000FF")
            counter += 1

        lineIn = f.readline()
    mymap.draw(path + '\mymap.html')
    print(counter)
开发者ID:MajorD4m4ge,项目名称:exifmap,代码行数:32,代码来源:exifmap.py

示例4: make_route_HTML

def make_route_HTML(input_file_name, output_file_name="", input_path="./GPS_route_log", output_path="./htmls", data_separator=",", open_at_finish=False):

	track_file = open(input_path + "/" + input_file_name, 'r')

	GPS_data = []
	for line in track_file:
		data = (line.split("\n")[0]).split(data_separator)
		GPS_data.append((float(data[0]), float(data[1])))

	start = [(GPS_data[0])[0], (GPS_data[0])[1]]
	stop = [(GPS_data[len(GPS_data)-1])[0], (GPS_data[len(GPS_data)-1])[1]]

	mymap = pygmaps.maps(start[0], start[1], 16)
	mymap.addpoint(start[0], start[1]) #, "#0000FF")
	mymap.addpoint(stop[0], stop[1], "#FFFFFF") #, "#0000FF")
	mymap.addpath(GPS_data,"#0000FF")

	if output_file_name == "":
		output_file_name = input_file_name + ".html"

	if (not (os.path.isdir(output_path))):
		os.system('mkdir ' + output_path)
	mymap.draw(output_path + "/" + output_file_name)

	if open_at_finish:
		webbrowser.open(output_path + "/" + output_file_name,2)
开发者ID:GPS-Robotic,项目名称:Motorization,代码行数:26,代码来源:create_map.py

示例5: func7

def func7(signal_data):
    #Declaring an empty list to hold the list of coordinates
    coordinates = []
    #Declaring a smaller list to hold the current coordinates
    position = []
    count = 0
    for line in signal_data:
        if 'latitude' in line.values() and count is 0:
            position.append(float(line['value']))
            count = count + 1
            continue
        if 'latitude' in line.values() and count is 1:
            position.insert(0,float(line['value']))
            coordinates.append(tuple(position))
            #Reinitialize position to empty list when both coordinates are found
            position = []
            count = 0
            continue
        if 'longitude' in line.values() and count is 0:    
            position.append(float(line['value']))
            count = count + 1
            continue
        if 'longitude' in line.values() and count is 1:    
            position.append(float(line['value']))
            coordinates.append(tuple(position))
            #Reinitialize position to empty list when both coordinates are found
            position = []
            count = 0
            continue
    print('Map file created')
    mymap = pygmaps.maps(coordinates[0][0], coordinates[0][1],15)
    mymap.addpath(coordinates, "#FF0000")
    mymap.draw('./mymap.html')
开发者ID:anushagj,项目名称:Analysis-of-CAN-bus-data-in-automobiles,代码行数:33,代码来源:Data+Analysis.py

示例6: drawTopK

def drawTopK(topKPath, cluster_centers, cluster_centers2):
    global colors
    mymap = pygmaps.maps(37.78713, -122.42392, 13)
    i = 0
    colorNum = 6
    for score, route, timeLen in topKPath:
        path = []
        if sc.haveStartClus:
            mymap.addpoint(cluster_centers[sc.startClus][1], cluster_centers[sc.startClus][0], colors[8], title = str(sc.startClus)+'_clus ')
            path.append((cluster_centers[sc.startClus][1], cluster_centers[sc.startClus][0]))

        for clus, hr, clusScore in route:
            lms = findClusLms(clus, hr)
            mymap.addpoint(cluster_centers[clus][1], cluster_centers[clus][0], colors[i%colorNum], title = str(clus)+'_clus '+str(hr)+'hr')
            path.append((cluster_centers[clus][1], cluster_centers[clus][0]))
            for lmId, lm_time, lm_score in lms:
                lon, lat = findLmLoc(lmId, cluster_centers2)
                if lmId != 186 and lmId!= 310:
                    if len(path) == 0:
                        mymap.addpoint(lat, lon, colors[8], title = str(lmId)+'_lm '+str(lm_time)+'hr')
                    else:
                        mymap.addpoint(lat, lon, colors[i%colorNum], title = str(lmId)+'_lm '+str(lm_time)+'hr')
                    # path.append((lat, lon)) #draw lm paths
        mymap.addpoint(cluster_centers[clus][1], cluster_centers[clus][0], colors[7], title = str(clus)+'_clus '+str(hr)+'hr')
        # mymap.addpoint(lat, lon, colors[7], title = str(lmId)+'_lm '+str(lm_time)+'hr')
        mymap.addpath(path, colors[i%colorNum])
        i += 1

    if sc.haveStartClus:
        drawName = '_'.join(['topK', str(sc.popImp), str(sc.simImp), str(sc.ulmImp), 'StartClus'+str(sc.startClus), sc.seqtime]) + '.html'
    else:
        drawName = '_'.join(['topK', str(sc.popImp), str(sc.simImp), str(sc.ulmImp), 'NoStart', sc.seqtime]) + '.html'
    mymap.draw(drawName)
    url = drawName
    webbrowser.open_new_tab(url)
开发者ID:shelley57123,项目名称:Thesis,代码行数:35,代码来源:drawGmap.py

示例7: drawTopK_cmp

def drawTopK_cmp(topKPath, cluster_centers):
    global colors
    mymap = pygmaps.maps(37.78713, -122.42392, 13)
    i = 0
    colorNum = 6
    for route, timeLen, score in topKPath:
        path = []

        # mymap.addpoint(cluster_centers[sc.startLm][1], cluster_centers[sc.startLm][0], colors[8], title = str(sc.startLm)+'_clus ')
        # path.append((cluster_centers[sc.startLm][1], cluster_centers[sc.startLm][0]))

        for lmId in route:
            lon, lat = findLmLoc(lmId, cluster_centers)
            if len(path) == 0:
                mymap.addpoint(lat, lon, colors[8], title = str(lmId)+'_lm '+str(timeLen)+'hr s:'+str(score))
            else:
                mymap.addpoint(lat, lon, colors[i%colorNum], title = str(lmId)+'_lm ')
            path.append((lat, lon))

        mymap.addpoint(lat, lon, colors[7], title = str(lmId)+'_lm ')
        mymap.addpath(path, colors[i%colorNum])
        i += 1

    drawName = '_'.join(['topK_cmp', str(sc.popImp), str(sc.simImp), str(sc.ulmImp), 'StartLm'+str(sc.startLm) ]) + '.html'
    
    mymap.draw(drawName)
    url = drawName
    webbrowser.open_new_tab(url)
开发者ID:shelley57123,项目名称:Thesis,代码行数:28,代码来源:drawGmap.py

示例8: draw_trips

def draw_trips(directory, outputpath):
  filelist = traverseFolder(directory, '.mat')
  print(filelist)
  
  make_sure_path_exists(outputpath)
  
  color_list = ['Aqua',
    'Alizarin crimson',
    'Amber',
    'Amethyst',
    'Android Green',
    'Azure',
    'Deep pink',
    'Magenta']
  
  color_dictionary = {'Aqua':       "#00ffff",
          'Alizarin crimson': "#e32636",
          'Amber':      "#ffbf00",
          'Amethyst':   "#9966cc",
          'Android Green':    "#a4c639",
          'Azure':      "#007fff",
          'Deep pink':    "#ff1493",
          'Magenta':	"#f00ff"
      }
  
  start_color = "#0000FF"
  end_color = "#FF0000"
  
  index = 0
  Trip_list = []

  for file in filelist:
    Trip_data = load_mat_file(file) # load origin .mat data
    point_list = extract_points_location(Trip_data)
    
    trip = Trip()
    trip.name = file
    trip.start_point = point_list[0]
    trip.end_point = point_list[-1]
    trip.Trip_index = index
    trip.path_list = []
    trip.path_color = color_list[index]
    
    for i in point_list:
      trip.path_list.append(tuple([i.latitude, i.longitude]))

    # draw start point, end point, route_path
    if 'mymap' not in locals():
      mymap = pygmaps.maps(trip.start_point.latitude, trip.start_point.longitude, 12) # start a map
    mymap.addpoint(trip.start_point.latitude, trip.start_point.longitude, start_color)
    mymap.addpoint(trip.end_point.latitude, trip.end_point.longitude, end_color)
    mymap.addpath(trip.path_list, color_dictionary[trip.path_color])
    index = (index + 1) % len(color_list)
    
  map_path = outputpath + 'SoSd.map.draw.html'  # delete the '.mat' and add '.map.draw.html'
  mymap.draw(map_path)
  url = map_path
  webbrowser.open_new_tab(url)
  Trip_list.append(trip)
开发者ID:mayuan798,项目名称:ISL_project_MTC,代码行数:59,代码来源:draw_SoSd.py

示例9: getGoogleMap

	def getGoogleMap(self):
		latidute = [y.data.x for y in self.gps_llh]
		longitude = [y.data.y for y in self.gps_llh]
		height =  [y.data.z for y in self.gps_llh]
		mymap = pygmaps.maps(latidute[1],longitude[1],16)
		path = zip(latidute, longitude)
		mymap.addpath(path, "#0099FF")
		mymap.draw('./mymap.html')
开发者ID:Fab7c4,项目名称:cletus,代码行数:8,代码来源:logdata.py

示例10: gmaps

def gmaps():
  #Build map
  map = pygmaps.maps(latitude, longitude, 3)
  for p,k in latlong.items():
    #Add in locations
    map.addpoint(float(p), float(k))
  #Draw the map
  map.draw('./map.html')
开发者ID:radman404,项目名称:Who-s-attacking-me-now--,代码行数:8,代码来源:wamnv0.2a.py

示例11: index

def index(request):	
	mymap = pygmaps.maps(20.680329,-103.348732,17)
	mapa = mymap.script_drawmap() 
	miubicacion = mymap.script_self_point()
	c = Context({'drawselfpoint':miubicacion,'drawmap':mapa})
	t = get_template("mimapa.html")
	html = t.render(c)
	return HttpResponse(html) 
开发者ID:ejricardo,项目名称:mysite,代码行数:8,代码来源:views.py

示例12: draw_coroutes

def draw_coroutes(directory, outputpath, number):
  filelist = traverseFolder(directory, '.mat', number)
  print(filelist)

  make_sure_path_exists(outputpath)
  
  color_list = ['Deep pink',
    'Alizarin crimson',
    'Amber',
    'Amethyst',
    'Android Green',
    'Azure',
    'Aqua',
    'Magenta']
  
  color_dictionary = {'Aqua':       "#00ffff",
          'Alizarin crimson': "#e32636",
          'Amber':      "#ffbf00",
          'Amethyst':   "#9966cc",
          'Android Green':    "#a4c639",
          'Azure':      "#007fff",
          'Deep pink':    "#ff1493",
          'Magenta':  "#f00ff"
      }
  
  start_color = "#0000FF"
  end_color = "#FF0000"
  
  index = 0
  coRoute_list = []
  
  for file in filelist:
    coRoute_data = load_mat_file(file)
    point_list = extract_points_location(coRoute_data)
    
    route = coRoute()
    route.name = file
    route.start_point = point_list[0]
    route.end_point = point_list[-1]
    route.coRoute_index = index
    route.path_list = []
    route.path_color = color_list[index]
    
    for i in point_list:
      route.path_list.append(tuple([i.latitude, i.longitude]))

    # draw start point, end point, route_path
    mymap = pygmaps.maps(route.start_point.latitude, route.start_point.longitude, 12) # start a map
    mymap.addpoint(route.start_point.latitude, route.start_point.longitude, start_color)
    mymap.addpoint(route.end_point.latitude, route.end_point.longitude, end_color)
    mymap.addpath(route.path_list, color_dictionary[route.path_color])
    index = index + 1

    map_path = outputpath + file.split("/")[-1][:-4] + '.map.draw.html'  # delete the '.mat' and add '.map.draw.html'
    mymap.draw(map_path)
    url = map_path
    webbrowser.open_new_tab(url)
    coRoute_list.append(route)
开发者ID:mayuan798,项目名称:ISL_project_MTC,代码行数:58,代码来源:draw_coRoute.py

示例13: create_search_map

def create_search_map(origin, coords, radius_enforced=True, radius=1):
    lat, lon = origin
    gmap = pygmaps.maps(lat, lon, 12)  # 14 is the map's zoom level
    gmap.addradpoint(lat, lon, (radius * METERS_PER_MILE), "origin")
    for pair in coords:
        lat, lon = pair
        gmap.addpoint(lat, lon, "#0000FF")
    timestamp = strftime("%H:%M:%S", localtime())
    gmap.draw("./search_map_({0}).html".format(timestamp))
开发者ID:verygoodsoftwarenotvirus,项目名称:Screlp-CLI,代码行数:9,代码来源:files.py

示例14: iphone_test

def iphone_test(value):
    flag=0
    lats=[]
    longs=[]
    lines=value
    line=lines.split("\n")
    for each in line:
        if (each!=""):
            each1=each.split()
            if (re.match("[0-9]+",each1[5])):
                lats.append(float(each1[5]))
            if (re.match("[0-9]+",each1[6])):
                longs.append(float(each1[6]))
    latitudes=RemoveOutliers(lats)
    longitudes=RemoveOutliers(longs)
    centerlong=mean(longitudes)
    centerlat=mean(latitudes)
    mymap = pygmaps.maps(centerlat,centerlong, 10)
    print "<table border='1'>"
    for each in line:
        if(each != ""):            
            print "<tr>"
            each1=each.split()
            if(re.match("[0-9]+",each1[5])):
                print "<td>"+each1[5]+"</td>"
                lat=float(each1[5])
                flag=0
            else:
                flag=-1
                print "<th>"+"Latitude&nbsp;&nbsp;"+"</th>"                        
                        
            if(re.match("[0-9]+",each1[6])):
                print "<td>"+"<br>"+each1[6]+"</td>"
                longitude=float(each1[6])
                flag=0
            else:
                print "<th>"+"Longitude"+"</th>"
                flag=-1

            if flag==-1:
                print "<th>"+"Formatted Address"+"</th>"

            else:
                address=returnaddress(lat,longitude)
                utf_version=address.encode('utf-8')
                print "<td>"+"<br>"+utf_version+"</td>"
            
            if(flag==0):
                mymap.addradpoint(lat, longitude, 30000, "#FF0000")
                mymap.addpoint(lat, longitude, "#FF0000")

        print "</tr>"

    print "</table>"
    mymap.draw('mymap.draw.html') 
    url = 'mymap.draw.html'
    webbrowser.open_new(url) 
开发者ID:GpsProjection,项目名称:devop,代码行数:57,代码来源:save_file.py

示例15: ihopethisshitwrosk

def ihopethisshitwrosk():
    Food.query(fat,rat)
    title = "ur here"
    mymap = pygmaps.maps(fat,rat,20)
    mymap.addpoint(fat, rat,"Sr")
    for k,v in Food.query(fat,rat).items():
        mymap.addpoint(k,v,"#0000FF")
   
    mymap.draw("./mymap.html")
开发者ID:PhillyBadGuide,项目名称:RealCodeDayStuff,代码行数:9,代码来源:TheFile.py


注:本文中的pygmaps.maps函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。