question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rendering Map Fails at ~3000 Markers

See original GitHub issue

Please add a code sample or a nbviewer link, copy-pastable if possible

import folium
import json
import os
import numpy

from folium.plugins import MarkerCluster

m = folium.Map(
    location=[0, 0],
    zoom_start=2,
    tiles='http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
    attr='Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
)

marker_cluster = MarkerCluster().add_to(m)

random_marker_count=3000        
colors = numpy.random.randint(low=0, high=0xFFFFFF, size=(random_marker_count,1))
lats = numpy.random.random_sample(random_marker_count)
longs = numpy.random.random_sample(random_marker_count)

for i in range(0, random_marker_count):
    lat = ((lats[i]*2) - 1) * 90
    long = ((longs[i]*2) - 1) * 180
    coor = [lat,long]
    c = "#%06x" % colors[i][0]
    folium.CircleMarker(
        location=coor,
        fill=True,
        radius=5,
        color=c,
        fill_color=c
    ).add_to(marker_cluster)

m

Problem description

Somewhere around 3000 markers I can no longer render the map. I can see the cell, it just never populates. Not seeing any errors in the logs.

Am I creating these data points incorrectly? Perhaps I should be loading a GeoJSON layer instead? This was intended to be a simple scaling test.

Expected Output

Map renders in a < 5 seconds.

I’d expect issues at 10,000’s or 100,000’s of markers, not 1000’s.

Output of folium.__version__

'0.5.0'

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

6reactions
anderl80commented, Feb 27, 2019

What is the preferred way with folium to create a big data marker map with more than ~3000 markers? ClusterMarker is not an option as this visually distorts the information I want to display.

0reactions
sherl0ckscommented, Jan 8, 2018

What do you mean by 'saving the result`?

I think you hit this on the head with server side / headless approach.

At this point, I have the information I need. Thanks for your help. Closing

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a limit to plotting markers with folium?
This code takes ~10ms to render the map. ... we can add a specific number of markers(let's say 3000 markers) on a layer,...
Read more >
Why is Leaflet so slow when you add a non-trivial amount of ...
It's doubtlessly caused by the markers being rendered. Why would less than 3,000 markers even make it go slower at all? Even a...
Read more >
first render works, second render is not centered
Hello all, I have a mysterious problem where a simple map (just a single marker) renders fine the first time, but a second...
Read more >
Error While Rendering Visualization -- Map (Markers)
All Users Group — Petehart88 (Customer) asked a question. October 19, 2022 at 11:15 PM. Error While Rendering Visualization -- Map (Markers).
Read more >
Map, search tab,center marker and geolocation are perfect ...
loadStoreData(); //Create a bubble layer for rendering clustered data points. var clusterBubbleLayer = new atlas.layer.BubbleLayer(datasource, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found