diff --git a/README.md b/README.md index fdd30d36b88db502503b2fb3ba356b537d138f52..7154c69cfd9bab5653c93075d541107a4e6b2f1d 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ NODE_ENV=development "VUE_APP_DISABLE_LOGIN_BUTTON":false, "VUE_APP_LOGIN_URL":"", + "DEFAULT_BASE_MAP_SCHEMA_TYPE": "tms", "DEFAULT_BASE_MAP_SERVICE": "https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png", "DEFAULT_BASE_MAP_OPTIONS": { "attribution": "© contributeurs d'<a href='https://osm.org/copyright'>OpenStreetMap</a>", diff --git a/public/config/config.json.sample b/public/config/config.json.sample index 1eea174255484f212873d244b115ef343ae52341..f812252eaa1bf46307917f32352c910d81154600 100644 --- a/public/config/config.json.sample +++ b/public/config/config.json.sample @@ -7,13 +7,14 @@ "VUE_APP_APPLICATION_FAVICO":"/geocontrib/img/geo2f.ico", "VUE_APP_APPLICATION_ABSTRACT":"Application de saisie d'informations géographiques contributive", "VUE_APP_LOGO_PATH":"/geocontrib/img/logo-neogeo-circle.png", - "VUE_APP_DJANGO_BASE":"http://localhost", - "VUE_APP_DJANGO_API_BASE":"http://localhost/api/", + "VUE_APP_DJANGO_BASE":"http://localhost:8010", + "VUE_APP_DJANGO_API_BASE":"http://localhost:8010/api/", "VUE_APP_CATALOG_NAME": "Datasud", "VUE_APP_IDGO": true, "VUE_APP_RELOAD_INTERVAL": 15000, "VUE_APP_DISABLE_LOGIN_BUTTON":false, "VUE_APP_LOGIN_URL":"", + "DEFAULT_BASE_MAP_SCHEMA_TYPE": "tms", "DEFAULT_BASE_MAP_SERVICE": "https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png", "DEFAULT_BASE_MAP_OPTIONS": { "attribution": "© contributeurs d'<a href='https://osm.org/copyright'>OpenStreetMap</a>", diff --git a/src/assets/js/map-util.js b/src/assets/js/map-util.js index 4c2434bff8808af4071d7c522c5fc2ff601962a0..5a966b9cd02ebe5ae117ef3be89d24524c2b19ee 100644 --- a/src/assets/js/map-util.js +++ b/src/assets/js/map-util.js @@ -208,13 +208,13 @@ const mapUtil = { }).addTo(map); } }, - addLayers: function (layers, serviceMap, optionsMap) { - if (layers) { + addLayers: function (layers, serviceMap, optionsMap, schemaType) { + if (layers) { //* if admin has defined basemaps for this project layers.forEach((layer) => { if (layer) { - const options = layer.options; - options.noWrap=true; + let options = layer.options; if (options) { + options.noWrap = true; options.opacity = layer.opacity; if (layer.schema_type === 'wms') { @@ -237,9 +237,15 @@ const mapUtil = { } } }); - } else { - optionsMap.noWrap=true; - L.tileLayer(serviceMap, optionsMap).addTo(map); + } else { //* else when no basemaps defined + optionsMap.noWrap = true; + if (schemaType === 'wms') { + L.tileLayer + .wms(serviceMap, optionsMap) + .addTo(map); + } else { + L.tileLayer(serviceMap, optionsMap).addTo(map); + } } }, diff --git a/src/components/map-layers/SidebarLayers.vue b/src/components/map-layers/SidebarLayers.vue index dff38f0550dd138d43fed667f3bdd174e2d604d6..2e9cc9d64c89a85ea6897286b05225b44d926502 100644 --- a/src/components/map-layers/SidebarLayers.vue +++ b/src/components/map-layers/SidebarLayers.vue @@ -172,7 +172,8 @@ export default { mapUtil.addLayers( null, this.$store.state.configuration.DEFAULT_BASE_MAP_SERVICE, - this.$store.state.configuration.DEFAULT_BASE_MAP_OPTIONS + this.$store.state.configuration.DEFAULT_BASE_MAP_OPTIONS, + this.$store.state.configuration.DEFAULT_BASE_MAP_SCHEMA_TYPE ); } setTimeout(this.initSortable.bind(this), 1000); @@ -357,7 +358,7 @@ export default { mapUtil.removeLayers(mapUtil.getMap()); // Reverse is done because the first layer in order has to be added in the map in last. // Slice is done because reverse() changes the original array, so we make a copy first - mapUtil.addLayers(baseMap.layers.slice().reverse(), null, null); + mapUtil.addLayers(baseMap.layers.slice().reverse(), null, null, null,); }, }, }; diff --git a/src/store/modules/map.store.js b/src/store/modules/map.store.js index 766ab39d9e3b08351979b6480ac1d7d9126b9338..9aa4745f03fc7c358801b3973c8de73c1fa4667b 100644 --- a/src/store/modules/map.store.js +++ b/src/store/modules/map.store.js @@ -142,7 +142,8 @@ const map = { mapUtil.addLayers( layersToLoad, this.state.configuration.DEFAULT_BASE_MAP_SERVICE, - this.state.configuration.DEFAULT_BASE_MAP_OPTIONS + this.state.configuration.DEFAULT_BASE_MAP_OPTIONS, + this.state.configuration.DEFAULT_BASE_MAP_SCHEMA_TYPE, ); // Remove multiple interactions with the map diff --git a/src/views/feature/Feature_detail.vue b/src/views/feature/Feature_detail.vue index d78abd48c74527edd342773c22359b4b24a165f3..c20cb72cda4d07e4ce38d6bc4feaf87a428bf1f9 100644 --- a/src/views/feature/Feature_detail.vue +++ b/src/views/feature/Feature_detail.vue @@ -712,7 +712,8 @@ export default { mapUtil.addLayers( layersToLoad, this.$store.state.configuration.DEFAULT_BASE_MAP_SERVICE, - this.$store.state.configuration.DEFAULT_BASE_MAP_OPTIONS + this.$store.state.configuration.DEFAULT_BASE_MAP_OPTIONS, + this.$store.state.configuration.DEFAULT_BASE_MAP_SCHEMA_TYPE, ); mapUtil.getMap().dragging.disable();