Skip to content

Adding multiple Custom Icon in Folium #744

@shubham039

Description

@shubham039

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions