0

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.

Sandy_4242
  • 57
  • 1
  • 7
  • 2
    I haven't used a custom tileset before, but you could try to pass the API key in the tiles arg e.g. `tiles='http://{s}.api.tomtom.com/map/1/tile/basic/main/{z}/{x}/{y}.png?view=Unified&key=*****'` Also, you would omit the `API_key` arg in this scenario – Bob Haffner Nov 21 '18 at 16:46
  • I agree with Bob. Cloudmade API key's parameter name is **apikey** and for TomTom it is **key**. – szogoon Nov 22 '18 at 08:37
  • Thanks guys, this is doing the trick! :) – Sandy_4242 Nov 22 '18 at 10:45
  • Good deal. I'll have to explore the custom tileset options soon – Bob Haffner Nov 22 '18 at 17:19

1 Answers1

2

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')
Sandy_4242
  • 57
  • 1
  • 7