geonetwork-ui 2.3.0-dev.376e0e90 → 2.3.0-dev.3d65a13b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/esm2022/libs/feature/dataviz/src/lib/service/data.service.mjs +2 -2
  2. package/esm2022/libs/feature/map/src/lib/add-layer-from-catalog/add-layer-record-preview/add-layer-record-preview.component.mjs +6 -2
  3. package/esm2022/libs/feature/map/src/lib/add-layer-from-ogc-api/add-layer-from-ogc-api.component.mjs +72 -0
  4. package/esm2022/libs/feature/map/src/lib/feature-map.module.mjs +7 -3
  5. package/esm2022/libs/feature/map/src/lib/layers-panel/layers-panel.component.mjs +12 -7
  6. package/esm2022/libs/feature/map/src/lib/map-context/map-context.model.mjs +2 -1
  7. package/esm2022/libs/feature/map/src/lib/map-context/map-context.service.mjs +52 -25
  8. package/esm2022/libs/feature/map/src/lib/utils/map-utils.service.mjs +12 -49
  9. package/esm2022/libs/feature/record/src/lib/map-view/map-view.component.mjs +6 -2
  10. package/esm2022/translations/de.json +2 -0
  11. package/esm2022/translations/en.json +2 -0
  12. package/esm2022/translations/es.json +2 -0
  13. package/esm2022/translations/fr.json +2 -0
  14. package/esm2022/translations/it.json +2 -0
  15. package/esm2022/translations/nl.json +2 -0
  16. package/esm2022/translations/pt.json +2 -0
  17. package/fesm2022/geonetwork-ui.mjs +2575 -2492
  18. package/fesm2022/geonetwork-ui.mjs.map +1 -1
  19. package/libs/feature/map/src/lib/add-layer-from-catalog/add-layer-record-preview/add-layer-record-preview.component.d.ts.map +1 -1
  20. package/libs/feature/map/src/lib/add-layer-from-ogc-api/add-layer-from-ogc-api.component.d.ts +23 -0
  21. package/libs/feature/map/src/lib/add-layer-from-ogc-api/add-layer-from-ogc-api.component.d.ts.map +1 -0
  22. package/libs/feature/map/src/lib/feature-map.module.d.ts +2 -1
  23. package/libs/feature/map/src/lib/feature-map.module.d.ts.map +1 -1
  24. package/libs/feature/map/src/lib/layers-panel/layers-panel.component.d.ts +2 -0
  25. package/libs/feature/map/src/lib/layers-panel/layers-panel.component.d.ts.map +1 -1
  26. package/libs/feature/map/src/lib/map-context/map-context.model.d.ts +10 -5
  27. package/libs/feature/map/src/lib/map-context/map-context.model.d.ts.map +1 -1
  28. package/libs/feature/map/src/lib/map-context/map-context.service.d.ts.map +1 -1
  29. package/libs/feature/map/src/lib/utils/map-utils.service.d.ts +2 -3
  30. package/libs/feature/map/src/lib/utils/map-utils.service.d.ts.map +1 -1
  31. package/libs/feature/record/src/lib/map-view/map-view.component.d.ts.map +1 -1
  32. package/package.json +2 -2
  33. package/src/libs/feature/dataviz/src/lib/service/data.service.ts +1 -1
  34. package/src/libs/feature/map/src/lib/add-layer-from-catalog/add-layer-record-preview/add-layer-record-preview.component.ts +5 -1
  35. package/src/libs/feature/map/src/lib/add-layer-from-ogc-api/add-layer-from-ogc-api.component.css +0 -0
  36. package/src/libs/feature/map/src/lib/add-layer-from-ogc-api/add-layer-from-ogc-api.component.html +36 -0
  37. package/src/libs/feature/map/src/lib/add-layer-from-ogc-api/add-layer-from-ogc-api.component.ts +80 -0
  38. package/src/libs/feature/map/src/lib/feature-map.module.ts +2 -0
  39. package/src/libs/feature/map/src/lib/layers-panel/layers-panel.component.html +8 -0
  40. package/src/libs/feature/map/src/lib/layers-panel/layers-panel.component.ts +5 -0
  41. package/src/libs/feature/map/src/lib/map-context/map-context.model.ts +10 -3
  42. package/src/libs/feature/map/src/lib/map-context/map-context.service.ts +60 -32
  43. package/src/libs/feature/map/src/lib/utils/map-utils.service.ts +17 -61
  44. package/src/libs/feature/record/src/lib/map-view/map-view.component.ts +5 -1
  45. package/translations/de.json +2 -0
  46. package/translations/en.json +2 -0
  47. package/translations/es.json +2 -0
  48. package/translations/fr.json +2 -0
  49. package/translations/it.json +2 -0
  50. package/translations/nl.json +2 -0
  51. package/translations/pt.json +2 -0
  52. package/translations/sk.json +2 -0
@@ -12,7 +12,6 @@ import Source from 'ol/source/Source'
12
12
  import ImageWMS from 'ol/source/ImageWMS'
13
13
  import TileWMS from 'ol/source/TileWMS'
14
14
  import VectorSource from 'ol/source/Vector'
15
- import { optionsFromCapabilities } from 'ol/source/WMTS'
16
15
  import { defaults, DragPan, Interaction, MouseWheelZoom } from 'ol/interaction'
17
16
  import {
18
17
  mouseOnly,
@@ -20,23 +19,17 @@ import {
20
19
  platformModifierKeyOnly,
21
20
  primaryAction,
22
21
  } from 'ol/events/condition'
23
- import WMTSCapabilities from 'ol/format/WMTSCapabilities'
24
- import { from, Observable } from 'rxjs'
22
+ import { Observable } from 'rxjs'
25
23
  import { map } from 'rxjs/operators'
26
24
  import {
27
25
  MapContextLayerModel,
28
- MapContextLayerTypeEnum,
29
26
  MapContextLayerWmsModel,
30
- MapContextLayerWmtsModel,
31
27
  } from '../map-context/map-context.model'
32
28
  import Collection from 'ol/Collection'
33
29
  import MapBrowserEvent from 'ol/MapBrowserEvent'
34
- import {
35
- CatalogRecord,
36
- DatasetDistribution,
37
- } from '../../../../../../libs/common/domain/src/lib/model/record'
30
+ import { CatalogRecord } from '../../../../../../libs/common/domain/src/lib/model/record'
38
31
  import { ProxyService } from '../../../../../../libs/util/shared/src'
39
- import { WmsEndpoint } from '@camptocamp/ogc-client'
32
+ import { WmsEndpoint, WmtsEndpoint } from '@camptocamp/ogc-client'
40
33
  import { LONLAT_CRS_CODES } from '../constant/projections'
41
34
  import { fromEPSGCode, register } from 'ol/proj/proj4'
42
35
  import proj4 from 'proj4/dist/proj4'
@@ -152,11 +145,14 @@ export class MapUtilsService {
152
145
  } else if (layer && layer.type === 'wms') {
153
146
  latLonExtent = await this.getWmsLayerExtent(layer)
154
147
  } else if (layer && layer.type === 'wmts') {
155
- if (layer.extent) {
156
- latLonExtent = layer.extent
157
- } else {
158
- return layer.options.tileGrid.getExtent()
159
- }
148
+ // TODO: isolate this in utils service
149
+ latLonExtent = await new WmtsEndpoint(layer.url)
150
+ .isReady()
151
+ .then((endpoint) => {
152
+ const layerName = endpoint.getSingleLayerName() ?? layer.name
153
+ const wmtsLayer = endpoint.getLayerByName(layerName)
154
+ return wmtsLayer.latLonBoundingBox
155
+ })
160
156
  } else {
161
157
  return null
162
158
  }
@@ -180,59 +176,19 @@ export class MapUtilsService {
180
176
  LONLAT_CRS_CODES.includes(crs)
181
177
  )
182
178
  if (lonLatCRS) {
183
- return boundingBoxes[lonLatCRS].map(parseFloat)
179
+ return boundingBoxes[lonLatCRS]
184
180
  } else {
185
181
  const availableEPSGCode = Object.keys(boundingBoxes)[0]
186
182
  register(proj4)
187
183
  const proj = await fromEPSGCode(availableEPSGCode)
188
- const bboxWithFiniteNumbers =
189
- boundingBoxes[availableEPSGCode].map(parseFloat)
190
- return transformExtent(bboxWithFiniteNumbers, proj, 'EPSG:4326')
184
+ return transformExtent(
185
+ boundingBoxes[availableEPSGCode],
186
+ proj,
187
+ 'EPSG:4326'
188
+ )
191
189
  }
192
190
  }
193
191
 
194
- getWmtsLayerFromCapabilities(
195
- link: DatasetDistribution
196
- ): Observable<MapContextLayerWmtsModel> {
197
- const getCapabilitiesUrl = new URL(link.url, window.location.toString())
198
- getCapabilitiesUrl.searchParams.set('SERVICE', 'WMTS')
199
- getCapabilitiesUrl.searchParams.set('REQUEST', 'GetCapabilities')
200
- return from(
201
- fetch(getCapabilitiesUrl.toString())
202
- .then(async function (response) {
203
- if (!response.ok) {
204
- throw new Error(`WMTS GetCapabilities HTTP request failed with code ${
205
- response.status
206
- } and body:
207
- ${await response.text()}`)
208
- }
209
- return response.text()
210
- })
211
- .then(function (text) {
212
- try {
213
- const result = new WMTSCapabilities().read(text)
214
- const options = optionsFromCapabilities(result, {
215
- layer: link.name,
216
- matrixSet: 'EPSG:3857',
217
- })
218
- const layerCap = result?.Contents?.Layer.find(
219
- (layer) => layer.Identifier === link.name
220
- )
221
- return {
222
- options,
223
- type: MapContextLayerTypeEnum.WMTS as 'wmts',
224
- ...(layerCap?.WGS84BoundingBox
225
- ? { extent: layerCap.WGS84BoundingBox }
226
- : {}),
227
- }
228
- } catch (e: any) {
229
- throw new Error(`WMTS GetCapabilities parsing failed:
230
- ${e.stack || e.message || e}`)
231
- }
232
- })
233
- )
234
- }
235
-
236
192
  prioritizePageScroll(interactions: Collection<Interaction>) {
237
193
  interactions.clear()
238
194
  interactions.extend(
@@ -188,7 +188,11 @@ export class MapViewComponent implements OnInit, OnDestroy {
188
188
  link.type === 'service' &&
189
189
  link.accessServiceProtocol === 'wmts'
190
190
  ) {
191
- return this.mapUtils.getWmtsLayerFromCapabilities(link)
191
+ return of({
192
+ url: link.url.toString(),
193
+ type: MapContextLayerTypeEnum.WMTS,
194
+ name: link.name,
195
+ })
192
196
  } else if (
193
197
  (link.type === 'service' &&
194
198
  (link.accessServiceProtocol === 'wfs' ||
@@ -177,6 +177,7 @@
177
177
  "map.add.layer": "Eine Ebene hinzufügen",
178
178
  "map.add.layer.catalog": "Aus dem Katalog",
179
179
  "map.add.layer.file": "Aus einer Datei",
180
+ "map.add.layer.ogc.api": "",
180
181
  "map.add.layer.wfs": "Aus WFS",
181
182
  "map.add.layer.wms": "Aus WMS",
182
183
  "map.addFromFile.placeholder": "Klicke hier oder ziehe eine Datei herein",
@@ -188,6 +189,7 @@
188
189
  "map.loading.data": "Kartendaten werden geladen...",
189
190
  "map.loading.service": "Dienst wird geladen...",
190
191
  "map.navigation.message": "Bitte verwenden Sie STRG + Maus (oder zwei Finger auf einem Mobilgerät), um die Karte zu navigieren",
192
+ "map.ogc.urlInput.hint": "",
191
193
  "map.select.layer": "Datenquelle",
192
194
  "map.wfs.urlInput.hint": "Geben Sie die WFS URL ein",
193
195
  "map.wms.urlInput.hint": "Geben Sie die WMS URL ein",
@@ -177,6 +177,7 @@
177
177
  "map.add.layer": "Add a layer",
178
178
  "map.add.layer.catalog": "From the catalog",
179
179
  "map.add.layer.file": "From a file",
180
+ "map.add.layer.ogc.api": "From OGC API",
180
181
  "map.add.layer.wfs": "From WFS",
181
182
  "map.add.layer.wms": "From WMS",
182
183
  "map.addFromFile.placeholder": "Click or drop a file here",
@@ -188,6 +189,7 @@
188
189
  "map.loading.data": "Loading map data...",
189
190
  "map.loading.service": "Loading service...",
190
191
  "map.navigation.message": "Please use CTRL + mouse (or two fingers on mobile) to navigate the map",
192
+ "map.ogc.urlInput.hint": "Enter OGC API service URL",
191
193
  "map.select.layer": "Data source",
192
194
  "map.wfs.urlInput.hint": "Enter WFS service URL",
193
195
  "map.wms.urlInput.hint": "Enter WMS service URL",
@@ -177,6 +177,7 @@
177
177
  "map.add.layer": "",
178
178
  "map.add.layer.catalog": "",
179
179
  "map.add.layer.file": "",
180
+ "map.add.layer.ogc.api": "",
180
181
  "map.add.layer.wfs": "",
181
182
  "map.add.layer.wms": "",
182
183
  "map.addFromFile.placeholder": "",
@@ -188,6 +189,7 @@
188
189
  "map.loading.data": "",
189
190
  "map.loading.service": "",
190
191
  "map.navigation.message": "",
192
+ "map.ogc.urlInput.hint": "",
191
193
  "map.select.layer": "",
192
194
  "map.wfs.urlInput.hint": "",
193
195
  "map.wms.urlInput.hint": "",
@@ -177,6 +177,7 @@
177
177
  "map.add.layer": "Ajouter une couche",
178
178
  "map.add.layer.catalog": "Du catalogue",
179
179
  "map.add.layer.file": "À partir d'un fichier",
180
+ "map.add.layer.ogc.api": "",
180
181
  "map.add.layer.wfs": "Depuis un service WFS",
181
182
  "map.add.layer.wms": "Depuis un service WMS",
182
183
  "map.addFromFile.placeholder": "Cliquez ou déposez un fichier ici",
@@ -188,6 +189,7 @@
188
189
  "map.loading.data": "Chargement des données...",
189
190
  "map.loading.service": "Chargement du service...",
190
191
  "map.navigation.message": "Veuillez utiliser CTRL + souris (ou deux doigts sur mobile) pour naviguer sur la carte",
192
+ "map.ogc.urlInput.hint": "",
191
193
  "map.select.layer": "Source de données",
192
194
  "map.wfs.urlInput.hint": "Entrez l'URL du service WFS",
193
195
  "map.wms.urlInput.hint": "Entrez l'URL du service WMS",
@@ -177,6 +177,7 @@
177
177
  "map.add.layer": "Aggiungere un layer",
178
178
  "map.add.layer.catalog": "Dal catalogo",
179
179
  "map.add.layer.file": "Da un file",
180
+ "map.add.layer.ogc.api": "",
180
181
  "map.add.layer.wfs": "Da un WFS",
181
182
  "map.add.layer.wms": "Da un WMS",
182
183
  "map.addFromFile.placeholder": "Clicca o trascina un file qui",
@@ -188,6 +189,7 @@
188
189
  "map.loading.data": "Caricamento dati...",
189
190
  "map.loading.service": "Caricamento del servizio...",
190
191
  "map.navigation.message": "Si prega di utilizzare CTRL + mouse (o due dita su mobile) per navigare sulla mappa",
192
+ "map.ogc.urlInput.hint": "",
191
193
  "map.select.layer": "Sorgente dati",
192
194
  "map.wfs.urlInput.hint": "Inserisci URL del servizio WFS",
193
195
  "map.wms.urlInput.hint": "Inserisci URL del servizio WMS",
@@ -177,6 +177,7 @@
177
177
  "map.add.layer": "",
178
178
  "map.add.layer.catalog": "",
179
179
  "map.add.layer.file": "",
180
+ "map.add.layer.ogc.api": "",
180
181
  "map.add.layer.wfs": "",
181
182
  "map.add.layer.wms": "",
182
183
  "map.addFromFile.placeholder": "",
@@ -188,6 +189,7 @@
188
189
  "map.loading.data": "",
189
190
  "map.loading.service": "",
190
191
  "map.navigation.message": "",
192
+ "map.ogc.urlInput.hint": "",
191
193
  "map.select.layer": "",
192
194
  "map.wfs.urlInput.hint": "",
193
195
  "map.wms.urlInput.hint": "",
@@ -177,6 +177,7 @@
177
177
  "map.add.layer": "",
178
178
  "map.add.layer.catalog": "",
179
179
  "map.add.layer.file": "",
180
+ "map.add.layer.ogc.api": "",
180
181
  "map.add.layer.wfs": "",
181
182
  "map.add.layer.wms": "",
182
183
  "map.addFromFile.placeholder": "",
@@ -188,6 +189,7 @@
188
189
  "map.loading.data": "",
189
190
  "map.loading.service": "",
190
191
  "map.navigation.message": "",
192
+ "map.ogc.urlInput.hint": "",
191
193
  "map.select.layer": "",
192
194
  "map.wfs.urlInput.hint": "",
193
195
  "map.wms.urlInput.hint": "",
@@ -177,6 +177,7 @@
177
177
  "map.add.layer": "Pridať vrstvu",
178
178
  "map.add.layer.catalog": "Z katalógu",
179
179
  "map.add.layer.file": "Zo súboru",
180
+ "map.add.layer.ogc.api": "",
180
181
  "map.add.layer.wfs": "Z WFS",
181
182
  "map.add.layer.wms": "Z WMS",
182
183
  "map.addFromFile.placeholder": "Kliknite na tlačidlo alebo sem vložte súbor",
@@ -188,6 +189,7 @@
188
189
  "map.loading.data": "Načítavanie dát mapy...",
189
190
  "map.loading.service": "Načítavanie služieb...",
190
191
  "map.navigation.message": "Použite prosím CTRL + myš (alebo dva prsty na mobilnom zariadení) na navigáciu po mape",
192
+ "map.ogc.urlInput.hint": "",
191
193
  "map.select.layer": "Zdroj dát",
192
194
  "map.wfs.urlInput.hint": "Zadajte URL adresu služby WFS",
193
195
  "map.wms.urlInput.hint": "Zadajte URL adresu služby WMS",