{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Folium Flask App" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "folium_flask_app is a function for serving an interactive Folium map via Flask that binds map clicks with python functions." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ " * Running on http://localhost:9000/ (Press CTRL+C to quit)\n", "127.0.0.1 - - [20/Mar/2020 17:16:47] \"\u001b[37mGET / HTTP/1.1\u001b[0m\" 200 -\n", "127.0.0.1 - - [20/Mar/2020 17:16:48] \"\u001b[33mGET /favicon.ico HTTP/1.1\u001b[0m\" 404 -\n" ] } ], "source": [ "import webbrowser\n", "from werkzeug.serving import run_simple\n", "\n", "from dpd.folium import folium_flask_app\n", "\n", "hostname = \"localhost\"\n", "port = 9000\n", "\n", "app = folium_flask_app()\n", "webbrowser.open(\"http://\" + hostname + \":\" + str(port))\n", "run_simple(hostname, port, app)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.5" } }, "nbformat": 4, "nbformat_minor": 4 }