def find(self, addss): obj = self._search_address(addss) closest_bldg = self._get_closest_bldg(obj) pophtml = self._create_text_box(obj, closest_bldg.iloc[:, :-3]\ .drop('geo', axis=1).dropna(axis=1).to_dict(orient='rows')[0]) try: # creates map bldg_poly = None gj = obj['geojson'] address = obj['address'] test_map = folium.Map( location=[float(obj['lat']), float(obj['lon'])], zoom_start=16) obj_point = folium.Marker(location=(float(obj['lat']), float(obj['lon'])), color='red') obj_point.add_to(test_map) if (gj['type'] == 'Point'): # delineates the surrounding/closest bldg polygon bldg_poly = folium.Polygon( locations=closest_bldg.geo_inv.values.tolist(), color="red", fill=True, fill_color='#FF0000', tooltip=folium.Tooltip(', '.join( obj['display_name'].split(',')[:3])), popup=folium.Popup(pophtml, max_width=300)) bldg_poly.add_to(test_map) if (gj['type'] == 'Polygon' and not bldg_poly): obj_poly = folium.Polygon( locations=[[(a[1], a[0]) for a in b] for b in gj['coordinates']], color="red", fill=True, fill_color='#FF0000', tooltip=folium.Tooltip(', '.join( obj['display_name'].split(',')[:3])), popup=folium.Popup(pophtml, max_width=300)) obj_poly.add_to(test_map) display(test_map) except Exception as e: print("Error while displaying bldg on map.\n{}".format(e))
def add_accident(self, data, **kwargs): if not (re.search(r'NUM', data.lugar)): try: folium.Marker( location=(data.lat, data.lon), tooltip=folium.Tooltip( f'Tipo de colisión: {data.tipo_accidente}<br>' f'Número de parte: {data.numero_parte}<br>' f'Fecha: {data.fecha}<br>' f'Hora: {data.hora}<br>' f'Lugar: {data.lugar}<br>' f'Distrito: {data.distrito}<br>' f'Latitud: {round(data.lat, 5)}<br>' f'Longitud: {round(data.lon, 5)}<br><br>' f'Conductor 1 ---<br>' f'Tipo vehiculo: {data.conductor_1_tipo_vehiculo}<br>' f'Sexo: {data.conductor_1_sexo}<br>' f'Edad: {data.conductor_1_edad}<br><br>' f'Conductor 2 ---<br>' f'Tipo vehiculo: {data.conductor_2_tipo_vehiculo}<br>' f'Sexo: {data.conductor_2_sexo}<br>' f'Edad: {data.conductor_2_edad}<br>'), icon=folium.CustomIcon( icon_image= './mc_map_generator/resources/images/icons/peligro.png', icon_size=(12, 12))).add_to(self._map) except Exception as e: print(e)
def addTraffic(nmap, traffic, month): # Get the mean and standard deviation of traffic at counters mean = traffic.mean()['TrafficCountDay' + str(month)] std = traffic.std()['TrafficCountDay' + str(month)] # Create a marker for each traffic counter for ind in traffic['CountID'].index: num_cars = traffic.loc[ind, 'TrafficCountDay' + str(month)] park = traffic.loc[ind, 'ParkName'] if ~np.isnan(std): if num_cars <= (mean - 0.8*std): qualifier = 'VERY LOW' color = '#009933' elif (num_cars <= (mean - 0.5*std)) and (num_cars > (mean - 0.8*std)): qualifier = 'LOW' color = '#8cff1a' elif (num_cars <= (mean + 0.5*std)) and (num_cars > (mean - 0.5*std)): qualifier = 'AVERAGE' color = '#ffff00' elif (num_cars <= (mean + 0.8*std)) and (num_cars > (mean + 0.5*std)): qualifier = 'HIGH' color = '#ff9900' else: qualifier = 'VERY HIGH' color = '#990000' else: qualifier = 'AVERAGE' color = '#ffff00' popup = folium.Popup( html='<p></strong>' + traffic.loc[ind, 'CountLocation'] + '</strong></p>' + '<p>Mean daily car count at this location: <strong>{}</strong></p>'.format(int(num_cars)) + '<p>Mean daily car count at all locations in ' + park + ': <strong>{}</strong></p>'.format(int(mean)), min_width = 280, max_width = 280 ) tooltip = folium.Tooltip( text='Traffic at ' + traffic.loc[ind, 'CountLocation'] + ' is ' + qualifier + ' compared to the rest of ' + park, sticky=False ) folium.CircleMarker( location = [traffic.loc[ind, 'latitude'], traffic.loc[ind, 'longitude']], popup=popup, tooltip = tooltip, radius = 6, fill = True, color = 'grey', weight = 1, fill_color = color, fill_opacity = 0.9 ).add_to(nmap) return nmap
def global_visualization(topo_json_data, countries, df, factor, layer_name): """ The function is used to create popup map. Parameters: topo_json_data: The geometric data. countries: Lists of countries with data. df: The dataframe containing information to plot. factor: The column of dataframe to plot. layer_name: Returned layer name Return: The layer to be added over map. """ popup = folium.FeatureGroup(name=layer_name, overlay=True, show=True) colormap1 = createcm(df, factor) for data in topo_json_data['objects']['countries1']['geometries']: country_topo = copy.deepcopy(topo_json_data) country_topo['objects']['countries1']['geometries'] = [data] country_name = country_topo['objects']['countries1']['geometries'][0][ 'properties']['name'] country_layer = folium.TopoJson(country_topo,object_path = 'objects.countries1',control=False, show = False, style_function = lambda feature:{ 'fillColor': color_map(feature['properties']['name'],\ colormap1,countries,df,factor), 'color' : 'black', 'fillOpacity': 1, 'weight' : 1, 'dashArray' : '5, 5' }) if country_name not in countries: country_layer.add_child( folium.Tooltip(country_name + ': data not collected.')) else: country_layer.add_child( folium.Tooltip('The ' + factor + ' of ' + country_name + ' is :' + str(df.loc[country_name][factor]))) country_layer.add_to(popup) return popup
def create_map(data, year1, year2): """ Takes a Data class instance as input """ # create map fmap = folium.Map( tiles="Stamen Toner", location=[40.75, -73.9], zoom_start=11, ) # use colorscale normalized by all years values colormap = cm.LinearColormap(colors=["green", "red"], ) # get the difference in consumption between two years diff = data.tds_by_year.loc[:, year1] - data.tds_by_year.loc[:, year2] # create markers colored by the difference in consumption for tds in diff.index: if not pd.isna(diff.loc[tds]): # get lat,long of this tds lat = data.coords[data.coords.tds == tds].latitude.values[0] lon = data.coords[data.coords.tds == tds].longitude.values[0] # add marker to this year marker = folium.Circle( location=[lat, lon], radius=150, color=colormap(diff.loc[tds]), fill=True, tooltip=folium.Tooltip( text=f"tds={tds}, delta-consumption={diff.loc[tds]:.0f}", ), ) fmap.add_child(marker) # show map return fmap
def add_traffic_station_marker(self, locations, station_names=None, legend=None, **kwargs): """Agrega al mapa el tantas estaciones de calidad del aire como ubicaciones existan dentro del parametro locations""" if station_names is None: station_names = [[i] for i in range(len(locations))] for location, stat_name in zip(locations, station_names): try: folium.CircleMarker( location=location, tooltip=folium.Tooltip( f'Estación: {stat_name[0]}<br>Latitud: {round(location[0], 4)}<br>Longitud: {round(location[1], 4)}' ), popup=legend, radius=2, color='red').add_to(self._map) except TypeError as e: print( "El parametro location debe ser un de la forma [lat, lon] ó (lat,lon)" ) print('Probando con la siguiente estación...') continue except FileNotFoundError as e: print( 'El archivo para representar las estaciones no se encuentra en la carpeta "icons"' ) break except Exception as e: print(e)
elev = list(data["ELEV"]) def color_producer(elevation): if elevation < 1000: return 'green' elif 1000 <= elevation < 3000: return 'orange' else: return 'red' map = folium.Map(location=[38.58, -99.09], zoom_start=6, tiles="Mapbox Bright") fg = folium.FeatureGroup(name="My Map") for lt, ln, el in zip(lat, lon, elev): fg.add_child( folium.CircleMarker(location=[lt, ln], radius=6, popup=str(el) + " m", fill_color=color_producer(el), color='grey', fill_opacity=0.7, tooltip=folium.Tooltip(text=str(el)))) fg.add_child( folium.GeoJson( data=(open("world.json", 'r', encoding='utf-8-sig').read()))) map.add_child(fg) map.save("Map1.html")
return color map = folium.Map(location=[32.318230, -86.902298], zoom_start=6, tiles="Mapbox Bright") fg = folium.FeatureGroup(name="My map") html = """<h4>Volcano information:</h4> Height: %s m """ for lt, ln, el in zip(lat, lon, elev): iframe = folium.IFrame(html=html % str(el), width=200, height=100) fg.add_child( folium.CircleMarker(location=[lt, ln], radius=6, popup=folium.Popup(iframe), tooltip=folium.Tooltip(text=str(el) + " M"), fill_color=color_mapper(el), color='grey', fill_opacity=0.7)) fg.add_child( folium.GeoJson( data=(open('world.json', 'r', encoding='utf-8-sig').read()))) map.add_child(fg) map.save("Map3.html")
def make_map(layer_geojson=None, points=None, circles=None, polyline=None, goal_line=None, margin=0, thermal_layer=False, show_thermal=False, waypoint_layer=False, show_waypoint=False, extra_tracks=None, airspace_layer=None, show_airspace=False, infringements=None, bbox=None, trackpoints=None): """Gets elements and layers from Flask, and returns map object""" '''creates layers''' if points is None: points = [] if bbox: location = bbox_centre(bbox) else: location = [45, 10] folium_map = folium.Map(location=location, position='relative', zoom_start=13, tiles="Stamen Terrain", max_bounds=True, min_zoom=5, prefer_canvas=True) # folium.LayerControl().add_to(folium_map) '''Define map borders''' # at this stage a track (layer_geojason has bbox inside, # otherwise (plotting wpts, airspace, task) we can use the bbox variable if bbox: folium_map.fit_bounds(bounds=bbox, max_zoom=13) if layer_geojson: '''Define map borders''' if layer_geojson["bbox"]: bbox = layer_geojson["bbox"] folium_map.fit_bounds(bounds=bbox, max_zoom=13) """Design track""" if layer_geojson["geojson"]: track = layer_geojson['geojson']['tracklog'] folium.GeoJson( track, name='Flight', style_function=track_style_function).add_to(folium_map) if extra_tracks: extra_track_style_function = lambda colour: (lambda x: { 'color': colour if x['properties']['Track'] == 'Pre_Goal' else 'grey' }) for extra_track in extra_tracks: colour = extra_track['colour'] folium.GeoJson(extra_track['track'], name=extra_track['name'], style_function=extra_track_style_function( colour)).add_to(folium_map) if thermal_layer: thermals = layer_geojson['geojson']['thermals'] thermal_group = FeatureGroup(name='Thermals', show=show_thermal) for t in thermals: # icon = Icon(color='blue', icon_color='black', icon='sync-alt', angle=0, prefix='fas') icon = CustomIcon('/app/airscore/static/img/thermal.png') thermal_group.add_child( Marker([t[1], t[0]], icon=icon, popup=Popup(t[2]))) folium_map.add_child(thermal_group) if waypoint_layer: waypoints = layer_geojson['geojson']['waypoint_achieved'] waypoint_group = FeatureGroup(name='Waypoints Taken', show=show_waypoint) for w in waypoints: waypoint_group.add_child( Marker([w[1], w[0]], popup=Popup(w[6], max_width=300))) folium_map.add_child(waypoint_group) """Design cylinders""" if circles: for c in circles: """create design based on type""" if c['type'] == 'launch': col = '#996633' elif c['type'] == 'speed': col = '#00cc00' elif c['type'] == 'endspeed': col = '#cc3333' elif c['type'] == 'restricted': col = '#ff0000' else: col = '#3186cc' popup = folium.Popup( f"<b>{c['name']}</b><br>Radius: {str(c['radius_label'])} m.", max_width=300) folium.Circle(location=(c['latitude'], c['longitude']), radius=0.0 + c['radius'], popup=popup, color=col, weight=2, opacity=0.8, fill=True, fill_opacity=0.2, fill_color=col).add_to(folium_map) """Plot tolerance cylinders""" if margin: for c in circles: """create two circles based on tolerance value""" folium.Circle(location=(c['latitude'], c['longitude']), radius=0.0 + c['radius'] * (1 + margin), popup=None, color="#44cc44", weight=0.75, opacity=0.8, fill=False).add_to(folium_map) folium.Circle(location=(c['latitude'], c['longitude']), radius=0.0 + c['radius'] * (1 - margin), popup=None, color="#44cc44", weight=0.75, opacity=0.8, fill=False).add_to(folium_map) """Plot waypoints""" if points: for p in points: folium.Marker(location=[p['latitude'], p['longitude']], popup=p['name'], icon=folium.features.DivIcon( icon_size=(20, 20), icon_anchor=(0, 0), html='<div class="waypoint-label">%s</div>' % p['name'], )).add_to(folium_map) """Design optimised route""" if polyline: folium.PolyLine(locations=polyline, weight=1.5, opacity=0.75, color='#2176bc').add_to(folium_map) if goal_line: folium.PolyLine(locations=goal_line, weight=1.5, opacity=0.75, color='#800000').add_to(folium_map) if airspace_layer: airspace_group = FeatureGroup(name='Airspaces', show=show_airspace) for space in airspace_layer: airspace_group.add_child(space) if infringements: for i in infringements: popup = folium.Popup( f"<b>{i[3]}</b><br>{i[5]}. separation: {i[4]} m. <br>" f"{i[7]} - alt. {i[2]} m.", max_width=300) icon = folium.Icon(color="red", icon="times", prefix='fa') airspace_group.add_child( Marker([i[1], i[0]], icon=icon, popup=popup)) folium_map.add_child(airspace_group) if trackpoints: trackpoints_group = FeatureGroup(name='Trackpoints', show=True) for i in trackpoints: tooltip = folium.Tooltip( f"Time UTC: <b>{i[5]}</b> Local Time: <b>{i[6]}</b><br>" f"lat: <b>{round(i[1], 4)}</b> lon: <b>{round(i[0], 4)}</b><br>" f"GPS alt: <b>{int(i[4])} m.</b> ISA Press alt: <b>{int(i[3])} m.</b>" ) trackpoints_group.add_child( folium.CircleMarker((i[1], i[0]), radius=1, tooltip=tooltip)) folium_map.add_child(trackpoints_group) folium.LayerControl().add_to(folium_map) folium.plugins.Fullscreen().add_to(folium_map) folium.plugins.MeasureControl().add_to(folium_map) return folium_map
import folium import pandas as pd data = pd.read_csv("Volcanoes.txt") lat = list(data["LAT"]) lon = list(data["LON"]) elev = list(data["ELEV"]) def color_producer(elevation): if elevation < 1000: return 'green' elif 1000 <= elevation <3000: return 'orange' else: return 'red' map = folium.Map(location=[38.58, -99.09], zoom_start=6, tiles="Mapbox Bright") fg = folium.FeatureGroup(name="My Map") for lt, ln, el in zip(lat, lon, elev): fg.add_child(folium.CircleMarker(location=[lt, ln], radius=6, popup=str(el) + " m", fill_color = color_producer(el), color = 'grey', fill_opacity=0.7, tooltip=folium.Tooltip(text = str(el)))) fg.add_child(folium.GeoJson(data=open('world.json', 'r', encoding='utf-8-sig').read(), style_function=lambda x: {'fillColor':'green' if x['properties']['POP2005'] < 1000000 else 'orange' if 1000000 <= x['properties']['POP2005'] < 2000000 else 'red'})) map.add_child(fg) map.save("Map1.html")
i] + '.jpeg' + slash + '\' width=' + slash + '\'200' + slash + '\'/>' here3 += "var la" + str(i) + "=new L.CircleMarker([" + str( entry[0]) + "," + str( entry[1]) + "], {'color':'#124d00'}).addTo(map); " here3 += "la" + str(i) + ".bindPopup('" + popup + "').openPopup(); " here3 += "})()\">tutaj</a>" for lp, ln, ad, gr in zip(lap, lon, address, group): if gr == "los_angeles": fgv.add_child( folium.CircleMarker(location=[lp, ln], radius=10, popup=folium.Popup(here % (ad, ad, ad)), tooltip=folium.Tooltip(ad), fill_color="#124d00", color="black", fill_opacity=0.7, zoom_start='5')) if gr == "gen": fgv.add_child( folium.CircleMarker(location=[lp, ln], radius=10, popup=folium.Popup(gen % (ad, ad, ad)), tooltip=folium.Tooltip(ad), fill_color="#8cff66", color="black", fill_opacity=0.7)) if gr == "las_vegas": fgv.add_child(
import folium import pandas map = folium.Map(location=[32.318230, -86.902298],zoom_start=6,tiles="Mapbox Bright") data = pandas.read_csv("Volcanoes.txt") lat=list(data["LAT"]) lon=list(data["LON"]) elev=list(data["ELEV"]) def color_mapper(elevation): if(elevation < 1000): color='green' elif(1000<= elevation < 3000): color='orange' else: color='red' return color html = """<h4>Volcano information:</h4> Height: %s m """ fg = folium.FeatureGroup(name="My map1") for lt, ln, el in zip(lat, lon, elev): iframe = folium.IFrame(html=html % str(el), width=200, height=100) fg.add_child(folium.Marker(location=[lt,ln],popup=folium.Popup(iframe), tooltip=folium.Tooltip(text=str(el) + " M"), icon=folium.Icon(color=color_mapper(el)))) map.add_child(fg) map.save("Map1.html")
def create_worldmap(statistic, statistics, merged_data, stats_max): statistics = statistics.copy() if statistic in statistics: statistics.remove(statistic) statistics.insert(0, statistic) colormap = cm.linear.YlOrRd_03.scale(0, stats_max[statistic]).to_step(6) colormap.caption = 'World Map of COVID-19 {}'.format( fields_mapping[statistic]) world_map = folium.Map(location=[42, 0], zoom_start=2, tiles='cartodbpositron') for i in range(merged_data.shape[0]): country_row_data = merged_data.iloc[i:i + 1] country_name = country_row_data['admin'].item() display_values = [] for statistic_to_display in statistics: statistic_value = merged_data.iloc[i][statistic_to_display] if country_row_data[statistic_to_display].isna().bool( ) or statistic_value == 'No Data': display_value = 'No Data' else: statistic_value = float(statistic_value) if statistic_value < 1 and statistic_value > 0: display_value = str(statistic_value) else: display_value = format(int(statistic_value), ',') if statistic_to_display in ['new_cases', 'new_deaths' ] and display_value != '0': display_value = '+{}'.format(display_value) display_values.append(display_value) gs = folium.GeoJson( merged_data.iloc[i:i + 1], style_function=lambda x: { "fillColor": colormap(x['properties'][statistic]) if x['properties'][statistic] is not None else "grey", "color": "black", "weight": 0.5, "fillOpacity": 0.7, }, tooltip=folium.Tooltip( ''' <div style="font-weight:bold; display: inline-block;"> <p>Country: </p> <p>{}: </p> <p>{}: </p> <p>{}: </p> <p>{}: </p> <p>{}: </p> <p>{}: </p> </div> <div style="display: inline-block;"> <p>{}</p> <p>{}</p> <p>{}</p> <p>{}</p> <p>{}</p> <p>{}</p> <p>{}</p> </div> '''.format( fields_mapping[statistics[0]], fields_mapping[statistics[1]], fields_mapping[statistics[2]], fields_mapping[statistics[3]], fields_mapping[statistics[4]], fields_mapping[statistics[5]], country_name, display_values[0], display_values[1], display_values[2], display_values[3], display_values[4], display_values[5], ), style=""" background-color: #F0EFEF; border: 1px solid black; border-radius: 1px; box-shadow: 3px; padding: 10px; """, ), highlight_function=lambda x: { "fillColor": colormap(x["properties"][statistic]) if x["properties"][statistic] is not None else "grey", 'color': 'black', 'fillOpacity': 0.7, 'weight': 2 }).add_to(world_map) colormap.add_to(world_map) return world_map
else: return "red" data = pandas.read_csv('Volcanoes.txt') latitudes = list(data["LAT"]) longitudes = list(data["LON"]) elevations = list(data["ELEV"]) html = """<h4>Volcano information:</h4> Height: %s m """ map = folium.Map(location=(38.58, -99.09), zoom_start=6) fgv = folium.FeatureGroup(name="Volcanoes") for lat, lon, elev in zip(latitudes, longitudes, elevations): fgv.add_child(folium.CircleMarker(location=(lat, lon), tooltip=folium.Tooltip(html % elev), color=color_producer(elev), fill_color=color_producer(elev))) fgp = folium.FeatureGroup(name="Populations") data = open("world.json", "r", encoding="utf-8-sig").read() fgp.add_child(folium.GeoJson(data, style_function=lambda x: {"fillColor":"green" if x["properties"]["POP2005"] < 10000000 else "orange" if 10000000 <= x["properties"]["POP2005"] < 20000000 else "red"})) map.add_child(fgp) map.add_child(fgv) map.add_child(folium.LayerControl()) map.save("webmap1.html")
def create_map(): get_countries() get_cities() global translator, update_time, cities, db, city_update_time # Number of Total Cases in all around the world total_cases = data[1:].TotalCases.sum() total_deaths = data[1:].TotalDeaths.sum() # Empty Folium Map with that uses Open Street Map as a tile m = folium.Map(location=[39.933333333333,32.866667], tiles='OpenStreetMap', zoom_start=5) # Title of map title = "<div class='container'><h1 class='text-center'>CoronaVirus (Covid-19) Haritası</h1><center>Güncelleme Zamanı: {t1}, İl Verileri {t2} Tarihine Aittir</center></div>".format(t1=update_time, t2="03.04.2020") # m.get_root().html.add_child(folium.Element(title)) # CSV file for marking each country on its capitals. This file contains countries information which are name and coordinates of capitals and region of country capitals = pd.read_csv('countries.csv') print("Number of countries", data.shape[0]) # Minimum radius for marking countries with circle min_radius = 50000 cursor = db.cursor() il_feature_group = folium.FeatureGroup(name='İl Verisi') ulke_feature_group = folium.FeatureGroup(name="Ülke Verisi", show=False) update_time_query = 'update update_time set all_data="{v1}", cities_data="{v2}" where row = 1'.format( v1=update_time, v2=city_update_time ) cursor.execute(update_time_query) db.commit() api_check = False try: translator.translate("API Control", src="en", dest="tr").text except json.decoder.JSONDecodeError: print("googletrans json error") api_check = False else: api_check = True # For every country in countries array on global, loop draw circle with respect to number of total cases in country for country in countries[1:]: temp = capitals[capitals.CountryName == country.name] print("CountryName: ", country.name) temp = temp.reset_index() print(temp.iloc[0].CapitalName) # print("Total Cases: ", total_cases) print("Case:", country.total_cases) radius = (int(country.total_cases) / int(total_cases)) * 2000000 radius += min_radius print("Radius:", radius) country_name = temp.iloc[0].ActualName if api_check: try: country_name = translator.translate(temp.iloc[0].ActualName, src="en", dest="tr").text except json.decoder.JSONDecodeError: print("googletrans json error") text = "<div><h4>" + country_name + "</h4><h5>Vaka Sayısı: " + str( int(country.total_cases)) + "</h5><h5>Ölü Sayısı: " + str(int(country.total_deaths)) + "</h5></div>" popup = folium.Popup(html=text, max_width=200, min_width=150, sticky=False) tooltip = folium.Tooltip(text=country_name) country_Circle = folium.Circle( location=(temp.iloc[0].CapitalLatitude, temp.iloc[0].CapitalLongitude), popup=popup, radius=(radius if radius > min_radius else min_radius), color='red', fill=True, fill_color='red', tooltip=tooltip ) if country.name == "Turkey": for city in cities: # folium.Polygon(city.coordinates).add_to(m) city_geojson = create_geojson(city, country) percentage = (city.total_cases/country.total_cases)*100 print("Percentage: ", percentage) style_function = lambda feature: {'fillColor': 'red', 'fillOpacity': 0.15 + (int(feature['properties']['total_cases'])/int(feature['properties']['country_total_cases'])), 'color': 'white', 'weight': 0.75} text = "<div><h5>" + city.name + "</h5><h6>Vaka Sayısı: " + str(int(city.total_cases)) \ + " (%{:.2f}) ".format(percentage)\ + "</h6><h6>Ölü Sayısı: " + str(int(city.total_deaths)) + "</h6><hr><h4>" + str(country.name)\ + "</h4><h5>Vaka Sayısı: " + str(int(country.total_cases)) + "</h5>" \ + "<h5>Ölü Sayısı: " + str(int(country.total_deaths)) + "</h5></div>" popup = folium.Popup(html=text, max_width=200, min_width=150, sticky=False) tooltip = folium.Tooltip(text=city.name) geoJsonLayer = folium.GeoJson(city_geojson, style_function=style_function, tooltip=tooltip) geoJsonLayer.add_child(popup) geoJsonLayer.add_to(il_feature_group) country_Circle.add_to(ulke_feature_group) else: country_Circle.add_to(m) item_txt = """<br> Vaka Sayısı: {total_cases} <br> Ölü Sayısı: {total_deaths}""" html_itms = item_txt.format(total_cases=int(total_cases), total_deaths=int(total_deaths)) legend_html = """ <div style=" position: fixed; bottom: 25px; left: 25px; border:2px white; z-index:9999; font-size:12px; font-weight: bold; background: white; color: #5f6769; opacity: 0.8; padding : 5px; "> <center><h5>{title}</h5></center> {itm_txt} </div> """.format(title="Dünya Geneli", itm_txt=html_itms) m.get_root().html.add_child(folium.Element(legend_html)) il_feature_group.add_to(m) ulke_feature_group.add_to(m) folium.LayerControl(collapsed=True).add_to(m) minimap = plugins.MiniMap(width=100, height=75, minimized=True, toggle_display=True) m.add_child(minimap) m.save(map_path) print("You can find map file at: ", os.path.join(os.getcwd(), map_path))