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.

Combining `GeoJson` markers in a `MarkerCluster` shows unclustered markers

See original GitHub issue

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

with open('examples/data/search_bars_rome.json') as f:
    data = json.load(f)
data_url = 'https://raw.githubusercontent.com/python-visualization/folium/master/examples/data/search_bars_rome.json'

m = folium.Map((41.9, 12.5), tiles='cartodbpositron')
marker_cluster = folium.plugins.MarkerCluster(name='mc').add_to(m)
folium.GeoJson(data_url, embed=False).add_to(marker_cluster)
folium.GeoJson(data_url, embed=False, name='geojson').add_to(m)
folium.LayerControl(collapsed=False).add_to(m)
m.save('_map.html')
m

Problem description

I expected to see the markers in a clustered fashion

image

I can’t tell from #1190, #1129 and #1188 if this is fixed in version 0.10.0, and if it is, what’s the right syntax?

Expected Output

Clustered markers (This was taken from another example)

image

Output of folium.__version__

‘0.10.0’

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
Conengmocommented, Jun 18, 2020

The fix has been merged. It will be in the next release, v0.12.0, release date yet unknown. If you want it earlier you can install folium from the main branch:

pip install git+https://github.com/python-visualization/folium.git@master
1reaction
Conengmocommented, Jun 13, 2020

It seems combining GeoJsonTooltip and MarkerCluster plugin is not supported behavior. Note that while everything in the base folium library should work well together we can’t guarantee that for the plugins.

I don’t think using the FeatureGroupSubGroup plugin is a real solution here. I’ll make a PR where we do the ajax call asynchronously.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Combining Feature Selection and Marker Clustering
I am using the basic structure for layer toggling found in this CartoDB tutorial, with buttons wired to a ul navigation menu.
Read more >
Styling individual markers in markercluster - Stack Overflow
I am trying to style individual markers, or clusters of size 1, based on some feature property. var markers = L.markerClusterGroup(); function ...
Read more >
Marker cluster in leaflet | GeoJSON points to cluster | GeoDev
marker cluster Github: https://github.com/Leaflet/Leaflet.markerclustertutorial code: ...
Read more >
leaflet.markercluster - npm Package Health Analysis - Snyk
Provides Beautiful Animated Marker Clustering functionality for Leaflet For more information about how to use this package see README.
Read more >
leaflet-cluster · development · MAKB / MapKB · GitLab - USGS
package.json ... Provides Beautiful Animated Marker Clustering functionality for ... Install with npm: npm install leaflet.markercluster.
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