Display TomTom map with folium

725 Views Asked by At

I am starting data scientist and I am doing a benchmark for maps. I would like to visualize the TomTom map API in Jupyter notebook with folium to compare it with OpenStreetMap. Openstreet map is supported by folium so that is easy. This code is doing the trick:

import folium 

OSM_map = folium.Map(location=[45.523, -122.675],
                    zoom_start=13,
                    tiles="OpenStreetMap")

Now, I would like to do the same with the TomTom maps API. On developer.tomtom.com I find that this is the request URL:

https://api.tomtom.com/map/1/tile/basic/main/0/0/0.png?view=Unified&key=*****

So I thought to implement this in folium. I don't get an error message but it is just displaying a gray map.

TomTom_map = folium.Map(
   location=[45.523, -122.675],
   zoom_start=10,
   tiles='http://{s}.api.tomtom.com/map/1/tile/basic/main/{z}/{x}/{y}.png',
   API_key = 'xxxxxx',
   attr='TomTom')

I follow literally the example of the folium documentation but it does not work. Anyone knows how to solve this? That would be great :). Cheers.

1

There are 1 best solutions below

0
On

Thanks Bob and szogoon,

It works now! I replaced the code with:

import folium 

TomTom_map = folium.Map(
    location=[45.523, -122.675],
    zoom_start=10,
    tiles= 'http://{s}.api.tomtom.com/map/1/tile/basic/main/{z}/{x}/{y}.png? 
    view=Unified&key=********',
    attr='TomTom')