MarkerCluster: icon_create_function is not inserted as function
See original GitHub issueHello,
I have a problem with my generation of map. In fact, I obtain double quotes in my source code, so I get “this._group.options.iconCreateFunction is not a function” message in Firefox.
Sample of my script :
# Create Map
obj_map_cluster = folium.Map(
# Latitude and Longitude of Map (Northing, Easting)
location=[46.5286, 2.4389],
# Forces Leaflet to use the Canvas back-end for vector layers instead of SVG
prefer_canvas=True,
# Map tileset to use
tiles='cartodbdark_matter',
# Initial zoom level for the map
zoom_start=6
)
# Assign icon create function
obj_markercluster = plugins.MarkerCluster(
icon_create_function="""
function (cluster) {
return L.divIcon({ html: cluster.getChildCount(), className: 'mycluster', iconSize: L.point(40, 40) });
}
"""
)
# Create Marker
obj_marker = folium.Marker([DEFINITION OF MARKER])
obj_markercluster.add_child(obj_marker)
obj_markercluster.add_to(obj_map_cluster)
obj_map_cluster.save('sites_cluster.html')
Problem description
HTML source code is :
"iconCreateFunction": "function (cluster) {\n return L.divIcon({ html: cluster.getChildCount(), iconSize: L.point(40, 40) });\n}"
Expected Output
To work, I would like :
iconCreateFunction: function (cluster) { return L.divIcon({ html: cluster.getChildCount(), iconSize: L.point(40, 40) });}
Without ‘"’ and ‘\n’
Output of folium.__version__
My version is 0.6.0+11.g71ab988
Thank you !
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top Results From Across the Web
Marker cluster leaflet : dynamically modify icon - Stack Overflow
My code works but doesn't do want I want : in the function iconCreateFunction I want to count markers of "ClusterBatterieFaible", but I...
Read more >react-leaflet-markercluster | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >Adding custom icons to L.markerClusterGroup?
Here's the rest of my code: var markerClusters = L.markerClusterGroup(); iconCreateFunction: function (cluster) { var markers ...
Read more >Does Markercluster Work Together With Leafletproxy() And ...
I am trying to make leaflet markercluster plugin work with leafletProxy in an R Shiny app using the option iconCreateFunction. Is the plugin...
Read more >How can i render 60000 accounts on leaflet map using ...
chunkInterval: 300, iconCreateFunction: function (cluster) { var childCount = cluster.getChildCount(); var c = ' marker-cluster-';
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello,
Sorry for my absence, I confirm that it works with the master version.
Thank you,
This has been fixed in #954. To use it you should install folium from the git master branch (until we release a next version). Thanks @nakasix for reporting this. By the way, if you have time maybe you can confirm it works now.