{
"metadata": {
"name": "",
"signature": "sha256:a45c55171064486650197eeb8d869dfd5569e90d967efefa1dfaf9a33281b334"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"from IPython.display import HTML\n",
"import folium"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 16
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"def inline_map(map):\n",
" \"\"\"\n",
" Embeds the HTML source of the map directly into the IPython notebook.\n",
" \n",
" This method will not work if the map depends on any files (json data). Also this uses\n",
" the HTML5 srcdoc attribute, which may not be supported in all browsers.\n",
" \"\"\"\n",
" map._build_map()\n",
" return HTML(''.format(srcdoc=map.HTML.replace('\"', '"')))\n",
"\n",
"def embed_map(map, path=\"m213map.html\"):\n",
" \"\"\"\n",
" Embeds a linked iframe to the map into the IPython notebook.\n",
" \n",
" Note: this method will not capture the source of the map into the notebook.\n",
" This method should work for all maps (as long as they use relative urls).\n",
" \"\"\"\n",
" map.create_map(path=path)\n",
" return HTML(''.format(path=path))"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 17
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"map = folium.Map(width=500,height=500,location=[44, -73], zoom_start=4)\n",
"\n",
"map.simple_marker([40.67, -73.94], popup='Add popup text here.',marker_color='green',marker_icon='ok-sign')\n",
"map.simple_marker([44.67, -73.94], popup='Add popup text here.',marker_color='red',marker_icon='remove-sign')\n",
"map.simple_marker([44.67, -71.94], popup='Add popup text here.')\n",
"inline_map(map)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"html": [
""
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 24,
"text": [
""
]
}
],
"prompt_number": 24
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}