From 68f00502f36782fda18ff16ca3c4d0bdfddf7cda Mon Sep 17 00:00:00 2001 From: Lars Gusowski Date: Wed, 31 Oct 2018 15:36:21 +0100 Subject: [PATCH] Change URL for Here tiles --- plugins/basemap-nokia-ovi.user.js | 39 +++++++++++++++++++------------ 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/plugins/basemap-nokia-ovi.user.js b/plugins/basemap-nokia-ovi.user.js index 89aadc2b4..17cf6c8fc 100644 --- a/plugins/basemap-nokia-ovi.user.js +++ b/plugins/basemap-nokia-ovi.user.js @@ -26,28 +26,37 @@ window.plugin.mapNokiaOvi = function() {}; window.plugin.mapNokiaOvi.setup = function() { //the list of styles you'd like to see - var oviStyles = { - 'normal.day': { name: "Normal", type: 'png8' }, - 'normal.day.grey': { name: "Normal (grey)", type: 'png8' }, - 'normal.day.transit': { name: "Normal (transit)", type: 'png8' }, - 'satellite.day': { name: "Satellite", type: 'jpg' }, - 'terrain.day': { name: "Terrain", type: 'png8' }, //would jpg be better? - 'normal.night.grey': { name: "Normal Night (grey)", type: 'png8' }, + let oviStyles = { + 'normal.day': { name: "Normal", request: 'base', type: 'png8' }, //Normal Street Map + 'normal.day.grey': { name: "Normal (grey)", request: 'base', type: 'png8' }, //Color-reduced Street Map + 'normal.day.transit': { name: "Normal (transit)", request: 'base', type: 'png8' }, //Color-reduced Transit Map + 'satellite.day': { name: "Satellite", request: 'aerial', type: 'png8' }, //Satellite Map + 'terrain.day': { name: "Terrain", request: 'aerial', type: 'png8' }, //Terrain Map + 'normal.night.grey': { name: "Normal Night (grey)", request: 'base', type: 'png8' }, + 'hybrid.day': { name: "Hybrid", request: 'aerial', type: 'png8' } //Hybrid Map }; - - - var oviOpt = {attribution: 'Imagery © Nokia OVI', maxNativeZoom: 20, maxZoom: 21}; - + + let oviOpt = {attribution: 'Imagery © Here OVI', subdomains: '1234', maxNativeZoom: 20, maxZoom: 21}; + $.each(oviStyles, function(style,data) { + //To get an app_id and an app_code register at https://developer.here.com/ and create your project. + //Afterwards create your JavaScript/REST APP_ID and APP_CODE + //demo IDs are available here: https://developer.here.com/api-explorer/rest/map-tile/map-tile-normal + let id = 'devportal-demo-20180625'; + let code = '9v2BkviRwi9Ot26kp2IysQ'; + oviOpt['style'] = style; + oviOpt['request'] = data.request; oviOpt['type'] = data.type; - var oviMap = new L.TileLayer('http://{s}.maptile.maps.svc.ovi.com/maptiler/maptile/newest/{style}/{z}/{x}/{y}/256/{type}', oviOpt); - layerChooser.addBaseLayer(oviMap, 'Nokia OVI '+data.name); + oviOpt['id'] = id; + oviOpt['code'] = code; + let oviMap = new L.TileLayer('https://{s}.{request}.maps.api.here.com/maptile/2.1/maptile/newest/{style}/{z}/{x}/{y}/256/{type}?app_id={id}&app_code={code}', oviOpt); + layerChooser.addBaseLayer(oviMap, 'Here OVI '+data.name); }); - + }; -var setup = window.plugin.mapNokiaOvi.setup; +let setup = window.plugin.mapNokiaOvi.setup; // PLUGIN END //////////////////////////////////////////////////////////