aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map/overlay/useMapOverlays.js
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/map/overlay/useMapOverlays.js')
-rw-r--r--modern/src/map/overlay/useMapOverlays.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/modern/src/map/overlay/useMapOverlays.js b/modern/src/map/overlay/useMapOverlays.js
index 1a917ba2..94baab3e 100644
--- a/modern/src/map/overlay/useMapOverlays.js
+++ b/modern/src/map/overlay/useMapOverlays.js
@@ -8,6 +8,10 @@ const sourceCustom = (urls) => ({
tileSize: 256,
});
+const sourceOpenWeather = (style, key) => sourceCustom([
+ `https://tile.openweathermap.org/map/${style}/{z}/{x}/{y}.png?appid=${key}`,
+]);
+
export default () => {
const t = useTranslation();
@@ -24,35 +28,35 @@ export default () => {
{
id: 'openWeatherClouds',
title: t('mapOpenWeatherClouds'),
- source: sourceCustom([`https://tile.openweathermap.org/map/clouds_new/{z}/{x}/{y}.png?appid=${openWeatherKey}`]),
+ source: sourceOpenWeather('clouds_new', 'openWeatherKey'),
available: !!openWeatherKey,
attribute: 'openWeatherKey',
},
{
id: 'openWeatherPrecipitation',
title: t('mapOpenWeatherPrecipitation'),
- source: sourceCustom([`https://tile.openweathermap.org/map/precipitation_new/{z}/{x}/{y}.png?appid=${openWeatherKey}`]),
+ source: sourceOpenWeather('precipitation_new', 'openWeatherKey'),
available: !!openWeatherKey,
attribute: 'openWeatherKey',
},
{
id: 'openWeatherPressure',
title: t('mapOpenWeatherPressure'),
- source: sourceCustom([`https://tile.openweathermap.org/map/pressure_new/{z}/{x}/{y}.png?appid=${openWeatherKey}`]),
+ source: sourceOpenWeather('pressure_new', 'openWeatherKey'),
available: !!openWeatherKey,
attribute: 'openWeatherKey',
},
{
id: 'openWeatherWind',
title: t('mapOpenWeatherWind'),
- source: sourceCustom([`https://tile.openweathermap.org/map/wind_new/{z}/{x}/{y}.png?appid=${openWeatherKey}`]),
+ source: sourceOpenWeather('wind_new', 'openWeatherKey'),
available: !!openWeatherKey,
attribute: 'openWeatherKey',
},
{
id: 'openWeatherTemperature',
title: t('mapOpenWeatherTemperature'),
- source: sourceCustom([`https://tile.openweathermap.org/map/temp_new/{z}/{x}/{y}.png?appid=${openWeatherKey}`]),
+ source: sourceOpenWeather('temp_new', 'openWeatherKey'),
available: !!openWeatherKey,
attribute: 'openWeatherKey',
},