qwc2 2025.4.10 → 2025.4.22

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 (53) hide show
  1. package/components/AppMenu.js +1 -1
  2. package/components/AttributeTableWidget.js +16 -0
  3. package/components/AutoEditForm.js +1 -1
  4. package/components/EditUploadField.js +2 -2
  5. package/components/QtDesignerForm.js +1 -1
  6. package/components/WindowManager.js +1 -1
  7. package/components/map3d/ExportObjects3D.js +6 -3
  8. package/components/map3d/Identify3D.js +4 -4
  9. package/components/map3d/Map3D.js +9 -8
  10. package/components/map3d/Measure3D.js +7 -5
  11. package/components/map3d/style/Map3D.css +9 -0
  12. package/components/map3d/style/SearchField3D.css +4 -3
  13. package/components/map3d/utils/Tiles3DStyle.js +11 -1
  14. package/components/style/AppMenu.css +19 -5
  15. package/components/style/AttributeTableWidget.css +214 -0
  16. package/package.json +4 -3
  17. package/plugins/API.js +2 -2
  18. package/plugins/AttributeTable.js +3 -12
  19. package/plugins/BackgroundSwitcher.js +1 -1
  20. package/plugins/Bookmark.js +1 -1
  21. package/plugins/HeightProfile.js +9 -8
  22. package/plugins/MapInfoTooltip.js +5 -3
  23. package/plugins/View3D.js +29 -4
  24. package/plugins/style/AttributeTable.css +1 -215
  25. package/plugins/style/Portal.css +2 -6
  26. package/reducers/layers.js +2 -1
  27. package/scripts/dist.sh +7 -1
  28. package/static/translations/bg-BG.json +7 -0
  29. package/static/translations/ca-ES.json +7 -0
  30. package/static/translations/cs-CZ.json +7 -0
  31. package/static/translations/de-CH.json +7 -0
  32. package/static/translations/de-DE.json +7 -0
  33. package/static/translations/en-US.json +7 -0
  34. package/static/translations/es-ES.json +7 -0
  35. package/static/translations/fi-FI.json +7 -0
  36. package/static/translations/fr-FR.json +7 -0
  37. package/static/translations/hu-HU.json +7 -0
  38. package/static/translations/it-IT.json +7 -0
  39. package/static/translations/ja-JP.json +7 -0
  40. package/static/translations/nl-NL.json +7 -0
  41. package/static/translations/no-NO.json +7 -0
  42. package/static/translations/pl-PL.json +7 -0
  43. package/static/translations/pt-BR.json +7 -0
  44. package/static/translations/pt-PT.json +7 -0
  45. package/static/translations/ro-RO.json +7 -0
  46. package/static/translations/ru-RU.json +7 -0
  47. package/static/translations/sv-SE.json +7 -0
  48. package/static/translations/tr-TR.json +7 -0
  49. package/static/translations/tsconfig.json +6 -1
  50. package/utils/EditingInterface.js +4 -1
  51. package/utils/ElevationInterface.js +25 -0
  52. package/utils/SearchProviders.js +1 -1
  53. package/utils/ServiceLayerUtils.js +2 -2
@@ -389,6 +389,7 @@
389
389
  "areaLabel": "Areal",
390
390
  "bearingLabel": "Orientering",
391
391
  "ground": "",
392
+ "heightDiffLabel": "",
392
393
  "imperial": "",
393
394
  "lengthLabel": "Lengde",
394
395
  "metric": "",
@@ -539,6 +540,7 @@
539
540
  "all": "Alle",
540
541
  "circleradius": "",
541
542
  "clearfilter": "",
543
+ "coordinates": "",
542
544
  "existinglayer": "Laget finnes allerede på kartet",
543
545
  "filter": "Filtrer",
544
546
  "layers": "",
@@ -706,6 +708,11 @@
706
708
  "undock": "Utløs",
707
709
  "unmaximize": "",
708
710
  "unminimize": ""
711
+ },
712
+ "colorschemes": {
713
+ "default": "",
714
+ "dark": "",
715
+ "highcontrast": ""
709
716
  }
710
717
  }
711
718
  }
@@ -389,6 +389,7 @@
389
389
  "areaLabel": "Obszar",
390
390
  "bearingLabel": "Bearing",
391
391
  "ground": "",
392
+ "heightDiffLabel": "",
392
393
  "imperial": "",
393
394
  "lengthLabel": "Odległość",
394
395
  "metric": "",
@@ -539,6 +540,7 @@
539
540
  "all": "Wszystko",
540
541
  "circleradius": "",
541
542
  "clearfilter": "",
543
+ "coordinates": "",
542
544
  "existinglayer": "",
543
545
  "filter": "",
544
546
  "layers": "",
@@ -706,6 +708,11 @@
706
708
  "undock": "",
707
709
  "unmaximize": "",
708
710
  "unminimize": ""
711
+ },
712
+ "colorschemes": {
713
+ "default": "",
714
+ "dark": "",
715
+ "highcontrast": ""
709
716
  }
710
717
  }
711
718
  }
@@ -389,6 +389,7 @@
389
389
  "areaLabel": "Área",
390
390
  "bearingLabel": "Direção",
391
391
  "ground": "",
392
+ "heightDiffLabel": "",
392
393
  "imperial": "Imperial",
393
394
  "lengthLabel": "Distância",
394
395
  "metric": "Métrica",
@@ -539,6 +540,7 @@
539
540
  "all": "Todos",
540
541
  "circleradius": "",
541
542
  "clearfilter": "",
543
+ "coordinates": "",
542
544
  "existinglayer": "A camada já existe no mapa",
543
545
  "filter": "Refinar a procura",
544
546
  "layers": "",
@@ -706,6 +708,11 @@
706
708
  "undock": "Desencaixar",
707
709
  "unmaximize": "Desmaximizar",
708
710
  "unminimize": "Desminimizar"
711
+ },
712
+ "colorschemes": {
713
+ "default": "",
714
+ "dark": "",
715
+ "highcontrast": ""
709
716
  }
710
717
  }
711
718
  }
@@ -389,6 +389,7 @@
389
389
  "areaLabel": "Área",
390
390
  "bearingLabel": "Direção",
391
391
  "ground": "",
392
+ "heightDiffLabel": "",
392
393
  "imperial": "Imperial",
393
394
  "lengthLabel": "Comprimento",
394
395
  "metric": "Métrico",
@@ -539,6 +540,7 @@
539
540
  "all": "Todos",
540
541
  "circleradius": "",
541
542
  "clearfilter": "Limpar Filtro",
543
+ "coordinates": "",
542
544
  "existinglayer": "A camada já existe no mapa",
543
545
  "filter": "Refinar Pesquisa",
544
546
  "layers": "",
@@ -706,6 +708,11 @@
706
708
  "undock": "Desacoplar",
707
709
  "unmaximize": "Restaurar Tamanho",
708
710
  "unminimize": "Restaurar Tamanho"
711
+ },
712
+ "colorschemes": {
713
+ "default": "",
714
+ "dark": "",
715
+ "highcontrast": ""
709
716
  }
710
717
  }
711
718
  }
@@ -389,6 +389,7 @@
389
389
  "areaLabel": "Arie",
390
390
  "bearingLabel": "Direcție",
391
391
  "ground": "",
392
+ "heightDiffLabel": "",
392
393
  "imperial": "Mărimi imperiale",
393
394
  "lengthLabel": "Lungime",
394
395
  "metric": "Mărimi metrice",
@@ -539,6 +540,7 @@
539
540
  "all": "Toate",
540
541
  "circleradius": "",
541
542
  "clearfilter": "",
543
+ "coordinates": "",
542
544
  "existinglayer": "Stratul există deja în hartă",
543
545
  "filter": "Filtrare căutare",
544
546
  "layers": "",
@@ -706,6 +708,11 @@
706
708
  "undock": "Anulează andocarea",
707
709
  "unmaximize": "Restaurează",
708
710
  "unminimize": "Restaurează"
711
+ },
712
+ "colorschemes": {
713
+ "default": "",
714
+ "dark": "",
715
+ "highcontrast": ""
709
716
  }
710
717
  }
711
718
  }
@@ -389,6 +389,7 @@
389
389
  "areaLabel": "Площадь",
390
390
  "bearingLabel": "Пеленг",
391
391
  "ground": "",
392
+ "heightDiffLabel": "",
392
393
  "imperial": "",
393
394
  "lengthLabel": "Длина",
394
395
  "metric": "",
@@ -539,6 +540,7 @@
539
540
  "all": "Всё",
540
541
  "circleradius": "",
541
542
  "clearfilter": "",
543
+ "coordinates": "",
542
544
  "existinglayer": "",
543
545
  "filter": "",
544
546
  "layers": "",
@@ -706,6 +708,11 @@
706
708
  "undock": "",
707
709
  "unmaximize": "",
708
710
  "unminimize": ""
711
+ },
712
+ "colorschemes": {
713
+ "default": "",
714
+ "dark": "",
715
+ "highcontrast": ""
709
716
  }
710
717
  }
711
718
  }
@@ -389,6 +389,7 @@
389
389
  "areaLabel": "Area",
390
390
  "bearingLabel": "Bäring",
391
391
  "ground": "",
392
+ "heightDiffLabel": "",
392
393
  "imperial": "",
393
394
  "lengthLabel": "Längd",
394
395
  "metric": "",
@@ -539,6 +540,7 @@
539
540
  "all": "",
540
541
  "circleradius": "",
541
542
  "clearfilter": "",
543
+ "coordinates": "",
542
544
  "existinglayer": "",
543
545
  "filter": "",
544
546
  "layers": "",
@@ -706,6 +708,11 @@
706
708
  "undock": "",
707
709
  "unmaximize": "",
708
710
  "unminimize": ""
711
+ },
712
+ "colorschemes": {
713
+ "default": "",
714
+ "dark": "",
715
+ "highcontrast": ""
709
716
  }
710
717
  }
711
718
  }
@@ -389,6 +389,7 @@
389
389
  "areaLabel": "Alan",
390
390
  "bearingLabel": "Doğrultu",
391
391
  "ground": "İrtifa (m)",
392
+ "heightDiffLabel": "",
392
393
  "imperial": "Imperial",
393
394
  "lengthLabel": "Uzunluk",
394
395
  "metric": "Metrik",
@@ -539,6 +540,7 @@
539
540
  "all": "Tümü",
540
541
  "circleradius": "Daire yarıçapı",
541
542
  "clearfilter": "Temizle",
543
+ "coordinates": "",
542
544
  "existinglayer": "Katman zaten haritada mevcut",
543
545
  "filter": "Gelişmiş arama",
544
546
  "layers": "Katmanlar",
@@ -706,6 +708,11 @@
706
708
  "undock": "Çöz",
707
709
  "unmaximize": "Eski haline getir",
708
710
  "unminimize": "Küçültmeyi kaldır"
711
+ },
712
+ "colorschemes": {
713
+ "default": "",
714
+ "dark": "",
715
+ "highcontrast": ""
709
716
  }
710
717
  }
711
718
  }
@@ -52,7 +52,10 @@
52
52
  "appmenu.items.Tools",
53
53
  "appmenu.items.Bookmark",
54
54
  "appmenu.items.TimeManager",
55
- "appmenu.items.View3D"
55
+ "appmenu.items.View3D",
56
+ "colorschemes.default",
57
+ "colorschemes.dark",
58
+ "colorschemes.highcontrast"
56
59
  ],
57
60
  "strings": [
58
61
  "app.missingbg",
@@ -341,6 +344,7 @@
341
344
  "measureComponent.areaLabel",
342
345
  "measureComponent.bearingLabel",
343
346
  "measureComponent.ground",
347
+ "measureComponent.heightDiffLabel",
344
348
  "measureComponent.imperial",
345
349
  "measureComponent.lengthLabel",
346
350
  "measureComponent.metric",
@@ -463,6 +467,7 @@
463
467
  "search.all",
464
468
  "search.circleradius",
465
469
  "search.clearfilter",
470
+ "search.coordinates",
466
471
  "search.existinglayer",
467
472
  "search.filter",
468
473
  "search.layers",
@@ -64,4 +64,7 @@ var tol=10/dpi*0.0254*mapScale;var bbox=mapPos[0]-tol+","+(mapPos[1]-tol)+","+(m
64
64
  keyvalues: <dataset>:<key_column>:<value_column>,<dataset>:<key_column>:<value_column>,...
65
65
  callback: function(result), result is a {"keyvalues": {"<dataset>": [{"key": <key>, "value": <value}, ...]}}
66
66
  filter: the filter expression as [[["<name>", "<op>", <value>],"and|or",["<name>","<op>",<value>],...]] (one filter expr per keyvalue entry), or null
67
- */function getKeyValues(keyvalues,callback){var filter=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var SERVICE_URL=ConfigUtils.getConfigProp("editServiceUrl");var req=SERVICE_URL+"keyvals?tables="+keyvalues;var params={filter:filter?JSON.stringify(filter):undefined};var headers={"Accept-Language":LocaleUtils.lang()};axios.get(req,{headers:headers,params:params}).then(function(response){callback(response.data)})["catch"](function(){return callback({})})}export default{getFeature:getFeature,getFeatureById:getFeatureById,getFeatures:getFeatures,getExtent:getExtent,addFeatureMultipart:addFeatureMultipart,editFeatureMultipart:editFeatureMultipart,deleteFeature:deleteFeature,getRelations:getRelations,getKeyValues:getKeyValues};
67
+ */function getKeyValues(keyvalues,callback){var filter=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var SERVICE_URL=ConfigUtils.getConfigProp("editServiceUrl");var req=SERVICE_URL+"keyvals?tables="+keyvalues;var params={filter:filter?JSON.stringify(filter):undefined};var headers={"Accept-Language":LocaleUtils.lang()};axios.get(req,{headers:headers,params:params}).then(function(response){callback(response.data)})["catch"](function(){return callback({})})}/*
68
+ layerId: The edit layer id
69
+ fileValue: The attachment field value
70
+ */function resolveAttachmentUrl(layerId,fileValue){var SERVICE_URL=ConfigUtils.getConfigProp("editServiceUrl");return SERVICE_URL+layerId+"/attachment?file="+encodeURIComponent(fileValue)}export default{getFeature:getFeature,getFeatureById:getFeatureById,getFeatures:getFeatures,getExtent:getExtent,addFeatureMultipart:addFeatureMultipart,editFeatureMultipart:editFeatureMultipart,deleteFeature:deleteFeature,getRelations:getRelations,getKeyValues:getKeyValues,resolveAttachmentUrl:resolveAttachmentUrl};
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright 2025 Sourcepole AG
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */import axios from"axios";import ConfigUtils from"./ConfigUtils";/**
8
+ * Interface for querying elevations/height profiles
9
+ */var ElevationInterface={/**
10
+ * Query the elevation at the specified position
11
+ *
12
+ * * `pos`: query position, as tuple `[x, y]`
13
+ * * `crs`: CRS of the query position, as an EPSG string
14
+ *
15
+ * Returns: a promise which resolves to an elevation value (in meteres)
16
+ */getElevation:function getElevation(pos,crs){return new Promise(function(resolve,reject){var serviceUrl=ConfigUtils.getConfigProp("elevationServiceUrl",null,"").replace(/\/$/,"");if(!serviceUrl){reject(null);return}axios.get(serviceUrl+"/getelevation",{params:{pos:pos.join(","),crs:crs}}).then(function(response){resolve(response.data.elevation)})["catch"](function(e){reject(String(e))})})},/**
17
+ * Query the elevation profile along the specified line
18
+ *
19
+ * * `coordinates`: line coordinates `[[x1, y1], [x2, y2], ...]`
20
+ * * `distances`: distances of the line segments `[dist1, dist2, ...]`
21
+ * * `crs`: CRS of the line coordinates, as an EPSG string
22
+ * * `samples`: the number of samples
23
+ *
24
+ * Returns a promise which resolves to the elevation values `[z1, z2, ...]`
25
+ */getProfile:function getProfile(coordinates,distances,crs,samples){return new Promise(function(resolve,reject){var serviceUrl=ConfigUtils.getConfigProp("elevationServiceUrl",null,"").replace(/\/$/,"");if(!serviceUrl){reject(null);return}axios.post(serviceUrl+"/getheightprofile",{coordinates:coordinates,distances:distances,projection:crs,samples:samples}).then(function(response){resolve(response.data.elevations)})["catch"](function(e){/* eslint-disable-next-line */console.log("Query failed: "+e);reject(String(e))})})}};export function getElevationInterface(){var _window$QWC2Elevation;return(_window$QWC2Elevation=window.QWC2ElevationInterface)!==null&&_window$QWC2Elevation!==void 0?_window$QWC2Elevation:ElevationInterface};
@@ -4,7 +4,7 @@ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
- */import axios from"axios";import yaml from"js-yaml";import polygonIntersectTest from"polygon-intersect-test";import ConfigUtils from"./ConfigUtils";import CoordinatesUtils from"./CoordinatesUtils";import IdentifyUtils from"./IdentifyUtils";import LocaleUtils from"./LocaleUtils";export var SearchResultType={PLACE:0,THEMELAYER:1,THEME:2,EXTERNALLAYER:3};function coordinatesSearch(text,searchParams,callback){var displaycrs=searchParams.displaycrs||"EPSG:4326";var matches=text.match(/^\s*([+-]?\d+\.?\d*)[,\s]\s*([+-]?\d+\.?\d*)\s*$/);var items=[];if(matches&&matches.length>=3){var x=parseFloat(matches[1]);var y=parseFloat(matches[2]);if(displaycrs!=="EPSG:4326"){items.push({id:"coord0",text:x+", "+y+" ("+displaycrs+")",x:x,y:y,crs:displaycrs,bbox:[x,y,x,y]})}if(x>=-180&&x<=180&&y>=-90&&y<=90){var title=Math.abs(x)+(x>=0?"\xB0E":"\xB0W")+", "+Math.abs(y)+(y>=0?"\xB0N":"\xB0S");items.push({id:"coord"+items.length,text:title,x:x,y:y,crs:"EPSG:4326",bbox:[x,y,x,y]})}if(x>=-90&&x<=90&&y>=-180&&y<=180&&x!==y){var _title=Math.abs(y)+(y>=0?"\xB0E":"\xB0W")+", "+Math.abs(x)+(x>=0?"\xB0N":"\xB0S");items.push({id:"coord"+items.length,text:_title,x:y,y:x,crs:"EPSG:4326",bbox:[y,x,y,x]})}}var results=[];if(items.length>0){results.push({id:"coords",titlemsgid:"search.coordinates",type:SearchResultType.PLACE,items:items})}callback({results:results})}/** ************************************************************************ **/var NominatimSearch=/*#__PURE__*/function(){function NominatimSearch(){_classCallCheck(this,NominatimSearch)}return _createClass(NominatimSearch,null,[{key:"search",value:function search(text,searchParams,callback){var viewboxParams={};if(searchParams.filterBBox){viewboxParams.viewbox=CoordinatesUtils.reprojectBbox(searchParams.filterBBox,searchParams.mapcrs,"EPSG:4326").join(",");viewboxParams.bounded=1}axios.get("https://nominatim.openstreetmap.org/search",{params:_objectSpread(_objectSpread({"q":text,"addressdetails":1,"polygon_geojson":1,"limit":20,"format":"json","accept-language":searchParams.lang},viewboxParams),searchParams.cfgParams||{})}).then(function(response){var locale=searchParams.lang;if(NominatimSearch.TRANSLATIONS[locale]===undefined){NominatimSearch.TRANSLATIONS[locale]={promise:NominatimSearch.loadLocale(locale)};NominatimSearch.TRANSLATIONS[locale].promise.then(function(){NominatimSearch.parseResults(response.data,NominatimSearch.TRANSLATIONS[locale].strings,callback)})}else if(NominatimSearch.TRANSLATIONS[locale].promise){NominatimSearch.TRANSLATIONS[locale].promise.then(function(){NominatimSearch.parseResults(response.data,NominatimSearch.TRANSLATIONS[locale].strings,callback)})}else if(NominatimSearch.TRANSLATIONS[locale].strings){NominatimSearch.parseResults(response.data,NominatimSearch.TRANSLATIONS[locale].strings,callback)}})}},{key:"parseResults",value:function parseResults(obj,translations,callback){var results=[];var groups={};var groupcounter=0;(obj||[]).map(function(entry){if(!(entry["class"]in groups)){var title=entry.type;try{title=translations[entry["class"]][entry.type]||entry.type}catch(e){/* pass */}groups[entry["class"]]={id:"nominatimgroup"+groupcounter++,// capitalize class
7
+ */import axios from"axios";import yaml from"js-yaml";import polygonIntersectTest from"polygon-intersect-test";import ConfigUtils from"./ConfigUtils";import CoordinatesUtils from"./CoordinatesUtils";import IdentifyUtils from"./IdentifyUtils";import LocaleUtils from"./LocaleUtils";export var SearchResultType={PLACE:0,THEMELAYER:1,THEME:2,EXTERNALLAYER:3};function coordinatesSearch(text,searchParams,callback){var displaycrs=searchParams.displaycrs||"EPSG:4326";var matches=text.match(/^\s*([+-]?\d+\.?\d*)[,\s]\s*([+-]?\d+\.?\d*)\s*$/);var items=[];if(matches&&matches.length>=3){var x=parseFloat(matches[1]);var y=parseFloat(matches[2]);if(displaycrs!=="EPSG:4326"){items.push({id:"coord0",text:x+", "+y+" ("+displaycrs+")",x:x,y:y,crs:displaycrs,bbox:[x,y,x,y]})}if(x>=-180&&x<=180&&y>=-90&&y<=90){var title=Math.abs(x)+(x>=0?"\xB0E":"\xB0W")+", "+Math.abs(y)+(y>=0?"\xB0N":"\xB0S");items.push({id:"coord"+items.length,text:title,x:x,y:y,crs:"EPSG:4326",bbox:[x,y,x,y]})}if(x>=-90&&x<=90&&y>=-180&&y<=180&&x!==y){var _title=Math.abs(y)+(y>=0?"\xB0E":"\xB0W")+", "+Math.abs(x)+(x>=0?"\xB0N":"\xB0S");items.push({id:"coord"+items.length,text:_title,x:y,y:x,crs:"EPSG:4326",bbox:[y,x,y,x]})}}var results=[];if(items.length>0){results.push({id:"coords",titlemsgid:LocaleUtils.trmsg("search.coordinates"),type:SearchResultType.PLACE,items:items})}callback({results:results})}/** ************************************************************************ **/var NominatimSearch=/*#__PURE__*/function(){function NominatimSearch(){_classCallCheck(this,NominatimSearch)}return _createClass(NominatimSearch,null,[{key:"search",value:function search(text,searchParams,callback){var viewboxParams={};if(searchParams.filterBBox){viewboxParams.viewbox=CoordinatesUtils.reprojectBbox(searchParams.filterBBox,searchParams.mapcrs,"EPSG:4326").join(",");viewboxParams.bounded=1}axios.get("https://nominatim.openstreetmap.org/search",{params:_objectSpread(_objectSpread({"q":text,"addressdetails":1,"polygon_geojson":1,"limit":20,"format":"json","accept-language":searchParams.lang},viewboxParams),searchParams.cfgParams||{})}).then(function(response){var locale=searchParams.lang;if(NominatimSearch.TRANSLATIONS[locale]===undefined){NominatimSearch.TRANSLATIONS[locale]={promise:NominatimSearch.loadLocale(locale)};NominatimSearch.TRANSLATIONS[locale].promise.then(function(){NominatimSearch.parseResults(response.data,NominatimSearch.TRANSLATIONS[locale].strings,callback)})}else if(NominatimSearch.TRANSLATIONS[locale].promise){NominatimSearch.TRANSLATIONS[locale].promise.then(function(){NominatimSearch.parseResults(response.data,NominatimSearch.TRANSLATIONS[locale].strings,callback)})}else if(NominatimSearch.TRANSLATIONS[locale].strings){NominatimSearch.parseResults(response.data,NominatimSearch.TRANSLATIONS[locale].strings,callback)}})}},{key:"parseResults",value:function parseResults(obj,translations,callback){var results=[];var groups={};var groupcounter=0;(obj||[]).map(function(entry){if(!(entry["class"]in groups)){var title=entry.type;try{title=translations[entry["class"]][entry.type]||entry.type}catch(e){/* pass */}groups[entry["class"]]={id:"nominatimgroup"+groupcounter++,// capitalize class
8
8
  title:title,type:SearchResultType.PLACE,items:[]};results.push(groups[entry["class"]])}// shorten display_name
9
9
  var text=entry.display_name.split(", ").slice(0,3).join(", ");// map label
10
10
  var label=text;// collect address fields
@@ -4,10 +4,10 @@ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof
4
4
  *
5
5
  * This source code is licensed under the BSD-style license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
- */import axios from"axios";import deepmerge from"deepmerge";import{XMLParser}from"fast-xml-parser";import isEmpty from"lodash.isempty";import{getWidth}from"ol/extent";import{get as getProjection}from"ol/proj";import ol from"openlayers";import randomColor from"randomcolor";import url from"url";import{LayerRole}from"../actions/layers";import ConfigUtils from"./ConfigUtils";import CoordinatesUtils from"./CoordinatesUtils";import LayerUtils from"./LayerUtils";import MiscUtils from"./MiscUtils";function strcmp(a,b){var al=a.toLowerCase();var bl=b.toLowerCase();if(al<bl){return-1}else if(al>bl){return 1}return 0}var ServiceLayerUtils={getWMTSLayers:function getWMTSLayers(capabilities,capabilitiesUrl,mapCrs){var _this=this;if(!(capabilities!==null&&capabilities!==void 0&&capabilities.Contents)){return[]}var tileMatrices=capabilities.Contents.TileMatrixSet.reduce(function(res,entry){var crsMatch=entry.SupportedCRS.match(/(EPSG).*:(\d+)/i);res[entry.Identifier]={crs:crsMatch?"EPSG:"+crsMatch[2]:entry.SupportedCRS,matrix:entry.TileMatrix};return res},{});var layers=capabilities.Contents.Layer.map(function(layer){var _capabilities$Service,_capabilities$Service2,_capabilities$Service3;var styles=_this.getWMTSLayerStyles(capabilities,capabilitiesUrl,layer,tileMatrices);return{capabilitiesUrl:capabilitiesUrl,title:layer.Title,name:layer.Identifier,bbox:{crs:"EPSG:4326",bounds:layer.WGS84BoundingBox},sublayers:styles,"abstract":layer.Abstract,attribution:{Title:((_capabilities$Service=capabilities.ServiceProvider)===null||_capabilities$Service===void 0?void 0:_capabilities$Service.ProviderName)||((_capabilities$Service2=capabilities.ServiceIdentification)===null||_capabilities$Service2===void 0?void 0:_capabilities$Service2.Title)||"",OnlineResource:((_capabilities$Service3=capabilities.ServiceProvider)===null||_capabilities$Service3===void 0?void 0:_capabilities$Service3.ProviderSite)||""}}});layers.sort(function(a,b){return a.title.localeCompare(b.title)});return layers},getWMTSLayerStyles:function getWMTSLayerStyles(capabilities,capabilitiesUrl,layer,tileMatrices){var _this2=this;if(layer.Style.length===1){return this.getWMTSLayerTileMatrixSetLinks(capabilities,capabilitiesUrl,layer,tileMatrices,layer.Style[0].Identifier)}else{return layer.Style.map(function(style){return{title:style.Identifier,sublayers:_this2.getWMTSLayerTileMatrixSetLinks(capabilities,capabilitiesUrl,layer,tileMatrices,style.Identifier)}})}},getWMTSLayerTileMatrixSetLinks:function getWMTSLayerTileMatrixSetLinks(capabilities,capabilitiesUrl,layer,tileMatrices,style){var tileMatrixSetLinks=layer.TileMatrixSetLink;var layerLinks=tileMatrixSetLinks.map(function(link){var _MiscUtils$ensureArra,_capabilities$Service4,_capabilities$Service5,_capabilities$Service6;var tileMatrixSet=link.TileMatrixSet;var topMatrix=tileMatrices[tileMatrixSet].matrix[0];var tileMatrixPrefix=topMatrix.Identifier.includes(":")?topMatrix.Identifier.replace(/:[0-9]+$/,""):"";var origin=[topMatrix.TopLeftCorner[0],topMatrix.TopLeftCorner[1]];try{var axisOrder=CoordinatesUtils.getAxisOrder(tileMatrices[tileMatrixSet].crs).substr(0,2);if(axisOrder==="ne"){origin=[topMatrix.TopLeftCorner[1],topMatrix.TopLeftCorner[0]]}}catch(e){// eslint-disable-next-line
7
+ */import axios from"axios";import deepmerge from"deepmerge";import{XMLParser}from"fast-xml-parser";import isEmpty from"lodash.isempty";import{getWidth}from"ol/extent";import{get as getProjection}from"ol/proj";import ol from"openlayers";import randomColor from"randomcolor";import url from"url";import{LayerRole}from"../actions/layers";import ConfigUtils from"./ConfigUtils";import CoordinatesUtils from"./CoordinatesUtils";import LayerUtils from"./LayerUtils";import MiscUtils from"./MiscUtils";function strcmp(a,b){var al=a.toLowerCase();var bl=b.toLowerCase();if(al<bl){return-1}else if(al>bl){return 1}return 0}var ServiceLayerUtils={getWMTSLayers:function getWMTSLayers(capabilities,capabilitiesUrl,mapCrs){var _this=this;if(!(capabilities!==null&&capabilities!==void 0&&capabilities.Contents)){return[]}var tileMatrices=capabilities.Contents.TileMatrixSet.reduce(function(res,entry){var crsMatch=entry.SupportedCRS.match(/(EPSG).*:(\d+)/i);res[entry.Identifier]={crs:crsMatch?"EPSG:"+crsMatch[2]:entry.SupportedCRS,matrix:entry.TileMatrix};return res},{});var layers=capabilities.Contents.Layer.map(function(layer){var _capabilities$Service,_capabilities$Service2,_capabilities$Service3;var styles=_this.getWMTSLayerStyles(capabilities,capabilitiesUrl,layer,tileMatrices);return{capabilitiesUrl:capabilitiesUrl,title:layer.Title,name:layer.Identifier,bbox:{crs:"EPSG:4326",bounds:layer.WGS84BoundingBox},sublayers:styles,"abstract":layer.Abstract,attribution:{Title:((_capabilities$Service=capabilities.ServiceProvider)===null||_capabilities$Service===void 0?void 0:_capabilities$Service.ProviderName)||((_capabilities$Service2=capabilities.ServiceIdentification)===null||_capabilities$Service2===void 0?void 0:_capabilities$Service2.Title)||"",OnlineResource:((_capabilities$Service3=capabilities.ServiceProvider)===null||_capabilities$Service3===void 0?void 0:_capabilities$Service3.ProviderSite)||""}}});layers.sort(function(a,b){return a.title.localeCompare(b.title)});return layers},getWMTSLayerStyles:function getWMTSLayerStyles(capabilities,capabilitiesUrl,layer,tileMatrices){var _this2=this;if(layer.Style.length===1){return this.getWMTSLayerTileMatrixSetLinks(capabilities,capabilitiesUrl,layer,tileMatrices,layer.Style[0].Identifier)}else{return layer.Style.map(function(style){return{title:style.Identifier,sublayers:_this2.getWMTSLayerTileMatrixSetLinks(capabilities,capabilitiesUrl,layer,tileMatrices,style.Identifier)}})}},getWMTSLayerTileMatrixSetLinks:function getWMTSLayerTileMatrixSetLinks(capabilities,capabilitiesUrl,layer,tileMatrices,style){var tileMatrixSetLinks=layer.TileMatrixSetLink;var layerLinks=tileMatrixSetLinks.map(function(link){var _MiscUtils$ensureArra,_capabilities$Operati,_capabilities$Service4,_capabilities$Service5,_capabilities$Service6;var tileMatrixSet=link.TileMatrixSet;var topMatrix=tileMatrices[tileMatrixSet].matrix[0];var tileMatrixPrefix=topMatrix.Identifier.includes(":")?topMatrix.Identifier.replace(/:[0-9]+$/,""):"";var origin=[topMatrix.TopLeftCorner[0],topMatrix.TopLeftCorner[1]];try{var axisOrder=CoordinatesUtils.getAxisOrder(tileMatrices[tileMatrixSet].crs).substr(0,2);if(axisOrder==="ne"){origin=[topMatrix.TopLeftCorner[1],topMatrix.TopLeftCorner[0]]}}catch(e){// eslint-disable-next-line
8
8
  console.warn("Could not determine axis order for projection "+tileMatrices[tileMatrixSet].crs);return null}// https://openlayers.org/en/latest/examples/wmts-ign.html
9
9
  var proj=getProjection(tileMatrices[tileMatrixSet].crs);var maxResolution=proj!==null&&proj!==void 0&&proj.getExtent()?getWidth(proj===null||proj===void 0?void 0:proj.getExtent())/topMatrix.TileWidth:null;var resolutions=tileMatrices[tileMatrixSet].matrix.map(function(entry,index){// 0.00028: assumed pixel width in meters, as per WMTS standard
10
- return maxResolution?maxResolution/Math.pow(2,index):entry.ScaleDenominator*0.00028});var format=(_MiscUtils$ensureArra=MiscUtils.ensureArray(layer.Format).find(function(fmt){return fmt==="image/png"}))!==null&&_MiscUtils$ensureArra!==void 0?_MiscUtils$ensureArra:MiscUtils.ensureArray(layer.Format)[0];var getTile=MiscUtils.ensureArray(capabilities.OperationsMetadata.GetTile.DCP.HTTP.Get)[0];var getEncoding=MiscUtils.ensureArray(getTile.Constraint).find(function(c){return c.name==="GetEncoding"});var requestEncoding=MiscUtils.ensureArray(getEncoding.AllowedValues.Value)[0];var serviceUrl=null;if(requestEncoding==="KVP"){serviceUrl=getTile.href}else{serviceUrl=layer.ResourceURL.find(function(u){return u.resourceType==="tile"}).template;(layer.Dimension||[]).forEach(function(dim){serviceUrl=serviceUrl.replace("{"+dim.Identifier+"}",dim.Default)})}return{type:"wmts",url:serviceUrl,capabilitiesUrl:capabilitiesUrl,title:layer.Title+" - "+tileMatrixSet,name:layer.Identifier,tileMatrixPrefix:tileMatrixPrefix,tileMatrixSet:tileMatrixSet,originX:origin[0],originY:origin[1],projection:tileMatrices[tileMatrixSet].crs,tileSize:[topMatrix.TileWidth,topMatrix.TileHeight],style:style,bbox:{crs:"EPSG:4326",bounds:layer.WGS84BoundingBox},format:format,requestEncoding:requestEncoding,resolutions:resolutions,"abstract":layer.Abstract,attribution:{Title:((_capabilities$Service4=capabilities.ServiceProvider)===null||_capabilities$Service4===void 0?void 0:_capabilities$Service4.ProviderName)||((_capabilities$Service5=capabilities.ServiceIdentification)===null||_capabilities$Service5===void 0?void 0:_capabilities$Service5.Title)||"",OnlineResource:((_capabilities$Service6=capabilities.ServiceProvider)===null||_capabilities$Service6===void 0?void 0:_capabilities$Service6.ProviderSite)||""}}}).filter(Boolean);return layerLinks},getWMSLayers:function getWMSLayers(capabilities,calledServiceUrl){var _capabilities,_capabilities2,_capabilities$WMS_Cap,_this3=this;var asGroup=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(!((_capabilities=capabilities)!==null&&_capabilities!==void 0&&_capabilities.WMS_Capabilities)&&!((_capabilities2=capabilities)!==null&&_capabilities2!==void 0&&_capabilities2.WMT_MS_Capabilities)){return[]}capabilities=(_capabilities$WMS_Cap=capabilities.WMS_Capabilities)!==null&&_capabilities$WMS_Cap!==void 0?_capabilities$WMS_Cap:capabilities.WMT_MS_Capabilities;var calledUrlParts=url.parse(calledServiceUrl,true);var extwmsparams={};calledUrlParts.query=Object.keys(calledUrlParts.query).filter(function(key){// Extract extwms params
10
+ return maxResolution?maxResolution/Math.pow(2,index):entry.ScaleDenominator*0.00028});var format=(_MiscUtils$ensureArra=MiscUtils.ensureArray(layer.Format).find(function(fmt){return fmt==="image/png"}))!==null&&_MiscUtils$ensureArra!==void 0?_MiscUtils$ensureArra:MiscUtils.ensureArray(layer.Format)[0];var getTile=MiscUtils.ensureArray((_capabilities$Operati=capabilities.OperationsMetadata)===null||_capabilities$Operati===void 0||(_capabilities$Operati=_capabilities$Operati.GetTile)===null||_capabilities$Operati===void 0||(_capabilities$Operati=_capabilities$Operati.DCP)===null||_capabilities$Operati===void 0||(_capabilities$Operati=_capabilities$Operati.HTTP)===null||_capabilities$Operati===void 0?void 0:_capabilities$Operati.Get)[0];var getEncoding=MiscUtils.ensureArray(getTile===null||getTile===void 0?void 0:getTile.Constraint).find(function(c){return c.name==="GetEncoding"});var requestEncoding=MiscUtils.ensureArray(getEncoding===null||getEncoding===void 0?void 0:getEncoding.AllowedValues.Value)[0];var serviceUrl=null;if(requestEncoding==="KVP"){serviceUrl=getTile.href}else{serviceUrl=layer.ResourceURL.find(function(u){return u.resourceType==="tile"}).template;(layer.Dimension||[]).forEach(function(dim){serviceUrl=serviceUrl.replace("{"+dim.Identifier+"}",dim.Default)})}return{type:"wmts",url:serviceUrl,capabilitiesUrl:capabilitiesUrl,title:layer.Title+" - "+tileMatrixSet,name:layer.Identifier,tileMatrixPrefix:tileMatrixPrefix,tileMatrixSet:tileMatrixSet,originX:origin[0],originY:origin[1],projection:tileMatrices[tileMatrixSet].crs,tileSize:[topMatrix.TileWidth,topMatrix.TileHeight],style:style,bbox:{crs:"EPSG:4326",bounds:layer.WGS84BoundingBox},format:format,requestEncoding:requestEncoding,resolutions:resolutions,"abstract":layer.Abstract,attribution:{Title:((_capabilities$Service4=capabilities.ServiceProvider)===null||_capabilities$Service4===void 0?void 0:_capabilities$Service4.ProviderName)||((_capabilities$Service5=capabilities.ServiceIdentification)===null||_capabilities$Service5===void 0?void 0:_capabilities$Service5.Title)||"",OnlineResource:((_capabilities$Service6=capabilities.ServiceProvider)===null||_capabilities$Service6===void 0?void 0:_capabilities$Service6.ProviderSite)||""}}}).filter(Boolean);return layerLinks},getWMSLayers:function getWMSLayers(capabilities,calledServiceUrl){var _capabilities,_capabilities2,_capabilities$WMS_Cap,_this3=this;var asGroup=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(!((_capabilities=capabilities)!==null&&_capabilities!==void 0&&_capabilities.WMS_Capabilities)&&!((_capabilities2=capabilities)!==null&&_capabilities2!==void 0&&_capabilities2.WMT_MS_Capabilities)){return[]}capabilities=(_capabilities$WMS_Cap=capabilities.WMS_Capabilities)!==null&&_capabilities$WMS_Cap!==void 0?_capabilities$WMS_Cap:capabilities.WMT_MS_Capabilities;var calledUrlParts=url.parse(calledServiceUrl,true);var extwmsparams={};calledUrlParts.query=Object.keys(calledUrlParts.query).filter(function(key){// Extract extwms params
11
11
  if(key.toUpperCase().startsWith("EXTWMS.")){extwmsparams[key.substring(7)]=calledUrlParts.query[key];return false}// Filter service and request from calledServiceUrl, but keep other parameters (i.e. MAP)
12
12
  return!["service","request"].includes(key.toLowerCase())}).reduce(function(res,key){return _objectSpread(_objectSpread({},res),{},_defineProperty({},key,calledUrlParts.query[key]))},{});delete calledUrlParts.search;var topLayer=capabilities.Capability.Layer;var getMapUrl=this.mergeCalledServiceUrlQuery(ServiceLayerUtils.getDCPTypes(capabilities.Capability.Request.GetMap.DCPType).HTTP.Get.OnlineResource.href,calledUrlParts);var featureInfoUrl=getMapUrl;try{featureInfoUrl=this.mergeCalledServiceUrlQuery(ServiceLayerUtils.getDCPTypes(capabilities.Capability.Request.GetFeatureInfo.DCPType).HTTP.Get.OnlineResource.href,calledUrlParts)}catch(e){// pass
13
13
  }var mapFormats=null;try{mapFormats=MiscUtils.ensureArray(capabilities.Capability.Request.GetMap.Format)}catch(e){mapFormats=["image/png"]}var infoFormats=null;try{infoFormats=MiscUtils.ensureArray(capabilities.Capability.Request.GetFeatureInfo.Format)}catch(e){infoFormats=["text/plain"]}var externalLayerFeatureInfoFormats=ConfigUtils.getConfigProp("externalLayerFeatureInfoFormats")||{};for(var _i=0,_Object$keys=Object.keys(externalLayerFeatureInfoFormats);_i<_Object$keys.length;_i++){var entry=_Object$keys[_i];if(featureInfoUrl.toLowerCase().includes(entry.toLowerCase())){infoFormats=[externalLayerFeatureInfoFormats[entry]];break}}var version=capabilities.version;var supportedCrs=MiscUtils.ensureArray(topLayer.crs);var topLayerExtent=null;if(topLayer.EX_GeographicBoundingBox){topLayerExtent={crs:"EPSG:4326",bounds:[parseFloat(topLayer.EX_GeographicBoundingBox.westBoundLongitude),parseFloat(topLayer.EX_GeographicBoundingBox.southBoundLatitude),parseFloat(topLayer.EX_GeographicBoundingBox.eastBoundLongitude),parseFloat(topLayer.EX_GeographicBoundingBox.northBoundLatitude)]}}if(!topLayer.Layer||asGroup){return[this.getWMSLayerParams(topLayer,supportedCrs,calledUrlParts,version,getMapUrl,featureInfoUrl,mapFormats,infoFormats,extwmsparams,topLayerExtent)].filter(function(entry){return entry})}else{var entries=MiscUtils.ensureArray(topLayer.Layer).map(function(layer){return _this3.getWMSLayerParams(layer,supportedCrs,calledUrlParts,version,getMapUrl,featureInfoUrl,mapFormats,infoFormats,extwmsparams,topLayerExtent)}).filter(function(entry){return entry});return entries.sort(function(a,b){return strcmp(a.title,b.title)})}},getWMSLayerParams:function getWMSLayerParams(layer,parentCrs,calledUrlParts,version,getMapUrl,featureInfoUrl,mapFormats,infoFormats,extwmsparams,topLayerExtent){var _this4=this,_Object$keys$,_layer$Attribution,_layer$Attribution2,_layer$opacity;var groupbbox=arguments.length>10&&arguments[10]!==undefined?arguments[10]:null;var supportedCrs=MiscUtils.ensureArray(layer.CRS);if(isEmpty(supportedCrs)){supportedCrs=_toConsumableArray(parentCrs||[])}else{supportedCrs=[].concat(_toConsumableArray(parentCrs||[]),_toConsumableArray(supportedCrs))}var sublayers=[];var sublayerbounds={};if(!isEmpty(layer.Layer)){sublayers=MiscUtils.ensureArray(layer.Layer).map(function(sublayer){return _this4.getWMSLayerParams(sublayer,supportedCrs,calledUrlParts,version,getMapUrl,featureInfoUrl,mapFormats,infoFormats,extwmsparams,topLayerExtent,sublayerbounds)}).filter(function(entry){return entry})}var bbox=null;if(isEmpty(layer.BoundingBox)){if(!isEmpty(sublayerbounds)){bbox=sublayerbounds}else if(topLayerExtent){bbox=topLayerExtent}}else{var _boundingBox$CRS;var boundingBox=MiscUtils.ensureArray(layer.BoundingBox)[0];bbox={crs:(_boundingBox$CRS=boundingBox.CRS)!==null&&_boundingBox$CRS!==void 0?_boundingBox$CRS:boundingBox.SRS,bounds:[boundingBox.minx,boundingBox.miny,boundingBox.maxx,boundingBox.maxy].map(Number)}}if(groupbbox!==null){if(isEmpty(groupbbox)){Object.assign(groupbbox,bbox)}else if(bbox&&bbox.crs===groupbbox.crs){groupbbox.bounds[0]=Math.min(bbox.bounds[0],groupbbox.bounds[0]);groupbbox.bounds[1]=Math.min(bbox.bounds[1],groupbbox.bounds[1]);groupbbox.bounds[2]=Math.max(bbox.bounds[2],groupbbox.bounds[2]);groupbbox.bounds[3]=Math.max(bbox.bounds[3],groupbbox.bounds[3])}}var legendUrl=getMapUrl;try{legendUrl=this.mergeCalledServiceUrlQuery(MiscUtils.ensureArray(MiscUtils.ensureArray(layer.Style)[0].LegendURL)[0].OnlineResource.href,calledUrlParts)}catch(e){/* pass */}var styles=MiscUtils.ensureArray(layer.Style).reduce(function(res,entry){return _objectSpread(_objectSpread({},res),{},_defineProperty({},String(entry.Name),entry.Title))},{});var style=styles["default"]?"default":(_Object$keys$=Object.keys(styles)[0])!==null&&_Object$keys$!==void 0?_Object$keys$:"";var attribution={Title:(_layer$Attribution=layer.Attribution)===null||_layer$Attribution===void 0?void 0:_layer$Attribution.Title,OnlineResource:(_layer$Attribution2=layer.Attribution)===null||_layer$Attribution2===void 0||(_layer$Attribution2=_layer$Attribution2.OnlineResource)===null||_layer$Attribution2===void 0?void 0:_layer$Attribution2.href};return{type:"wms",name:String(layer.Name),title:layer.Title,"abstract":layer.Abstract,attribution:attribution,url:getMapUrl,featureInfoUrl:featureInfoUrl,legendUrl:legendUrl,version:version,infoFormats:infoFormats,mapFormats:mapFormats,queryable:layer.queryable===1,sublayers:isEmpty(sublayers)?null:sublayers,expanded:false,bbox:bbox,visibility:layer.visibilityChecked!==0,opacity:((_layer$opacity=layer.opacity)!==null&&_layer$opacity!==void 0?_layer$opacity:1)*255,extwmsparams:extwmsparams,minScale:layer.MinScaleDenominator!==undefined?Number(layer.MinScaleDenominator):undefined,maxScale:layer.MinScaleDenominator!==undefined?Number(layer.MaxScaleDenominator):undefined,styles:styles,style:style}},getWFSLayers:function getWFSLayers(capabilities,calledServiceUrl,mapCrs){var _capabilities$WFS_Cap;var calledUrlParts=url.parse(calledServiceUrl,true);// Filter service and request from calledServiceUrl, but keep other parameters (i.e. MAP)