Search code examples
python-3.xgeojsongeopandasfolium

Python - Search plugin of Folium doesn't appear


I'm trying to reproduce the following jupyter notebook :

https://nbviewer.jupyter.org/github/jtbaker/folium/blob/geojsonmarker/examples/plugin-Search.ipynb

But once I'm trying to create the map I had to make a few changes to the search plugin because of the documentation:

citysearch = Search(layer=citygeo, 
                geom_type='Point', 
                placeholder="Search for a US City", 
                collapsed=True, 
                search_label='nameascii'
               ).add_to(m)

becomes, according to the folium documentation here :

citysearch = Search(data=citygeo, 
                   geom_type='Point', 
                   search_label='nameascii'
                   ).add_to(m)

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 problem as well ? Or is there any dependecies I've forgot ?


Solution

  • Alright found the solution after couple days of research,

    The example in the notebook is using a new search.pyfile which isn't updated in the folium document yet (as the working version is from december 23 2018 so it's very recent)

    I just went to the pluginfolder to change the search.py with the github newest version Here Then it doesn't update automatically to my notebooks so I just created a new one and there it works !

    OR simpler way : update folium to version 0.8.0 and it will work so just do pip install folium==0.8.0 (just went out yesterday)