{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/home/filipe/.virtualenvs/iris/lib/python2.7/site-packages/folium/__init__.py\n", "0.2.0\n" ] } ], "source": [ "import folium\n", "\n", "print(folium.__file__)\n", "print(folium.__version__)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lon = -(41 + 20/60. + 17/60/60.)\n", "lat = -(20 + 59/60. + 35/60/60.)\n", "\n", "min_lat, max_lat = -25, -15\n", "min_lon, max_lon = -45, -35\n", "\n", "mapa = folium.Map(location=[lat, lon], zoom_start=4)\n", "\n", "mapa" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mapa.fit_bounds([[min_lat, min_lon], [max_lat, max_lon]])\n", "\n", "mapa" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Add a feature" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "[[-21.716667, -43.9], [-21.68, -43.33]]" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "folium.Marker([-21.68, -43.33]).add_to(mapa)\n", "folium.Marker([-21.716667, -43.9]).add_to(mapa)\n", "\n", "mapa.get_bounds()" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mapa.fit_bounds(mapa.get_bounds())\n", "mapa" ] } ], "metadata": { "kernelspec": { "display_name": "Iris (Python 2)", "language": "python", "name": "iris_python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.8" } }, "nbformat": 4, "nbformat_minor": 0 }