How to use the folium.Icon function in folium

To help you get started, we’ve selected a few folium examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FinalProject0b1100100 / tfa_project / final project.py View on Github external
def get_map(self,startpoint,dff,dff2, route_edges, api_key):
        startpoint_ll = self.get_lat_lng(startpoint,api_key)
        m = folium.Map(location=startpoint_ll,zoom_start=14)
        icon_hz = dict(prefix='fa', color='red', icon_color='darkred', icon='cny')
        folium.Marker(startpoint_ll, popup = "You are here: "+ startpoint,icon=folium.Icon(color='green')).add_to(m)
        for i in range(len(dff)):
            folium.Marker([dff.iloc[i]['lat'],dff.iloc[i]['lng']],
                            popup='Attraction: '+dff.iloc[i]['attraction']+ ';   Address: '+dff.iloc[i]['address']
                          + ';   Duration: ' +str(dff.iloc[i]['duration'])+' hour(s)'
                             ).add_to(m)
        for i in route_edges:
            lat1 = dff2[dff2['attraction']==i[0]]['lat'].iloc[0]
            lng1 = dff2[dff2['attraction']==i[0]]['lng'].iloc[0]
            lat2 = dff2[dff2['attraction']==i[1]]['lat'].iloc[0]
            lng2 = dff2[dff2['attraction']==i[1]]['lng'].iloc[0]
            ls = folium.PolyLine(locations=[[lat1,lng1],[lat2,lng2]],color='blue')
            ls.add_to(m)
        return m
github hastagAB / Awesome-Python-Scripts / covid_visualiser / main.py View on Github external
mp = folium.Map(location = [city_data[1]['lat'],city_data[1]['lng']],zoom_start= 5)

for i in range(len(city_data)):
    if "deaths" in city_data[i]:
        if float(city_data[i]['deaths']) > 50:
            folium.Marker(location = [city_data[i]['lat'],city_data[i]['lng']],
                          popup = city_data[i]['state'],
                          icon=folium.Icon(color='darkred',icon_color='white',icon='remove-sign',),
                          tooltip = 'deaths: ' + city_data[i]['deaths'] + ' confirmed: ' + city_data[i]['confirmed']
                         ).add_to(mp)
        elif float(city_data[i]['deaths']) > 20:
            folium.Marker(location = [city_data[i]['lat'],city_data[i]['lng']],
                          popup = city_data[i]['state'],
                          icon=folium.Icon(color='red',icon_color='white',icon='ban-circle',),
                          tooltip = 'deaths: ' + city_data[i]['deaths'] + ' confirmed: ' + city_data[i]['confirmed']
                         ).add_to(mp)
        elif float(city_data[i]['deaths']) > 0:
            folium.Marker(location = [city_data[i]['lat'],city_data[i]['lng']],
                          popup = city_data[i]['state'],
                          icon=folium.Icon(color='orange',icon_color='white',icon='warning-sign',),
                          tooltip = 'deaths: ' + city_data[i]['deaths'] + ' confirmed: ' + city_data[i]['confirmed']
                         ).add_to(mp)

        elif float(city_data[i]['deaths']) == 0:
            folium.Marker(location = [city_data[i]['lat'],city_data[i]['lng']],
                          popup = city_data[i]['state'],
                          icon=folium.Icon(color='green',icon_color='white',icon='ok-circle',),
                          tooltip = 'deaths: ' + city_data[i]['deaths'] + ' confirmed: ' + city_data[i]['confirmed']
                         ).add_to(mp)
github FinalProject0b1100100 / tfa_project / file.py View on Github external
def get_map(startpoint,result):
    import folium
    import os
    startpoint_ll = get_lat_lng(startpoint,api_key)
    m = folium.Map(location=startpoint_ll,zoom_start=14)
    icon_hz = dict(prefix='fa', color='red', icon_color='darkred', icon='cny')
    folium.Marker(startpoint_ll, popup = startpoint,icon=folium.Icon(color='green')).add_to(m)
    for i in range(len(df)):
            folium.Marker([df.iloc[i]['lat'],df.iloc[i]['lng']],
                            popup='Attraction: '+df.iloc[i]['attraction']+ ';   Address: '+df.iloc[i]['address']
                          + ';   Duration: ' +str(df.iloc[i]['duration'])+' hour(s);   Type: ' +df.iloc[i]['type']
                          + ';   Link: ' +df.iloc[i]['attraction_link']
                             ).add_to(m)
    for i in route_edges:
        lat1 = df2[df2['attraction']==i[0]]['lat'].iloc[0]
        lng1 = df2[df2['attraction']==i[0]]['lng'].iloc[0]
        lat2 = df2[df2['attraction']==i[1]]['lat'].iloc[0]
        lng2 = df2[df2['attraction']==i[1]]['lng'].iloc[0]
        ls = folium.PolyLine(locations=[[lat1,lng1],[lat2,lng2]],color='blue')
        ls.add_to(m)
    return m
# get_map(startpoint,df2)
github TaipanRex / pyvisgraph / examples / 3_plot_path_on_interactive_map.py View on Github external
graph = vg.VisGraph()
graph.load('GSHHS_c_L1.graph')

# Calculate the shortest path
shortest_path  = graph.shortest_path(start_point, end_point)

# Plot of the path using folium
geopath = [[point.y, point.x] for point in shortest_path]
geomap  = folium.Map([0, 0], zoom_start=2)
for point in geopath:
    folium.Marker(point, popup=str(point)).add_to(geomap)
folium.PolyLine(geopath).add_to(geomap)

# Add a Mark on the start and positions in a different color
folium.Marker(geopath[0], popup=str(start_point), icon=folium.Icon(color='red')).add_to(geomap)
folium.Marker(geopath[-1], popup=str(end_point), icon=folium.Icon(color='red')).add_to(geomap)

# Save the interactive plot as a map
output_name = 'example_shortest_path_plot.html'
geomap.save(output_name)
print('Output saved to: {}'.format(output_name))
github microsoft / msticpy / msticpy / nbtools / foliummap.py View on Github external
if ip_entity.AdditionalData:
                addl_props = ", ".join(
                    [
                        f"{key}={val}"
                        for key, val in ip_entity.AdditionalData.items()
                        if val
                    ]
                )
                popup_text = f"{popup_text}<br>{addl_props}"
                tooltip_text = f"{tooltip_text}, {addl_props}"
            marker = folium.Marker(
                location=[ip_entity.Location.Latitude, ip_entity.Location.Longitude],
                popup=popup_text,
                tooltip=tooltip_text,
                icon=folium.Icon(**kwargs),
            )
            marker.add_to(self.folium_map)
github scikit-mobility / scikit-mobility / skmob / utils / plot.py View on Github external
color = get_color(hex_color)
        else:
            color = hex_color

        tgeojson = folium.GeoJson(line,
                                  name='tgeojson',
                                  style_function=style_function(weight, color, opacity)
                                  )
        tgeojson.add_to(map_f)

        if start_end_markers:

            dtime, la, lo = df.loc[df['datetime'].idxmin()]\
                [[constants.DATETIME, constants.LATITUDE, constants.LONGITUDE]].values
            dtime = pd.datetime.strftime(dtime, '%Y/%m/%d %H:%M')
            mker = folium.Marker(trajlist[0][::-1], icon=folium.Icon(color='green'))
            popup = folium.Popup('<i>Start</i><br>{}<br>Coord: <a href="https://www.google.co.uk/maps/place/{},{}">{}, {}</a>'.\
                          format(dtime, la, lo, np.round(la, 4), np.round(lo, 4)), max_width=300)
            mker = mker.add_child(popup)
            mker.add_to(map_f)

            dtime, la, lo = df.loc[df['datetime'].idxmax()]\
                [[constants.DATETIME, constants.LATITUDE, constants.LONGITUDE]].values
            dtime = pd.datetime.strftime(dtime, '%Y/%m/%d %H:%M')
            mker = folium.Marker(trajlist[-1][::-1], icon=folium.Icon(color='red'))
            popup = folium.Popup('<i>End</i><br>{}<br>Coord: <a href="https://www.google.co.uk/maps/place/{},{}">{}, {}</a>'.\
                          format(dtime, la, lo, np.round(la, 4), np.round(lo, 4)), max_width=300)
            mker = mker.add_child(popup)
            mker.add_to(map_f)

    return map_f