def mapaCalorVistoria(): conexao = pymysql.connect(host='www.db4free.net',user='******',password='******',db='mydb_ufrpe') c = conexao.cursor() consulta = ''' select Latitude,Longitude from `Localidade do Chamado` where idLocalidade in(SELECT `Localidade do Chamado_idLocalidade` FROM mydb_ufrpe.processo as p , mydb_ufrpe.vistoria as v where p.Numero = v.Processo_Numero); ''' #consulta = '''SELECT `Latitude`, `Longitude` FROM `sedecvistorias` as vist, `sedecchamados` as chama WHERE vist.processo_numero = chama.processo_numero ;''' c.execute(consulta) resposta = c.fetchall() lista3=[] for x in resposta: try: lat = float(x[0]) long = float(x[1]) lista3.append([lat,long]) except: pass consulta2 = '''SELECT `rpa_nome` ,count(`rpa_nome`) from mydb_ufrpe.`sedecchamados` as c , mydb_ufrpe.vistoria as v where c.processo_numero = v.processo_numero GROUP BY `rpa_nome` ''' c.execute(consulta2) re = c.fetchall() re2 =[] total = 0 for x in re: total = x[1] + total for x in re: nomeRpa = x[0] qtdChamados = x[1] link = 'http://www2.recife.pe.gov.br/servico/sobre-rpa-' + nomeRpa[0] percentual = qtdChamados/total*100 string = ("%.2f" % percentual) re2.append([nomeRpa, qtdChamados, link, string]) re2.sort(reverse = True,key=lambda x:x[1]) pernambuco = folium.Map(location=[-8.0421584, -35.008676],zoom_start=10) pernambuco.add_child(plugins.HeatMap(lista3,min_opacity=0.7,max_val=0.5,)) pernambuco.add_child(plugins.HeatMap(lista3,min_opacity=0.7,max_val=0.5,)) map_path = app.root_path + '/templates' + '/' + 'map_vistorias.html' pernambuco.save(map_path) return render_template ('mapaVistoria.html', resporta = rpa)
def get_searchmap_heat(self, data): if data['flag'] == True: self.scrapping_jobkorea_search(data) if self.db.keyword.count() != 0: self.db.keyword.drop() self.db.keyword.insert_one(data) infolists = list(self.db.Joblist2.find()) lat_long = [36, 127.4] m = folium.Map(lat_long, zoom_start=7, tiles='stamentoner') data = [] for infolist in infolists: data.append([float(infolist['y']), float(infolist['x'])]) plugins.HeatMap(data).add_to(m) folium.TileLayer('openstreetmap').add_to(m) folium.TileLayer('Stamenterrain').add_to(m) folium.TileLayer('stamentoner').add_to(m) folium.TileLayer('Stamenwatercolor').add_to(m) folium.TileLayer('cartodbpositron').add_to(m) folium.TileLayer('cartodbdark_matter').add_to(m) folium.LayerControl().add_to(m) m = m._repr_html_() return m
def test_heat_map(): data = (np.random.normal(size=(100, 2)) * np.array([[1, 1]]) + np.array([[48, 5]])).tolist() m = folium.Map([48., 5.], tiles='stamentoner', zoom_start=6) hm = plugins.HeatMap(data) m.add_children(hm) m._repr_html_() out = m._parent.render() # We verify that the script import is present assert ( '<script src="https://leaflet.github.io/Leaflet.heat/dist/leaflet-heat.js"></script>' ) in out # We verify that the script part is correct tmpl = Template(""" var {{this.get_name()}} = L.heatLayer( {{this.data}}, { minOpacity: {{this.min_opacity}}, maxZoom: {{this.max_zoom}}, max: {{this.max_val}}, radius: {{this.radius}}, blur: {{this.blur}}, gradient: {{this.gradient}} }) .addTo({{this._parent.get_name()}}); """) assert tmpl.render(this=hm)
def heatmap_school(conn, map): cur = conn.execute("select lat,lon,name from entity where type = 'school'") data = [] for row in cur.fetchall(): data.append([row[0], row[1], 1]) map.add_child(plugins.HeatMap(data, min_opacity=0.3, radius=50)) map.save('school.html')
def Calango(verde): a = verde if a == False: consulta = '''SELECT `Latitude`, `Longitude`,rpa_id_rpa FROM `Localidade do Chamado` WHERE (`Endereco`!= "teste" or `Endereco`!= "TESTE") ;''' else: consulta = '''SELECT `Latitude`, `Longitude`,rpa_id_rpa FROM `Localidade do Chamado` WHERE (`Endereco`!= "teste" or `Endereco`!= "TESTE") and `rpa_id_rpa` = '''+a+''';''' c.execute(consulta) resposta = c.fetchall() lista3=[] for x in resposta: try: lat = float(x[0]) long = float(x[1]) lista3.append([lat,long]) except: print("error") pernambuco = folium.Map(location=[-8.0421584, -35.008676],zoom_start=10) pernambuco.add_child(plugins.HeatMap(lista3,min_opacity=0.7,max_val=0.5,)) map_path = app.root_path + '/templates' + '/' + 'map_test2.html' pernambuco.save(map_path)
def generate_map(latitude=39.7, longitude=3, zoom=8, did=None, emailAddress=None, *args, **kwargs): location_data = load() location_data = location_data[location_data.accuracy < 1000] location_data = prepare(location_data) m = folium.Map([float(latitude), float(longitude)], zoom_start=int(zoom)) geo_matrix = location_data[['latitude', 'longitude']].values m.add_child(plugins.HeatMap(geo_matrix, radius=15)) m.add_child(folium.LatLngPopup()) mime_html = 'text/html' fn = os.getcwd() + (f'/proxy-{did}.html' or '/did/index.html') m.save(fn) if emailAddress: from .gdrive import upload, authorize fileId = upload(fn, mime_html) print(fileId, emailAddress) authorize(emailAddress=emailAddress, fileId=fileId) content = get_file(fn) return Response(content, mimetype=mime_html)
def test_heat_map(): np.random.seed(3141592) data = (np.random.normal(size=(100, 2)) * np.array([[1, 1]]) + np.array([[48, 5]])).tolist() m = folium.Map([48., 5.], tiles='stamentoner', zoom_start=6) hm = plugins.HeatMap(data) m.add_children(hm) m._repr_html_() out = m._parent.render() # We verify that the script import is present. script = '<script src="https://leaflet.github.io/Leaflet.heat/dist/leaflet-heat.js"></script>' # noqa assert script in out # We verify that the script part is correct. tmpl = Template(""" var {{this.get_name()}} = L.heatLayer( {{this.data}}, { minOpacity: {{this.min_opacity}}, maxZoom: {{this.max_zoom}}, max: {{this.max_val}}, radius: {{this.radius}}, blur: {{this.blur}}, gradient: {{this.gradient}} }) .addTo({{this._parent.get_name()}}); """) assert tmpl.render(this=hm) bounds = m.get_bounds() assert bounds == [[3.0302801394447734, 46.218566840847025], [7.132453997672826, 50.75345011431167]], bounds
def get_heat_map(descp, knn, model, train): map_osm = folium.Map(tiles='cartodbdark_matter', location=[40.7158, -73.9970], zoom_start=13) results = locations_of_best_match(descp, knn, model, train) temp = results[["latitude", "longitude"]].values.tolist() map_osm.add_children( plugins.HeatMap(temp, min_opacity=0.45, radius=30, blur=30, gradient=return_color_scale(1), name=descp)) for i in range(10): html = """<h3 class = "lead"> Title: {0} </h3> <br> Airbnb Link: {3} <br><br> Summary: {1} <br><br> Price: {2} """.format(results.name.iloc[i], results.summary.iloc[i], results.price.iloc[i], results.listing_url.iloc[i]) iframe = folium.element.IFrame(html=html, width=300, height=300) popup = folium.Popup(iframe, max_width=1200) folium.Marker([results.iloc[i].latitude, results.iloc[i].longitude], popup=popup, icon=folium.Icon(color='black', icon='glyphicon-home')).add_to(map_osm) return map_osm
def heatMap(info, mapTitle): usMap = folium.Map(location=[40, -100], tiles='Stamen Terrain', zoom_start=4, control_scale=True) #for each row in the dataset, plot the corresponding lat/lon for i, row in info.iterrows(): folium.CircleMarker((row.latitude, row.longitude), radius=3, weight=2, color='red', fill_color='red', fill_opacity=0.5).add_to(usMap) #add the heatmap. The core parameters are: #--data: a list of points of the form (latitude, longitude) indicating locations #--radius: how big each circle will be around each point #--blur: the degree to which the circles blend together in the heatmap usMap.add_child( plugins.HeatMap(data=info[['latitude', 'longitude']].values, radius=25, blur=10)) #save the map usMap.save(mapTitle + '.html')
def create_distribution_heatmap(name: str, lats: list, lons: list): """Create a folonium distribution heatmap. It plots a point for every couple of latitude and longitude given """ url_base = "http://server.arcgisonline.com/ArcGIS/rest/services/" service = "NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}" tileset = url_base + service heatmap_map = folium.Map( location=france_location, zoom_start=2, control_scale=True, tiles=tileset, attr="USGS style", ) data = [lon_lat for lon_lat in zip(lats, lons)] heatmap_map.add_child(plugins.HeatMap(data)) heatmap_map.add_child(plugins.MeasureControl()) heatmap_map.add_child( plugins.Fullscreen( position="topright", title="Expand me", title_cancel="Exit me", force_separate_button=True, ) ) heatmap_map.add_child(plugins.MeasureControl()) heatmap_map.add_child(plugins.MiniMap()) save_map(heatmap_map, name)
def render_incident_map(df): """ takes a incident dataframe, which must have "Longitude", "Latitude" or else it will fail :param df: insident dataframe to render :return: rendered html content that contains the html for incident plot """ yyc_coordinates = (51.049999, -114.066666) yyc_map = folium.Map(location=yyc_coordinates, zoom_start=10) src_geo_df = df[["longitude", "latitude"]] coordinates = [] for index, value in src_geo_df.iterrows(): coordinates.append([value[1], value[0]]) # print(coordinates) # geo_json = get_geo_json(coordinates) yyc_map.add_child( plugins.HeatMap(coordinates, width=1, height=1, radius=13)) yyc_map.save('map.html') render = html.Div([ html.H1('Traffic Analysis Map'), html.Iframe(id='map', srcDoc=open('map.html').read(), width='100%', height=600) ]) return render
def folium_heatmap(df, lat_col, lon_col, zoom_start=11, \ plot_points=False, pt_radius=15, popup_name = 'subrubriek' , \ draw_heatmap=False, heat_map_weights_col=None, \ heat_map_weights_normalize=True, heat_map_radius=15): """Creates a Foilium HeatMap given a dataframe of lat lon points. Can also produce a heatmap overlay. Note: pop_name arg is set to 'subrubriek', only present in Mora dataset Arg: df: dataframe lon lat coordinates to maps lat_col: Column containing latitude lon_col: Column containing longitude zoom_start: initial zoom of the map plot_points: Add points to map (boolean) popup_name = When adding points this will be the pop_up name (choose categorical) pt_radius: Size of each point draw_heatmap: Add heatmap to map (boolean) heat_map_weights_col: Column containing heatmap weights heat_map_weights_normalize: Normalize heatmap weights (boolean) heat_map_radius: Size of heatmap point Returns: folium map object """ ## center map in the middle of points center in middle_lat = df[lat_col].median() middle_lon = df[lon_col].median() curr_map = folium.Map(location=[middle_lat, middle_lon], tiles='stamentoner', zoom_start=zoom_start) # add points to map if plot_points: for _, row in df.iterrows(): folium.CircleMarker([row[lat_col], row[lon_col]], radius=pt_radius, popup=row[popup_name], fill=True, fill_color="red", fill_opacity=0.7).add_to(curr_map) # add heatmap if draw_heatmap: # convert to (n, 2) or (n, 3) matrix format if heat_map_weights_col is None: cols_to_pull = [lat_col, lon_col] else: # if we have to normalize if heat_map_weights_normalize: df[heat_map_weights_col] = \ df[heat_map_weights_col] / df[heat_map_weights_col].sum() cols_to_pull = [lat_col, lon_col, heat_map_weights_col] stations = df[cols_to_pull].as_matrix().tolist() curr_map.add_child(plugins.HeatMap(stations, radius=heat_map_radius)) return curr_map
def mapa_p(bot, update): bot.sendChatAction(update.message.chat_id, action=telegram.ChatAction.TYPING) heat = [] with open("file.txt", "r") as myfile: data_p = myfile.read().replace("\n", ",").split(",") data_p.remove("") x = 0 while x != len(data_p): date_format = "%Y-%m-%d %H:%M:%S" t1 = datetime.datetime.strptime(data_p[x], date_format) data_dif = datetime.datetime.now() - t1 print(data_dif.days) print((data_dif.seconds) / 60) if data_dif.days == 0 and (data_dif.seconds) / 60 < 360: heat.append([data_p[x + 1], data_p[x + 2], data_dif.seconds]) x += 3 mapa = folium.Map([-22.934007, -43.356883], tiles='stamentoner', zoom_start=11) mapa.add_children(plugins.HeatMap(heat)) fn = '/Users/candidobugarin/Desktop/telegram_proj/testmap.html' mapa.save(fn) browser.get('file://' + str(fn)) browser.refresh() time.sleep(3) browser.save_screenshot('map.png') bot.sendPhoto(update.message.chat_id, photo=open('map.png', 'rb'))
def create_heatmap_query(sql_add): """Function to return a heatmap of tickets that meet the criteria of the search addding. Parameters ---------- sql_add : string string argument of query. Will follow 'WHERE' in SQL statement. Returns ------- folium heatmap """ print('Creating heatmap') try: df = pd.read_sql_query( 'Select lat, lon from ticket_data t1 join address_data t2 on t1.address = t2.address ' "where " + sql_add, conn) except: print('Invalid Query') return if df.shape[0] > 50000: df = df.sample(n=50000) ticketarr = df[['lat', 'lon']].as_matrix() m = folium.Map([37.7749, -122.4194], zoom_start=12) m.add_children(plugins.HeatMap(ticketarr, radius=8)) filename = map_loc + re.sub('[\W]', '', sql_add) + ".html" m.save(filename) webbrowser.open('file://' + os.path.realpath(filename)) time.sleep(20) return
def add_heatmap_layer(my_map, points, layer_name="heatmap", weight_vals=pd.Series(), custom_gradient=None): # Note: weight_vals defaul is [], meaning no specific weights # TODO: study more print("number of points:", len(points)) lats = points.apply(lambda x: x[0]) lons = points.apply(lambda x: x[1]) if weight_vals.empty: points = list(zip(lats.values, lons.values)) else: points = list(zip(lats.values, lons.values, weight_vals)) plugins.HeatMap( data=points, min_opacity=1, radius=5, #blur=12, gradient=custom_gradient, #max_zoom=1, #control=True, #overlay=True, name=layer_name, ).add_to(my_map)
def map(): folium_map = folium.Map(location=[40.745857, -74.025598], zoom_start=13) mapdata = pd.read_excel('data.xlsx') heat_df = mapdata[['Latitude', 'Longitude']] heat_df = heat_df.dropna(axis=0, subset=['Latitude', 'Longitude']) heatdata = mapdata[['Latitude', 'Longitude']].to_numpy() folium_map.add_children(plugins.HeatMap(heatdata, radius=20)) return folium_map._repr_html_()
def mapear(): os.chdir("../Images") mapa=folium.Map(location=[19.443056, -99.144444], zoom_start=15) for index, row in roma_n.iterrows(): folium.CircleMarker([row['latitud'], row['longitud']], radius=1, fill_color="#3db7e4").add_to(mapa) geo = roma_n[['latitud', 'longitud']].as_matrix() mapa.add_children(plugins.HeatMap(geo, radius=15)) mapa.save('mapa.html')
def mapa_calor(dataframe): mapa = folium.Map(location=[37.778254811523, -122.405834032593], tiles='openstreetmap') mapa.add_child( plugins.HeatMap([[row["Y"], row["X"]] for name, row in dataframe.iterrows()])) mapa.save('mapa_calor_incidencias.html') return mapa
def add_heat(self, df): """Add standard folium heatmap to the map object.""" # convert to (n, 2) nd-array format for heat map location_arr = df[['latitude', 'longitude']].values hm = plugins.HeatMap(location_arr, radius=2, blur=1, max_val=3) hm.add_to(self.fmap)
def generate_map(html): current_dir = os.path.dirname(os.path.abspath(__file__)) api_file_path = os.path.join(current_dir, 'bikeshare_api/station_information') check_and_update_api_file(api_file_path) # read the station information and get their name and coordinates with open(api_file_path) as f: data = json.load(f) station_data = data['data']['stations'] station_lat_long = {} for station in station_data: station_lat_long[station['name']] = { 'lat': station['lat'], 'lon': station['lon'] } # parse the html to get the trip data soup = BeautifulSoup(html, 'html.parser') rows = soup.find('div', class_='table-responsive').table.tbody.findAll('tr') user_trips = [] for row in rows: cols = row.find_all('td') cols = [ele.text.strip() for ele in cols] user_trips.append([ele for ele in cols if ele]) # Get rid of empty values # go through the trips and keep count of often each was used station_trip_count = {} for trip in user_trips: station_from = trip[1] station_to = trip[3] station_trip_count[station_from] = station_trip_count.get( station_from, 0) + 1 station_trip_count[station_to] = station_trip_count.get(station_to, 0) + 1 m = folium.Map(location=[43.66093, -79.3880384], zoom_start=13, tiles='Stamen Toner') # build the heatmap data using the coordinates and trip count # meanwhile also generate the points on the map heatmap_values = [] for key, value in station_trip_count.items( ): # convert name:count to [lat, lon, count] lat = station_lat_long[key]['lat'] lon = station_lat_long[key]['lon'] heatmap_values.append([lat, lon, value]) folium.Circle([lat, lon], radius=4, fill=True, popup='{}<br>Count: {}'.format(key, value)).add_to(m) m.add_child(plugins.HeatMap(heatmap_values, radius=15, blur=20)) return m
def createHeatmap(transport, json): heatMap = folium.Map([transport.iloc[0]['lat'], transport.iloc[0]['lon']], zoom_start=11) heatMap.add_child(plugins.HeatMap(transport[['lat', 'lon']].values, name='Heatmap', radius=15)) if(len(json) > 0): folium.GeoJson(json, name="City Division").add_to(heatMap) folium.LayerControl().add_to(heatMap) heatMap.save('client/public/results/heatmap.html')
def map_points(df, lat_col='latitude', lon_col='longitude', zoom_start=11, \ plot_points=False, pt_radius=15, \ draw_heatmap=False, heat_map_weights_col=None, \ heat_map_weights_normalize=True, heat_map_radius=15): """Creates a map given a dataframe of points. Can also produce a heatmap overlay Arg: df: dataframe containing points to maps lat_col: Column containing latitude (string) lon_col: Column containing longitude (string) zoom_start: Integer representing the initial zoom of the map plot_points: Add points to map (boolean) pt_radius: Size of each point draw_heatmap: Add heatmap to map (boolean) heat_map_weights_col: Column containing heatmap weights heat_map_weights_normalize: Normalize heatmap weights (boolean) heat_map_radius: Size of heatmap point Returns: folium map object """ ## center map in the middle of points center in middle_lat = df[lat_col].median() middle_lon = df[lon_col].median() curr_map = folium.Map(location=[middle_lat, middle_lon], zoom_start=zoom_start) # add points to map if plot_points: for _, row in df.iterrows(): folium.CircleMarker( [row[lat_col], row[lon_col]], radius=pt_radius, popup=row['name'], fill_color="#3db7e4", # divvy color ).add_to(curr_map) # add heatmap if draw_heatmap: # convert to (n, 2) or (n, 3) matrix format if heat_map_weights_col is None: cols_to_pull = [lat_col, lon_col] else: # if we have to normalize if heat_map_weights_normalize: df[heat_map_weights_col] = \ df[heat_map_weights_col] / df[heat_map_weights_col].sum() cols_to_pull = [lat_col, lon_col, heat_map_weights_col] stations = df[cols_to_pull].as_matrix() curr_map.add_children(plugins.HeatMap(stations, radius=heat_map_radius)) return curr_map
def HeatMapping(df): m = folium.Map( location=[47.548,9.688], zoom_start=11 ) heat_data = [[row['lat'], row['lon'], row['edge_media_count']] for index,row in df.iterrows()] m.add_child(plugins.HeatMap(heat_data, radius=15)) m.save('heatmap.html')
def add_heat(self, df): """Add standard folium heatmap to the map object.""" # convert to (n, 2) nd-array format for heat map fleet_arr = df[['Lat', 'Lon']].values # plot heat map self.fmap.add_child(plugins.HeatMap(fleet_arr, radius=10)) return self.fmap
def draw_heatmap_mon(df): """ Esta función recibe un conjunto de incidentes y los dibuja en un mapa de calor que se guarda en un fichero html :param ds: dataset de incidentes en formato de DataFrame """ heat_map = folium.Map(location=[37.7617007179518, -122.42158168136999], zoom_start=11, tiles='Stamen Terrain') heat_map.add_child(plugins.HeatMap([[row["Y"], row["X"]] for name, row in df.iterrows()])) heat_map.save('heat_map_incidets.html') return heat_map
def heatmap(lats,lons,weights,map_tile = None): lat, lon = lm.calcCentrePoint(lats,lons) if map_tile is None: m = folium.Map(location=[lat,lon], zoom_start=15,control_scale = True) else: m = folium.Map(location=[lat,lon], zoom_start=15,control_scale = True,tiles=map_tile) # I am using the magnitude as the weight for the heatmap m.add_child(plugins.HeatMap(zip(d_cor['lat'].tolist(), d_cor['lon'].tolist(), d_cor['manifest_count'].tolist()), radius = 10)) return m
def HeatMap(): try: df = pd.read_csv('data.csv') arr = df[['latitude', 'longitude']].values m = folium.Map(location=[34.0522, -118.2437], zoom_start=10) m.add_child(plugins.HeatMap(arr, radius=15)) m.save('map.html') print("Map generated") except Exception as e: print(e)
def gerarMapadeCalor(listaDeCoordenadas, nomeDoMapa): lCoordenadas = [] mapa_calor = folium.Map(location=[-8.05428, -34.8813], zoom_start=12) print(len(listaDeCoordenadas[0])) if listaDeCoordenadas != None: for la, lo in zip(listaDeCoordenadas[0], listaDeCoordenadas[1]): lCoordenadas.append([la, lo]) mapa_calor.add_child(plugins.HeatMap(lCoordenadas)) mapa_calor.save('app/templates/' + nomeDoMapa + ".html")
def heatmap_restaurant(conn, map): cur = conn.execute( "select lat,lon,name from entity where type = 'restaurant'") data = [] for row in cur.fetchall(): data.append([row[0], row[1], 1]) #folium.CircleMarker(location=[row[0], row[1]], popup=row[2], radius=0.5, color='#ff0000').add_to(map) map.add_child(plugins.HeatMap(data, min_opacity=0)) map.save('restaurant.html') cur.close()
def generate_map(marker_layer=True, marker_num=None, crime_heatmap=True, choropleth_zipcode=True): """ Funtion to generate map demo Input: marker_layer --- bool, whether to generate marker for each house marker_num --- number of markers to generate in the map, if None, all the markers will generate crime_heatmap --- bool, whether to generate a map of crime incidence choropleth_zipcode --- bool, choropleth layer of average house price in each zipcode return a html file """ data = pd.read_csv("../Data/house_crime_data.csv", parse_dates=['date']) data['zipcode'] = data['zipcode'].astype(str) crime_data = pd.read_csv('../Data/cleaned_crime_data.csv', parse_dates=['incident_datetime']) zipcode_data = data.groupby('zipcode').mean() zipcode_data['count'] = data.groupby('zipcode').count()['id'] zipcode_data.reset_index(inplace=True) # Generate base map layer geo_path = '../Data/zipcode_king_county.geojson' Map = folium.Map(location=[data['lat'].mean(), data['long'].mean()], zoom_start=11, API_key='zipcode') # Generate marker map layer if marker_layer == True: if marker_num is not None: MAX_SHOW = marker_num marker_cluster = folium.MarkerCluster(name='House Cluster').add_to(Map) for iters, row in data[0:MAX_SHOW].iterrows(): folium.Marker([row["lat"], row["long"]], popup=hc.popup_text(iters, row)).add_to(marker_cluster) else: marker_cluster = folium.MarkerCluster(name='House Cluster').add_to(Map) for iters, row in data.iterrows(): folium.Marker([row["lat"], row["long"]], popup=hc.popup_text(iters, row)).add_to(marker_cluster) # Generate zipcode vs. house price layer if choropleth_zipcode == True: Map.choropleth(geo_path=geo_path, data=zipcode_data, columns=['zipcode', 'price'], key_on='feature.properties.ZCTA5CE10', fill_color='OrRd', threshold_scale=[200000, 400000, 600000, 800000, 1000000, 1500000], fill_opacity=0.6, line_opacity=0.2, legend_name='House Price') # Generate Crime heatmap if crime_heatmap == True: Map.add_children(plugins.HeatMap([[row["latitude"], row["longitude"]] for iters, row in crime_data.iterrows()], name='Crime Incidence', min_opacity=0.5, max_zoom=18, radius=11)) folium.LayerControl().add_to(Map) Map.save('Map.html')