qwc2 2025.10.9 → 2025.10.14
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.
- package/actions/display.js +30 -1
- package/actions/editing.js +22 -1
- package/actions/layerinfo.js +13 -1
- package/actions/layers.js +213 -3
- package/actions/localConfig.js +58 -1
- package/actions/locale.js +21 -1
- package/actions/locate.js +26 -1
- package/actions/logging.js +10 -1
- package/actions/map.js +105 -2
- package/actions/measurement.js +12 -1
- package/actions/processNotifications.js +37 -1
- package/actions/redlining.js +18 -1
- package/actions/redliningPick.js +12 -1
- package/actions/search.js +12 -1
- package/actions/serviceinfo.js +12 -1
- package/actions/task.js +55 -3
- package/actions/theme.js +339 -19
- package/actions/windows.js +164 -5
- package/components/AppMenu.js +435 -3
- package/components/AttributeForm.js +928 -32
- package/components/AttributeTableWidget.js +1105 -13
- package/components/AutoEditForm.js +189 -3
- package/components/CoordinateDisplayer.js +78 -2
- package/components/EditComboField.js +190 -6
- package/components/EditUploadField.js +315 -3
- package/components/ExportSelection.js +203 -2
- package/components/FullscreenSwitcher.js +90 -3
- package/components/Icon.js +81 -2
- package/components/IdentifyViewer.js +1161 -6
- package/components/ImportLayer.js +718 -20
- package/components/LayerInfoWindow.js +145 -2
- package/components/LinkFeatureForm.js +246 -5
- package/components/MapButton.js +88 -2
- package/components/MapSelection.js +287 -8
- package/components/MessageBar.js +68 -2
- package/components/NumericInputWindow.js +359 -2
- package/components/PickFeature.js +266 -2
- package/components/PluginsContainer.js +227 -8
- package/components/PrintSelection.js +620 -49
- package/components/ProcessNotifications.js +104 -2
- package/components/QtDesignerForm.js +1137 -18
- package/components/ResizeableWindow.js +591 -8
- package/components/SearchBox.js +1307 -20
- package/components/ServiceInfoWindow.js +107 -2
- package/components/SideBar.js +204 -4
- package/components/StandardApp.js +381 -20
- package/components/Swipeable.js +15 -1
- package/components/TaskBar.js +85 -2
- package/components/ThemeLayersListWindow.js +216 -4
- package/components/ThemeList.js +381 -7
- package/components/Toolbar.js +106 -2
- package/components/WindowManager.js +178 -2
- package/components/map/OlLayer.js +257 -6
- package/components/map/OlMap.js +405 -5
- package/components/map/layers/BingLayer.js +31 -2
- package/components/map/layers/GoogleLayer.js +222 -19
- package/components/map/layers/GraticuleLayer.js +21 -1
- package/components/map/layers/ImageLayer.js +15 -1
- package/components/map/layers/MVTLayer.js +52 -2
- package/components/map/layers/OSMLayer.js +24 -2
- package/components/map/layers/OverlayLayer.js +55 -3
- package/components/map/layers/VectorLayer.js +173 -8
- package/components/map/layers/WFSLayer.js +220 -6
- package/components/map/layers/WMSLayer.js +180 -6
- package/components/map/layers/WMTSLayer.js +67 -3
- package/components/map/layers/XYZLayer.js +24 -2
- package/components/map/layers/index.js +28 -1
- package/components/map3d/EditDataset3D.js +190 -3
- package/components/map3d/HeightProfile3D.js +402 -3
- package/components/map3d/ImportObjects3D.js +162 -2
- package/components/map3d/Map3D.js +1304 -38
- package/components/map3d/MapControls3D.js +392 -7
- package/components/map3d/SearchField3D.js +183 -11
- package/components/map3d/View3DSwitcher.js +98 -2
- package/components/map3d/drawtool/CreateTool3D.js +174 -4
- package/components/map3d/drawtool/EditTool3D.js +590 -6
- package/components/map3d/drawtool/NumericInput3D.js +336 -4
- package/components/map3d/layers/GeoTIFFLayer3D.js +15 -1
- package/components/map3d/layers/VectorLayer3D.js +53 -2
- package/components/map3d/layers/WFSLayer3D.js +109 -3
- package/components/map3d/layers/WMSLayer3D.js +70 -2
- package/components/map3d/layers/WMTSLayer3D.js +27 -3
- package/components/map3d/layers/index.js +14 -1
- package/components/map3d/utils/FirstPersonControls3D.js +423 -16
- package/components/map3d/utils/MiscUtils3D.js +221 -13
- package/components/map3d/utils/OrbitControls3D.js +176 -5
- package/components/map3d/utils/Tiles3DStyle.js +238 -9
- package/components/share/ShareLink.js +54 -2
- package/components/share/ShareQRCode.js +62 -2
- package/components/share/ShareSocials.js +125 -3
- package/components/timeline/FixedTimeline.js +236 -5
- package/components/timeline/InfiniteTimeline.js +347 -8
- package/components/timeline/TimelineFeaturesSlider.js +439 -5
- package/components/widgets/AccordeonWidget.js +96 -2
- package/components/widgets/ButtonBar.js +124 -2
- package/components/widgets/ColorButton.js +201 -3
- package/components/widgets/ComboBox.js +166 -2
- package/components/widgets/CopyButton.js +110 -2
- package/components/widgets/DateTimeInput.js +100 -3
- package/components/widgets/EditableSelect.js +230 -3
- package/components/widgets/FileSelector.js +128 -4
- package/components/widgets/Input.js +124 -2
- package/components/widgets/InputContainer.js +96 -2
- package/components/widgets/LayerCatalogWidget.js +219 -3
- package/components/widgets/MenuButton.js +157 -1
- package/components/widgets/ModalDialog.js +64 -2
- package/components/widgets/NavBar.js +119 -2
- package/components/widgets/NumberInput.js +226 -4
- package/components/widgets/PopupMenu.js +72 -1
- package/components/widgets/Primitives.js +6 -1
- package/components/widgets/ReCaptchaWidget.js +55 -1
- package/components/widgets/SearchWidget.js +255 -2
- package/components/widgets/Spinner.js +44 -2
- package/components/widgets/SuggestionInput.js +77 -2
- package/components/widgets/TextInput.js +308 -2
- package/components/widgets/ToggleSwitch.js +85 -2
- package/components/widgets/VectorLayerPicker.js +85 -3
- package/libs/openlayers.js +225 -5
- package/package.json +1 -1
- package/plugins/API.js +358 -15
- package/plugins/AttributeTable.js +109 -3
- package/plugins/Authentication.js +130 -5
- package/plugins/BackgroundSwitcher.js +218 -4
- package/plugins/Bookmark.js +289 -3
- package/plugins/BottomBar.js +298 -4
- package/plugins/CookiePopup.js +67 -3
- package/plugins/Cyclomedia.js +442 -5
- package/plugins/Editing.js +497 -9
- package/plugins/FeatureForm.js +366 -4
- package/plugins/FeatureSearch.js +458 -3
- package/plugins/GeometryDigitizer.js +664 -7
- package/plugins/HeightProfile.js +763 -15
- package/plugins/Help.js +102 -3
- package/plugins/HomeButton.js +80 -3
- package/plugins/Identify.js +543 -5
- package/plugins/LayerCatalog.js +215 -4
- package/plugins/LayerTree.js +1194 -6
- package/plugins/LocateButton.js +94 -3
- package/plugins/Map.js +320 -16
- package/plugins/MapCompare.js +94 -3
- package/plugins/MapCopyright.js +127 -5
- package/plugins/MapExport.js +613 -20
- package/plugins/MapFilter.js +868 -12
- package/plugins/MapInfoTooltip.js +277 -3
- package/plugins/MapLegend.js +253 -4
- package/plugins/MapTip.js +290 -4
- package/plugins/Measure.js +220 -4
- package/plugins/NewsPopup.js +137 -3
- package/plugins/OverviewMap.js +167 -7
- package/plugins/Panoramax.js +340 -2
- package/plugins/Portal.js +199 -4
- package/plugins/Print.js +1231 -15
- package/plugins/Redlining.js +750 -6
- package/plugins/Reports.js +332 -3
- package/plugins/Routing.js +1278 -15
- package/plugins/ScratchDrawing.js +173 -5
- package/plugins/Settings.js +241 -4
- package/plugins/Share.js +198 -3
- package/plugins/StartupMarker.js +84 -4
- package/plugins/TaskButton.js +88 -3
- package/plugins/ThemeSwitcher.js +164 -4
- package/plugins/TimeManager.js +971 -10
- package/plugins/TopBar.js +300 -7
- package/plugins/TourGuide.js +213 -2
- package/plugins/ValueTool.js +419 -4
- package/plugins/View3D.js +519 -14
- package/plugins/ZoomButtons.js +165 -3
- package/plugins/map/EditingSupport.js +199 -7
- package/plugins/map/LocateSupport.js +260 -4
- package/plugins/map/MeasurementSupport.js +216 -8
- package/plugins/map/RedliningPickSupport.js +201 -7
- package/plugins/map/RedliningSupport.js +726 -17
- package/plugins/map/SnapInteraction.js +101 -1
- package/plugins/map/SnapSupport.js +210 -2
- package/plugins/map/SnappingSupport.js +356 -17
- package/plugins/map3d/BackgroundSwitcher3D.js +44 -3
- package/plugins/map3d/BottomBar3D.js +118 -3
- package/plugins/map3d/Compare3D.js +422 -8
- package/plugins/map3d/Draw3D.js +353 -6
- package/plugins/map3d/ExportObjects3D.js +393 -18
- package/plugins/map3d/HideObjects3D.js +313 -12
- package/plugins/map3d/Identify3D.js +283 -12
- package/plugins/map3d/LayerTree3D.js +323 -3
- package/plugins/map3d/MapCopyright3D.js +128 -5
- package/plugins/map3d/MapExport3D.js +590 -10
- package/plugins/map3d/MapLight3D.js +553 -6
- package/plugins/map3d/Measure3D.js +571 -20
- package/plugins/map3d/OverviewMap3D.js +169 -3
- package/plugins/map3d/Settings3D.js +73 -3
- package/plugins/map3d/TopBar3D.js +207 -9
- package/plugins/redlining/RedliningBufferSupport.js +206 -3
- package/reducers/display.js +34 -2
- package/reducers/editing.js +68 -3
- package/reducers/index.js +9 -1
- package/reducers/layerinfo.js +26 -2
- package/reducers/layers.js +456 -9
- package/reducers/localConfig.js +122 -2
- package/reducers/locale.js +38 -2
- package/reducers/locate.js +40 -2
- package/reducers/map.js +176 -5
- package/reducers/measurement.js +42 -2
- package/reducers/processNotifications.js +49 -2
- package/reducers/redlining.js +50 -2
- package/reducers/redliningPick.js +27 -2
- package/reducers/search.js +20 -1
- package/reducers/serviceinfo.js +25 -2
- package/reducers/task.js +45 -2
- package/reducers/theme.js +51 -2
- package/reducers/windows.js +203 -2
- package/scripts/dist.sh +1 -1
- package/scripts/gen-plugin-docs.js +152 -2
- package/scripts/makeIconkit.js +85 -6
- package/scripts/themesConfig.js +742 -40
- package/scripts/updateTranslations.js +251 -10
- package/selectors/searchproviders.js +44 -2
- package/stores/StandardStore.js +42 -2
- package/utils/ConfigUtils.js +84 -3
- package/utils/CoordinatesUtils.js +234 -23
- package/utils/DxfUtils.js +237 -11
- package/utils/EditingInterface.js +421 -87
- package/utils/EditingUtils.js +357 -13
- package/utils/ElevationInterface.js +83 -22
- package/utils/FeatureStyles.js +429 -5
- package/utils/IdentifyUtils.js +443 -7
- package/utils/ImageEditor.js +79 -9
- package/utils/LayerUtils.js +1516 -50
- package/utils/LocaleUtils.js +117 -7
- package/utils/MapUtils.js +241 -59
- package/utils/MeasureUtils.js +323 -2
- package/utils/MiscUtils.js +189 -11
- package/utils/PermaLinkUtils.js +429 -6
- package/utils/PluginStore.js +27 -1
- package/utils/ResourceRegistry.js +15 -1
- package/utils/RoutingInterface.js +307 -7
- package/utils/SearchProviders.js +722 -19
- package/utils/ServiceLayerUtils.js +669 -14
- package/utils/Signal.js +32 -2
- package/utils/ThemeUtils.js +341 -7
- package/utils/VectorLayerUtils.js +589 -15
- package/utils/expr_grammar/grammar.js +2239 -2
- package/utils/expr_grammar/test.js +65 -3
|
@@ -1,19 +1,674 @@
|
|
|
1
|
-
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
5
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
6
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
7
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
8
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
10
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
11
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
12
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
13
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
17
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
|
+
/**
|
|
2
19
|
* Copyright 2017-2024 Sourcepole AG
|
|
3
20
|
* All rights reserved.
|
|
4
21
|
*
|
|
5
22
|
* This source code is licensed under the BSD-style license found in the
|
|
6
23
|
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import axios from 'axios';
|
|
27
|
+
import deepmerge from 'deepmerge';
|
|
28
|
+
import { XMLParser } from 'fast-xml-parser';
|
|
29
|
+
import isEmpty from 'lodash.isempty';
|
|
30
|
+
import ol from 'openlayers';
|
|
31
|
+
import randomColor from 'randomcolor';
|
|
32
|
+
import url from 'url';
|
|
33
|
+
import { LayerRole } from '../actions/layers';
|
|
34
|
+
import ConfigUtils from './ConfigUtils';
|
|
35
|
+
import CoordinatesUtils from './CoordinatesUtils';
|
|
36
|
+
import LayerUtils from './LayerUtils';
|
|
37
|
+
import MiscUtils from './MiscUtils';
|
|
38
|
+
function strcmp(a, b) {
|
|
39
|
+
var al = a.toLowerCase();
|
|
40
|
+
var bl = b.toLowerCase();
|
|
41
|
+
if (al < bl) {
|
|
42
|
+
return -1;
|
|
43
|
+
} else if (al > bl) {
|
|
44
|
+
return 1;
|
|
45
|
+
}
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
48
|
+
var ServiceLayerUtils = {
|
|
49
|
+
getWMTSLayers: function getWMTSLayers(capabilities, capabilitiesUrl, mapCrs) {
|
|
50
|
+
var _this = this;
|
|
51
|
+
if (!(capabilities !== null && capabilities !== void 0 && capabilities.Contents)) {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
var tileMatrices = capabilities.Contents.TileMatrixSet.reduce(function (res, entry) {
|
|
55
|
+
var crsMatch = entry.SupportedCRS.match(/(EPSG).*:(\d+)/i);
|
|
56
|
+
res[entry.Identifier] = {
|
|
57
|
+
crs: crsMatch ? "EPSG:" + crsMatch[2] : entry.SupportedCRS,
|
|
58
|
+
matrix: entry.TileMatrix
|
|
59
|
+
};
|
|
60
|
+
return res;
|
|
61
|
+
}, {});
|
|
62
|
+
var layers = capabilities.Contents.Layer.map(function (layer) {
|
|
63
|
+
var _capabilities$Service, _capabilities$Service2, _capabilities$Service3;
|
|
64
|
+
var styles = _this.getWMTSLayerStyles(capabilities, capabilitiesUrl, layer, tileMatrices);
|
|
65
|
+
return {
|
|
66
|
+
capabilitiesUrl: capabilitiesUrl,
|
|
67
|
+
title: layer.Title,
|
|
68
|
+
name: layer.Identifier,
|
|
69
|
+
bbox: {
|
|
70
|
+
crs: "EPSG:4326",
|
|
71
|
+
bounds: layer.WGS84BoundingBox
|
|
72
|
+
},
|
|
73
|
+
sublayers: styles,
|
|
74
|
+
"abstract": layer.Abstract,
|
|
75
|
+
attribution: {
|
|
76
|
+
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) || "",
|
|
77
|
+
OnlineResource: ((_capabilities$Service3 = capabilities.ServiceProvider) === null || _capabilities$Service3 === void 0 ? void 0 : _capabilities$Service3.ProviderSite) || ""
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
layers.sort(function (a, b) {
|
|
82
|
+
return a.title.localeCompare(b.title);
|
|
83
|
+
});
|
|
84
|
+
return layers;
|
|
85
|
+
},
|
|
86
|
+
getWMTSLayerStyles: function getWMTSLayerStyles(capabilities, capabilitiesUrl, layer, tileMatrices) {
|
|
87
|
+
var _this2 = this;
|
|
88
|
+
if (layer.Style.length === 1) {
|
|
89
|
+
return this.getWMTSLayerTileMatrixSetLinks(capabilities, capabilitiesUrl, layer, tileMatrices, layer.Style[0].Identifier);
|
|
90
|
+
} else {
|
|
91
|
+
return layer.Style.map(function (style) {
|
|
92
|
+
return {
|
|
93
|
+
title: style.Identifier,
|
|
94
|
+
sublayers: _this2.getWMTSLayerTileMatrixSetLinks(capabilities, capabilitiesUrl, layer, tileMatrices, style.Identifier)
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
getWMTSLayerTileMatrixSetLinks: function getWMTSLayerTileMatrixSetLinks(capabilities, capabilitiesUrl, layer, tileMatrices, style) {
|
|
100
|
+
var tileMatrixSetLinks = layer.TileMatrixSetLink;
|
|
101
|
+
var layerLinks = tileMatrixSetLinks.map(function (link) {
|
|
102
|
+
var _MiscUtils$ensureArra, _capabilities$Operati, _capabilities$Service4, _capabilities$Service5, _capabilities$Service6;
|
|
103
|
+
var tileMatrixSet = link.TileMatrixSet;
|
|
104
|
+
var topMatrix = tileMatrices[tileMatrixSet].matrix[0];
|
|
105
|
+
var tileMatrixPrefix = topMatrix.Identifier.includes(":") ? topMatrix.Identifier.replace(/:[0-9]+$/, "") : "";
|
|
106
|
+
var origin = [topMatrix.TopLeftCorner[0], topMatrix.TopLeftCorner[1]];
|
|
107
|
+
try {
|
|
108
|
+
var axisOrder = CoordinatesUtils.getAxisOrder(tileMatrices[tileMatrixSet].crs).substr(0, 2);
|
|
109
|
+
if (axisOrder === 'ne') {
|
|
110
|
+
origin = [topMatrix.TopLeftCorner[1], topMatrix.TopLeftCorner[0]];
|
|
111
|
+
}
|
|
112
|
+
} catch (e) {
|
|
113
|
+
// eslint-disable-next-line
|
|
114
|
+
console.warn("Could not determine axis order for projection " + tileMatrices[tileMatrixSet].crs);
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
var matrixIds = [];
|
|
118
|
+
var resolutions = tileMatrices[tileMatrixSet].matrix.map(function (entry, index) {
|
|
119
|
+
// 0.00028: assumed pixel width in meters, as per WMTS standard
|
|
120
|
+
matrixIds.push(entry.Identifier);
|
|
121
|
+
return entry.ScaleDenominator * 0.00028;
|
|
122
|
+
});
|
|
123
|
+
var format = (_MiscUtils$ensureArra = MiscUtils.ensureArray(layer.Format).find(function (fmt) {
|
|
124
|
+
return fmt === "image/png";
|
|
125
|
+
})) !== null && _MiscUtils$ensureArra !== void 0 ? _MiscUtils$ensureArra : MiscUtils.ensureArray(layer.Format)[0];
|
|
126
|
+
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];
|
|
127
|
+
var getEncoding = MiscUtils.ensureArray(getTile === null || getTile === void 0 ? void 0 : getTile.Constraint).find(function (c) {
|
|
128
|
+
return c.name === "GetEncoding";
|
|
129
|
+
});
|
|
130
|
+
var requestEncoding = MiscUtils.ensureArray(getEncoding === null || getEncoding === void 0 ? void 0 : getEncoding.AllowedValues.Value)[0];
|
|
131
|
+
var serviceUrl = null;
|
|
132
|
+
if (requestEncoding === 'KVP') {
|
|
133
|
+
serviceUrl = getTile.href;
|
|
134
|
+
} else {
|
|
135
|
+
serviceUrl = layer.ResourceURL.find(function (u) {
|
|
136
|
+
return u.resourceType === "tile";
|
|
137
|
+
}).template;
|
|
138
|
+
(layer.Dimension || []).forEach(function (dim) {
|
|
139
|
+
serviceUrl = serviceUrl.replace("{" + dim.Identifier + "}", dim.Default);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
type: "wmts",
|
|
144
|
+
url: serviceUrl,
|
|
145
|
+
capabilitiesUrl: capabilitiesUrl,
|
|
146
|
+
title: layer.Title + " - " + tileMatrixSet,
|
|
147
|
+
name: layer.Identifier,
|
|
148
|
+
tileMatrixPrefix: tileMatrixPrefix,
|
|
149
|
+
tileMatrixSet: tileMatrixSet,
|
|
150
|
+
originX: origin[0],
|
|
151
|
+
originY: origin[1],
|
|
152
|
+
projection: tileMatrices[tileMatrixSet].crs,
|
|
153
|
+
tileSize: [topMatrix.TileWidth, topMatrix.TileHeight],
|
|
154
|
+
style: style,
|
|
155
|
+
bbox: {
|
|
156
|
+
crs: "EPSG:4326",
|
|
157
|
+
bounds: layer.WGS84BoundingBox
|
|
158
|
+
},
|
|
159
|
+
format: format,
|
|
160
|
+
requestEncoding: requestEncoding,
|
|
161
|
+
resolutions: resolutions,
|
|
162
|
+
matrixIds: matrixIds,
|
|
163
|
+
"abstract": layer.Abstract,
|
|
164
|
+
attribution: {
|
|
165
|
+
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) || "",
|
|
166
|
+
OnlineResource: ((_capabilities$Service6 = capabilities.ServiceProvider) === null || _capabilities$Service6 === void 0 ? void 0 : _capabilities$Service6.ProviderSite) || ""
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
}).filter(Boolean);
|
|
170
|
+
return layerLinks;
|
|
171
|
+
},
|
|
172
|
+
getWMSLayers: function getWMSLayers(capabilities, calledServiceUrl) {
|
|
173
|
+
var _capabilities,
|
|
174
|
+
_capabilities2,
|
|
175
|
+
_capabilities$WMS_Cap,
|
|
176
|
+
_this3 = this;
|
|
177
|
+
var asGroup = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
178
|
+
if (!((_capabilities = capabilities) !== null && _capabilities !== void 0 && _capabilities.WMS_Capabilities) && !((_capabilities2 = capabilities) !== null && _capabilities2 !== void 0 && _capabilities2.WMT_MS_Capabilities)) {
|
|
179
|
+
return [];
|
|
180
|
+
}
|
|
181
|
+
capabilities = (_capabilities$WMS_Cap = capabilities.WMS_Capabilities) !== null && _capabilities$WMS_Cap !== void 0 ? _capabilities$WMS_Cap : capabilities.WMT_MS_Capabilities;
|
|
182
|
+
var calledUrlParts = url.parse(calledServiceUrl, true);
|
|
183
|
+
var extwmsparams = {};
|
|
184
|
+
calledUrlParts.query = Object.keys(calledUrlParts.query).filter(function (key) {
|
|
185
|
+
// Extract extwms params
|
|
186
|
+
if (key.toUpperCase().startsWith("EXTWMS.")) {
|
|
187
|
+
extwmsparams[key.substring(7)] = calledUrlParts.query[key];
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
// Filter service and request from calledServiceUrl, but keep other parameters (i.e. MAP)
|
|
191
|
+
return !["service", "request"].includes(key.toLowerCase());
|
|
192
|
+
}).reduce(function (res, key) {
|
|
193
|
+
return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, key, calledUrlParts.query[key]));
|
|
194
|
+
}, {});
|
|
195
|
+
delete calledUrlParts.search;
|
|
196
|
+
var topLayer = capabilities.Capability.Layer;
|
|
197
|
+
var getMapUrl = this.mergeCalledServiceUrlQuery(ServiceLayerUtils.getDCPTypes(capabilities.Capability.Request.GetMap.DCPType).HTTP.Get.OnlineResource.href, calledUrlParts);
|
|
198
|
+
var featureInfoUrl = getMapUrl;
|
|
199
|
+
try {
|
|
200
|
+
featureInfoUrl = this.mergeCalledServiceUrlQuery(ServiceLayerUtils.getDCPTypes(capabilities.Capability.Request.GetFeatureInfo.DCPType).HTTP.Get.OnlineResource.href, calledUrlParts);
|
|
201
|
+
} catch (e) {
|
|
202
|
+
// pass
|
|
203
|
+
}
|
|
204
|
+
var mapFormats = null;
|
|
205
|
+
try {
|
|
206
|
+
mapFormats = MiscUtils.ensureArray(capabilities.Capability.Request.GetMap.Format);
|
|
207
|
+
} catch (e) {
|
|
208
|
+
mapFormats = ['image/png'];
|
|
209
|
+
}
|
|
210
|
+
var infoFormats = null;
|
|
211
|
+
try {
|
|
212
|
+
infoFormats = MiscUtils.ensureArray(capabilities.Capability.Request.GetFeatureInfo.Format);
|
|
213
|
+
} catch (e) {
|
|
214
|
+
infoFormats = ['text/plain'];
|
|
215
|
+
}
|
|
216
|
+
var externalLayerFeatureInfoFormats = ConfigUtils.getConfigProp("externalLayerFeatureInfoFormats") || {};
|
|
217
|
+
for (var _i = 0, _Object$keys = Object.keys(externalLayerFeatureInfoFormats); _i < _Object$keys.length; _i++) {
|
|
218
|
+
var entry = _Object$keys[_i];
|
|
219
|
+
if (featureInfoUrl.toLowerCase().includes(entry.toLowerCase())) {
|
|
220
|
+
infoFormats = [externalLayerFeatureInfoFormats[entry]];
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
var version = capabilities.version;
|
|
225
|
+
var supportedCrs = MiscUtils.ensureArray(topLayer.crs);
|
|
226
|
+
var topLayerExtent = null;
|
|
227
|
+
if (topLayer.EX_GeographicBoundingBox) {
|
|
228
|
+
topLayerExtent = {
|
|
229
|
+
crs: "EPSG:4326",
|
|
230
|
+
bounds: [parseFloat(topLayer.EX_GeographicBoundingBox.westBoundLongitude), parseFloat(topLayer.EX_GeographicBoundingBox.southBoundLatitude), parseFloat(topLayer.EX_GeographicBoundingBox.eastBoundLongitude), parseFloat(topLayer.EX_GeographicBoundingBox.northBoundLatitude)]
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
if (!topLayer.Layer || asGroup) {
|
|
234
|
+
return [this.getWMSLayerParams(topLayer, supportedCrs, calledUrlParts, version, getMapUrl, featureInfoUrl, mapFormats, infoFormats, extwmsparams, topLayerExtent)].filter(function (entry) {
|
|
235
|
+
return entry;
|
|
236
|
+
});
|
|
237
|
+
} else {
|
|
238
|
+
var entries = MiscUtils.ensureArray(topLayer.Layer).map(function (layer) {
|
|
239
|
+
return _this3.getWMSLayerParams(layer, supportedCrs, calledUrlParts, version, getMapUrl, featureInfoUrl, mapFormats, infoFormats, extwmsparams, topLayerExtent);
|
|
240
|
+
}).filter(function (entry) {
|
|
241
|
+
return entry;
|
|
242
|
+
});
|
|
243
|
+
return entries.sort(function (a, b) {
|
|
244
|
+
return strcmp(a.title, b.title);
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
getWMSLayerParams: function getWMSLayerParams(layer, parentCrs, calledUrlParts, version, getMapUrl, featureInfoUrl, mapFormats, infoFormats, extwmsparams, topLayerExtent) {
|
|
249
|
+
var _this4 = this,
|
|
250
|
+
_Object$keys$,
|
|
251
|
+
_layer$Attribution,
|
|
252
|
+
_layer$Attribution2,
|
|
253
|
+
_layer$opacity;
|
|
254
|
+
var groupbbox = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : null;
|
|
255
|
+
var supportedCrs = MiscUtils.ensureArray(layer.CRS);
|
|
256
|
+
if (isEmpty(supportedCrs)) {
|
|
257
|
+
supportedCrs = _toConsumableArray(parentCrs || []);
|
|
258
|
+
} else {
|
|
259
|
+
supportedCrs = [].concat(_toConsumableArray(parentCrs || []), _toConsumableArray(supportedCrs));
|
|
260
|
+
}
|
|
261
|
+
var sublayers = [];
|
|
262
|
+
var sublayerbounds = {};
|
|
263
|
+
if (!isEmpty(layer.Layer)) {
|
|
264
|
+
sublayers = MiscUtils.ensureArray(layer.Layer).map(function (sublayer) {
|
|
265
|
+
return _this4.getWMSLayerParams(sublayer, supportedCrs, calledUrlParts, version, getMapUrl, featureInfoUrl, mapFormats, infoFormats, extwmsparams, topLayerExtent, sublayerbounds);
|
|
266
|
+
}).filter(function (entry) {
|
|
267
|
+
return entry;
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
var bbox = null;
|
|
271
|
+
if (isEmpty(layer.BoundingBox)) {
|
|
272
|
+
if (!isEmpty(sublayerbounds)) {
|
|
273
|
+
bbox = sublayerbounds;
|
|
274
|
+
} else if (topLayerExtent) {
|
|
275
|
+
bbox = topLayerExtent;
|
|
276
|
+
}
|
|
277
|
+
} else {
|
|
278
|
+
var _boundingBox$CRS;
|
|
279
|
+
var boundingBox = MiscUtils.ensureArray(layer.BoundingBox)[0];
|
|
280
|
+
bbox = {
|
|
281
|
+
crs: (_boundingBox$CRS = boundingBox.CRS) !== null && _boundingBox$CRS !== void 0 ? _boundingBox$CRS : boundingBox.SRS,
|
|
282
|
+
bounds: [boundingBox.minx, boundingBox.miny, boundingBox.maxx, boundingBox.maxy].map(Number)
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
if (groupbbox !== null) {
|
|
286
|
+
if (isEmpty(groupbbox)) {
|
|
287
|
+
Object.assign(groupbbox, bbox);
|
|
288
|
+
} else if (bbox && bbox.crs === groupbbox.crs) {
|
|
289
|
+
groupbbox.bounds[0] = Math.min(bbox.bounds[0], groupbbox.bounds[0]);
|
|
290
|
+
groupbbox.bounds[1] = Math.min(bbox.bounds[1], groupbbox.bounds[1]);
|
|
291
|
+
groupbbox.bounds[2] = Math.max(bbox.bounds[2], groupbbox.bounds[2]);
|
|
292
|
+
groupbbox.bounds[3] = Math.max(bbox.bounds[3], groupbbox.bounds[3]);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
var legendUrl = getMapUrl;
|
|
296
|
+
try {
|
|
297
|
+
legendUrl = this.mergeCalledServiceUrlQuery(MiscUtils.ensureArray(MiscUtils.ensureArray(layer.Style)[0].LegendURL)[0].OnlineResource.href, calledUrlParts);
|
|
298
|
+
} catch (e) {
|
|
299
|
+
/* pass */
|
|
300
|
+
}
|
|
301
|
+
var dimensions = [];
|
|
302
|
+
MiscUtils.ensureArray(layer.Dimension).forEach(function (dim) {
|
|
303
|
+
var _dim$fieldName, _dim$endFieldName;
|
|
304
|
+
dimensions.push({
|
|
305
|
+
units: dim.units,
|
|
306
|
+
name: dim.name,
|
|
307
|
+
multiple: dim.multiple === '1',
|
|
308
|
+
value: dim["#text"],
|
|
309
|
+
fieldName: (_dim$fieldName = dim.fieldName) !== null && _dim$fieldName !== void 0 ? _dim$fieldName : null,
|
|
310
|
+
endFieldName: (_dim$endFieldName = dim.endFieldName) !== null && _dim$endFieldName !== void 0 ? _dim$endFieldName : null
|
|
311
|
+
});
|
|
312
|
+
});
|
|
313
|
+
var styles = MiscUtils.ensureArray(layer.Style).reduce(function (res, entry) {
|
|
314
|
+
return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, String(entry.Name), entry.Title));
|
|
315
|
+
}, {});
|
|
316
|
+
var style = styles["default"] ? 'default' : (_Object$keys$ = Object.keys(styles)[0]) !== null && _Object$keys$ !== void 0 ? _Object$keys$ : '';
|
|
317
|
+
var attribution = {
|
|
318
|
+
Title: (_layer$Attribution = layer.Attribution) === null || _layer$Attribution === void 0 ? void 0 : _layer$Attribution.Title,
|
|
319
|
+
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
|
|
320
|
+
};
|
|
321
|
+
return {
|
|
322
|
+
type: "wms",
|
|
323
|
+
name: String(layer.Name),
|
|
324
|
+
title: layer.Title,
|
|
325
|
+
"abstract": layer.Abstract,
|
|
326
|
+
attribution: attribution,
|
|
327
|
+
url: getMapUrl,
|
|
328
|
+
featureInfoUrl: featureInfoUrl,
|
|
329
|
+
legendUrl: legendUrl,
|
|
330
|
+
version: version,
|
|
331
|
+
infoFormats: infoFormats,
|
|
332
|
+
mapFormats: mapFormats,
|
|
333
|
+
queryable: layer.queryable === 1,
|
|
334
|
+
sublayers: isEmpty(sublayers) ? null : sublayers,
|
|
335
|
+
expanded: false,
|
|
336
|
+
bbox: bbox,
|
|
337
|
+
visibility: layer.visibilityChecked !== 0,
|
|
338
|
+
opacity: ((_layer$opacity = layer.opacity) !== null && _layer$opacity !== void 0 ? _layer$opacity : 1) * 255,
|
|
339
|
+
extwmsparams: extwmsparams,
|
|
340
|
+
minScale: layer.MinScaleDenominator !== undefined ? Number(layer.MinScaleDenominator) : undefined,
|
|
341
|
+
maxScale: layer.MinScaleDenominator !== undefined ? Number(layer.MaxScaleDenominator) : undefined,
|
|
342
|
+
dimensions: dimensions,
|
|
343
|
+
styles: styles,
|
|
344
|
+
style: style
|
|
345
|
+
};
|
|
346
|
+
},
|
|
347
|
+
getWFSLayers: function getWFSLayers(capabilities, calledServiceUrl, mapCrs) {
|
|
348
|
+
var _capabilities$WFS_Cap;
|
|
349
|
+
var calledUrlParts = url.parse(calledServiceUrl, true);
|
|
350
|
+
// Filter service and request from calledServiceUrl, but keep other parameters (i.e. MAP)
|
|
351
|
+
calledUrlParts.query = Object.keys(calledUrlParts.query).filter(function (key) {
|
|
352
|
+
return !["service", "request"].includes(key.toLowerCase());
|
|
353
|
+
}).reduce(function (res, key) {
|
|
354
|
+
return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, key, calledUrlParts.query[key]));
|
|
355
|
+
}, {});
|
|
356
|
+
delete calledUrlParts.search;
|
|
357
|
+
if (!(capabilities !== null && capabilities !== void 0 && (_capabilities$WFS_Cap = capabilities.WFS_Capabilities) !== null && _capabilities$WFS_Cap !== void 0 && _capabilities$WFS_Cap.version)) {
|
|
358
|
+
return [];
|
|
359
|
+
} else if (capabilities.WFS_Capabilities.version < "1.1.0") {
|
|
360
|
+
return ServiceLayerUtils.getWFS10Layers(capabilities.WFS_Capabilities, calledUrlParts);
|
|
361
|
+
} else {
|
|
362
|
+
return ServiceLayerUtils.getWFS11_20Layers(capabilities.WFS_Capabilities, calledUrlParts, mapCrs);
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
getWFS10Layers: function getWFS10Layers(capabilities, calledUrlParts) {
|
|
366
|
+
var serviceUrl = null;
|
|
367
|
+
var version = capabilities.version;
|
|
368
|
+
var formats = null;
|
|
369
|
+
try {
|
|
370
|
+
serviceUrl = ServiceLayerUtils.getDCPTypes(MiscUtils.ensureArray(capabilities.Capability.Request.GetFeature.DCPType)).HTTP.Get.onlineResource;
|
|
371
|
+
serviceUrl = this.mergeCalledServiceUrlQuery(serviceUrl, calledUrlParts);
|
|
372
|
+
formats = Object.keys(capabilities.Capability.Request.GetFeature.ResultFormat);
|
|
373
|
+
if (typeof formats === 'string') {
|
|
374
|
+
// convert to list if single entry
|
|
375
|
+
formats = [formats];
|
|
376
|
+
}
|
|
377
|
+
} catch (e) {
|
|
378
|
+
return [];
|
|
379
|
+
}
|
|
380
|
+
var layers = [];
|
|
381
|
+
var _iterator = _createForOfIteratorHelper(MiscUtils.ensureArray(capabilities.FeatureTypeList.FeatureType)),
|
|
382
|
+
_step;
|
|
383
|
+
try {
|
|
384
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
385
|
+
var featureType = _step.value;
|
|
386
|
+
var name = void 0;
|
|
387
|
+
var bbox = void 0;
|
|
388
|
+
try {
|
|
389
|
+
name = featureType.Name;
|
|
390
|
+
var llbbox = featureType.LatLongBoundingBox;
|
|
391
|
+
bbox = {
|
|
392
|
+
crs: featureType.SRS,
|
|
393
|
+
bounds: [llbbox.minx, llbbox.miny, llbbox.maxx, llbbox.maxy]
|
|
394
|
+
};
|
|
395
|
+
} catch (e) {
|
|
396
|
+
continue; // Name and bbox are required
|
|
397
|
+
}
|
|
398
|
+
var title = featureType.Title || name;
|
|
399
|
+
var _abstract = featureType.Abstract || "";
|
|
400
|
+
layers.push({
|
|
401
|
+
type: "wfs",
|
|
402
|
+
name: name,
|
|
403
|
+
title: title,
|
|
404
|
+
"abstract": _abstract,
|
|
405
|
+
bbox: bbox,
|
|
406
|
+
projection: featureType.SRS,
|
|
407
|
+
url: serviceUrl,
|
|
408
|
+
version: version,
|
|
409
|
+
formats: formats,
|
|
410
|
+
color: randomColor(),
|
|
411
|
+
visibility: true
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
} catch (err) {
|
|
415
|
+
_iterator.e(err);
|
|
416
|
+
} finally {
|
|
417
|
+
_iterator.f();
|
|
418
|
+
}
|
|
419
|
+
return layers;
|
|
420
|
+
},
|
|
421
|
+
getWFS11_20Layers: function getWFS11_20Layers(capabilities, calledUrlParts, mapCrs) {
|
|
422
|
+
var serviceUrl = null;
|
|
423
|
+
var version = capabilities.version;
|
|
424
|
+
var formats = null;
|
|
425
|
+
try {
|
|
426
|
+
var getFeatureOp = MiscUtils.ensureArray(capabilities.OperationsMetadata.Operation).find(function (el) {
|
|
427
|
+
return el.name === "GetFeature";
|
|
428
|
+
});
|
|
429
|
+
serviceUrl = ServiceLayerUtils.getDCPTypes(MiscUtils.ensureArray(getFeatureOp.DCP)).HTTP.Get.href;
|
|
430
|
+
serviceUrl = this.mergeCalledServiceUrlQuery(serviceUrl, calledUrlParts);
|
|
431
|
+
var outputFormat = MiscUtils.ensureArray(getFeatureOp.Parameter).find(function (el) {
|
|
432
|
+
return el.name === "outputFormat";
|
|
433
|
+
});
|
|
434
|
+
formats = MiscUtils.ensureArray(outputFormat.AllowedValues ? outputFormat.AllowedValues.Value : outputFormat.Value);
|
|
435
|
+
} catch (e) {
|
|
436
|
+
return [];
|
|
437
|
+
}
|
|
438
|
+
var layers = [];
|
|
439
|
+
var _iterator2 = _createForOfIteratorHelper(MiscUtils.ensureArray(capabilities.FeatureTypeList.FeatureType)),
|
|
440
|
+
_step2;
|
|
441
|
+
try {
|
|
442
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
443
|
+
var featureType = _step2.value;
|
|
444
|
+
var name = void 0;
|
|
445
|
+
var bbox = void 0;
|
|
446
|
+
try {
|
|
447
|
+
name = featureType.Name;
|
|
448
|
+
var lc = featureType.WGS84BoundingBox.LowerCorner.split(/\s+/);
|
|
449
|
+
var uc = featureType.WGS84BoundingBox.UpperCorner.split(/\s+/);
|
|
450
|
+
bbox = {
|
|
451
|
+
crs: "EPSG:4326",
|
|
452
|
+
bounds: [lc[0], lc[1], uc[0], uc[1]]
|
|
453
|
+
};
|
|
454
|
+
} catch (e) {
|
|
455
|
+
continue; // Name and bbox are required
|
|
456
|
+
}
|
|
457
|
+
var title = featureType.Title || name;
|
|
458
|
+
var _abstract2 = featureType.Abstract || "";
|
|
459
|
+
var projections = [CoordinatesUtils.fromOgcUrnCrs(featureType.DefaultCRS || featureType.DefaultSRS)].concat(_toConsumableArray(MiscUtils.ensureArray(featureType.OtherCRS || featureType.OtherSRS || []).map(function (crs) {
|
|
460
|
+
return CoordinatesUtils.fromOgcUrnCrs(crs);
|
|
461
|
+
})));
|
|
462
|
+
var projection = projections.includes(mapCrs) ? mapCrs : projections[0];
|
|
463
|
+
layers.push({
|
|
464
|
+
type: "wfs",
|
|
465
|
+
name: name,
|
|
466
|
+
title: title,
|
|
467
|
+
"abstract": _abstract2,
|
|
468
|
+
bbox: bbox,
|
|
469
|
+
projection: projection,
|
|
470
|
+
url: serviceUrl,
|
|
471
|
+
version: version,
|
|
472
|
+
formats: formats,
|
|
473
|
+
color: randomColor(),
|
|
474
|
+
visibility: true
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
} catch (err) {
|
|
478
|
+
_iterator2.e(err);
|
|
479
|
+
} finally {
|
|
480
|
+
_iterator2.f();
|
|
481
|
+
}
|
|
482
|
+
return layers;
|
|
483
|
+
},
|
|
484
|
+
getCapabilities: function getCapabilities(baseUrl, params) {
|
|
485
|
+
var urlParts = url.parse(baseUrl, true);
|
|
486
|
+
if (params) {
|
|
487
|
+
urlParts.query = _objectSpread(_objectSpread({}, Object.entries(urlParts.query).reduce(function (res, _ref) {
|
|
488
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
489
|
+
key = _ref2[0],
|
|
490
|
+
val = _ref2[1];
|
|
491
|
+
return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, key.toUpperCase(), val));
|
|
492
|
+
}, {})), params);
|
|
493
|
+
delete urlParts.search;
|
|
494
|
+
}
|
|
495
|
+
if (urlParts.protocol === "http" && location.protocol === "https") {
|
|
496
|
+
urlParts.protocol = "https";
|
|
497
|
+
}
|
|
498
|
+
var requestUrl = url.format(urlParts);
|
|
499
|
+
return new Promise(function (resolve, reject) {
|
|
500
|
+
axios.get(requestUrl).then(function (response) {
|
|
501
|
+
var options = {
|
|
502
|
+
attributeNamePrefix: "",
|
|
503
|
+
ignoreAttributes: false,
|
|
504
|
+
parseTagValue: true,
|
|
505
|
+
parseAttributeValue: true,
|
|
506
|
+
removeNSPrefix: true
|
|
507
|
+
};
|
|
508
|
+
resolve({
|
|
509
|
+
capabilities: new XMLParser(options).parse(response.data),
|
|
510
|
+
requestUrl: requestUrl
|
|
511
|
+
});
|
|
512
|
+
})["catch"](function (e) {
|
|
513
|
+
reject(e);
|
|
514
|
+
});
|
|
515
|
+
});
|
|
516
|
+
},
|
|
517
|
+
getWMTSCapabilities: function getWMTSCapabilities(serviceUrl) {
|
|
518
|
+
return new Promise(function (resolve, reject) {
|
|
519
|
+
var requestUrl = MiscUtils.adjustProtocol(serviceUrl);
|
|
520
|
+
axios.get(requestUrl).then(function (response) {
|
|
521
|
+
var wmtsFormat = new ol.format.WMTSCapabilities();
|
|
522
|
+
resolve({
|
|
523
|
+
capabilities: wmtsFormat.read(response.data),
|
|
524
|
+
requestUrl: requestUrl
|
|
525
|
+
});
|
|
526
|
+
})["catch"](reject);
|
|
527
|
+
});
|
|
528
|
+
},
|
|
529
|
+
getWMSCapabilities: function getWMSCapabilities(serviceUrl) {
|
|
530
|
+
return new Promise(function (resolve, reject) {
|
|
531
|
+
ServiceLayerUtils.getCapabilities(serviceUrl, {
|
|
532
|
+
SERVICE: 'WMS',
|
|
533
|
+
REQUEST: 'GetProjectSettings'
|
|
534
|
+
}).then(function (result) {
|
|
535
|
+
var _result$capabilities;
|
|
536
|
+
if ((_result$capabilities = result.capabilities) !== null && _result$capabilities !== void 0 && _result$capabilities.WMS_Capabilities) {
|
|
537
|
+
resolve(result);
|
|
538
|
+
} else {
|
|
539
|
+
ServiceLayerUtils.getCapabilities(serviceUrl, {
|
|
540
|
+
SERVICE: 'WMS',
|
|
541
|
+
REQUEST: 'GetCapabilities'
|
|
542
|
+
}).then(resolve);
|
|
543
|
+
}
|
|
544
|
+
})["catch"](function () {
|
|
545
|
+
ServiceLayerUtils.getCapabilities(serviceUrl, {
|
|
546
|
+
SERVICE: 'WMS',
|
|
547
|
+
REQUEST: 'GetCapabilities'
|
|
548
|
+
}).then(resolve)["catch"](reject);
|
|
549
|
+
});
|
|
550
|
+
});
|
|
551
|
+
},
|
|
552
|
+
getWFSCapabilities: function getWFSCapabilities(serviceUrl) {
|
|
553
|
+
return new Promise(function (resolve, reject) {
|
|
554
|
+
ServiceLayerUtils.getCapabilities(serviceUrl, {
|
|
555
|
+
SERVICE: 'WFS',
|
|
556
|
+
REQUEST: 'GetCapabilities'
|
|
557
|
+
}).then(resolve)["catch"](reject);
|
|
558
|
+
});
|
|
559
|
+
},
|
|
560
|
+
findLayers: function findLayers(type, serviceUrl, layerConfigs, mapCrs, callback) {
|
|
561
|
+
var getCapabilities = null;
|
|
562
|
+
var getLayers = null;
|
|
563
|
+
if (type === "wmts") {
|
|
564
|
+
getCapabilities = ServiceLayerUtils.getWMTSCapabilities;
|
|
565
|
+
getLayers = function getLayers(capabilites, requestUrl) {
|
|
566
|
+
return ServiceLayerUtils.getWMTSLayers(capabilites, requestUrl, mapCrs);
|
|
567
|
+
};
|
|
568
|
+
} else if (type === "wms") {
|
|
569
|
+
getCapabilities = ServiceLayerUtils.getWMSCapabilities;
|
|
570
|
+
getLayers = function getLayers(capabilites, requestUrl) {
|
|
571
|
+
return ServiceLayerUtils.getWMSLayers(capabilites, requestUrl, true);
|
|
572
|
+
};
|
|
573
|
+
} else if (type === "wfs") {
|
|
574
|
+
getCapabilities = ServiceLayerUtils.getWFSCapabilities;
|
|
575
|
+
getLayers = function getLayers(capabilites, requestUrl) {
|
|
576
|
+
return ServiceLayerUtils.getWFSLayers(capabilites, requestUrl, mapCrs);
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
getCapabilities(serviceUrl).then(function (_ref3) {
|
|
580
|
+
var capabilities = _ref3.capabilities,
|
|
581
|
+
requestUrl = _ref3.requestUrl;
|
|
582
|
+
var layers = getLayers(capabilities, requestUrl);
|
|
583
|
+
var _iterator3 = _createForOfIteratorHelper(layerConfigs),
|
|
584
|
+
_step3;
|
|
585
|
+
try {
|
|
586
|
+
var _loop = function _loop() {
|
|
587
|
+
var _LayerUtils$searchSub;
|
|
588
|
+
var layerConfig = _step3.value;
|
|
589
|
+
var layer = LayerUtils.matchSubLayer({
|
|
590
|
+
sublayers: layers
|
|
591
|
+
}, function (l) {
|
|
592
|
+
return l.name === layerConfig.name && (!layerConfig.style || l.style === layerConfig.style);
|
|
593
|
+
});
|
|
594
|
+
// Some services (i.e. wms.geo.admin.ch) have same-named sublayers
|
|
595
|
+
layer = (_LayerUtils$searchSub = LayerUtils.searchSubLayer(layer, "name", layerConfig.name)) !== null && _LayerUtils$searchSub !== void 0 ? _LayerUtils$searchSub : layer;
|
|
596
|
+
if (layer) {
|
|
597
|
+
layer = _objectSpread(_objectSpread({}, layer), {}, {
|
|
598
|
+
id: layerConfig.id,
|
|
599
|
+
opacity: layerConfig.opacity,
|
|
600
|
+
visibility: layerConfig.visibility,
|
|
601
|
+
style: layerConfig.style || layer.style,
|
|
602
|
+
role: LayerRole.USERLAYER
|
|
603
|
+
});
|
|
604
|
+
if (layer.type === "wms") {
|
|
605
|
+
layer.params = {
|
|
606
|
+
LAYERS: layerConfig.name
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
callback(layerConfig.id, layer);
|
|
610
|
+
} else {
|
|
611
|
+
// eslint-disable-next-line
|
|
612
|
+
console.warn("Could not find layer " + layerConfig.name);
|
|
613
|
+
callback(layerConfig.id, null);
|
|
614
|
+
}
|
|
615
|
+
};
|
|
616
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
617
|
+
_loop();
|
|
618
|
+
}
|
|
619
|
+
} catch (err) {
|
|
620
|
+
_iterator3.e(err);
|
|
621
|
+
} finally {
|
|
622
|
+
_iterator3.f();
|
|
623
|
+
}
|
|
624
|
+
})["catch"](function () {
|
|
625
|
+
// eslint-disable-next-line
|
|
626
|
+
console.warn("Failed to read " + serviceUrl);
|
|
627
|
+
var _iterator4 = _createForOfIteratorHelper(layerConfigs),
|
|
628
|
+
_step4;
|
|
629
|
+
try {
|
|
630
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
631
|
+
var layerConfig = _step4.value;
|
|
632
|
+
callback(layerConfig.id, null);
|
|
633
|
+
}
|
|
634
|
+
} catch (err) {
|
|
635
|
+
_iterator4.e(err);
|
|
636
|
+
} finally {
|
|
637
|
+
_iterator4.f();
|
|
638
|
+
}
|
|
639
|
+
});
|
|
640
|
+
},
|
|
641
|
+
getDCPTypes: function getDCPTypes(dcpTypes) {
|
|
642
|
+
var result = {};
|
|
643
|
+
var _iterator5 = _createForOfIteratorHelper(MiscUtils.ensureArray(dcpTypes)),
|
|
644
|
+
_step5;
|
|
645
|
+
try {
|
|
646
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
647
|
+
var dcpType = _step5.value;
|
|
648
|
+
result = deepmerge(result, dcpType);
|
|
649
|
+
}
|
|
650
|
+
} catch (err) {
|
|
651
|
+
_iterator5.e(err);
|
|
652
|
+
} finally {
|
|
653
|
+
_iterator5.f();
|
|
654
|
+
}
|
|
655
|
+
return result;
|
|
656
|
+
},
|
|
657
|
+
mergeCalledServiceUrlQuery: function mergeCalledServiceUrlQuery(capabilityUrl, calledServiceUrlParts) {
|
|
658
|
+
if (ConfigUtils.getConfigProp("trustWmsCapabilityURLs")) {
|
|
659
|
+
return url.format(capabilityUrl);
|
|
660
|
+
}
|
|
661
|
+
try {
|
|
662
|
+
var _calledServiceUrlPart;
|
|
663
|
+
var urlParts = url.parse(capabilityUrl, true);
|
|
664
|
+
urlParts.host = calledServiceUrlParts.host;
|
|
665
|
+
urlParts.protocol = (_calledServiceUrlPart = calledServiceUrlParts.protocol) !== null && _calledServiceUrlPart !== void 0 ? _calledServiceUrlPart : location.protocol;
|
|
666
|
+
urlParts.query = _objectSpread(_objectSpread({}, calledServiceUrlParts.query), urlParts.query);
|
|
667
|
+
delete urlParts.search;
|
|
668
|
+
return url.format(urlParts);
|
|
669
|
+
} catch (e) {
|
|
670
|
+
return url.format(capabilityUrl);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
export default ServiceLayerUtils;
|