@masterportal/masterportalapi 2.57.0 → 2.59.0
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/CHANGELOG.md +20 -0
- package/example/config/portal.json +0 -10
- package/example/config/services.json +0 -136
- package/package.json +8 -4
- package/publiccode.yml +2 -2
- package/src/lib/ping.js +2 -1
- package/src/vectorStyle/createStyle.js +30 -1
- package/src/vectorStyle/styles/polygon/stylePolygon.js +14 -1
- package/test/vectorStyle/createStyle.test.js +36 -1
- package/test/vectorStyle/styles/polygon/stylePolygon.test.js +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
|
|
4
4
|
The [Semantic Versioning](https://semver.org/spec/v2.0.0.html) is used.
|
|
5
5
|
|
|
6
|
+
## 2.59.0 - 2026-03-13
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
- Updated examples to prevent console errors caused by certain layers/services.
|
|
10
|
+
- The following packages have been updated:
|
|
11
|
+
- dependencies:
|
|
12
|
+
- @cesium/engine: 20.0.1 to 23.0.0
|
|
13
|
+
- The following packages have been overwritten:
|
|
14
|
+
- geotiff in ol: to 2.1.3
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 2.58.0 - 2026-02-19
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- The following packages have been updated:
|
|
22
|
+
- dependencies:
|
|
23
|
+
- ol: 10.7.0 to 10.8.0
|
|
24
|
+
---
|
|
25
|
+
|
|
6
26
|
## 2.57.0 - 2026-02-12
|
|
7
27
|
|
|
8
28
|
### Fixed
|
|
@@ -62,16 +62,6 @@
|
|
|
62
62
|
"circle-rotate-with-view": true,
|
|
63
63
|
"circle-opacity": 0.8
|
|
64
64
|
}
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"id": "4002",
|
|
68
|
-
"name": "Gebäude LoD2",
|
|
69
|
-
"url": "https://daten-hamburg.de/gdi3d/datasource-data/LoD2",
|
|
70
|
-
"typ": "TileSet3D",
|
|
71
|
-
"styleId": "3DTileSetStyle",
|
|
72
|
-
"cesium3DTilesetOptions": {
|
|
73
|
-
"maximumScreenSpaceError": 6
|
|
74
|
-
}
|
|
75
65
|
}
|
|
76
66
|
],
|
|
77
67
|
"cesiumLib":"https://geoportal-hamburg.de/mastercode/cesium/latest/Cesium.js",
|
|
@@ -215,141 +215,5 @@
|
|
|
215
215
|
"typ": "WMTS",
|
|
216
216
|
"optionsFromCapabilities": true,
|
|
217
217
|
"layers": "eoc:basemap"
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
"id": "7003",
|
|
221
|
-
"name": "Geoland Basemap",
|
|
222
|
-
"urls": [
|
|
223
|
-
"https://maps1.wien.gv.at/basemap/geolandbasemap/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",
|
|
224
|
-
"https://maps2.wien.gv.at/basemap/geolandbasemap/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",
|
|
225
|
-
"https://maps3.wien.gv.at/basemap/geolandbasemap/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",
|
|
226
|
-
"https://maps4.wien.gv.at/basemap/geolandbasemap/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png",
|
|
227
|
-
"https://maps.wien.gv.at/basemap/geolandbasemap/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png"
|
|
228
|
-
],
|
|
229
|
-
"typ": "WMTS",
|
|
230
|
-
"layer": "geolandbasemap",
|
|
231
|
-
"version": "1.0.0",
|
|
232
|
-
"format": "image/png",
|
|
233
|
-
"style": "normal",
|
|
234
|
-
"transparent": false,
|
|
235
|
-
"tileSize": "256",
|
|
236
|
-
"minScale": "0",
|
|
237
|
-
"maxScale": "2500000",
|
|
238
|
-
"tileMatrixSet": "google3857",
|
|
239
|
-
"matrixSizes": [
|
|
240
|
-
[
|
|
241
|
-
1,
|
|
242
|
-
1
|
|
243
|
-
],
|
|
244
|
-
[
|
|
245
|
-
2,
|
|
246
|
-
2
|
|
247
|
-
],
|
|
248
|
-
[
|
|
249
|
-
4,
|
|
250
|
-
4
|
|
251
|
-
],
|
|
252
|
-
[
|
|
253
|
-
8,
|
|
254
|
-
8
|
|
255
|
-
],
|
|
256
|
-
[
|
|
257
|
-
16,
|
|
258
|
-
16
|
|
259
|
-
],
|
|
260
|
-
[
|
|
261
|
-
32,
|
|
262
|
-
32
|
|
263
|
-
],
|
|
264
|
-
[
|
|
265
|
-
64,
|
|
266
|
-
64
|
|
267
|
-
],
|
|
268
|
-
[
|
|
269
|
-
128,
|
|
270
|
-
128
|
|
271
|
-
],
|
|
272
|
-
[
|
|
273
|
-
256,
|
|
274
|
-
256
|
|
275
|
-
],
|
|
276
|
-
[
|
|
277
|
-
512,
|
|
278
|
-
512
|
|
279
|
-
],
|
|
280
|
-
[
|
|
281
|
-
1024,
|
|
282
|
-
1024
|
|
283
|
-
],
|
|
284
|
-
[
|
|
285
|
-
2048,
|
|
286
|
-
2048
|
|
287
|
-
],
|
|
288
|
-
[
|
|
289
|
-
4096,
|
|
290
|
-
4096
|
|
291
|
-
],
|
|
292
|
-
[
|
|
293
|
-
8192,
|
|
294
|
-
8192
|
|
295
|
-
],
|
|
296
|
-
[
|
|
297
|
-
16384,
|
|
298
|
-
16384
|
|
299
|
-
],
|
|
300
|
-
[
|
|
301
|
-
32768,
|
|
302
|
-
32768
|
|
303
|
-
],
|
|
304
|
-
[
|
|
305
|
-
65536,
|
|
306
|
-
65536
|
|
307
|
-
],
|
|
308
|
-
[
|
|
309
|
-
131072,
|
|
310
|
-
131072
|
|
311
|
-
],
|
|
312
|
-
[
|
|
313
|
-
262144,
|
|
314
|
-
262144
|
|
315
|
-
],
|
|
316
|
-
[
|
|
317
|
-
524288,
|
|
318
|
-
524288
|
|
319
|
-
]
|
|
320
|
-
],
|
|
321
|
-
"coordinateSystem": "EPSG:3857",
|
|
322
|
-
"layerAttribution": "nicht vorhanden",
|
|
323
|
-
"legend": false,
|
|
324
|
-
"cache": true,
|
|
325
|
-
"wrapX": true,
|
|
326
|
-
"origin": [
|
|
327
|
-
-20037508.3428,
|
|
328
|
-
20037508.3428
|
|
329
|
-
],
|
|
330
|
-
"scales": [
|
|
331
|
-
559082264.029,
|
|
332
|
-
279541132.015,
|
|
333
|
-
139770566.007,
|
|
334
|
-
69885283.0036,
|
|
335
|
-
34942641.5018,
|
|
336
|
-
17471320.7509,
|
|
337
|
-
8735660.37545,
|
|
338
|
-
4367830.18773,
|
|
339
|
-
2183915.09386,
|
|
340
|
-
1091957.54693,
|
|
341
|
-
45978.773466,
|
|
342
|
-
272989.386733,
|
|
343
|
-
136494.693366,
|
|
344
|
-
68247.3466832,
|
|
345
|
-
34123.6733416,
|
|
346
|
-
17061.8366708,
|
|
347
|
-
8530.91833540,
|
|
348
|
-
4265.45916770,
|
|
349
|
-
2132.72958385,
|
|
350
|
-
1066.36479193
|
|
351
|
-
],
|
|
352
|
-
"resLength": "20",
|
|
353
|
-
"requestEncoding": "REST"
|
|
354
218
|
}
|
|
355
219
|
]
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@masterportal/masterportalapi",
|
|
3
3
|
"author": "Implementierungspartnerschaft Masterportal <info@masterportal.org> (https://www.masterportal.org)",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.59.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Basic functions of the Masterportal as api",
|
|
7
7
|
"repository": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"core-js": "^3.33.1",
|
|
36
36
|
"dayjs": "^1.11.10",
|
|
37
|
-
"ol": "
|
|
37
|
+
"ol": "10.8.0",
|
|
38
38
|
"ol-mapbox-style": "12.5.0",
|
|
39
39
|
"olcs": "^2.22.1",
|
|
40
40
|
"proj4": "^2.10.0",
|
|
@@ -70,7 +70,12 @@
|
|
|
70
70
|
"util": "^0.12.5"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"@cesium/engine": "^
|
|
73
|
+
"@cesium/engine": "^23.0.0"
|
|
74
|
+
},
|
|
75
|
+
"overrides": {
|
|
76
|
+
"ol": {
|
|
77
|
+
"geotiff": "^2.1.3"
|
|
78
|
+
}
|
|
74
79
|
},
|
|
75
80
|
"engines": {
|
|
76
81
|
"node": "^22.19.0 || ^24.11.1",
|
|
@@ -78,7 +83,6 @@
|
|
|
78
83
|
},
|
|
79
84
|
"homepage": "https://bitbucket.org/geowerkstatt-hamburg/masterportalapi#readme",
|
|
80
85
|
"directories": {
|
|
81
|
-
"doc": "docs",
|
|
82
86
|
"example": "example",
|
|
83
87
|
"test": "test"
|
|
84
88
|
},
|
package/publiccode.yml
CHANGED
|
@@ -81,8 +81,8 @@ maintenance:
|
|
|
81
81
|
name: Masterportal
|
|
82
82
|
platforms:
|
|
83
83
|
- web
|
|
84
|
-
releaseDate: '2026-
|
|
84
|
+
releaseDate: '2026-03-13'
|
|
85
85
|
roadmap: 'https://bitbucket.org/geowerkstatt-hamburg/masterportalapi/src/master/'
|
|
86
86
|
softwareType: api
|
|
87
|
-
softwareVersion: 2.
|
|
87
|
+
softwareVersion: 2.59.0
|
|
88
88
|
url: 'https://bitbucket.org/geowerkstatt-hamburg/masterportalapi.git'
|
package/src/lib/ping.js
CHANGED
|
@@ -21,7 +21,8 @@ export default function ({url, typ, capabilitiesUrl, ...rest}) {
|
|
|
21
21
|
.forEach(entity => entity.url ? statusCheckUrls.push(entity.url) : null);
|
|
22
22
|
}
|
|
23
23
|
else if (typ === "TileSet3D" || typ === "Terrain3D") {
|
|
24
|
-
|
|
24
|
+
// 3D tile layers: skip HEAD ping; Cesium GET requests will load tiles
|
|
25
|
+
return Promise.resolve(200);
|
|
25
26
|
}
|
|
26
27
|
else if (typ === "GeoJSON") {
|
|
27
28
|
if (!url && rest.features) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Style} from "ol/style.js";
|
|
1
|
+
import {Style, Icon} from "ol/style.js";
|
|
2
2
|
import PointStyle from "./styles/point/stylePoint";
|
|
3
3
|
import TextStyle from "./styles/styleText";
|
|
4
4
|
import PolygonStyle from "./styles/polygon/stylePolygon";
|
|
@@ -267,6 +267,35 @@ function createStyle (styleObject, feature, isClustered, wfsImgPathFromConfig) {
|
|
|
267
267
|
if (feature?.getGeometry().getType() === "Point" || feature?.getGeometry().getType() === "MultiPoint") {
|
|
268
268
|
feature.setStyle(styleObjectGeometry);
|
|
269
269
|
}
|
|
270
|
+
// polygon with icon in the center is optional for given polygonImage in style config file
|
|
271
|
+
if (style?.polygonImage && (feature?.getGeometry().getType() === "Polygon" || feature?.getGeometry().getType() === "MultiPolygon")) {
|
|
272
|
+
if (!Array.isArray(styleObjectGeometry)) {
|
|
273
|
+
styleObjectGeometry = [styleObjectGeometry];
|
|
274
|
+
}
|
|
275
|
+
styleObjectGeometry.push(new Style({
|
|
276
|
+
geometry: function (geometryFeature) {
|
|
277
|
+
const geometry = geometryFeature.getGeometry(),
|
|
278
|
+
geometryType = geometry.getType();
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
if (geometryType === "Polygon") {
|
|
282
|
+
return geometry.getInteriorPoint();
|
|
283
|
+
}
|
|
284
|
+
if (geometryType === "MultiPolygon") {
|
|
285
|
+
return geometry.getInteriorPoints();
|
|
286
|
+
}
|
|
287
|
+
return geometry;
|
|
288
|
+
|
|
289
|
+
},
|
|
290
|
+
image: new Icon({
|
|
291
|
+
anchor: [0.5, 0.5],
|
|
292
|
+
anchorXUnits: "fraction",
|
|
293
|
+
anchorYUnits: "fraction",
|
|
294
|
+
crossOrigin: "anonymous",
|
|
295
|
+
src: wfsImgPathFromConfig + style?.polygonImage
|
|
296
|
+
})
|
|
297
|
+
}));
|
|
298
|
+
}
|
|
270
299
|
return styleObjectGeometry;
|
|
271
300
|
}
|
|
272
301
|
|
|
@@ -22,13 +22,17 @@ class PolygonStyle extends StyleClass {
|
|
|
22
22
|
* @param {ol/feature} feature Feature to be styled.
|
|
23
23
|
* @param {object} styles styling properties to overwrite defaults
|
|
24
24
|
* @param {Boolean} isClustered Flag to show if feature is clustered.
|
|
25
|
+
* @param {Boolean} wfsImgPathFromConfig image Path of the wfs.
|
|
25
26
|
* @returns {void}
|
|
26
27
|
*/
|
|
27
|
-
initialize (feature, styles, isClustered) {
|
|
28
|
+
initialize (feature, styles, isClustered, wfsImgPathFromConfig) {
|
|
28
29
|
this.setFeature(feature);
|
|
29
30
|
this.setIsClustered(isClustered);
|
|
30
31
|
this.overwriteStyling(styles);
|
|
31
32
|
this.setStyle(this.createStyle());
|
|
33
|
+
if (wfsImgPathFromConfig !== undefined) {
|
|
34
|
+
this.setImagePath(wfsImgPathFromConfig);
|
|
35
|
+
}
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
/**
|
|
@@ -124,6 +128,15 @@ class PolygonStyle extends StyleClass {
|
|
|
124
128
|
|
|
125
129
|
return legendCanvas.toDataURL();
|
|
126
130
|
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Setter for imagePath.
|
|
134
|
+
* @param {String} value Image path.
|
|
135
|
+
* @returns {void}
|
|
136
|
+
*/
|
|
137
|
+
setImagePath (value) {
|
|
138
|
+
this.attributes.imagePath = value;
|
|
139
|
+
}
|
|
127
140
|
}
|
|
128
141
|
|
|
129
142
|
export default PolygonStyle;
|
|
@@ -3,7 +3,7 @@ import PointStyle from "../../src/vectorStyle/styles/point/stylePoint";
|
|
|
3
3
|
import LineStringStyle from "../../src/vectorStyle/styles/styleLine";
|
|
4
4
|
import CesiumStyle from "../../src/vectorStyle/styles/styleCesium";
|
|
5
5
|
import PolygonStyle from "../../src/vectorStyle/styles/polygon/stylePolygon";
|
|
6
|
-
import {Style, Stroke, Fill} from "ol/style.js";
|
|
6
|
+
import {Style, Stroke, Fill, Icon} from "ol/style.js";
|
|
7
7
|
import {GeoJSON} from "ol/format.js";
|
|
8
8
|
|
|
9
9
|
let rules,
|
|
@@ -280,6 +280,41 @@ describe("createStyle", () => {
|
|
|
280
280
|
});
|
|
281
281
|
});
|
|
282
282
|
|
|
283
|
+
it("should return the correct style for a feature with geometry of type Polygon ", () => {
|
|
284
|
+
const stylingRules = [{
|
|
285
|
+
"conditions": {
|
|
286
|
+
"sequence": [0, 0]
|
|
287
|
+
},
|
|
288
|
+
"style": {
|
|
289
|
+
"polygonStrokeColor": [
|
|
290
|
+
161,
|
|
291
|
+
113,
|
|
292
|
+
14,
|
|
293
|
+
1
|
|
294
|
+
],
|
|
295
|
+
"polygonStrokeWidth": 0.2,
|
|
296
|
+
"polygonFillColor": [
|
|
297
|
+
161,
|
|
298
|
+
113,
|
|
299
|
+
14,
|
|
300
|
+
1
|
|
301
|
+
],
|
|
302
|
+
"polygonImage": "image.svg"
|
|
303
|
+
}
|
|
304
|
+
}],
|
|
305
|
+
styleObject = {styleId: "styleId", rules: stylingRules},
|
|
306
|
+
polygonFeature = jsonObjects[2],
|
|
307
|
+
style = createStyle.createStyle(styleObject, polygonFeature, isClustered, wfsImgPathFromConfig);
|
|
308
|
+
|
|
309
|
+
expect(style === null).toBe(false);
|
|
310
|
+
expect(style).toBeInstanceOf(Array);
|
|
311
|
+
style.forEach(aStyle => {
|
|
312
|
+
expect(aStyle).toBeInstanceOf(Style);
|
|
313
|
+
});
|
|
314
|
+
expect(style[1].getImage()).toBeInstanceOf(Icon);
|
|
315
|
+
expect(style[1].getImage().getSrc()).toEqual(wfsImgPathFromConfig + stylingRules[0].style.polygonImage);
|
|
316
|
+
});
|
|
317
|
+
|
|
283
318
|
it("should return the correct style for a feature with geometry of type MultiPolygon ", () => {
|
|
284
319
|
const stylingRules = [{
|
|
285
320
|
"conditions": {
|
|
@@ -13,6 +13,7 @@ describe("stylePolygon", () => {
|
|
|
13
13
|
imageName: "krankenhaus.png"
|
|
14
14
|
},
|
|
15
15
|
isClustered = false,
|
|
16
|
+
wfsImgPathFromConfig = "/path/to/wfs/images/",
|
|
16
17
|
stylePolygonClass = new PolygonStyle(feature, style, isClustered);
|
|
17
18
|
|
|
18
19
|
describe("createStyle", function () {
|
|
@@ -61,4 +62,11 @@ describe("stylePolygon", () => {
|
|
|
61
62
|
});
|
|
62
63
|
});
|
|
63
64
|
|
|
65
|
+
describe("setImagePath", () => {
|
|
66
|
+
it("defines setImagePath() needed for polygon with Icon", () => {
|
|
67
|
+
stylePolygonClass.setImagePath(wfsImgPathFromConfig);
|
|
68
|
+
expect(stylePolygonClass.attributes.imagePath).toEqual(wfsImgPathFromConfig);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
64
72
|
});
|