I have been experimenting with a few Python packages that have great potential for my dissertation research. Since I use pandas for pretty much everything, geopandas was a natural choice for working with spatial data (within the range of capability of the package), and the interactive properties of folium are ... sweet.

In any case, I want to be able to share the maps that I have made with other folks who are not using or even familiar with IPython Notebook. My test case is plotting the location of traffic cameras in DC. (The shapefile is provided to the public by DCGIS via opendatadc.org, a new and growing source for District info.) The Notebook Viewer seemed like an obvious choice, but as can be seen from my rendered gist, the maps are 1) static, and 2) displayed only in their final form. (Markers were not added until the last map, even though they appear in the first one.)

I then thought I could leverage Mike Bostock's awesome viewer for interactive graphics, bl.ocks.org. I am missing something, however, because while my map is now interactive, the markers have disappeared.

Has anyone run into this problem? Any help would certainly be appreciated.


I haven't gotten json files to load with nbviewer yet, but here's two things that work in similar situations:

If you only use map.simple_marker() and similar functions, it's possible to completely embed the map HTML into the notebook. I haven't gotten this to work with json yet, but it looks like the upcoming version of follium allows templates, so it possibly can be inlined in the future. I have an example of this here:


Also, you're running a SimpleHTTPServer but you don't need to. You can use the magic IPython files/ url to refer to files in the directory that IPython was launched from. So you can use an iframe with a source files/index.html. However, I haven't been able to get that to work in the Notebook Viewer. Theoretically you should be able to include multiple files in the gist and make it work.

  • 1
    Sorry for the delay. This is exactly what I was looking for when I asked this question. The inline will certainly work, but if you get embed to work as well, I would be interested in a follow up comment. Much appreciated! Dec 29 '13 at 0:11
  • Great. There's been some recent activity on follium's github, hopefully it will be possible soon. The embed method actually does work, just not in the notebook viewer.
    – bburky
    Jan 14 '14 at 18:09
  • It looks like the notebook viewer has been updated, so the embed method works too now. It even successfully loads json.
    – bburky
    Apr 16 '14 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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