diff options
author | Anton Tananaev <anton@traccar.org> | 2024-06-12 07:39:15 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2024-06-12 07:39:24 -0700 |
commit | c42bb2baac7e66f1fb330ffbf941c1ce09b19737 (patch) | |
tree | da839d4d1cac88c08435e8baf92eb403df8a47b4 /src/map/overlay/useMapOverlays.js | |
parent | 505db06f0d16bb6394fe797e71b20f2a21772b35 (diff) | |
download | trackermap-web-c42bb2baac7e66f1fb330ffbf941c1ce09b19737.tar.gz trackermap-web-c42bb2baac7e66f1fb330ffbf941c1ce09b19737.tar.bz2 trackermap-web-c42bb2baac7e66f1fb330ffbf941c1ce09b19737.zip |
Add Google traffic overlayupstream
Diffstat (limited to 'src/map/overlay/useMapOverlays.js')
-rw-r--r-- | src/map/overlay/useMapOverlays.js | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/map/overlay/useMapOverlays.js b/src/map/overlay/useMapOverlays.js index dafb5f83..18218128 100644 --- a/src/map/overlay/useMapOverlays.js +++ b/src/map/overlay/useMapOverlays.js @@ -17,6 +17,7 @@ const sourceOpenWeather = (style, key) => sourceCustom([ export default () => { const t = useTranslation(); + const googleKey = useAttributePreference('googleKey'); const openWeatherKey = useAttributePreference('openWeatherKey'); const tomTomKey = useAttributePreference('tomTomKey'); const hereKey = useAttributePreference('hereKey'); @@ -24,6 +25,13 @@ export default () => { return useMemo(() => [ { + id: 'googleTraffic', + title: t('mapGoogleTraffic'), + source: sourceCustom([`google://satellite/{z}/{x}/{y}?key=${googleKey}&layerType=layerTraffic&overlay=true`]), + available: Boolean(googleKey), + attribute: 'googleKey', + }, + { id: 'openSeaMap', title: t('mapOpenSeaMap'), source: sourceCustom(['https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png']), @@ -39,49 +47,49 @@ export default () => { id: 'openWeatherClouds', title: t('mapOpenWeatherClouds'), source: sourceOpenWeather('clouds_new', openWeatherKey), - available: !!openWeatherKey, + available: Boolean(openWeatherKey), attribute: 'openWeatherKey', }, { id: 'openWeatherPrecipitation', title: t('mapOpenWeatherPrecipitation'), source: sourceOpenWeather('precipitation_new', openWeatherKey), - available: !!openWeatherKey, + available: Boolean(openWeatherKey), attribute: 'openWeatherKey', }, { id: 'openWeatherPressure', title: t('mapOpenWeatherPressure'), source: sourceOpenWeather('pressure_new', openWeatherKey), - available: !!openWeatherKey, + available: Boolean(openWeatherKey), attribute: 'openWeatherKey', }, { id: 'openWeatherWind', title: t('mapOpenWeatherWind'), source: sourceOpenWeather('wind_new', openWeatherKey), - available: !!openWeatherKey, + available: Boolean(openWeatherKey), attribute: 'openWeatherKey', }, { id: 'openWeatherTemperature', title: t('mapOpenWeatherTemperature'), source: sourceOpenWeather('temp_new', openWeatherKey), - available: !!openWeatherKey, + available: Boolean(openWeatherKey), attribute: 'openWeatherKey', }, { id: 'tomTomFlow', title: t('mapTomTomFlow'), source: sourceCustom([`https://api.tomtom.com/traffic/map/4/tile/flow/absolute/{z}/{x}/{y}.png?key=${tomTomKey}`]), - available: !!tomTomKey, + available: Boolean(tomTomKey), attribute: 'tomTomKey', }, { id: 'tomTomIncidents', title: t('mapTomTomIncidents'), source: sourceCustom([`https://api.tomtom.com/traffic/map/4/tile/incidents/s3/{z}/{x}/{y}.png?key=${tomTomKey}`]), - available: !!tomTomKey, + available: Boolean(tomTomKey), attribute: 'tomTomKey', }, { @@ -90,14 +98,14 @@ export default () => { source: sourceCustom( [1, 2, 3, 4].map((i) => `https://${i}.traffic.maps.ls.hereapi.com/maptile/2.1/flowtile/newest/normal.day/{z}/{x}/{y}/256/png8?apiKey=${hereKey}`), ), - available: !!hereKey, + available: Boolean(hereKey), attribute: 'hereKey', }, { id: 'custom', title: t('mapOverlayCustom'), source: sourceCustom(customMapOverlay), - available: !!customMapOverlay, + available: Boolean(customMapOverlay), }, - ], [t, openWeatherKey, tomTomKey, hereKey, customMapOverlay]); + ], [t, googleKey, openWeatherKey, tomTomKey, hereKey, customMapOverlay]); }; |