From c17480d6d00800d58ccb76a1408ea9623c040ee5 Mon Sep 17 00:00:00 2001 From: Daniel Berry Date: Thu, 24 Dec 2015 01:20:40 -0700 Subject: [PATCH] Added ability to customize the OSM url --- src/common/map/MapService.js | 13 ++++++++++++- src/common/utils/Globals.js | 6 +++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/common/map/MapService.js b/src/common/map/MapService.js index 713f06c9..59a48b12 100644 --- a/src/common/map/MapService.js +++ b/src/common/map/MapService.js @@ -550,6 +550,17 @@ }); } else { if (server.ptype === 'gxp_osmsource') { + var osmLocal = { + attributions: [ + new ol.Attribution({ + html: settings.OsmLocalAttribution + }), + ol.source.OSM.ATTRIBUTION + ], + crossOrigin: null, + url: settings.OsmLocalUrl + }; + var osmSource = (settings.OsmLocalUrl !== 'default') ? osmLocal : ''; layer = new ol.layer.Tile({ metadata: { serverId: server.id, @@ -557,7 +568,7 @@ title: fullConfig.Title }, visible: minimalConfig.visibility, - source: new ol.source.OSM() + source: new ol.source.OSM(osmSource) }); } else if (server.ptype === 'gxp_bingsource') { diff --git a/src/common/utils/Globals.js b/src/common/utils/Globals.js index ba11299d..6900f509 100644 --- a/src/common/utils/Globals.js +++ b/src/common/utils/Globals.js @@ -9,7 +9,11 @@ var settings = { DDPrecision: 8, WFSVersion: '1.1.0', WMSVersion: '1.1.1', - WPSVersion: '1.0.0' + WPSVersion: '1.0.0', + //Set to OsmLocalUrl to 'default' for default mapnick osm basemap + OsmLocalUrl: 'default', + //OsmLocalUrl: 'http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png', + OsmLocalAttribution: 'All maps © OpenCycleMap' }; var forEachArrayish = function(arrayish, funct) {