当前位置: 首页>>代码示例>>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;未经允许,请勿转载。