I am creating map of servers from a list. I have a function that filters these server and I would like to change marker color based on these filters. However, when I add color to marker as seen bellow, marker icon changes to info-sign and color is ignored. Anyone please know how to bypass this problem?

    for node in nodes:
        name = node[2]
        if node[-2] == 'unknown' or node[-1] == 'unknown':
            continue
        x = float(node[-2])
        y = float(node[-1])
        text = """
            NODE: %s, IP: %s
            URL: %s
            FULL NAME: %s
            LATITUDE: %s, LONGITUDE: %s
            """ % (node[2],
                   node[1],
                   node[7],
                   node[8],
                   node[9],
                   node[10])
        popup = folium.Popup(text.strip().replace('\n', '<br>'), max_width=1000)
        folium.Marker([x, y],popup=popup, icon=folium.Icon(color=color)).add_to(map_full)

    map_full.save('plbmng_server_map.html')

color is set at the beginning and can be one of the ['yellow', 'blue', 'red']

0 Answers