Tiles#

Built-in tilesets#

[1]:
import folium


lon, lat = -38.625, -12.875

zoom_start = 8
[2]:
folium.Map(location=[lat, lon], tiles="OpenStreetMap", zoom_start=zoom_start)
[2]:
Make this Notebook Trusted to load map: File -> Trust Notebook
[3]:
folium.Map(location=[lat, lon], tiles="Cartodb Positron", zoom_start=zoom_start)
[3]:
Make this Notebook Trusted to load map: File -> Trust Notebook
[4]:
folium.Map(location=[lat, lon], tiles="Cartodb dark_matter", zoom_start=zoom_start)
[4]:
Make this Notebook Trusted to load map: File -> Trust Notebook

Custom tiles#

[5]:
attr = (
    '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> '
    'contributors, &copy; <a href="https://cartodb.com/attributions">CartoDB</a>'
)
tiles = "https://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}.png"

folium.Map(location=[lat, lon], tiles=tiles, attr=attr, zoom_start=zoom_start)
[5]:
Make this Notebook Trusted to load map: File -> Trust Notebook

Other tilesets#

For a list of many more tile providers go to https://leaflet-extras.github.io/leaflet-providers/preview/.

You can also use the xyzservices package: geopandas/xyzservices.