Problem with Folium search plugin (Data=marker_cluster)
See original GitHub issueI get a couple of stuck when i use folium.plugins.Search(marker_cluster) ,the first one search bar is not respond when i try to searching the second customicon png and default marker appear at the same place. how can i get rid off these default marker?. thanks!.
import folium
from folium import plugins
from folium.plugins import Search
points = {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"name": "one",
'icons': 'C:\\Users\\avion\\Desktop\\pandas\\my project\\factory.png'
},
"geometry": {
"type": "Point",
"coordinates": [-71.0636, 42.3581]
}
},
{
"type": "Feature",
"properties": {
"name": "two",
'icons': 'C:\\Users\\avion\\Desktop\\pandas\\my project\\factory.png'
},
"geometry": {
"type": "Point",
"coordinates": [-74.78991444, 42.82995815]
}
},
{
"type": "Feature",
"properties": {
"name": "three",
'icons': 'C:\\Users\\avion\\Desktop\\pandas\\my project\\factory.png'
},
"geometry": {
"type": "Point",
"coordinates": [-78.56603306, 39.17929819]
}
}
]
}
m = folium.Map(
location=[42.82995815, -74.78991444],
tiles = 'cartodbpositron',
zoom_start=1
)
style_one = lambda x: {'fillColor': 'green'}
marker_cluster = folium.plugins.MarkerCluster(name = 'site location').add_to(m)
for feature in points['features']:
lon, lat = feature['geometry']['coordinates']
icon = feature['properties']['icons']
name = feature['properties']['name']
icon = folium.CustomIcon(icon_image = icon,
icon_size = (30,35),
icon_anchor = (0,0))
marker =folium.Marker(location = [lat, lon] ,popup =(folium.Popup(str(name))),
tooltip = "<strong>"+str(name)+"</strong>",
icon = icon).add_to(marker_cluster)
geojson_obj = folium.GeoJson(points, style_function=style_one).add_to(marker_cluster)
statesearch = Search(layer=marker_cluster,
geom_type='Point',
placeholder="Search",
collapsed=True,
search_label='name',
search_zoom=14,
position='topright'
).add_to(m)
m.save('example.html')
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
Python - Search Plugin of Folium give an error - Stack Overflow
I use folium.Search() in python.However ,The code returns an error when I run my code.How the fix this problem? import folium from folium...
Read more >plugins — Folium 0.12.1 documentation - GitHub Pages
Wrap some of the most popular leaflet external plugins. ... False) – When set to True, plugin will be activated on map loading...
Read more >Search plugin of Folium doesn't appear - GIS Stack Exchange
The issue is that, at best the search plugin doesn't appear and at worse my folium map isn't displayed. Does anyone have this...
Read more >folium search - You.com | The AI Search Engine You Control
I'm trying to add search functionality to a map I'm generating in Python with Folium. I see there is a handy Search plugin...
Read more >python-visualization/folium - Gitter
I'll also look at opening an issue on github. ... For #3 the closest I belive is the Search plugin but it would...
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
I don’t really understand your issue. Please check out our example notebooks and take it from there.
These issues are meant for tracking bugs and new functionalities, if you need more help debugging your code than Stackoverflow is probably a better channel.
Probably because it’s not implemented
https://github.com/python-visualization/folium/blob/60ae79cd1f4f16fc48e206947c7cef870ea28b8e/folium/plugins/search.py#L120