{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import folium\n", "\n", "\n", "lon, lat = -38.625, -12.875\n", "\n", "zoom_start = 8" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Make this Notebook Trusted to load map: File -> Trust Notebook
" ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m = folium.Map(location=[lat, lon], tiles=\"OpenStreetMap\", zoom_start=zoom_start)\n", "\n", "m" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Make this Notebook Trusted to load map: File -> Trust Notebook
" ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m = folium.Map(location=[lat, lon], tiles=\"Stamen Terrain\", zoom_start=zoom_start)\n", "\n", "m" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Make this Notebook Trusted to load map: File -> Trust Notebook
" ], "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m = folium.Map(location=[lat, lon], tiles=\"Stamen Toner\", zoom_start=zoom_start)\n", "\n", "m" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Make this Notebook Trusted to load map: File -> Trust Notebook
" ], "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m = folium.Map(location=[lat, lon], tiles=\"Stamen Watercolor\", zoom_start=zoom_start)\n", "\n", "m" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Make this Notebook Trusted to load map: File -> Trust Notebook
" ], "text/plain": [ "" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m = folium.Map(location=[lat, lon], tiles=\"Cartodb Positron\", zoom_start=zoom_start)\n", "\n", "m" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Make this Notebook Trusted to load map: File -> Trust Notebook
" ], "text/plain": [ "" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m = folium.Map(location=[lat, lon], tiles=\"Cartodb dark_matter\", zoom_start=zoom_start)\n", "\n", "m" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Custom tiles" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Make this Notebook Trusted to load map: File -> Trust Notebook
" ], "text/plain": [ "" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "attr = (\n", " '© OpenStreetMap '\n", " 'contributors, © CartoDB'\n", ")\n", "tiles = \"http://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}.png\"\n", "\n", "m = folium.Map(location=[lat, lon], tiles=tiles, attr=attr, zoom_start=zoom_start)\n", "\n", "m" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### There are plenty tile sources to choose from" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For a list of many more tile providers go to http://leaflet-extras.github.io/leaflet-providers/preview/" ] } ], "metadata": { "anaconda-cloud": {}, "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.9.0" } }, "nbformat": 4, "nbformat_minor": 1 }