當前位置: 首頁>>代碼示例>>Python>>正文


Python folium.Icon方法代碼示例

本文整理匯總了Python中folium.Icon方法的典型用法代碼示例。如果您正苦於以下問題:Python folium.Icon方法的具體用法?Python folium.Icon怎麽用?Python folium.Icon使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在folium的用法示例。


在下文中一共展示了folium.Icon方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: plot_on_map

# 需要導入模塊: import folium [as 別名]
# 或者: from folium import Icon [as 別名]
def plot_on_map(data, _index):

    resolution, width, height = 75, 7, 3
    lat, lon = (sangil_gwangju_lat_limit[0]/2 + sangil_gwangju_lat_limit[1]/2 ,
        sangil_gwangju_lon_limit[0]/2 + sangil_gwangju_lon_limit[1]/2)

    map = folium.Map(location=[lat, lon], zoom_start=12)
    Color = mcolors.CSS4_COLORS.values()
    countcar = 0

    for i in _index:
        countcar += 1
        print str(data[2][i])+'번 차량 지도에 그리는 중....'
        for j in range(0, len(data[0][i])):

            if j == 0:
                folium.Marker(location=[float(data[0][i][j]), float(data[1][i][j])],
                    icon=folium.Icon(color='red'),
                    popup=data[2][i]+'start').add_to(map)
            elif j == len(data[0][i]) - 1:
                folium.Marker(location=[float(data[0][i][j]), float(data[1][i][j])],
                    icon=folium.Icon(color='blue'),popup=data[2][i]+'end').add_to(map)

            folium.CircleMarker(location=[float(data[0][i][j]), float(data[1][i][j])],
                radius=20, line_color=Color[countcar],fill_color=Color[countcar],
                fill_opacity=0.1)

        folium.CircleMarker(location=[sangil_gwangju_lat_limit[1], sangil_gwangju_lon_limit[0]],
            radius=100, line_color='black',
            fill_color='black', fill_opacity=1)

        folium.CircleMarker(location=[sangil_gwangju_lat_limit[0], sangil_gwangju_lon_limit[1]], radius=100,
                          line_color='black', fill_color='black', fill_opacity=1)

    map.save('result.html')

    os.system('explorer.exe result.html')

    print "총 지나간 차량 : %.3s 대" % countcar 
開發者ID:jeonghoonkang,項目名稱:BerePi,代碼行數:41,代碼來源:gps_map_marker.py

示例2: _add_begin_end_markers_to_folium_map

# 需要導入模塊: import folium [as 別名]
# 或者: from folium import Icon [as 別名]
def _add_begin_end_markers_to_folium_map(move_data, base_map):
    """
    Adds a green marker to beginning of the trajectory and a red marker to the
    end of the trajectory.

    Parameters
    ----------
    move_data : pymove.core.MoveDataFrameAbstract subclass.
        Input trajectory data.
    base_map : folium.folium.Map, optional, default None.
        Represents the folium map. If not informed, a new map is generated.

    """

    folium.Marker(
        location=[move_data.iloc[0][LATITUDE], move_data.iloc[0][LONGITUDE]],
        color='green',
        clustered_marker=True,
        popup='Início',
        icon=folium.Icon(color='green', icon='info-sign'),
    ).add_to(base_map)

    folium.Marker(
        location=[move_data.iloc[-1][LATITUDE], move_data.iloc[-1][LONGITUDE]],
        color='red',
        clustered_marker=True,
        popup='Fim',
        icon=folium.Icon(color='red', icon='info-sign'),
    ).add_to(base_map) 
開發者ID:InsightLab,項目名稱:PyMove,代碼行數:31,代碼來源:visualization.py

示例3: tracker

# 需要導入模塊: import folium [as 別名]
# 或者: from folium import Icon [as 別名]
def tracker():
  loc = geocoder.osm(app.vars.get('location'))
  if loc.lat is not None and loc.lng is not None:
    latlng = [loc.lat, loc.lng]
  else:
    return redirect('/geoerror.html')
  
  # insist on a valid map config
  map_path = app.vars.get("map_path")
  if not map_path:
    return redirect('/error.html')
  if app.vars.get("cache") == "yes" and Path(map_path).exists():
    return render_template('display.html')
  else:
    bus_map = folium.Map(location=latlng, zoom_start=15)
    bus_map.add_child(folium.Marker(location=latlng,
                                    popup=escape_apostrophes(loc.address),
                                    icon=folium.Icon(color='blue')))

    # Call API for bus locations
    bus_list = get_buses(loc.lat, loc.lng, app.vars['radius'])

    for bus in bus_list:
      route_id = bus.get('RouteID')
      trip_headsign = escape_apostrophes(bus.get('TripHeadsign'))
      folium.features.RegularPolygonMarker(location = [bus['Lat'], bus['Lon']],
                                           popup = f"Route {route_id} to {trip_headsign}",
                                           number_of_sides = 3,
                                           radius = 15,
                                           weight = 1,
                                           fill_opacity = 0.8,
                                           rotation = 30).add_to(bus_map)
  
    bus_map.save(map_path)
    return render_template('display.html')
  pass 
開發者ID:gotoariel,項目名稱:folium-demo,代碼行數:38,代碼來源:app.py


注:本文中的folium.Icon方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。