import folium import pandas data=pandas.read_csv("Volcanoes.txt") lat=list(data["LAT"]) lon=list(data["LON"]) elev=list(data["ELEV"]) 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.Marker(location=[lt,ln], popup=str(el)+" m", icon=folium.Icon(color="green"))) map.add_child(fg) map.save("Map1.html")
m = folium.Map(location=[27.9305, 88.7346], zoom_start=10) tooltip = 'Click For More Info' vis = os.path.join('data', 'vis.json') overlay = os.path.join('data', 'overlay.json') # BINSAR # Create markers(tourist spots) folium.Marker( [27.9305, 88.7346], popup=folium.Popup( '<a href="map.html" target="blank"><strong>Zero Point</strong></a>'), icon=folium.Icon(icon='star'), tooltip=tooltip).add_to(m), folium.Marker( [27.9500, 88.7428], popup=folium.Popup( '<a href="map.html" target="blank"><strong>Pariyadeva Pashan</strong></a>' ), icon=folium.Icon(icon='star'), tooltip=tooltip).add_to(m), folium.Marker( [29.6968, 79.7534], popup=folium.Popup( '<a href="map.html" target="blank"><strong>Marry Budden Estate</strong></a>' ), icon=folium.Icon(icon='star'), tooltip=tooltip).add_to(m),
#マップに読み込んだCSVファイル内の携帯基地局の座標にマーカーを設置したマップを取得 import pandas as pd import folium #csvを読み込み df = pd.read_csv('kddi_okayama_city.csv') ##対象範囲の緯度経度(岡山駅周辺) LAT = 34.673759 LNG = 133.923437 #対象範囲を指定 m = folium.Map(location=[LAT, LNG]) #マップにマーカを反映 for i, r in df.iterrows(): if r['radio'] == 'LTE': #folium.Marker(location=[r['lat'], r['lon']], icon=folium.Icon('blue'), popup="LTE").add_to(m) folium.CircleMarker(location=[r['lat'], r['lon']], radius=1000, color="green", fill_color="green").add_to(m) else: folium.Marker(location=[r['lat'], r['lon']], icon=folium.Icon('red'), popup="UMTS").add_to(m) #マップを保存 m.save("mapping_BaseStation_500.html")
import folium import pandas data = pandas.read_csv("volcanoes.csv") lat = list(data["LAT"]) lon = list(data["LON"]) nam = list(data["NAME"]) elev = list(data["ELEV"]) map = folium.Map( location=[-1.287060, 36.798872], zoom_start=3, tiles= 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', attr= 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community' ) fg = folium.FeatureGroup(name="My Geo-Map") for lt, ln, nm, el in zip(lat, lon, nam, elev): fg.add_child( folium.Marker(location=[lt, ln], popup="<b>Name:</b> " + nm + "\n<b>Height:</b> " + str(el) + "m.", icon=folium.Icon(color='green'))) map.add_child(fg) map.save("map1.html")
s1 = list(dd["LAT"]) s2 = list(dd["LON"]) el = list(dd["ELEV"]) name = list(dd["NAME"]) html = """<h4>Volcano info</h4> Name = <a href="https://www.google.com/search?q=%s" target="_blank">%s</a><br> Height = %s m """ for i in range(len(dd)): ifr = folium.IFrame(html=html % (name[i], name[i], str(el[i])), height=100, width=200) if el[i] < 1000: col = "green" elif el[i] < 2000: col = "blue" elif el[i]<3000: col = "orange" else: col = "red" fg.add_child(folium.Marker(location=[s1[i], s2[i]], popup=folium.Popup(ifr), icon=folium.Icon(color=col), tooltip= name[i])) fg1.add_child(folium.GeoJson(data=open("world.json", "r", encoding="utf-8-sig").read(), style_function = lambda x: {"fillColor":"red" if x["properties"]["POP2005"] < 1000000000 else "blue"})) mapp.add_child(fg) mapp.add_child(fg1) mapp.add_child(folium.LayerControl()) mapp.save("map_advanced_html.html")
import pandas import json df=pandas.read_csv("Volcanoes_USA.txt") map=folium.Map(location=[df['LAT'].mean(),df['LON'].mean()],zoom_start=4,tiles='Stamen Terrain') fg=folium.FeatureGroup(name="Volcano Locations") def color(elev): minimum=int(min(df['ELEV'])) step=int((max(df['ELEV'])-min(df['ELEV']))/3) if elev in range(minimum,step): col='green' elif elev in range(minimum+step,minimum+step*2): col='orange' else: col='red' return col for lat,lon,name,elev in zip(df['LAT'],df['LON'],df['NAME'],df['ELEV']): fg.add_child(folium.Marker([lat,lon],popup=name,icon=folium.Icon(color=color(elev)))) map.add_child(fg) map.add_child(folium.GeoJson(json.load(open('worldpopulation.json')), name='World Population', style_function=lambda x: {'fillColor':'green' if x['properties']['POP2005']<=10000000 else 'orange' if x['properties']['POP2005']<20000000 else 'red'})) map.add_child(folium.LayerControl()) map.save(outfile='map.html')
# Turning string representations of tuples into actual tuples i = 0 while i < len(coordinates.index): coordinates.iloc[i]['Location'] = ast.literal_eval( coordinates.iloc[i]['Location']) i = i + 1 # Generating a map of Boston m = folium.Map(location=[42.35843, -71.05977], zoom_start=10) ############################## # Adding a marker to the map # ############################## popup = "Boston" boston_marker = folium.Marker([42.35843, -71.05977], popup=popup) m.add_child(boston_marker) ############################## # Generating marker clusters # ############################## locations = coordinates['Location'].tolist() icons = [folium.Icon(icon="car", prefix="fa") for _ in range(len(locations))] cluster = MarkerCluster(locations=locations, icons=icons) m.add_child(cluster) ########## # Saving # ########## m.save('index.html') # Saving the map in a file
def search(requests, restaurant_name='', street_name='', postcode=''): # reformat string args restaurant_name = restaurant_name.strip().upper() postcode = postcode.strip().upper() street_name = street_name.strip().upper() # Establish cursor to database cur = connection.cursor() map = create_map() cur.execute( 'select restaurant_name, longitude, latitude, aggregate_rating, image_url, concat(street_num, \', \', street_name, \', \', city, \', \', state, \' \', postcode)\n' + 'from restaurants_restaurant\n' + 'inner join restaurants_coordinates on restaurant_id=coordinates_id_id\n' + 'inner join locations_address on address_id_id=address_id\n' + 'inner join locations_postcode on postcode_id=postcode\n' + 'inner join restaurants_ratingstats on restaurant_id=rating_stats_id_id\n' + 'inner join restaurants_imageurl on restaurants_restaurant.restaurant_id=restaurants_imageurl.restaurant_id_id\n' + 'where upper(restaurant_name)=' + "'" + restaurant_name.replace("'", "''") + "'" + ' or ' + 'upper(postcode_id)=' + "'" + postcode + "'" + ' or ' + 'upper(street_name)=' + "'" + street_name.replace("'", "''") + "'") rows = cur.fetchall() for row in rows: restaurant_name = row[0] longitude = row[1] latitude = row[2] aggregate_rating = row[3] image_url = row[4] address = row[5] split_addr = address.split(',') addr_line1 = split_addr[0].strip() + ' ' + split_addr[1].strip() addr_line2 = split_addr[2].split( '(')[0].strip() + ', ' + split_addr[3].strip() popup_html = '<div class="card" style="width: 24rem;"><img src="' + image_url + '" class="card-img-top" alt=""><div class="card-body"><strong class="card-title">' + restaurant_name + ': ' + str( aggregate_rating ) + ' stars' + '</strong><p class="card-text">' + addr_line1 + '</br>' + addr_line2 + '</p></div>' folium.Marker([latitude, longitude], tooltip='More Info', popup=popup_html, icon=folium.Icon(color="lightgray", icon="cutlery", prefix='fa')).add_to(map) # get total number of restaurant entries cur.execute('select count(*) from restaurants_restaurant') total_restaurants = cur.fetchall()[0][0] context = { 'map': map.get_root().render(), 'results_count': str(len(rows)) + ' results found in ' + str(total_restaurants) + ' entries' } return render(requests, 'map.html', context)
col = "red" return col map = folium.Map(location=[37.09024, -95.712891], zoom_start=6, tiles="Mapbox bright") fg = folium.FeatureGroup(name="Volcano Locations") fg1 = folium.FeatureGroup(name="US States and Capitals") for lat, lon, name, elev in zip(df['LAT'], df["LON"], df["NAME"], df["ELEV"]): fg.add_child( folium.Marker(location=[lat, lon], popup=name, icon=folium.Icon(color=color(elev)))) for lat1, long1, name, capital in zip(df1['latitude'], df1['longitude'], df1['name'], df1['capital']): fg1.add_child( folium.Marker(location=[lat1, long1], popup="State: " + name + ", Capital: " + capital)) map.add_child(fg) map.add_child(fg1) map.add_child( folium.GeoJson( data=open("World_Population.json"), name="World Population", style_function=lambda x: {
folium_static(map_robi) i = 1 for (index, row) in data.iterrows(): folium.Marker(location=[row.loc['lat'], row.loc['long']], popup='Retailer shop:' + str(row.loc['sr']), color='black', tooltip='click').add_to(map_robi) map_robi.add_child(MeasureControl()) st.title("Retailer Shops") st.subheader( "Click on the following buttons for visualizing the retailer shops") if st.button("Click"): folium.Marker(location=[23.741276, 90.370660], popup='Tower', icon=folium.Icon(color='black', icon='info-sign')).add_to(map_robi) folium.Marker(location=[23.739567, 90.364373], popup='Tower', icon=folium.Icon(color='black', icon='info-sign')).add_to(map_robi) folium.Marker(location=[23.736483, 90.373235], popup='Tower', icon=folium.Icon(color='black', icon='info-sign')).add_to(map_robi) folium.Marker(location=[23.742474, 90.376840], popup='Tower', icon=folium.Icon(color='black', icon='info-sign')).add_to(map_robi) folium.Marker(location=[23.745931, 90.368729], popup='Tower',
def lingkaranHijau(lat, long): LH = folium.CircleMarker( radius=15, location=[lat, long], popup='<i>Greenzone<i>', color='green', fill=True,) return LH m = normal(-7.0796837, 113.2876241) folium.Marker( location=[-7.0095568, 113.8495442], popup='Sumenep', icon=folium.Icon(icon='info-sign') ).add_to(m) folium.Marker( location=[-7.0461858, 113.5339472], popup='Bandungan', icon=folium.Icon(icon='info-sign') ).add_to(m) folium.Marker( location=[-7.1227688, 113.3218422], popup='Omben', icon=folium.Icon(icon='info-sign') ).add_to(m) folium.Marker( location=[-7.1557868, 113.4795329], popup='Pamekasan', icon=folium.Icon(icon='info-sign')
def folium_map_to_png (m): img_data = m._to_png(1) img = Image.open(io.BytesIO(img_data)) return img folium_map_to_png(m) map_osm = folium.Map(location=[45, -122]) folium_map_to_png(map_osm) map_osm = folium.Map(location=[45, -122], tiles='stamen toner', zoom_start=13, width=300, height=200) folium_map_to_png(map_osm) map_osm = folium.Map(location=[45, -122], # tiles='stamen toner', zoom_start=8, width=500, height=300) folium.Marker([45.3288, -121.6625], popup='Mt. Hood Meadows', icon=folium.Icon(icon='cloud')).add_to(map_osm) folium.Marker([45.3311, -121.7113], popup='Timberline Lodge', icon=folium.Icon(icon='cloud')).add_to(map_osm) folium_map_to_png(map_osm) map_1 = folium.Map(location=[45.372, -121.6972], zoom_start=12, tiles='Stamen Terrain') folium.Marker([45.3288, -121.6625], popup='Mt. Hood Meadows', icon=folium.Icon(color='blue',icon='cloud')).add_to(map_1) folium.Marker([45.3311, -121.7113], popup='Timberline Lodge', icon=folium.Icon(color='green')).add_to(map_1) folium.Marker([45.3300, -121.6823], popup='Some Other Location', icon=folium.Icon(color='red',icon='info-sign')).add_to(map_1) folium_map_to_png(map_1) map_2 = folium.Map(location=[45.5236, -122.6750], tiles='Stamen Toner',
zoom_start=3) for i in range(0, len(df_map)): html = html_row(i) iframe = branca.element.IFrame(html=html, width=400, height=300) popup = folium.Popup(iframe, parse_html=True) bags_t = int(df_map['Bags_t'].iloc[i]) # Function to change the marker color # according to the mean value of Bags_t if bags_t in range(1000000, 5000000): col = "blue" elif bags_t in range(10000, 100000): col = "green" elif bags_t in range(100000, 1000000): col = "red" else: col = "purple" tooltip = "Total Value for: {} <br> Bags_T: {}<br> Type A: {}<br> Type C: {}<br> Click for more".format( df_map['Location'][i], round(df_map["Bags_tt"][i], 2), round(df_map["Type_A"][i], 2), round(df_map["Type_C"][i], 2)) folium.Marker([df_map['LATITUDE'].iloc[i], df_map['LONGITUDE'].iloc[i]], popup=popup, tooltip=tooltip, icon=folium.Icon(color=col, icon='info-sign')).add_to(map1) map1.save("Product_data.html")
@author: Akash """ import folium import pandas as pd data = pd.read_csv("college.csv") def elevation_color(elevation): if 0 < elevation < 1000: return "green" elif 1000 < elevation < 2500: return "blue" elif 2500 < elevation: return "red" map = folium.Map(location=[20.59,78.96], zoom_start=0,tiles = "Mapbox Bright") fg= folium.FeatureGroup(name="My map") for college_name,lat,lon in zip(data["College Name"],data["Latitude"],data["Longitude"]): fg.add_child(folium.Marker(location=[lat,lon],popup=folium.Popup(str(college_name),parse_html=True),icon = folium.Icon(color="green"))) fg.add_child(folium.GeoJson(data=open("world.json",encoding="utf-8-sig").read(), style_function=lambda x: {"fillColor":"green"})) folium.LayerControl().add_to(map) map.add_child(fg) map.save("CollegeList.html")
import folium import pandas data = pandas.read_csv("Volcanoes.txt") lat = list(data["LAT"]) lon = list(data["LON"]) elev = list(data["ELEV"]) html = """<h4>Volcano information:</h4> Height: %s m """ map = folium.Map(location=[38.58, -99.09], zoom_start=5, tiles="Stamen Terrain") fg = folium.FeatureGroup(name="My Map") for lt, ln, el in zip(lat, lon, elev): iframe = folium.IFrame(html=html % str(el), width=200, height=100) fgv.add_child( folium.Marker(location=[lt, ln], popup=folium.Popup(iframe), icon=folium.Icon(color="green"))) map.add_child(fg) map.save("Map_html_popup_simple.html")
colnames = ["city","city_ascii","lat","lng"] coord_list =[[]] #lat #lon i = 1; data = pandas.read_csv("worlds2.csv", sep=';') lat = list(data["lat"]) lon = list(data["lng"]) #coord_list.append(lat,lon) #print(coord_list) #for x in range(len(coord_list)): # print (coord_list[x]) # print(coord_list[x]) map = folium.Map(location=[50.2871, 21.4238]) #i = 1; for lt, ln in zip(lat,lon): map.add_child(folium.Marker(location=[lt, ln], popup="Tn", icon=folium.Icon(color='blue'))) map.save("map.html")
def f1(): import folium import tool_mysql x=-0.013 #经度误差 y=-0.005 #维度误差 m=folium.Map(location=[28.217917,112.991041],zoom_start=11) # 绘制地图,确定聚焦点 df=tool_mysql.select("tbHospitals") num=df.__len__() for i in range(num): scale=df["scale"][i] if(scale==32): folium.Marker([(float)(df["latitude"][i])+y, (float)(df["longitude"][i])+x], popup=df["name"][i],icon=folium.Icon(color='red')).add_to(m) elif(scale==0): folium.Marker([(float)(df["latitude"][i])+y, (float)(df["longitude"][i])+x], popup=df["name"][i],icon=folium.Icon(color='green')).add_to(m) else: folium.Marker([(float)(df["latitude"][i])+y, (float)(df["longitude"][i])+x], popup=df["name"][i]).add_to(m)#默认颜色:蓝色 # folium.Marker([28.224387,112.951701],popup='<b>浮标上面的那个文字</b>',icon=folium.Icon(color='green',icon='info-sign')).add_to(m) # 浮标改图样 #标记一个空心的圈 # folium.Circle( # location=[40.2,117.7], # radius=10000, # color='crimson', # popup='popup', # fill=False # ).add_to(m) #标记一个实心圆 # folium.CircleMarker( # location=[39.2,117.7], # radius=100, # popup='popup', # color='#DC143C',#圈的颜色 # fill=True, # fill_color='#6495ED' #填充颜色 # ).add_to(m) m.save('map.html') print("map导出成功")
profile = cProfile.Profile() profile.enable() clustering = RockGeoClustering(data, 5, theta=0.5, nbr_max_distance=40) final_clusters = clustering.clusters() profile.disable() profile.print_stats(sort='time') for i, cluster in enumerate(final_clusters, 1): print("Cluster no. {},\nlength = {}".format(i, len(cluster.points))) print(labels[cluster.points]) counts = np.bincount(np.asarray(labels, dtype=int)[cluster.points]) dominant = np.argmax(counts) if len(cluster.points) != 1: cluster_color = colors[random.randint(0, len(colors) - 1)] for point in cluster.points: folium.Marker(location=data[point, :], icon=folium.Icon(color=cluster_color, icon='circle', prefix='fa-')).add_to(map) else: for point in cluster.points: folium.Marker(location=data[point, :], icon=folium.Icon(color="purple", icon='circle', prefix='fa-')).add_to(map) print("Purity = {}".format( purity(final_clusters, np.asarray(labels, dtype=int)))) map.save('docs/nyc_clustering.html')
df = pd.read_csv('Volcanoes_USA.txt') lon = list(df['LON']) lat = list(df['LAT']) elev = list(df['ELEV']) #Using Folium #tilesMaobox =' https://api.mapbox.com/styles/v1/mapbox/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}' map = folium.Map(location=[40.58, -99.09], zoom_start=3, tilesMaobox='Dark') fgv = folium.FeatureGroup(name='Volcanoes') # Here we will use a for loop that will create a zip() function and iterate len,lat and elev one by one for lt, ln, el in zip(lat, lon, elev): fgv.add_child( folium.Marker(location=[lt, ln], popup=str(el) + ' m', icon=folium.Icon(color=color_producer(el)))) # map --> Featuregroup ---> child map.save('folium.html') fgp = folium.FeatureGroup(name='Population') fgp.add_child( folium.GeoJson( data=io.open('world.json', 'r', encoding='utf-8-sig').read(), style_function=lambda x: { 'fillOpacity': 0.1, 'fillColor': 'green' if x['properties']['pop_est'] < 10000000 else 'orange' if 10000000 <= x['properties']['pop_est'] < 20000000 else 'red' }))
import pandas as pd import folium file_data = pd.read_csv("Volcanoes.txt") lat = list(file_data["LAT"]) lon = list(file_data["LON"]) elv = list(file_data["ELEV"]) map = folium.Map(location=[35.58, -99.09], zoom_start=6, tiles="Stamen Terrain") # user feature group fg = folium.FeatureGroup(name="My Map") for la, lo, el in zip(lat, lon, elv): fg.add_child( folium.Marker(location=[la, lo], popup=str(el) + " m", icon=folium.Icon(color='red'))) map.add_child(fg) map.save("tilesTest4.html")
lat = [valuesofperminfo[rng][7]] longi = [valuesofperminfo[rng][8]] listofcoordsandlabelnames += [name + lat + longi] return listofcoordsandlabelnames makethemapwiththislist = getcoordsandlabelname() m = folium.Map(location=[40.7128, -74.0060]) folium.Marker(location=[ float(makethemapwiththislist[0][1]), float(makethemapwiththislist[0][2]) ], popup=makethemapwiththislist[0][0], icon=folium.Icon(icon='cutlery')).add_to(m) folium.Marker(location=[ float(makethemapwiththislist[1][1]), float(makethemapwiththislist[1][2]) ], popup=makethemapwiththislist[1][0], icon=folium.Icon(icon='cutlery')).add_to(m) folium.Marker(location=[ float(makethemapwiththislist[2][1]), float(makethemapwiththislist[2][2]) ], popup=makethemapwiththislist[2][0], icon=folium.Icon(icon='cutlery')).add_to(m)
map = folium.Map(location=[37.5666, 126.97], zoom_start=12, tiles="Stamen Toner") #folium.Marker([37.5666, 126.97],popup='Test',icon=folium.Icon(color='blue',icon='info-sign')).add_to(map) map.choropleth(geo_data=state_geo, data=state_data, columns=['State', 'Unemployment'], key_on='feature.properties.SIG_CD', fill_color='YlGn', fill_opacity=0.7, line_opacity=0.2, legend_name='Unemployment Rate (%)') file = open(".\\data_shop\\상가업소_201706_01.csv") csv_reader = csv.reader(file) for i in csv_reader: longitude = i[-2] latitude = i[-1] name = i[1] if name.find("스타벅스") >= 0: x = folium.Marker([float(latitude), float(longitude)], popup=name, icon=folium.Icon(color='blue', icon='coffee', prefix='fa')) x.add_to(map) map.save(".\\data\\Korea_Seoul_03.html")
def index1(): import folium m = folium.Map(location=[15.454166, 18.732206], tiles="Stamen Terrain", zoom_start=5) for i in range(1): import folium m = folium.Map(location=[15.454166, 18.732206], tiles="Stamen Terrain", zoom_start=5) #Chad folium.Marker( location=[12.023559, 18.906193], popup= "<strong>Desertificated Areas with high risk in Chad</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[14.023559, 20.906193], popup= "<strong>Desertificated Areas with high risk in Chad</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[13.023559, 19.906193], popup= "<strong>Desertificated Areas with high risk in Chad</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[14.023559, 15.906193], popup= "<strong>Desertificated Areas with high risk in Chad</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[12.023559, 16.906193], popup= "<strong>Desertificated Areas with high risk in Chad</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[21.023559, 17.906193], popup= "<strong>Desertificated Areas with high risk in Chad</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[20.023559, 15.906193], popup= "<strong>Desertificated Areas with high risk in Chad</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[19.023559, 17.906193], popup= "<strong>Desertificated Areas with high risk in Chad</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[18.023559, 21.906193], popup= "<strong>Desertificated Areas with high risk in Chad</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[11.023559, 17.906193], popup="<strong>Desertificated Areas with low risk in Chad</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[13.023559, 19.906193], popup= "<strong>Desertificated Areas with medium to low risk in Chad</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="red")).add_to(m) #Niger #folium.Marker(location=[-13.813930,10.540200], popup="<strong>Desertificated Areas with high risk in Niger</strong>", tooltip="Click for more information").add_to(m) #folium.Marker(location=[-13.813930,9.540200], popup="<strong>Desertificated Areas with high risk in Niger</strong>", tooltip="Click for more information").add_to(m) #folium.Marker(location=[-15.813930,10.540200], popup="<strong>Desertificated Areas with high risk in Niger</strong>", tooltip="Click for more information").add_to(m) #folium.Marker(location=[-14.813930,10.540200], popup="<strong>Desertificated Areas with high risk in Niger</strong>", tooltip="Click for more information").add_to(m) #folium.Marker(location=[-18.813930,12.540200], popup="<strong>Desertificated Areas with high risk in Niger</strong>", tooltip="Click for more information").add_to(m) #folium.Marker(location=[-16.813930,6.540200], popup="<strong>Desertificated Areas with high risk in Niger</strong>", tooltip="Click for more information").add_to(m) #folium.Marker(location=[-11.813930,14.540200], popup="<strong>Desertificated Areas with high risk in Niger</strong>", tooltip="Click for more information").add_to(m) #folium.Marker(location=[-14.813930,13.540200], popup="<strong>Desertificated Areas with high risk in Niger</strong>", tooltip="Click for more information").add_to(m) #Angola folium.Marker( location=[-23.813930, 35.540200], popup= "<strong>Desertificated Areas with high risk in Angola</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[-23.813930, 35.540200], popup= "<strong>Desertificated Areas with high risk in Angola</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[-22.813930, 34.540200], popup= "<strong>Desertificated Areas with high risk in Angola</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[-24.813930, 34.540200], popup= "<strong>Desertificated Areas with high risk in Angola</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[-22.813930, 33.540200], popup= "<strong>Desertificated Areas with high risk in Angola</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[-21.813930, 34.540200], popup= "<strong>Desertificated Areas with high risk in Angola</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[-21.813930, 33.540200], popup= "<strong>Desertificated Areas with high risk in Angola</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[-23.813930, 32.540200], popup= "<strong>Desertificated Areas with high risk in Angola</strong>", tooltip="Click for more information").add_to(m) #Sierra Leone folium.Marker( location=[7.813930, 5.540200], popup= "<strong>Desertificated Areas with high risk in Sierra Leone</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[9.813930, 5.540200], popup= "<strong>Desertificated Areas with high risk in Sierra Leone</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[5.813930, 8.540200], popup= "<strong>Desertificated Areas with high risk in Sierra Leone</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[7.813930, 7.540200], popup= "<strong>Desertificated Areas with high risk in Sierra Leone</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[7.813930, 4.540200], popup= "<strong>Desertificated Areas with high risk in Sierra Leone</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[9.813930, 3.540200], popup= "<strong>Desertificated Areas with high risk in Sierra Leone</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[10.813930, 7.540200], popup= "<strong>Desertificated Areas with high risk in Sierra Leone</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[4.813930, 9.540200], popup= "<strong>Desertificated Areas with high risk in Sierra Leone</strong>", tooltip="Click for more information").add_to(m) folium.Marker(location=[4.23559, 3.906193], popup="<strong>Desertificated Areas in Congo</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="red")).add_to(m) #Ethiopia folium.Marker( location=[8.813930, 39.540200], popup= "<strong>Desertificated Areas with high risk in Ethiopia</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[9.813930, 39.540200], popup= "<strong>Desertificated Areas with high risk in Ethiopia</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[8.813930, 40.540200], popup= "<strong>Desertificated Areas with high risk in Ethiopia</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[7.813930, 40.540200], popup= "<strong>Desertificated Areas with high risk in Ethiopia</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[7.813930, 40.540200], popup= "<strong>Desertificated Areas with high risk in Ethiopia</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[9.813930, 41.540200], popup= "<strong>Desertificated Areas with high risk in Ethiopia</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[10.813930, 42.540200], popup= "<strong>Desertificated Areas with high risk in Ethiopia</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[6.813930, 41.540200], popup= "<strong>Desertificated Areas with high risk in Ethiopia</strong>", tooltip="Click for more information").add_to(m) folium.Marker(location=[6.23559, 43.906193], popup="<strong>Desertificated Areas in Congo</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) #Djibouti folium.Marker( location=[14.813930, 15.540200], popup= "<strong>Desertificated Areas with high risk in Djibouti</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[14.813930, 17.540200], popup= "<strong>Desertificated Areas with high risk in Djibouti</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[14.813930, 15.540200], popup= "<strong>Desertificated Areas with high risk in Djibouti</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[14.813930, 18.540200], popup= "<strong>Desertificated Areas with high risk in Djibouti</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[17.813930, 19.540200], popup= "<strong>Desertificated Areas with high risk in Djibouti</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[16.813930, 20.540200], popup= "<strong>Desertificated Areas with high risk in Djibouti</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[15.813930, 12.540200], popup= "<strong>Desertificated Areas with high risk in Djibouti</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[14.813930, 16.540200], popup= "<strong>Desertificated Areas with high risk in Djibouti</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[18.23559, 16.906193], popup="<strong>low risk Desertificated Areas in Djibouti</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) #Guinea folium.Marker( location=[9.813930, 9.540200], popup= "<strong>Desertificated Areas with high risk in Guinea</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[9.813930, 8.540200], popup= "<strong>Desertificated Areas with high risk in Guinea</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[8.813930, 9.540200], popup= "<strong>Desertificated Areas with high risk in Guinea</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[7.813930, 6.540200], popup= "<strong>Desertificated Areas with high risk in Guinea</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[7.813930, 11.540200], popup= "<strong>Desertificated Areas with high risk in Guinea</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[10.813930, 12.540200], popup= "<strong>Desertificated Areas with high risk in Guinea</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[10.813930, 9.540200], popup= "<strong>Desertificated Areas with high risk in Guinea</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[6.813930, 9.540200], popup= "<strong>Desertificated Areas with high risk in Guinea</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[7.23559, 6.906193], popup="<strong>low risk Desertificated Areas in Congo</strong>", tooltip="Click for more information", icon=folium.Icon(icon="envelope", color="green")).add_to(m) #Sudan folium.Marker( location=[12.813930, 30.540200], popup= "<strong>Desertificated Areas with high risk in Sudan</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[12.813930, 31.540200], popup= "<strong>Desertificated Areas with high risk in Sudan</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[13.813930, 30.540200], popup= "<strong>Desertificated Areas with high risk in Sudan</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[14.813930, 31.540200], popup= "<strong>Desertificated Areas with high risk in Sudan</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[15.813930, 32.540200], popup= "<strong>Desertificated Areas with high risk in Sudan</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[14.813930, 32.540200], popup= "<strong>Desertificated Areas with high risk in Sudan</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[15.813930, 29.540200], popup= "<strong>Desertificated Areas with high risk in Sudan</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[16.813930, 28.540200], popup= "<strong>Desertificated Areas with high risk in Sudan</strong>", tooltip="Click for more information").add_to(m) folium.Marker(location=[16.23559, 27.906193], popup="<strong>Desertificated Areas in Sudan</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="red")).add_to(m) #Brazzavile folium.Marker( location=[-3.540200, 15.45], popup= "<strong>Desertificated Areas with high risk in Brazzaville</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[-4.54020, 15.768], popup= "<strong>Desertificated Areas with high risk in Brazzaville</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[-4.813930, 15.540200], popup= "<strong>Desertificated Areas with high risk in Brazzaville</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[-5.813930, 16.540200], popup= "<strong>Desertificated Areas with high risk in Brazzaville</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[-5.813930, 14.540200], popup= "<strong>Desertificated Areas with high risk in Brazzaville</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[-3.813930, 15.540200], popup= "<strong>Desertificated Areas with high risk in Brazzaville</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[-2.813930, 17.540200], popup= "<strong>Desertificated Areas with high risk in Brazzaville</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[-6.813930, 18.540200], popup= "<strong>Desertificated Areas with low risk in Brazzaville</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) #folium.Marker(location=[-6.23559,.906193], popup="<strong>Desertificated Areas in Brazzaville</strong>", tooltip="Click for more information",icon=folium.Icon(icon="cloud", color="red")).add_to(m) folium.Marker( location=[-3.540200, 17.45], popup= "<strong>Desertificated Areas with low risk in Brazzaville</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[-4.54020, 18.768], popup= "<strong>Desertificated Areas with low risk in Brazzaville</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[-4.813930, 17.540200], popup= "<strong>Desertificated Areas with low risk in Brazzaville</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[-5.813930, 16.540200], popup= "<strong>Desertificated Areas with low risk in Brazzaville</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[-5.813930, 18.540200], popup= "<strong>Desertificated Areas with low risk in Brazzaville</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[-3.813930, 18.540200], popup= "<strong>Desertificated Areas with low risk in Brazzaville</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[-2.813930, 19.540200], popup= "<strong>Desertificated Areas with low risk in Brazzaville</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[-6.813930, 16.540200], popup= "<strong>Desertificated Areas with low risk in Brazzaville</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[-6.23559, 17.906193], popup= "<strong>medium risk Desertificated Areas in Brazzaville</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="red")).add_to(m) #South Africa folium.Marker( location=[-22.813930, 22.540200], popup= "<strong>Desertificated Areas with high risk in South Africa</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[-23.813930, 22.540200], popup= "<strong>Desertificated Areas with high risk in South Africa</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[-23.813930, 23.540200], popup= "<strong>Desertificated Areas with high risk in South Africa</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[-23.813930, 24.540200], popup= "<strong>Desertificated Areas with high risk in South Africa</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[-24.813930, 21.540200], popup= "<strong>Desertificated Areas with high risk in South Africa</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[-24.813930, 22.540200], popup= "<strong>Desertificated Areas with high risk in South Africa</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[-22.813930, 23.540200], popup= "<strong>Desertificated Areas with high risk in South Africa</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[-21.813930, 24.540200], popup= "<strong>Desertificated Areas with high risk in South Africa</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[-22.23559, 22.906193], popup="<strong>Desertificated Areas in South Africa</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="red")).add_to(m) #Nigeria for i in range(8): folium.Marker( location=[8.813930 + (0.5 * i), 6.540200 + (0.15 * i * i)], popup= "<strong>Desertificated Areas with high risk in Nigeria</strong>", tooltip="Click for more information").add_to(m) for i in range(5): folium.Marker( location=[ 6.813930 + (0.15 * i * i), 3.540200 + (0.15 * i * i * i) ], popup= "<strong>Desertificated Areas with medium risk in Nigeria</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="red")).add_to(m) for i in range(5): folium.Marker( location=[ -10.813930 + (0.15 * i * i / 7), 15.540200 + (0.15 * i * i * i) ], popup="<strong>Desertificated Areas with medium risk</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="red")).add_to(m) for i in range(7): folium.Marker( location=[ -29.813930 + (0.15 * i * i), 28.540200 + (0.1 * i * i) ], popup="<strong>Desertificated Areas with medium risk</strong>", tooltip="Click for more information").add_to(m) for i in range(6, 28): folium.Marker( location=[i, i], popup="<strong>Desertificated Areas with medium risk</strong>", tooltip="Click for more information").add_to(m) for i in range(6, 28): folium.Marker( location=[i, 0], popup="<strong>Desertificated Areas with medium risk</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[4.5, i], popup="<strong>Desertificated Areas with medium risk</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[-25.023559, 16.906193], popup="<strong>Desertificated Areas in Congo</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="red")).add_to(m) for i in range(6, 28): folium.Marker( location=[-10 + (0.15 * i), 30 + (0.25 * i)], popup="<strong>Desertificated Areas with medium risk</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[-10 + (0.15 * i), 30 + (0.007) * i], popup="<strong>Desertificated Areas in Congo</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="red")).add_to(m) #Mauritania folium.Marker( location=[23.813930, -10.540200], popup= "<strong>Desertificated Areas with high risk in Mauritania</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[21.813930, -9.540200], popup= "<strong>Desertificated Areas with high risk in Mauritania</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[21.813930, -10.540200], popup= "<strong>Desertificated Areas with high risk in Mauritania</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[18.813930, -13.540200], popup= "<strong>Desertificated Areas with high risk in Mauritania</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[17.813930, -15.540200], popup= "<strong>Desertificated Areas with high risk in Mauritania</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[19.813930, -12.540200], popup= "<strong>Desertificated Areas with high risk in Mauritania</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[20.813930, -11.540200], popup= "<strong>Desertificated Areas with high risk in Mauritania</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[10.813930, -8.540200], popup= "<strong>Desertificated Areas with high risk in Mauritania</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[10.23559, -8.906193], popup="<strong>Desertificated Areas in Mauritania</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="red")).add_to(m) #Malawi folium.Marker( location=[-13.540200, 33.45], popup= "<strong>Desertificated Areas with high risk in Malawai</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[-14.54020, 35.768], popup= "<strong>Desertificated Areas with high risk in Malawai</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[-14.813930, 34.540200], popup= "<strong>Desertificated Areas with high risk in Malawai</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[-15.813930, 34.540200], popup= "<strong>Desertificated Areas with high risk in Malawai</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[-15.813930, 32.540200], popup= "<strong>Desertificated Areas with high risk in Malawai</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[-13.813930, 33.540200], popup= "<strong>Desertificated Areas with high risk in Malawai</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[-12.813930, 35.540200], popup= "<strong>Desertificated Areas with high risk in Malawai</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker( location=[-16.813930, 34.540200], popup= "<strong>Desertificated Areas with high risk in Malawai</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="green")).add_to(m) folium.Marker(location=[-13.23559, 33.906193], popup="<strong>Desertificated Areas in Malawai</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="red")).add_to(m) #Kenya folium.Marker( location=[0.813930, 37.540200], popup= "<strong>Desertificated Areas with high risk in Kenya</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[1.813930, 38.540200], popup= "<strong>Desertificated Areas with high risk in Kenya</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[1.813930, 40.540200], popup= "<strong>Desertificated Areas with high risk in Kenya</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[0.813930, 39.540200], popup= "<strong>Desertificated Areas with high risk in Kenya</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[0.813930, 33.540200], popup= "<strong>Desertificated Areas with high risk in Kenya</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[-1.813930, 34.540200], popup= "<strong>Desertificated Areas with high risk in Kenya</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[2.813930, 35.540200], popup= "<strong>Desertificated Areas with high risk in Kenya</strong>", tooltip="Click for more information").add_to(m) folium.Marker( location=[1.813930, 37.540200], popup= "<strong>Desertificated Areas with high risk in Kenya</strong>", tooltip="Click for more information").add_to(m) folium.Marker(location=[3.23559, 38.906193], popup="<strong>Desertificated Areas in Kenya</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="red")).add_to(m) #Mali folium.Marker(location=[15.023559, -5.906193], popup="<strong>Desertificated Areas in Congo</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="red")).add_to(m) folium.Marker(location=[14.023559, -7.906193], popup="<strong>Desertificated Areas in Congo</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="red")).add_to(m) folium.Marker(location=[3.023559, 16.906193], popup="<strong>Desertificated Areas in Congo</strong>", tooltip="Click for more information", icon=folium.Icon(icon="cloud", color="red")).add_to(m) m1 = m.get_root().render() return render_template("desertificationml.html", m=m1)
df_shops = pd.read_csv('shops.csv') #Farming shops X1 = df_shops.iloc[:, 1].values Y1 = df_shops.iloc[:, 3].values shop = df_shops.iloc[:, 0].values print(X1) tooltip = 'Click for more info' m = folium.Map(location=[13.0827, 80.2707], zoom_start=12) for lt, lg, sp in zip(X1, Y1, shop): folium.Marker([lt, lg], popup=sp, icon=folium.Icon(color='green', icon='leaf'), tooltip=tooltip).add_to(m) #Banks df_shops = pd.read_csv('banks.csv') X2 = df_shops.iloc[:, 1].values Y2 = df_shops.iloc[:, 2].values bank = df_shops.iloc[:, 0].values for lt, lg, sp in zip(X2, Y2, bank): folium.Marker([lt, lg], popup=sp, icon=folium.Icon(icon='home'), tooltip=tooltip).add_to(m) m.save('map1.html')
elif elev in range(mini + step, mini + step * 2): col = 'blue' elif elev in range(mini + step * 2, mini + step * 3): col = 'orange' else: col = 'red' return col fg = folium.FeatureGroup(name="Volcano Locations") for lat, lon, name, elev in zip(df['LAT'], df['LON'], df['NAME'], df['ELEV']): fg.add_child( folium.Marker(location=[lat, lon], popup=name, icon=folium.Icon(color=color(elev), icon='cloud', icon_color='green'))) map.add_child( folium.GeoJson( data=open('World_Population.json', 'r', encoding='utf-8-sig').read(), name='World population', style_function=lambda x: { 'fillColor': 'green' if x['properties']['POP2005'] <= 10000000 else 'orange' if 10000000 < x['properties']['POP2005'] < 20000000 else 'red' })) map.add_child(fg) map.add_child(folium.LayerControl()) # Use above or below command to add marker #folium.Marker([lat,lon], popup=name,icon = folium.Icon(color = color(elev), icon = 'cloud')).add_to(map)
color = 'pink' elif level == 'District Pre-K Center': color == 'red' elif level == 'Elementary': color = 'orange' elif level == 'Junior High-Intermediate-Middle': color = 'yellow' elif level == 'High school': color = 'green' elif level == 'K-8': color = 'blue' elif level == 'K-12 all grades': color = 'purple' elif level == 'Secondary School': color = 'darkblue' else: # just in case we missed a type of school print(level) continue schoolsMap.add_child(folium.Marker(location=[lat, lon], popup=(folium.Popup(name)), icon=folium.Icon(color=color))) except Exception as e: print(e) continue schoolsMap.choropleth(geo_path='../data/2014-2015_School_Zones.geojson', fill_color='grey', fill_opacity=0.15, line_opacity=0.3) schoolsMap.save(outfile='../html/nyc-schools.html')
lng = list(get_store_lnfo['lng']) remain_stat = list(get_store_lnfo['remain_stat']) stock_at = list(get_store_lnfo['stock_at']) colorList = { 'plenty': 'green', 'some': 'orange', 'few': 'red', 'empty': 'gray', 'break': 'black', 'none': 'blue' } amount = { 'plenty': '100개이상', 'some': '30개이상 100개 미만', 'few': '2개이상 30개미만', 'empty': '다팔려버렸다', 'break': '판매중지', 'none': '정보없음' } #지도에 표시해주기 위해 MarkerCluster 을 사용해준다. #location=[위도경도],popup=이름 , icon Marker_Cluster = MarkerCluster().add_to(m) for i in range(len(name)): folium.Marker(location=[lat[i], lng[i]], popup='약국이름 : ' + name[i] + '\n입고시간 : ' + stock_at[i] + '\n재고상태 : ' + amount[remain_stat[i]], icon=folium.Icon(color=colorList[remain_stat[i]], icon='ok')).add_to(MarkerCluster) m.save('map.html') #html 파일로 저장
def user_detail_view(request, user_id, *args, **kwargs): user = User.objects.get(pk=user_id) message = search_address = search = point_location = modal = None if request.method == "POST": modal = True geolocator = Nominatim(user_agent="users") search = str(request.POST["address"]).strip().replace(',', '') location = geolocator.geocode(search) while not location: search = " ".join(search.split()[:len(search.split()) - 1]) location = geolocator.geocode(search) if not search: break if location: point_location = Point(location.longitude, location.latitude, srid=4326) search_address = location.address else: message = "No location found." m = folium.Map( max_width=500, max_height=300, location=list(user.location)[::-1] if user.location else None, # (location.latitude, location.longitude), # User's location | user.location zoom_start=16, ) if user.location: folium.Marker( list(user.location)[::-1], #[4.7064546, -74.0925343], tooltip=f"{user.address[:30]}...", popup='Your current location!', icon=folium.Icon(color="red"), ).add_to(m) # Remember to add marker to map. return render( request, "users/profile.html", { 'modal': modal, 'user': user, 'map': m._repr_html_(), # map in html representation 'message': message, 'search_address': search_address, 'search': search, 'profileform': ProfileForm( initial={ 'genre': user.genre.all(), 'job': user.job.all(), 'instrument': user.instrument.all(), }), 'form': LocationForm(initial={ 'location': point_location if point_location else user.location }), # (request.POST or None), })
# -*- coding: utf-8 -*- """ Created on Sun May 10 14:23:24 2020 WebMap with Markers @author: SowjanyaG """ import folium map = folium.Map(location=[17.4, 78.5], zoom_start=12, tiles="Stamen Terrain") fg = folium.FeatureGroup(name="My Map") fg.add_child( folium.CircleMarker([17.4, 78.5], popup="Hi I'm Marker", icon=folium.Icon(color='blue'))) 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'] < 10000000 else 'orange' if 10000000 <= x['properties']['POP2005'] < 20000000 else 'red' })) map.add_child(fg) map.add_child(folium.LayerControl()) map.save("Map1.html")
print('1.6', '-' * 50) import googlemaps gmaps_key = "xxxxxxxxxxxxxxxxxxxxxx" # 자신의 key를 사용합니다. gmaps = googlemaps.Client(key=gmaps_key) def get_lat_lng(addr): area = gmaps.geocode(addr, language='ko') latlng = area[0].get("geometry") lat = latlng['location']['lat'] lng = latlng['location']['lng'] # print(lat,lng) return lat, lng import folium lat, lng = get_lat_lng(df['주소'].values[0]) map = folium.Map(location=[lat, lng], zoom_start=12) for addr in range(len(df['주소'].values)): lat, lng = get_lat_lng(df['주소'].values[addr]) # print(lat,lng) # print(df['주소'].values[addr]) # print(df['상호명'].values[addr]) m = folium.Marker([lat, lng], popup=str(addr) + df['상호명'].values[addr], icon=folium.Icon(icon='cloud')).add_to(map) m.add_to(map) map.save('Daejoen_맛집.html')