pip install folium
import folium
m = folium.Map(location = [45.5236, -122.6750])
m
m = folium.Map(location = [45.5236, -122.6750])
m.save('index.html') # HTML ์ ์ฅ ๊ฐ๋ฅ
folium.Map(location=[45.5236, -122.6750], tiles='Stamen Toner', zoom_start=13)
my_map = folium.Map(location=[45.372, -121.6972], zoom_start=12, tiles='Stamen Terrain')
# ๋ง์ปค ์ถ๊ฐ ๊ฐ๋ฅ
folium.Marker([45.3288, -121.6625], popup='<i>Mt. Hood Meadows</i>').add_to(my_map)
folium.Marker([45.3311, -121.7113], popup='<b>Timberline Lodge</b>').add_to(my_map) # popup : ๋ง์ปค์ ํ์๋๋ ๊ธ๊ท
my_map
m = folium.Map(
location = [37.544564958079896, 127.05582307754338],
zoom_start = 14,
tiles = 'OpenStreetMap'
)
m.add_child(folium.ClickForMarker(popup = 'ClickForMaker'))
m = folium.Map(
location = [37.544564958079896, 127.05582307754338],
zoom_start = 14,
tiles = 'OpenStreetMap'
)
m.add_child(folium.LatLngPopup())
folium.Circle()
: ์ขํ์ ์์ ์ด์ฉํด ํ์folium.CircleMarker()
: ์ขํ์ ์์ ์ด์ฉํด ํ์โป ๋ ๊ฐ์ ์ฐจ์ด์
1. folium.CircleMarker()๋ ๋ฐฐ์จ์ ๋ฐ๋ผ Circle์ radius๊ฐ ์๋ ์กฐ์ ๋จ
2. ๊ทธ ์ธ ์ต์ ์ ๋ชจ๋ ๋์ผ
# Circle Marker
m = folium.Map(location=[45.5236, -122.6750], zoom_start = 13, tiles = 'Stamen Terrain')
# ๋ง์ปค ์ถ๊ฐ ๊ฐ๋ฅ
folium.Circle(
radius = 100,
location = [45.5244, -122.6699],
popup = 'The Waterfront',
color = 'crimson',
fill = False
).add_to(m)
folium.Circle(
radius = 50,
location = [45.5215, -122.6261],
popup = 'Laurelhurst Park',
color = '#3186cc',
fill = True,
fill_color = '#3186cc'
).add_to(m)
m
m = folium.Map(
location = [37.544564958079896, 127.05582307754338],
zoom_start = 14,
tiles = 'OpenStreetMap'
)
# circle
folium.Circle(
location = [37.555243442409406, 127.04370422643919],
radius = 100,
fill = True,
color = '#eb9e34',
fill_color = 'red',
popup = 'circle popup',
tooltip = 'circle tooltip'
).add_to(m)
# circle marker
folium.CircleMarker(
location = [37.54347089498245, 127.04439204503],
radius = 100,
fill = True,
color = '#34ebc6',
fill_color = '#c634eb',
popup = 'circleMarker popup',
tooltip = 'circleMarker tooltip'
).add_to(m)
m
m = folium.Map(
location = [43, -102],
zoom_start = 3
)
m
fill_opacity
: ์ฑ์ฐ๊ธฐ ํฌ๋ช
๋line_opacity
: ์ ํฌ๋ช
๋legend_name
: ๋ฒ๋ก ์ด๋ฆfolium.Choropleth(
geo_data = f_path + '02. us-states.json', # ๊ฒฝ๊ณ์ ์ขํ๊ฐ์ด ๋ด๊ธด ๋ฐ์ดํฐ
data = state_data, # Series or DataFrame
columns = ['State', 'Unemployment'], # DataFrame Columns
key_on = 'feature.id',
fill_color = 'BuPu',
fill_opacity = 1, # 0-1
line_opacity = 1, # 0-1
legend_name = 'Unemployment rate(%)'
).add_to(m) # json file : ๊ฒฝ๊ณ์ ์ขํ๊ฐ์ด ๋ด๊ธด ๋ฐ์ดํฐ
m