-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
enhancementFeature request or idea about how to make folium betterFeature request or idea about how to make folium bettergood first issueNew contributors are welcome to pick up this issueNew contributors are welcome to pick up this issuepluginThis issue/PR is about an existing or new pluginThis issue/PR is about an existing or new plugin
Description
import folium
loc=[50.65795773762609, -1.2263860950441539]
m=folium.Map(location=loc, zoom_start=12)
for i in range(5):
folium.Marker(loc, popup='{}'.format( i )).add_to(m)
mWhen plotting markers geocoded from things like UK postcodes, it's quite common to get collisions when placing markers (multiple markers at the same location).
The markercluster approach will separate out markers that are colocated, but the overall effect can be quite unsatisfactory because the clustering algorithm tries to cluster things all over the place.
One solution is to perturb markers randomly. For example:
import numpy as np
m=folium.Map(location=loc, zoom_start=12)
for i in range(5):
loc[0]=loc[0]+np.random.uniform(0.001, 10**(-20))-0.00005
loc[1]=loc[1]+np.random.uniform(0.001, 10**(-20))-0.00005
folium.Marker(loc, popup='{}'.format( i )).add_to(m)
m
What would be really useful would be a plugin to separate out colocated markers. jawj/OverlappingMarkerSpiderfier-Leaflet looks like it might be a useful candidate?
Expected Output
Separate out colocated markers but not cluster markers AND separate out colocated ones.
bsassoli and davidljubadev22
Metadata
Metadata
Assignees
Labels
enhancementFeature request or idea about how to make folium betterFeature request or idea about how to make folium bettergood first issueNew contributors are welcome to pick up this issueNew contributors are welcome to pick up this issuepluginThis issue/PR is about an existing or new pluginThis issue/PR is about an existing or new plugin