Skip to content
Snippets Groups Projects
Commit 19a90348 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[fix] Map: force SSL map services, when using HTTPS

parent 5673ed3e
No related branches found
No related tags found
No related merge requests found
angular.module('cesium.map.utils.services', ['cesium.services', 'ui-leaflet']) angular.module('cesium.map.utils.services', ['cesium.services', 'ui-leaflet'])
.factory('MapUtils', function($timeout, $q, $translate, leafletData, csConfig, csSettings, esGeo, UIUtils, leafletHelpers) { .factory('MapUtils', function($timeout, $q, $translate, $window, leafletData, csConfig, csSettings, esGeo, UIUtils, leafletHelpers) {
'ngInject'; 'ngInject';
var var
googleApiKey = csConfig.plugins && csConfig.plugins.es && csConfig.plugins.es.googleApiKey, googleApiKey = csConfig.plugins && csConfig.plugins.es && csConfig.plugins.es.googleApiKey,
isHttps = ($window.location.protocol === 'https:'),
constants = { constants = {
locations: { locations: {
FRANCE: { FRANCE: {
...@@ -32,20 +33,20 @@ angular.module('cesium.map.utils.services', ['cesium.services', 'ui-leaflet']) ...@@ -32,20 +33,20 @@ angular.module('cesium.map.utils.services', ['cesium.services', 'ui-leaflet'])
osm: { osm: {
name: 'OpenStreetMap', name: 'OpenStreetMap',
type: 'xyz', type: 'xyz',
url: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', url: (isHttps ? 'https' : 'http' ) + '://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
layerOptions: { layerOptions: {
subdomains: ["a", "b", "c"], subdomains: ["a", "b", "c"],
attribution: "&copy; <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>", attribution: "&copy; <a target=\"_blank\" href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",
continuousWorld: true continuousWorld: true
} }
}, },
cycle: { cycle: {
name: "Google map", name: "Google map",
type: "xyz", type: "xyz",
url: 'http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}&key='+googleApiKey, url: (isHttps ? 'https' : 'http' ) + '://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}&key='+googleApiKey,
layerOptions: { layerOptions: {
subdomains: ['mt0','mt1','mt2','mt3'], subdomains: ['mt0','mt1','mt2','mt3'],
attribution: "&copy; <a href=\"http://google.com/copyright\">Google</a>", attribution: "&copy; <a target=\"_blank\" href=\"http://google.com/copyright\">Google</a>",
continuousWorld: true continuousWorld: true
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment