Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Google Hybrid, Esri Satellite, and HERE Hybrid base layers #11

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
5 changes: 5 additions & 0 deletions dist/css/worldmap.dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
filter: brightness(1.6) grayscale(1) contrast(1);
}

.map-desaturate img.leaflet-tile {
-webkit-filter: brightness(1.2) grayscale(0.4) contrast(1);
filter: brightness(1.2) grayscale(0.4) contrast(1);
}

.worldmap-popup .leaflet-popup-content-wrapper, .worldmap-popup .leaflet-popup-tip {
background-color: #333;
}
Expand Down
4 changes: 2 additions & 2 deletions dist/module.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/module.js.map

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/css/worldmap.dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
filter: brightness(1.6) grayscale(1) contrast(1);
}

.map-desaturate img.leaflet-tile {
-webkit-filter: brightness(1.2) grayscale(0.4) contrast(1);
filter: brightness(1.2) grayscale(0.4) contrast(1);
}

.worldmap-popup .leaflet-popup-content-wrapper, .worldmap-popup .leaflet-popup-tip {
background-color: #333;
}
Expand Down
17 changes: 16 additions & 1 deletion src/worldmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@ const tileServers = {
'&copy; <a href="http://cartodb.com/attributions">CartoDB</a>',
subdomains: 'abcd',
},
'Google Hybrid': {
url: 'http://{s}.google.com/vt/lyrs=s,h&x={x}&y={y}&z={z}',
attribution: 'Tiles &copy; Google',
subdomains: ['mt0','mt1','mt2','mt3'],
},
'Esri Satellite': {
url: 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
attribution: 'Tiles &copy; Esri',
subdomains: 'abcd',
},
'HERE Hybrid': {
url: 'https://{s}.aerial.maps.cit.api.here.com/maptile/2.1/maptile/newest/hybrid.day/{z}/{x}/{y}/256/png8?app_id=<app_id>&app_code=<app_code>&lg=eng',
attribution: 'Map &copy; 1987-2014 <a href="http://developer.here.com">HERE</a>',
subdomains: '1234',
},
};

export default class WorldMap {
Expand Down Expand Up @@ -55,7 +70,7 @@ export default class WorldMap {

const selectedTileServer = tileServers[this.ctrl.tileServer];
(<any>window).L.tileLayer(selectedTileServer.url, {
maxZoom: 18,
maxZoom: 20,
subdomains: selectedTileServer.subdomains,
reuseTiles: true,
detectRetina: true,
Expand Down
8 changes: 5 additions & 3 deletions src/worldmap_ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,7 @@ export default class WorldmapCtrl extends MetricsPanelCtrl {
/*
* Configure the Leaflet map widget.
*/
this.tileServer = contextSrv.user.lightTheme
? "CartoDB Positron"
: "CartoDB Dark";
this.tileServer = 'Google Hybrid';
this.setMapSaturationClass();
}

Expand All @@ -197,6 +195,10 @@ export default class WorldmapCtrl extends MetricsPanelCtrl {
*/
if (this.tileServer === "CartoDB Dark") {
this.saturationClass = "map-darken";
} else if (this.tileServer === "Esri Satellite") {
this.saturationClass = "map-desaturate";
} else if (this.tileServer === "Google Hybrid") {
this.saturationClass = "";
} else {
this.saturationClass = "";
}
Expand Down