from IPython.display import HTML import folium def inline_map(map): """ Embeds the HTML source of the map directly into the IPython notebook. This method will not work if the map depends on any files (json data). Also this uses the HTML5 srcdoc attribute, which may not be supported in all browsers. """ map._build_map() return HTML(''.format(srcdoc=map.HTML.replace('"', '"'))) def embed_map(map, path="m213map.html"): """ Embeds a linked iframe to the map into the IPython notebook. Note: this method will not capture the source of the map into the notebook. This method should work for all maps (as long as they use relative urls). """ map.create_map(path=path) return HTML(''.format(path=path)) map = folium.Map(width=500,height=500,location=[44, -73], zoom_start=4) map.simple_marker([40.67, -73.94], popup='Add popup text here.',marker_color='green',marker_icon='ok-sign') map.simple_marker([44.67, -73.94], popup='Add popup text here.',marker_color='red',marker_icon='remove-sign') map.simple_marker([44.67, -71.94], popup='Add popup text here.') inline_map(map)