I am trying to render 15,000 points in folium. When I have less than 1000 points I get a map that renders as the attached image (example map). When I include over 1000 my code returns an item void of either a map or points. The following is my code:
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
The only useful workaround I could find was to include cluster markers.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With