pip install folium
pip install jupyter
便于查看地图
import folium
m = folium.Map() # 显示地图
m
import folium
m = folium.Map(location=[30,100],zoom_start=3)
m
m = folium.Map(location=[30.6,114.4],zoom_start=8) # 武汉市地图
修改样式
m = folium.Map(location=[30.6,114.4],zoom_start=8,tiles='Stamen Toner')
m = folium.Map(location=[30.6,114.4],zoom_start=8,tiles='Stamen Terrain')
import folium
wuhan_map = folium.Map(location=[30.6,114.4],zoom_start=8)
# 添加标记
folium.Marker(
location=[30.6,114.3], # 位置
popup='Wu Han City Marker', # 鼠标点击 弹出的说明
icon=folium.Icon(icon='cloud') # 图标样式
).add_to(wuhan_map)
folium.Marker(
location=[30.6,114.33],
popup='Timberline Lodge',
icon=folium.Icon(color='green')
).add_to(wuhan_map)
folium.Marker(
location=[30.6,114.35],
popup='Some Other Location',
icon=folium.Icon(color='red', icon='info-sign')
).add_to(wuhan_map)
folium.Circle( # 添加圆
radius=200,
location=(30.6,114.32),
popup='The Waterfront',
color='crimson',
fill=False,
).add_to(wuhan_map)
folium.CircleMarker( #添加蓝色圆环
location=(30.6,114.37),
radius=50,
popup='Laurelhurst Park',
color='#3186cc',
fill=True,
fill_color='#3186cc'
).add_to(wuhan_map)
# 获取点的经纬度
# wuhan_map.add_child(folium.LatLngPopup())
# 动态添加标签
wuhan_map.add_child(folium.ClickForMarker(popup='Waypoint'))
import foliumposition = [30.4415, 114.2628] # 武科大的经纬度school_mp = folium.Map(location=position,zoom_start=15)school_mp
弹出pop_up显示图片不会。
传送门1
经纬度查询api