Skip to content

Point/bubble map not showing with more than 9500 points #1371

@Anaraquelpengelly

Description

@Anaraquelpengelly

Hi,

I am using folium to make several maps and it worked very nicely. However, as soon as the number of points to map exceeds 9500, the map no longer shows on jupyter labs and even if I save it as .html, the html although very big, just shows a blank page.

Here is the code I am using and doesn't work:
`#Code for bubble map:

for i in range(len(df_l)):

m = folium.Map(location=[51.51279, -0.09184],
prefer_canvas=True,
tiles="stamentoner",
zoom_start=12)

for lat, lon, merch,count in zip(df_l[i]['latitude'], df_l[i]['longitude'], df_l[i]['merchant_name'], df_l[i]['counts']):
folium.CircleMarker(
[lat, lon],
tooltip=merch,
popup=round(count/len(days[i])),
stroke=False,
weight=0.5,
radius=(count/(max(df_l[i]['counts'])/50)),
color='red',
fill=True,
fill_color='red'
).add_to(m)
names=['before', 'during']
m.save(path + f'/{names[i]}_bubble_london_Fri.html')

#code for points map:

for i in range(len(df_l)):
m2 = folium.Map(location=[51.51279, -0.09184],
tiles='stamentoner',#can set tiles= here
zoom_start=12)
for lat, lon, merch, count in zip(df_l[i]['latitude'], df_l[i]['longitude'], df_l[i]['merchant_name'], df_l[i]['counts']):
folium.CircleMarker(
[lat, lon],
tooltip=merch,
radius=1
).add_to(m2)
names=['before', 'during']
m2.save(path + f'/{names[i]}_point_london_Fri.html')

`
Both of the pieces of code above yield blank maps that are very big in size ( only for the dataset that is 9556 rows) If the data is 9500 rows as below, it works and I get a a notebook and html map.

m2 = folium.Map(location=[51.51279, -0.09184], tiles='stamentoner',#can set tiles= here zoom_start=12) for lat, lon, merch, count in zip(df_l[0][:9500]['latitude'], df_l[0][:9500]['longitude'], df_l[0][:9500]['merchant_name'], df_l[0][:9550]['counts']): folium.CircleMarker( [lat, lon], tooltip=merch, radius=1 ).add_to(m2) m2

Sadly, I cannot give access to my data. If this is a general problem, t should behave the same if you generate a df with random lat/long coordinates.

Environment (please complete the following information):

  • Browser : Chrome
  • Both on Jupyter lab and html files
  • folium version: 0.11.0

I hope there is something I can do to make the map visible.

Thanks!

Ana

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions