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.

Adding multiple Custom Icon in Folium

See original GitHub issue

I am creating a Custom Icon in folium, and displaying it on a map, but when i try to add another coordinate with the same Icon, it fails.

import folium
map_osm = folium.Map(location=[45.3288, -121.6625])
icon_url = 'https://cdn1.iconfinder.com/data/icons/maps-locations-2/96/Geo2-Number-512.png'
icon = folium.features.CustomIcon(icon_url,icon_size=(28, 30))  # Creating a custom Icon
folium.Marker(location=[45.3288, -121.6625],icon=icon).add_to(map_osm)  #adding it to the map
map_osm

image

Now adding another location with the same icon

folium.Marker(location=[46.3288, -122.6625],icon=icon).add_to(map_osm)
map_osm

image

[The map_osm points to new location with its default icon, and the previous pin is removed.]

Expected Output should have been two map pins with the same icon.

folium.__version__ = ‘0.5.0’

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

2reactions
ninabelcommented, Nov 9, 2018

When icon have to be initialised everytime we got huge file. It’s a bug.

2reactions
shubham039commented, Oct 12, 2017

I got this solved, it needs icon to be initialised everytime you add a marker.

icon = folium.features.CustomIcon(icon_url,icon_size=(28, 30))
folium.Marker(location=[46.3288, -122.6625],icon=icon).add_to(map_osm)
map_osm
Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Folium unable to add multiple points with "same" icon
My guess is that it is designed not to accept the same object ID. In this example, markers with the same icon settings...
Read more >
Custom icons in folium
This new class allow users to display custom images as icons instead of the default markers. Here is how to do it. First...
Read more >
Map with markers with Python and Folium
This blogpost explains how to build an interactive map with markers using Python and Folium . It explains how to add the markers...
Read more >
Python Folium — A Data Visualization Superhero - Medium
Create powerful & beautiful Maps with Python Folium. ... Custom Icons: To save even more time, we are making additional use of the ......
Read more >
2 Creating and Styling Markers (Best Folium and Python ...
Full course available below:https://www.udemy.com/course/introduction-to-maps-in- folium -and-python/?referralCode=BC6929A9BAEA48934B45LEARN ...
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