def visualize(): center = location_latlongs[1] m = Map(center=center, zoom=8) icon1 = Icon( icon_url='https://img.icons8.com/ultraviolet/40/000000/map-pin.png', icon_size=[40, 40], icon_anchor=[20, 40]) icon2 = Icon( icon_url='https://img.icons8.com/officel/40/000000/map-pin.png', icon_size=[40, 40], icon_anchor=[20, 40]) icon3 = Icon( icon_url= 'http://icons.iconarchive.com/icons/custom-icon-design/flatastic-6/256/Circle-icon.png', icon_size=[10, 10], icon_anchor=[5, 5], shadow_size=[5, 5]) line = Polyline(locations=[[ path_latlongs, ]], color="#669df6", fill=False, weight=2, stroke=True) m.add_layer(line) style = {'text-align': 'left', 'description_width': '150px'} i = 0 while i < len(location_latlongs): if i == 0: message = HTML() message.placeholder = "Source" message.description = "Source" + "<br>Node ID: " + location_latlongs[ i][2] + "<br>Lat: " + str( location_latlongs[i][1]) + "<br>Long: " + str( location_latlongs[i][0]) message.style = style marker = Marker(location=location_latlongs[i], draggable=False, title="Source", icon=icon1, rise_on_hover=True, z_index_offset=100) m.add_layer(marker) marker.popup = message elif (len(location_latlongs) - i) == 1: message = HTML() message.placeholder = "Destination" message.description = "Destination" + "<br>Node ID: " + location_latlongs[ i][2] + "<br>Lat: " + str( location_latlongs[i][1]) + "<br>Long: " + str( location_latlongs[i][0]) message.style = style marker = Marker(location=location_latlongs[i], draggable=False, title="Destination", icon=icon2, rise_on_hover=True) m.add_layer(marker) marker.popup = message else: message = HTML() message.placeholder = "Waypoint" message.description = "Waypoint: " + str( i) + "" + "<br>Node ID: " + location_latlongs[i][ 2] + "<br>Lat: " + str( location_latlongs[i][1]) + "<br>Long: " + str( location_latlongs[i][0]) message.style = style marker = Marker(location=location_latlongs[i], draggable=False, icon=icon3, title="Waypoint", rise_on_hover=True) m.add_layer(marker) marker.popup = message i += 1 return (m)