geohash folium 绘制 可视化 - xd21303/Notebook GitHub Wiki
安装
pip install python-geohash
conda install python-geohash
import geohash
import folium
from folium.features import DivIcon
from folium import plugins
map_gaode = folium.Map(
tiles=
'http://wprd02.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&scl=1&x={x}&y={y}&z={z}',
attr='default')
geo = geohash.encode(lat, lon, 8)
rec = geohash.decode_exactly(geo)
bounds = [(rec[0] + rec[2], rec[1] + rec[3]),
(rec[0] - rec[2], rec[1] - rec[3])]
folium.Rectangle(
bounds=bounds,
weight=2, # 线条宽度
color='red').add_to(map_gaode)
map_gaode.fit_bounds(map_gaode.get_bounds())
map_gaode