Folium Map Tiles

By | June 10, 2016

Using different map tiles can be a great way to change or improve the look of your map. This post shows you how to access Folium map tiles and switch between them.

Folium Map Tiles Basic Code

The basic code for changing the map tiles used by folium is to first add a specified tile layer to the map (in this case “my_map”).

You can also add a control for switching between layers with the “LayerControl()” method.

folium.TileLayer('openstreetmap').add_to(my_map)
# other mapping code (e.g. lines, markers etc.)
folium.LayerControl().add_to(my_map)

Folium Map Tiles Examples

Here are a some examples of the free Folium map tiles that work “out of the box”.

Open street map

Folium defaults to using openstreetmap tiles. You can also access these tiles with:

folium.TileLayer('openstreetmap').add_to(my_map)

Folium Map Tiles - open street map

Map Quest Open

Similar to open street map, mapquestopen tiles are a good general purpose tile set.

folium.TileLayer('mapquestopen').add_to(my_map)

Folium Map Tiles - mapquestopen

MapQuest Open Aerial

Mapquest also provides open aerial photography to use as map tiles:

folium.TileLayer('MapQuest Open Aerial').add_to(my_map)

Folium Map Tiles - mapquest open aerial

Mapbox Bright

Mapbox makes some nice map tiles, but the free versions only have limited levels of zoom available (i.e. you can’t zoom close in).

folium.TileLayer('Mapbox Bright').add_to(my_map)

Folium Map Tiles - mapbox bright

Mapbox Control Room

Control Room is another set of MapBox tiles. Again there are only limited levels of zoom available for the free version, but they do look cool.

folium.TileLayer('Mapbox Control Room').add_to(my_map)

Folium Map Tiles - mapboxcontrolroom

 

Stamen Terrain

Stamen also produce some cool map tiles which typically work at all zoom levels. These terrain tiles are only available for the USA unfortunately.

folium.TileLayer('stamenterrain').add_to(my_map)

Folium Map Tiles - stamenterrain

Stamen Toner

The Stamen toner map tiles produce a black and white map that both looks striking and would be more suitable for printing than some of the other Folium map tiles.

folium.TileLayer('stamentoner').add_to(my_map)

Folium Map Tiles - stamentoner

Stamen Watercolor

To be honest I’m not sure where the Stamen Watercolor map tiles would be useful, but they look very cool.

folium.TileLayer('stamenwatercolor').add_to(my_map)

Folium Map Tiles - stamen_watercolor

CartoDB Positron

The CartoDB folium map tiles are cool looking tiles and are available in the lighter “positron”, or “dark matter” (below)

folium.TileLayer('cartodbpositron').add_to(my_map)

Folium Map Tiles - cartodbpositron

CartoDB Dark Matter

The CartoDB Dark Matter tiles are essentially a darker version of the above positron tiles.

folium.TileLayer('cartodbdark_matter').add_to(my_map)

Folium Map Tiles - cartodbdark_matter