bokeh的密集地图

2024-10-08 19:28:36 发布

您现在位置:Python中文网/ 问答频道 /正文

我在博基准备了一张地图。我想把它的强度像在一张对开的地图上一样,但我不知道如何有效地做到这一点。叶库的大型元素可以应用于在博凯生成的地图吗?在

https://ibb.co/xFXCsz1-带地图边框的图像

https://ibb.co/5GpWvvJ-带地图页的图像(密集型)

import pandas as pd 
import folium
from folium.plugins import HeatMap
import geopandas as gpd
import os

dane = pd.read_csv("../data_out/dane_adresowe/bigdata_on_lublin_map.csv", sep="|", encoding='UTF-8')



congr_districts = gpd.read_file('zip://'+'../data_set/dane_geo/cb_2015_us_cd114_20m.zip')  
congr_districts.crs = {'datum': 'NAD83', 'ellps': 'GRS80', 'proj':'longlat', 'no_defs':True}

district23 = congr_districts[ congr_districts.GEOID == '3623' ]  # 36 = NY, 23 = District

# convert it to the projection of our folium openstreetmap  
district23 = district23.to_crs({'init':'epsg:4326'})

for_map = dane

max_amount = float(for_map['RAZEM_ILOSC_LOK'].max())

hmap = folium.Map(location=[42.5, -75.5], zoom_start=7, )

hm_wide = HeatMap( list(zip(for_map.SZEROKOSC.values, for_map.DLUGOSC.values, for_map.RAZEM_ILOSC_LOK.values)),
                   min_opacity=0.2,
                   max_val=max_amount,
                   radius=17, blur=15, 
                   max_zoom=1, 
                 )

folium.GeoJson(district23).add_to(hmap)
hmap.add_child(hm_wide)
hmap.save(os.path.join('heatmap.html'))
^{pr2}$

Tags: tohttpsimportmapfor地图zipmax

热门问题