Custom Markers only work with URLs
See original GitHub issueIt seems that custom markers only work with URLs and not local image files.
This works:
icon = folium.features.CustomIcon('http://www.pngall.com/wp-content/uploads/2016/05/Iron-Man.png', icon_size=(50,50))
folium.Marker([43, -79],
popup='Iron Man',
icon=icon
).add_to(geo_map)
This does not work:
icon = folium.features.CustomIcon('Iron-Man.png', icon_size=(50,50))
folium.Marker([43, -79],
popup='Iron Man',
icon=icon
).add_to(geo_map)
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (2 by maintainers)
Top Results From Across the Web
Custom Markers | Maps JavaScript API - Google Developers
This tutorial teaches you how to change the icon of a Google maps marker. It is beneficial to know the basics of creating...
Read more >Add custom markers in Mapbox GL JS | Help
In this tutorial, you will learn how to build an interactive web map that adds custom markers at specified locations using Mapbox GL...
Read more >Custom marker icons in Google Static Map URL don't show up
As this answer said: Static Maps service allows up to five unique custom icons per request. Note that each of these unique icons...
Read more >link to url from marker click - mutiple markers - Google Groups
The goal is simple each marker on the map will have a different URL to link to when clicked. The information is in...
Read more >Registering Custom Markers in PyTest - Numpy Ninja
Optionally specify a reason for better reporting and run=False if you don't even want to execute the tes t function. If only specific...
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
Ok I see. It seems like the utility function that parses images for CustomIcon (image_to_url) no longer supports BytesIO format in the current version. However, it supports the path! (so it will transform the file automatically to Bytes for you). What I did is directly pass the path of the image:
icon_path = r"C:\some_path\icon.png"
icon = folium.features.CustomIcon(icon_image=icon_path ,icon_size=icons_size)
marker=folium.Marker([row["coord"].y,row["coord"].x],popup=popup,icon=icon).add_to(feature_groups[alert_icon_name])
@nanodan this code will work with local image file.
but for list of markers, the code only shows the first icon. 😦