0

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 ?

6
  • what does the browser console say? Feb 24, 2019 at 21:13
  • Uncaught SyntaxError: Unexpected token < on this line : var macro_element_6d25be1d6f0b4126bc445bdd631cf103 = new L.GeoJSON(<folium.features.GeoJson object at 0x00000000886896D8>);
    – Brocolus
    Feb 24, 2019 at 21:36
  • That hints at a lack of JavaScript understanding, I recommend you either learn some of that or go to the general programming stackoverflow.com for help on programming. Feb 25, 2019 at 8:58
  • 1
    Ah, sorry, I forgot. :) Then this might hint at a Folium bug. Please provide a stackoverflow.com/help/mcve that exhibits the problem so we can help. Feb 25, 2019 at 9:09
  • 1
    Thank you for your answers, I'll create a new question with a minimal example to put the problem clearer
    – Brocolus
    Feb 25, 2019 at 9:55

1 Answer 1

1

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 !

2
  • 1
    Sweet! I was just going to notify you about the brand-new folium 0.8 release that just happened, as the search plugin is mentioned in its docs. I'll notify the author, so they fix their examples. Don't forget to mark your answer as solution! Feb 25, 2019 at 15:19
  • 1
    Yes I saw it today, now it works perfectly ! Thank you again, today I can't mark solution yet (blocked by stackExchange), I will put a mark tomorrow
    – Brocolus
    Feb 25, 2019 at 17:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.