diff options
author | Iván Ávalos <avalos@disroot.org> | 2021-12-08 00:41:16 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2021-12-08 00:41:16 -0600 |
commit | 6353b5e144fd21ef988abdf04c97e63689f58da4 (patch) | |
tree | c8689a1635f37ab555fc36c7b04b3adbc7eb1b0b /modern | |
parent | fdacbe991e0ccea66ab684a2e119607ad95299ee (diff) | |
download | etbsa-traccar-web-6353b5e144fd21ef988abdf04c97e63689f58da4.tar.gz etbsa-traccar-web-6353b5e144fd21ef988abdf04c97e63689f58da4.tar.bz2 etbsa-traccar-web-6353b5e144fd21ef988abdf04c97e63689f58da4.zip |
Added Google Maps layers
Diffstat (limited to 'modern')
-rw-r--r-- | modern/craco.config.js | 5 | ||||
-rw-r--r-- | modern/src/map/Map.js | 13 | ||||
-rw-r--r-- | modern/src/map/mapStyles.js | 8 |
3 files changed, 17 insertions, 9 deletions
diff --git a/modern/craco.config.js b/modern/craco.config.js index 32971f2..c598595 100644 --- a/modern/craco.config.js +++ b/modern/craco.config.js @@ -1,4 +1,9 @@ module.exports = { + devServer: { + watchOptions: { + ignored: /\.#|node_modules|~$/, + }, + }, webpack: { configure: (webpackConfig) => { const scopePluginIndex = webpackConfig.resolve.plugins.findIndex( diff --git a/modern/src/map/Map.js b/modern/src/map/Map.js index 10630d8..d71a40b 100644 --- a/modern/src/map/Map.js +++ b/modern/src/map/Map.js @@ -8,10 +8,9 @@ import { SwitcherControl } from './switcher/switcher'; import deviceCategories from '../common/deviceCategories'; import { prepareIcon, loadImage } from './mapUtil'; import { - styleCarto, styleLocationIq, styleMapbox, styleMapTiler, styleOsm, + styleLocationIq, styleCarto, styleOsm, styleGmapsStreets, styleGmapsSatellite, styleGmapsHybrid } from './mapStyles'; import { useAttributePreference } from '../common/preferences'; -import palette from '../theme/palette'; import { useTranslation } from '../LocalizationProvider'; const element = document.createElement('div'); @@ -98,15 +97,11 @@ const Map = ({ children }) => { useEffect(() => { switcher.updateStyles([ { id: 'locationIqStreets', title: t('mapLocationIqStreets'), uri: styleLocationIq('streets', locationIqKey) }, - { id: 'locationIqEarth', title: t('mapLocationIqEarth'), uri: styleLocationIq('earth', locationIqKey) }, - { id: 'locationIqHybrid', title: t('mapLocationIqHybrid'), uri: styleLocationIq('hybrid', locationIqKey) }, { id: 'osm', title: t('mapOsm'), uri: styleOsm() }, { id: 'carto', title: t('mapCarto'), uri: styleCarto() }, - { id: 'mapboxStreets', title: t('mapMapboxStreets'), uri: styleMapbox('streets-v11') }, - { id: 'mapboxOutdoors', title: t('mapMapboxOutdoors'), uri: styleMapbox('outdoors-v11') }, - { id: 'mapboxSatellite', title: t('mapMapboxSatellite'), uri: styleMapbox('satellite-v9') }, - { id: 'mapTilerBasic', title: t('mapMapTilerBasic'), uri: styleMapTiler('basic', mapTilerKey) }, - { id: 'mapTilerHybrid', title: t('mapMapTilerHybrid'), uri: styleMapTiler('hybrid', mapTilerKey) }, + { id: 'gmapsStreets', title: t('mapGmapsStreets'), uri: styleGmapsStreets() }, + { id: 'gmapsSatellite', title: t('mapGmapsSatellite'), uri: styleGmapsSatellite() }, + { id: 'gmapsHybrid', title: t('mapGmapsHybrid'), uri: styleGmapsHybrid() }, ], 'locationIqStreets'); }, [mapTilerKey]); diff --git a/modern/src/map/mapStyles.js b/modern/src/map/mapStyles.js index 86813a1..a6e84fd 100644 --- a/modern/src/map/mapStyles.js +++ b/modern/src/map/mapStyles.js @@ -53,3 +53,11 @@ export const styleMapbox = (style) => `mapbox://styles/mapbox/${style}`; export const styleMapTiler = (style, key) => `https://api.maptiler.com/maps/${style}/style.json?key=${key}`; export const styleLocationIq = (style, key) => `https://tiles.locationiq.com/v3/${style}/vector.json?key=${key}`; + +// Google Maps + +export const styleGmapsStreets = () => styleCustom('https://mt0.google.com/vt/lyrs=m&hl=en&x={x}&y={y}&z={z}&s=Ga', ''); + +export const styleGmapsSatellite = () => styleCustom('https://mt0.google.com/vt/lyrs=s&hl=en&x={x}&y={y}&z={z}&s=Ga', ''); + +export const styleGmapsHybrid = () => styleCustom('https://mt0.google.com/vt/lyrs=y&hl=en&x={x}&y={y}&z={z}&s=Ga', ''); |