#!/usr/bin/env python # coding: utf-8 # In[1]: import os import folium print(folium.__version__) # In[2]: lon, lat = -38.625, -12.875 zoom_start = 8 # In[3]: m = folium.Map(location=[lat, lon], tiles='OpenStreetMap', zoom_start=zoom_start) m.save(os.path.join('results', 'TilesExample_0.html')) m # In[4]: m = folium.Map(location=[lat, lon], tiles='Mapbox Bright', zoom_start=zoom_start) m.save(os.path.join('results', 'TilesExample_1.html')) m # In[5]: m = folium.Map(location=[lat, lon], tiles='Mapbox Control Room', zoom_start=zoom_start) m.save(os.path.join('results', 'TilesExample_2.html')) m # In[6]: m = folium.Map(location=[lat, lon], tiles='Stamen Terrain', zoom_start=zoom_start) m.save(os.path.join('results', 'TilesExample_3.html')) m # In[7]: m = folium.Map(location=[lat, lon], tiles='Stamen Toner', zoom_start=zoom_start) m.save(os.path.join('results', 'TilesExample_4.html')) m # In[8]: m = folium.Map(location=[lat, lon], tiles='Stamen Watercolor', zoom_start=zoom_start) m.save(os.path.join('results', 'TilesExample_5.html')) m # In[9]: m = folium.Map(location=[lat, lon], tiles='Cartodb Positron', zoom_start=zoom_start) m.save(os.path.join('results', 'TilesExample_6.html')) m # In[10]: m = folium.Map(location=[lat, lon], tiles='Cartodb dark_matter', zoom_start=zoom_start) m.save(os.path.join('results', 'TilesExample_7.html')) m # ### Custom tiles # In[11]: attr = ('© OpenStreetMap ' 'contributors, © CartoDB') tiles = 'http://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}.png' m = folium.Map(location=[lat, lon], tiles=tiles, attr=attr, zoom_start=zoom_start) m.save(os.path.join('results', 'TilesExample_8.html')) m # ### There are plenty tile sources to choose from: # In[12]: from IPython.display import IFrame IFrame('http://leaflet-extras.github.io/leaflet-providers/preview/', width=900, height=750)