aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2021-12-08 00:41:16 -0600
committerIván Ávalos <avalos@disroot.org>2021-12-08 00:41:16 -0600
commit6353b5e144fd21ef988abdf04c97e63689f58da4 (patch)
treec8689a1635f37ab555fc36c7b04b3adbc7eb1b0b
parentfdacbe991e0ccea66ab684a2e119607ad95299ee (diff)
downloadetbsa-traccar-web-6353b5e144fd21ef988abdf04c97e63689f58da4.tar.gz
etbsa-traccar-web-6353b5e144fd21ef988abdf04c97e63689f58da4.tar.bz2
etbsa-traccar-web-6353b5e144fd21ef988abdf04c97e63689f58da4.zip
Added Google Maps layers
-rw-r--r--modern/craco.config.js5
-rw-r--r--modern/src/map/Map.js13
-rw-r--r--modern/src/map/mapStyles.js8
-rw-r--r--web/l10n/en.json3
-rw-r--r--web/l10n/es.json6
5 files changed, 26 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', '');
diff --git a/web/l10n/en.json b/web/l10n/en.json
index ff5f61a..34585d2 100644
--- a/web/l10n/en.json
+++ b/web/l10n/en.json
@@ -249,6 +249,9 @@
"mapCustomLabel": "Custom map",
"mapCarto": "Carto Basemaps",
"mapOsm": "Open Street Map",
+ "mapGmapsStreets": "Google Maps Streets",
+ "mapGmapsSatellite": "Google Maps Satellite",
+ "mapGmapsHybrid": "Google Maps Hybrid",
"mapBingKey": "Bing Maps Key",
"mapBingRoad": "Bing Maps Road",
"mapBingAerial": "Bing Maps Aerial",
diff --git a/web/l10n/es.json b/web/l10n/es.json
index fb93dc8..d981c73 100644
--- a/web/l10n/es.json
+++ b/web/l10n/es.json
@@ -247,8 +247,14 @@
"mapCustom": "Personalizado (XYZ)",
"mapCustomArcgis": "ArcGIS Personalizado",
"mapCustomLabel": "Mapa Personalizado",
+ "mapLocationIqStreets": "LocationIQ Calles",
+ "mapLocationIqEarth": "LocationIQ Satélite",
+ "mapLocationIqHybrid": "LocationIQ Híbrido",
"mapCarto": "Mapas base Carto",
"mapOsm": "Open Street Map",
+ "mapGmapsStreets": "Google Maps Calles",
+ "mapGmapsSatellite": "Google Maps Satélite",
+ "mapGmapsHybrid": "Google Maps Híbrido",
"mapBingKey": "Bing Maps Key",
"mapBingRoad": "Bing Maps - Carretera",
"mapBingAerial": "Bing Maps - Aéreo",