{ "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": [], "source": [ "import numpy as np\n", "\n", "size = 1000\n", "lons = np.random.random_integers(-180, 180, size=size)\n", "lats = np.random.random_integers(-90, 90, size=size)\n", "\n", "locations = list(zip(lons, lats))\n", "popups = ['{}'.format(loc) for loc in locations]" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from folium.plugins import MarkerCluster\n", "\n", "mapa = folium.Map(location=[np.mean(lats), np.mean(lons)],\n", " tiles='Cartodb Positron', zoom_start=1)\n", "\n", "mapa.add_children(MarkerCluster(locations=locations, popups=popups))\n", "\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 }