Use ipywidget and dataframe in map folium

Viewed 18

I make a map display with folium.map(). From a dataframe I have a list of tuples containing my latitude and longitude. I make a display with ipywidget of the points on my map without problem. However, I would like that when a new point is found on the map (for example a point which was not present when my interact was at 1 but which appears in 2) this point is put in a different color than the others . the ideal would be that the point returns to the initial color (blue here in my code) once it is displayed from the x before. I can't because it depends on my interact and I don't know how to use it. Can you help me ?

@widgets.interact(x=(0, len(df_reg)-1))
def f(x=0):
  map_complete = folium.Map( location=(45, 0), zoom_start=3 )
  df_map = df_reg[x][(df_reg[x].region == 'AR') & (df_reg[x].data_type == 'MO')]
  points = [(i,j) for i,j in zip(df_map['geospatial_lat_min'],df_map['geospatial_lon_min'])]
  pf = [(i) for i in zip(df_map['platform_code'])]
  i=0
  for i in range(len(df_map)):
    folium.CircleMarker(points[i], radius=2, weight=1, color = 'blue',fill_color= 'blue', fill_opacity=1, tooltip = pf[i]).add_to(map_complete)
  display(map_complete)

points for interact x=0

0 Answers
Related