4

I currently am developing a map that uses the following code to set the map background:

//set the map background
L.tileLayer('http://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}.png', {
    attribution: 'http://www.thunderforest.com/'
}).addTo(map);

I have signed up for a Nokia HERE account so that I can use their transit map. I have an APP ID and APP CODE.

According to their instructions, (which I have also included below), I need to do a few steps before I can use their maps.

Can someone help me translate their steps into the what I need to do?

// Create a Platform object (one per application):
var platform = new H.service.Platform({ 'app_id': '{YOUR_APP_ID}',
    'app_code': '{YOUR_APP_CODE}' });

// Get an object containing the default map layers:
var defaultLayers = platform.createDefaultLayers();

// Instantiate the map using the normal map as the base layer:
var map = new H.Map(document.getElementById('mapContainer',
  defaultLayers.normal.map);

// Change the map base layer to the satellite map with traffic information:
map.setBaseLayer(defaultLayers.satellite.traffic);
1
+50

You can still use the L.tileLayer with CartoDB.js/Leaflet map object, just switch it's url param to a Nokia xyz url. Nokia has examples here including Transit Day, notice that your app id & code are appended to the url: https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/examples-base.html

3
0

I think you need to write the parameters of the URL without {}, something like:

?app_id=JPRO.....iUY&app_code=PdZ.....x-og

Also, sharing your credentials here is not a very safe practice :)

In any case, the following works loading a CartoDB basemap and overlying a Nokia transit layer:

L.tileLayer('http://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}.png', 
    {attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://cartodb.com/attributions">CartoDB</a>'
  }).addTo(map,0);

L.tileLayer('https://1.traffic.maps.cit.api.here.com/maptile/2.1/flowtile/newest/normal.day/{z}/{x}/{y}/256/png8?app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg', 
    {}).addTo(map,1);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.