Как я могу визуализировать более 1000 точек в Folium

Я пытаюсь отобразить 15 000 точек в фолиуме. Когда у меня меньше 1000 точек, я получаю карту, которая отображается как прикрепленное изображение (пример карты). Когда я включаю более 1000, мой код возвращает элемент, лишенный карты или точек. Ниже приведен мой код:

пример карты

z230['marker_color'] = pd.cut(z230['ClosePrice'], bins=5, 
                          labels=['blue','green','yellow','orange','red'])

m = folium.Map(location=[39.2904, -76.6122], zoom_start=12)

for index, row in z230.iterrows():
    folium.CircleMarker([row['Latitude'], row['Longitude']],
                radius=15, color=row['marker_color']).add_to(m)
m

person Ken    schedule 27.02.2018    source источник
comment
Ознакомьтесь с полезным решением по адресу stackoverflow.com/questions/49047519/   -  person RandomForestRanger    schedule 02.07.2019


Ответы (1)


Единственный полезный обходной путь, который я смог найти, — это включить кластерные маркеры.

from folium.plugins import FastMarkerCluster

x = #your centering coordinates here LAT
y = #your centering coordinates here LONG
z = #your zoomlevel here

your_map = folium.Map(location=[x, y], tiles="OpenStreetMap", zoom_start=z)

callback = ('function (row) {' 
                'var circle = L.circle(new L.LatLng(row[0], row[1]), {color: "red",  radius: 10000});'
                'return circle};')


your_map.add_child(FastMarkerCluster(your_df[['your_LAT_col', 'your_LONG_col']].values.tolist(), callback=callback))

your_map
person RandomForestRanger    schedule 02.07.2019