Skip to content

Commit

Permalink
Merge pull request #787 from geoadmin/develop
Browse files Browse the repository at this point in the history
New Release v1.14.0 - #minor
  • Loading branch information
ltshb authored Apr 17, 2024
2 parents 967aa8b + 85260e9 commit 19e4d1f
Show file tree
Hide file tree
Showing 143 changed files with 4,794 additions and 3,098 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.18
v18
22 changes: 12 additions & 10 deletions adr/2021_03_16_url_param_structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
> Date: 16.03.2021
> Updated: 17.11.2023
> Updated: 10.04.2024
## Context

Expand Down Expand Up @@ -95,17 +95,19 @@ The layer ID of the external Layers are in the following format (note that only

- an external WMS: `WMS|GET_CAP_BASE_URL|LAYER_ID`
- The WMS version is taken from the Get Capabilities
- an external group of WMS layer : `WMS|GET_CAP_BASE_URL|LAYER_ID`
- We don't differentiate between group of layers and regular WMS layer in the URL. This differentiation was neither done in the legacy viewer.
- an external WMTS: `WMTS|GET_CAP_BASE_URL|LAYER_ID`
- The WMTS version is taken from the Get Capabilities
- an external KML: `KML|URL|TITLE`
- TITLE is optional and used as display in the active layers, if omitted then it will be displayed as `KML`
- a geoadmin KML: `KML|URL|TITLE`
- TITLE is set to `Drawing` upon drawing creation and in the current language at that time
- a geoadmin KML with adminId: `KML|URL|TITLE@adminId=ADMIN_ID`
- an external GPX: `GPX|GPX|TITLE`
- TITLE is optional and used as display in the active layers, if omitted then it will be displayed as `GPX`
- an external KMZ: `KMZ|KMZ|TITLE` (needs to pass by proxy to be unzipped)
- TITLE is optional and used as display in the active layers, if omitted then it will be displayed as `KMZ`
- an external KML: `KML|URL`
- The title is read from the metadata
- a geoadmin KML: `KML|URL`
- The title is read from the metadata
- a geoadmin KML with adminId: `KML|URL@adminId=ADMIN_ID`
- The title is read from the metadata
- an external GPX: `GPX|URL`
- The title is read from the metadata
- an external KMZ: `KMZ|URL` (needs to pass by proxy to be unzipped)

## Consequences

Expand Down
1,147 changes: 640 additions & 507 deletions package-lock.json

Large diffs are not rendered by default.

52 changes: 26 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
"delete:reports:unit": "rimraf tests/results/unit/ || true"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-brands-svg-icons": "^6.5.1",
"@fortawesome/free-regular-svg-icons": "^6.5.1",
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@fortawesome/fontawesome-svg-core": "^6.5.2",
"@fortawesome/free-brands-svg-icons": "^6.5.2",
"@fortawesome/free-regular-svg-icons": "^6.5.2",
"@fortawesome/free-solid-svg-icons": "^6.5.2",
"@fortawesome/vue-fontawesome": "^3.0.6",
"@geoblocks/cesium-compass": "^0.5.0",
"@geoblocks/mapfishprint": "github:geoblocks/mapfishprint#4c47539f391af3c641f9455efe0d31ebdc145cfe",
"@geoblocks/mapfishprint": "^0.2.11",
"@geoblocks/ol-maplibre-layer": "^0.1.3",
"@ivanv/vue-collapse-transition": "^1.0.2",
"@mapbox/togeojson": "^0.16.2",
Expand All @@ -56,62 +56,62 @@
"@turf/nearest-point": "^6.5.0",
"@turf/point-to-line-distance": "^6.5.0",
"animate.css": "^4.1.1",
"axios": "^1.6.7",
"axios": "^1.6.8",
"bootstrap": "^5.3.3",
"cesium": "^1.115.0",
"cesium": "^1.116.0",
"chart.js": "^4.4.2",
"chartjs-plugin-zoom": "^2.0.1",
"dompurify": "^3.0.9",
"dompurify": "^3.0.11",
"file-saver": "^2.0.5",
"form-data": "^4.0.0",
"geographiclib-geodesic": "^2.0.0",
"hammerjs": "^2.0.8",
"jquery": "^3.7.1",
"liang-barsky": "^1.0.5",
"maplibre-gl": "^4.1.0",
"ol": "^9.0.0",
"maplibre-gl": "^4.1.2",
"ol": "^9.1.0",
"pako": "^2.1.0",
"print-js": "^1.6.0",
"proj4": "^2.10.0",
"proj4": "^2.11.0",
"reproject": "^1.2.7",
"sortablejs": "^1.15.2",
"tippy.js": "^6.3.7",
"vue": "^3.4.21",
"vue-chartjs": "^5.3.0",
"vue-i18n": "^9.10.1",
"vue-i18n": "^9.11.0",
"vue-router": "^4.3.0",
"vue-social-sharing": "next",
"vue-social-sharing": "^4.0.0-alpha4",
"vuex": "^4.1.0"
},
"devDependencies": {
"@4tw/cypress-drag-drop": "^2.2.5",
"@cypress/vite-dev-server": "^5.0.7",
"@cypress/vue": "^6.0.0",
"@nuintun/qrcode": "^3.4.0",
"@prettier/plugin-xml": "^3.3.1",
"@rushstack/eslint-patch": "^1.7.2",
"@prettier/plugin-xml": "^3.4.1",
"@rushstack/eslint-patch": "^1.10.1",
"@types/jsdom": "^21.1.6",
"@types/node": "^18.19.21",
"@types/node": "^18.19.29",
"@vitejs/plugin-vue": "^5.0.4",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^12.0.0",
"@vue/tsconfig": "^0.5.1",
"axios-retry": "^4.0.0",
"axios-retry": "^4.1.0",
"chai": "^5.1.0",
"cypress": "^13.6.6",
"cypress": "^13.7.2",
"cypress-browser-permissions": "^1.1.0",
"cypress-real-events": "^1.12.0",
"cypress-recurse": "^1.35.2",
"cypress-recurse": "^1.35.3",
"cypress-vite": "^1.5.0",
"cypress-wait-until": "^3.0.1",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
"eslint-plugin-cypress": "^2.15.1",
"eslint-plugin-markdownlint": "^0.5.0",
"eslint-plugin-mocha": "^10.3.0",
"eslint-plugin-mocha": "^10.4.1",
"eslint-plugin-prettier-vue": "^5.0.0",
"eslint-plugin-simple-import-sort": "^12.0.0",
"eslint-plugin-vue": "^9.22.0",
"eslint-plugin-vue": "^9.24.0",
"git-describe": "^4.1.1",
"googleapis": "^133.0.0",
"jsdom": "^24.0.0",
Expand All @@ -120,20 +120,20 @@
"prettier": "^3.2.5",
"prettier-plugin-jsdoc": "^1.3.0",
"rimraf": "^5.0.5",
"sass": "^1.71.1",
"sass": "^1.74.1",
"start-server-and-test": "^2.0.3",
"typescript": "^5.3.3",
"vite": "^5.2.2",
"typescript": "^5.4.4",
"vite": "^5.2.8",
"vite-node": "^1.4.0",
"vite-plugin-static-copy": "^1.0.1",
"vite-plugin-static-copy": "^1.0.2",
"vitest": "^1.4.0",
"vue-tsc": "^1.8.27",
"write-yaml-file": "^5.0.0",
"yargs": "^17.7.2"
},
"engines": {
"node": ">=18",
"npm": "9.*.*"
"npm": "10.*.*"
},
"type": "module",
"engineStrict": true
Expand Down
5 changes: 1 addition & 4 deletions src/api/features/LayerFeature.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ export default class LayerFeature extends SelectableFeature {
super({
id,
coordinates,
// using the layer name as title (so that user can differentiate the source)
title: layer.name,
// and the name as description (so that we do not lose track of this data)
description: name,
title: name,
extent,
geometry,
isEditable: false,
Expand Down
4 changes: 3 additions & 1 deletion src/api/features/SelectableFeature.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export default class SelectableFeature extends EventEmitter {
} = featureData
this.id = id
// using the setter for coordinate (see below)
this.coordinates = coordinates

// if coordinates are not defined, we set them to null
this.coordinates = coordinates ? coordinates : null
this.title = title
this.description = description
this.geometry = geometry
Expand Down
18 changes: 15 additions & 3 deletions src/api/features/features.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,13 +294,13 @@ async function identifyOnExternalWmsLayer(config) {
SERVICE: 'WMS',
VERSION: layer.wmsVersion ?? '1.3.0',
REQUEST: 'GetFeatureInfo',
LAYERS: layer.externalLayerId,
LAYERS: layer.id,
STYLES: null,
CRS: projection.epsg,
BBOX: requestExtent.join(','),
WIDTH: GET_FEATURE_INFO_FAKE_VIEWPORT_SIZE,
HEIGHT: GET_FEATURE_INFO_FAKE_VIEWPORT_SIZE,
QUERY_LAYERS: layer.externalLayerId,
QUERY_LAYERS: layer.id,
INFO_FORMAT: outputFormat,
FEATURE_COUNT: featureCount,
LANG: lang,
Expand Down Expand Up @@ -369,6 +369,7 @@ async function identifyOnExternalWmsLayer(config) {
return new LayerFeature({
layer,
id: feature.id,
name: feature.title ?? feature.name ?? feature.id,
data: feature.properties,
coordinates: getGeoJsonFeatureCoordinates(
geometry,
Expand Down Expand Up @@ -521,7 +522,18 @@ const getFeature = (layer, featureID, outputProjection, lang = 'en') => {
if (featureMetadata.bbox) {
featureExtent.push(...featureMetadata.bbox)
}
const featureName = featureMetadata?.properties?.name
let featureName = featureID
if (featureMetadata.properties) {
const { name = null, title = null } = featureMetadata.properties
const titleInCurrentLang = featureMetadata.properties[`title_${lang}`]
if (name) {
featureName = name
} else if (title) {
featureName = title
} else if (titleInCurrentLang) {
featureName = titleInCurrentLang
}
}

if (outputProjection.epsg !== LV95.epsg) {
if (featureExtent.length === 4) {
Expand Down
25 changes: 8 additions & 17 deletions src/api/feedback.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,16 @@ import { API_SERVICES_BASE_URL, APP_VERSION } from '@/config'
import log from '@/utils/logging'

/**
* @param {String} subject Mandatory
* @param {String} text Mandatory
* @param {Number} rating Optional
* @param {Number} maxRating Optional
* @param {String} kmlFileUrl Optional
* @param {String} email Optional
* @param {String | null} [options.kmlFileUrl=null] Default is `null`
* @param {String | null} [options.email=null] Default is `null`
* @param {File | null} [options.attachment=null] Default is `null`
* @returns {Promise<Boolean>} True if successful, false otherwise
*/
export default async function sendFeedback(
text,
rating = null,
maxRating = null,
kmlFileUrl = null,
email = null
) {
export default async function sendFeedback(subject, text, options) {
const { kmlFileUrl = null, email = null, attachment = null } = options

try {
let shortLink = null
try {
Expand Down Expand Up @@ -47,12 +43,6 @@ export default async function sendFeedback(
}
}

let subject = '[web-mapviewer]'
if (rating && maxRating) {
subject += ` [rating: ${rating}/${maxRating}]`
}
subject += ' User feedback'

const data = {
subject,
feedback: text,
Expand All @@ -61,6 +51,7 @@ export default async function sendFeedback(
permalink: shortLink,
kml,
email,
attachment,
}
log.debug('sending feedback with', data)
const response = await axios.post(`${API_SERVICES_BASE_URL}feedback`, data, {
Expand Down
11 changes: 3 additions & 8 deletions src/api/layers/ExternalGroupOfLayers.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ import LayerTypes from '@/api/layers/LayerTypes.enum'
*/
export default class ExternalGroupOfLayers extends ExternalLayer {
/**
* @param {String} externalLayerData.id Layer ID of the group to be found in GetCapabilities
* @param {String} externalLayerData.name Name of this layer to be shown to the user
* @param {number} [externalLayerData.opacity=1.0] The opacity of this layer, between 0.0
* (transparent) and 1.0 (opaque). Default is `1.0`
* @param {boolean} [externalLayerData.visible=true] If the layer should be shown on the map.
* Default is `true`
* @param {String} externalLayerData.baseUrl GetCapabilities base URL
* @param {String} externalLayerData.externalLayerId Layer ID of the group to be found in
* GetCapabilities
* @param {ExternalLayer[]} externalLayerData.layers Description of the layers being part of
* this group (they will all be displayed at the same time, in contrast to an aggregate
* layer)
Expand All @@ -53,11 +52,11 @@ export default class ExternalGroupOfLayers extends ExternalLayer {
throw new InvalidLayerDataError('Missing external layer data', externalLayerData)
}
const {
id = null,
name = null,
opacity = 1.0,
visible = true,
baseUrl = null,
externalLayerId = null,
layers = [],
attributions = null,
abstract = '',
Expand All @@ -74,13 +73,9 @@ export default class ExternalGroupOfLayers extends ExternalLayer {
)
}
super({
id,
name,
// format coming from https://github.com/geoadmin/web-mapviewer/blob/develop/adr/2021_03_16_url_param_structure.md
// NOTE we don't differentiate between group of layers and regular WMS layer. This differentiation was not
// done the legacy parameter and is not required.
id: `WMS|${baseUrl}|${externalLayerId}`,
type: LayerTypes.GROUP,
externalLayerId,
baseUrl,
opacity,
visible,
Expand Down
8 changes: 1 addition & 7 deletions src/api/layers/ExternalLayer.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,9 @@ export class LayerLegend {
export default class ExternalLayer extends AbstractLayer {
/**
* @param {String} externalLayerData.name Name of this layer to be shown to the user
* @param {String} externalLayerData.id The unique ID of this layer that will be used in the URL
* to identify it. It should typically contain the type of external layer we are dealing with,
* with the URL to get the capabilites or data of this layer.
* @param {String} externalLayerData.id Layer ID to use when requesting the tiles on the server
* @param {LayerTypes} externalLayerData.type The type of layer in GeoAdmin sense (WMTS, WMS,
* GeoJson, etc...)
* @param {String} externalLayerData.externalLayerId Layer ID to use when requesting the tiles
* on the server
* @param {String} externalLayerData.baseUrl Base URL to build the request to the data
* @param {number} [externalLayerData.opacity=1.0] The opacity of this layer, between 0.0
* (transparent) and 1.0 (opaque). Default is `1.0`
Expand Down Expand Up @@ -108,7 +104,6 @@ export default class ExternalLayer extends AbstractLayer {
name = null,
id = null,
type = null,
externalLayerId = null,
baseUrl = null,
opacity = 1.0,
visible = true,
Expand Down Expand Up @@ -141,7 +136,6 @@ export default class ExternalLayer extends AbstractLayer {
hasDescription: abstract?.length > 0 || legends?.length > 0,
hasLegend: legends?.length > 0,
})
this.externalLayerId = externalLayerId
this.abstract = abstract
this.extent = extent
this.legends = legends
Expand Down
Loading

0 comments on commit 19e4d1f

Please sign in to comment.