@masterportal/masterportalapi 2.4.0 → 2.6.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/.eslintrc CHANGED
@@ -9,7 +9,7 @@
9
9
  "Cesium": true
10
10
  },
11
11
  "parserOptions": {
12
- "ecmaVersion": 2020,
12
+ "ecmaVersion": 2022,
13
13
  "sourceType": "module"
14
14
  },
15
15
  "extends": [
package/CHANGELOG.md CHANGED
@@ -3,6 +3,49 @@
3
3
 
4
4
  The [Semantic Versioning](https://semver.org/spec/v2.0.0.html) is used.
5
5
 
6
+ ## 2.6.0 - 2022-09-06
7
+ ### Added
8
+ - Added possibility to set initial features for layer vectorBase.
9
+
10
+ ### Changed
11
+ - OAF: Fixed oaf recursion and a possibility to disable the CRS parameter is added.
12
+
13
+ ---
14
+
15
+ ## 2.5.1 - 2022-08-05
16
+ ### Fixed
17
+ - Remove import of `defaultResolutions` for the vectorStyle layer
18
+
19
+ ---
20
+
21
+ ## 2.5.0 - 2022-08-05
22
+ ### Added
23
+ - The following packages have been installed:
24
+ - jest-environment-jsdom: 28.1.3
25
+
26
+ ### Changed
27
+ - The following packages have been updated:
28
+ - dependencies:
29
+ - core-js: 3.16.1 to 3.24.0
30
+ - ol: 6.14.1 to 6.15.1 (This also raised ol-mapbox-style from 7 to version 8)
31
+ - proj4: 2.7.5 to 2.8.0
32
+ - devDependencies:
33
+ - @babel/core: 7.16.7 to 7.18.9
34
+ - @babel/plugin-transform-modules-commonjs: 7.16.8 to 7.18.6
35
+ - @parcel/transformer-sass: 2.2.0 to 2.6.2
36
+ - canvas: 2.8.0 to 2.9.3
37
+ - eslint: 7.32.0 to 8.20.0
38
+ - husky: 7.0.1 to 8.0.1
39
+ - jest: 27.4.0 to 28.1.3
40
+ - jest-canvas-mock: 2.3.1 to 2.4.0
41
+ - jsdoc: 3.6.7 to 3.6.11
42
+ - parcel: 2.2.0 to 2.6.2
43
+ - sass: 1.37.5 to 1.54.0
44
+ - peerDependencies:
45
+ - cesium: 1.88.0 to 1.95.0
46
+
47
+ ---
48
+
6
49
  ## 2.4.0 - 2022-07-06
7
50
  ### Added
8
51
  - Issue 776: Add 3D mode for WMTS layers.
@@ -31,5 +31,5 @@
31
31
  "id": "1001"
32
32
  }
33
33
  ],
34
- "cesiumLib":"https://geoportal-hamburg.de/mastercode/cesium/1_93/Cesium.js"
34
+ "cesiumLib":"https://geoportal-hamburg.de/mastercode/cesium/1_95/Cesium.js"
35
35
  }
@@ -62,6 +62,43 @@
62
62
  "maximumScreenSpaceError": 6
63
63
  }
64
64
  },
65
+ {
66
+ "id": "4003",
67
+ "name": "EntitiesLayer",
68
+ "typ": "Entities3D",
69
+ "entities": [
70
+ {
71
+ "url": "https://daten-hamburg.de/gdi3d/datasource-data/Simple_Building.glb",
72
+ "attributes": {
73
+ "name": "einfaches Haus in Planten und Blomen"
74
+ },
75
+ "latitude": 53.5631,
76
+ "longitude": 9.9800,
77
+ "height": 16,
78
+ "heading": 0,
79
+ "pitch": 0,
80
+ "roll": 0,
81
+ "scale": 5,
82
+ "allowPicking": true,
83
+ "show": true
84
+ },
85
+ {
86
+ "url": "https://daten-hamburg.de/gdi3d/datasource-data/Simple_Building.glb",
87
+ "attributes": {
88
+ "name": "einfaches Haus im See"
89
+ },
90
+ "latitude": 53.5622,
91
+ "longitude": 9.9808,
92
+ "height": 16,
93
+ "heading": 0,
94
+ "pitch": 0,
95
+ "roll": 0,
96
+ "scale": 2,
97
+ "allowPicking": true,
98
+ "show": true
99
+ }
100
+ ]
101
+ },
65
102
  {
66
103
  "id": "5001",
67
104
  "name": "Schulen",
@@ -106,12 +143,12 @@
106
143
  "zDirection": -1
107
144
  },
108
145
  {
109
- "id":"7001",
110
- "name":"TopPlusOpen",
111
- "capabilitiesUrl":"https://sgx.geodatenzentrum.de/wmts_topplus_open/1.0.0/WMTSCapabilities.xml",
112
- "optionsFromCapabilities":true,
113
- "typ":"WMTS",
114
- "layers":"web"
146
+ "id": "7001",
147
+ "name": "TopPlusOpen",
148
+ "capabilitiesUrl": "https://sgx.geodatenzentrum.de/wmts_topplus_open/1.0.0/WMTSCapabilities.xml",
149
+ "optionsFromCapabilities": true,
150
+ "typ": "WMTS",
151
+ "layers": "web"
115
152
  },
116
153
  {
117
154
  "id": "7002",
@@ -142,16 +179,86 @@
142
179
  "maxScale": "2500000",
143
180
  "tileMatrixSet": "google3857",
144
181
  "matrixSizes": [
145
- [1, 1], [2, 2],
146
- [4, 4], [8, 8],
147
- [16, 16], [32, 32],
148
- [64, 64], [128, 128],
149
- [256, 256], [512, 512],
150
- [1024, 1024], [2048, 2048],
151
- [4096, 4096], [8192, 8192],
152
- [16384, 16384], [32768, 32768],
153
- [65536, 65536], [131072, 131072],
154
- [262144, 262144], [524288, 524288]
182
+ [
183
+ 1,
184
+ 1
185
+ ],
186
+ [
187
+ 2,
188
+ 2
189
+ ],
190
+ [
191
+ 4,
192
+ 4
193
+ ],
194
+ [
195
+ 8,
196
+ 8
197
+ ],
198
+ [
199
+ 16,
200
+ 16
201
+ ],
202
+ [
203
+ 32,
204
+ 32
205
+ ],
206
+ [
207
+ 64,
208
+ 64
209
+ ],
210
+ [
211
+ 128,
212
+ 128
213
+ ],
214
+ [
215
+ 256,
216
+ 256
217
+ ],
218
+ [
219
+ 512,
220
+ 512
221
+ ],
222
+ [
223
+ 1024,
224
+ 1024
225
+ ],
226
+ [
227
+ 2048,
228
+ 2048
229
+ ],
230
+ [
231
+ 4096,
232
+ 4096
233
+ ],
234
+ [
235
+ 8192,
236
+ 8192
237
+ ],
238
+ [
239
+ 16384,
240
+ 16384
241
+ ],
242
+ [
243
+ 32768,
244
+ 32768
245
+ ],
246
+ [
247
+ 65536,
248
+ 65536
249
+ ],
250
+ [
251
+ 131072,
252
+ 131072
253
+ ],
254
+ [
255
+ 262144,
256
+ 262144
257
+ ],
258
+ [
259
+ 524288,
260
+ 524288
261
+ ]
155
262
  ],
156
263
  "coordinateSystem": "EPSG:3857",
157
264
  "layerAttribution": "nicht vorhanden",
@@ -163,53 +270,28 @@
163
270
  20037508.3428
164
271
  ],
165
272
  "scales": [
166
- 559082264.029, 279541132.015, 139770566.007, 69885283.0036,
167
- 34942641.5018, 17471320.7509, 8735660.37545, 4367830.18773,
168
- 2183915.09386, 1091957.54693, 45978.773466, 272989.386733,
169
- 136494.693366, 68247.3466832, 34123.6733416, 17061.8366708,
170
- 8530.91833540, 4265.45916770, 2132.72958385, 1066.36479193
273
+ 559082264.029,
274
+ 279541132.015,
275
+ 139770566.007,
276
+ 69885283.0036,
277
+ 34942641.5018,
278
+ 17471320.7509,
279
+ 8735660.37545,
280
+ 4367830.18773,
281
+ 2183915.09386,
282
+ 1091957.54693,
283
+ 45978.773466,
284
+ 272989.386733,
285
+ 136494.693366,
286
+ 68247.3466832,
287
+ 34123.6733416,
288
+ 17061.8366708,
289
+ 8530.91833540,
290
+ 4265.45916770,
291
+ 2132.72958385,
292
+ 1066.36479193
171
293
  ],
172
294
  "resLength": "20",
173
295
  "requestEncoding": "REST"
174
- },
175
- {
176
- "id": "4003",
177
- "name": "EntitiesLayer",
178
- "typ": "Entities3D",
179
- "entities": [
180
- {
181
- "url": "https://daten-hamburg.de/gdi3d/datasource-data/Simple_Building.glb",
182
- "attributes": {
183
- "name": "einfaches Haus in Planten und Blomen"
184
- },
185
- "latitude": 53.5631,
186
- "longitude": 9.9800,
187
- "height": 16,
188
- "heading": 0,
189
- "pitch": 0,
190
- "roll": 0,
191
- "scale": 5,
192
- "allowPicking": true,
193
- "show": true
194
- },
195
- {
196
- "url": "https://daten-hamburg.de/gdi3d/datasource-data/Simple_Building.glb",
197
- "attributes": {
198
- "name": "einfaches Haus im See"
199
- },
200
- "latitude": 53.5622,
201
- "longitude": 9.9808,
202
- "height": 16,
203
- "heading": 0,
204
- "pitch": 0,
205
- "roll": 0,
206
- "scale": 2,
207
- "allowPicking": true,
208
- "show": true
209
- }
210
- ],
211
- "gfiAttributes" : {
212
- "name": "Name"
213
- }
214
296
  }
215
297
  ]
package/example/index.js CHANGED
@@ -47,7 +47,7 @@ document.getElementById("enable").addEventListener("click", function () {
47
47
  document.getElementById("layer-visibility").style.display = "none";
48
48
  }
49
49
  else {
50
- const lib = portalConfig.cesiumLib ? portalConfig.cesiumLib : "https://geoportal-hamburg.de/mastercode/cesium/1_93/Cesium.js";
50
+ const lib = portalConfig.cesiumLib ? portalConfig.cesiumLib : "https://geoportal-hamburg.de/mastercode/cesium/1_95/index.js";
51
51
 
52
52
  document.getElementById("layer-visibility").style.display = "block";
53
53
 
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.0",
4
+ "version": "2.6.0",
5
5
  "license": "MIT",
6
6
  "description": "Basic functions of the Masterportal as api",
7
7
  "repository": {
@@ -19,33 +19,33 @@
19
19
  "prepare": "husky install"
20
20
  },
21
21
  "dependencies": {
22
- "core-js": "^3.16.1",
23
- "ol": "6.14.1",
22
+ "core-js": "^3.24.0",
23
+ "ol": "6.15.1",
24
24
  "olcs": "^2.13.0",
25
- "proj4": "^2.7.5",
25
+ "proj4": "^2.8.0",
26
26
  "xml2js": "^0.4.23"
27
27
  },
28
28
  "devDependencies": {
29
- "@babel/core": "^7.16.7",
30
- "@babel/plugin-transform-modules-commonjs": "^7.16.8",
31
- "@parcel/transformer-sass": "^2.2.0",
29
+ "@babel/core": "^7.18.9",
30
+ "@babel/plugin-transform-modules-commonjs": "^7.18.6",
31
+ "@parcel/transformer-sass": "^2.6.2",
32
32
  "buffer": "^6.0.3",
33
- "canvas": "^2.8.0",
34
- "eslint": "^7.32.0",
33
+ "canvas": "^2.9.3",
34
+ "eslint": "^8.20.0",
35
35
  "events": "^3.3.0",
36
- "husky": "^7.0.1",
37
- "jest": "^27.4.0",
38
- "jest-canvas-mock": "^2.3.1",
39
- "jsdoc": "^3.6.7",
40
- "parcel": "^2.2.0",
36
+ "husky": "^8.0.1",
37
+ "jest": "^28.1.3",
38
+ "jest-canvas-mock": "^2.4.0",
39
+ "jest-environment-jsdom": "^28.1.3",
40
+ "jsdoc": "^3.6.11",
41
+ "parcel": "^2.6.2",
41
42
  "process": "^0.11.10",
42
- "regenerator-runtime": "0.13.9",
43
- "sass": "^1.37.5",
43
+ "sass": "^1.54.0",
44
44
  "stream-browserify": "^3.0.0",
45
45
  "timers-browserify": "^2.0.12"
46
46
  },
47
47
  "peerDependencies": {
48
- "cesium": "^1.88.0"
48
+ "cesium": "^1.95.0"
49
49
  },
50
50
  "engines": {
51
51
  "node": "^16.13.2",
package/src/defaults.js CHANGED
@@ -19,7 +19,7 @@ export default {
19
19
  {resolution: 1.3229159522920524, scale: 5000, zoomLevel: 6},
20
20
  {resolution: 0.6614579761460262, scale: 2500, zoomLevel: 7},
21
21
  {resolution: 0.2645831904584105, scale: 1000, zoomLevel: 8},
22
- {resolution: 0.13229159522920521, scale: 500, zoomLevel: 9}
22
+ {resolution: 0.1322915952292052, scale: 500, zoomLevel: 9}
23
23
  ],
24
24
  namedProjections: [
25
25
  ["EPSG:25832", "+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"]
package/src/layer/oaf.js CHANGED
@@ -57,7 +57,8 @@ function getNextLinkFromFeatureCollection (featureCollection) {
57
57
  if (
58
58
  typeof featureCollection.links[i] === "object" && featureCollection.links[i] !== null
59
59
  && typeof featureCollection.links[i].href === "string"
60
- && featureCollection.links[i].title === "next page"
60
+ && featureCollection.links[i].rel === "next"
61
+ && featureCollection.links[i].type === "application/geo+json"
61
62
  ) {
62
63
  return featureCollection.links[i].href;
63
64
  }
@@ -157,7 +158,9 @@ function createUrl (rawLayer) {
157
158
  url += "bbox=" + appendingString + "&";
158
159
  }
159
160
  url += typeof rawLayer.bboxCrs === "string" && rawLayer.bboxCrs !== "" ? "bbox-crs=" + encodeURIComponent(rawLayer.bboxCrs) + "&" : "";
160
- url += "crs=" + encodeURIComponent(typeof rawLayer.crs === "string" && rawLayer.crs !== "" ? rawLayer.crs : crsDefault) + "&";
161
+ if (rawLayer.crs !== false) {
162
+ url += "crs=" + encodeURIComponent(typeof rawLayer.crs === "string" && rawLayer.crs !== "" ? rawLayer.crs : crsDefault) + "&";
163
+ }
161
164
  url += typeof rawLayer.datetime === "string" && rawLayer.datetime !== "" ? "datetime=" + rawLayer.datetime + "&" : "";
162
165
  url += getParamsUrl(rawLayer.params);
163
166
 
@@ -29,8 +29,10 @@ export default function Tileset (rawLayer) {
29
29
  id: rawLayer.id,
30
30
  typ: rawLayer.typ
31
31
  };
32
- this.tileset = createTileSet(rawLayer);
33
- this.tileset.layerReferenceId = rawLayer.id;
32
+ if (Cesium) {
33
+ this.tileset = createTileSet(rawLayer);
34
+ this.tileset.layerReferenceId = rawLayer.id;
35
+ }
34
36
  }
35
37
  /**
36
38
  *
@@ -4,10 +4,13 @@ import VectorSource from "ol/source/Vector.js";
4
4
 
5
5
  /**
6
6
  * Triggered by Layer to create a layerSource
7
+ * @param {Object} attrs attributes of the layer
7
8
  * @returns {void}
8
9
  */
9
- export function createLayerSource () {
10
- return new VectorSource();
10
+ export function createLayerSource (attrs) {
11
+ return new VectorSource({
12
+ features: attrs.features
13
+ });
11
14
  }
12
15
 
13
16
  /**
@@ -27,7 +30,7 @@ export function updateSource (layer, features) {
27
30
  * @returns {Object} layer
28
31
  */
29
32
  export function createLayer (attrs) {
30
- const source = this.createLayerSource();
33
+ const source = this.createLayerSource(attrs);
31
34
 
32
35
  return new VectorLayer({
33
36
  source: source,
@@ -4,8 +4,7 @@ import VectorTileSource from "ol/source/VectorTile";
4
4
  import OpenLayersTileGrid from "ol/tilegrid/TileGrid";
5
5
  import {extentFromProjection} from "ol/tilegrid";
6
6
 
7
- import stylefunction from "ol-mapbox-style/dist/stylefunction";
8
- import {defaultResolutions} from "ol-mapbox-style/dist/util";
7
+ import {stylefunction} from "ol-mapbox-style";
9
8
 
10
9
  import defaults from "../defaults";
11
10
 
@@ -167,8 +166,8 @@ export function createLayer (rawLayer = {}, {layerParams = {}, options = {}} = {
167
166
  export function setStyle (layer, glStyle, {options = {}} = {}) {
168
167
  stylefunction(layer, glStyle,
169
168
  options.sourceId ? options.sourceId : Object.keys(glStyle.sources)[0],
170
- options.resolutions ? options.resolutions : defaultResolutions,
169
+ options.resolutions,
171
170
  options.spriteData,
172
171
  options.spriteImageUrl,
173
172
  options.getFonts);
174
- }
173
+ }
@@ -1,3 +1,6 @@
1
+ import Feature from "ol/Feature";
2
+ import Point from "ol/geom/Point";
3
+ import Polygon from "ol/geom/Polygon";
1
4
  import VectorLayer from "ol/layer/Vector";
2
5
  import VectorSource from "ol/source/Vector.js";
3
6
  import * as vectorBase from "../../src/layer/vectorBase";
@@ -5,8 +8,20 @@ import * as vectorBase from "../../src/layer/vectorBase";
5
8
  describe("vectorBase.js", function () {
6
9
 
7
10
  describe("createLayerSource", function () {
8
- it("creates a layerSource", function () {
9
- const source = vectorBase.createLayerSource();
11
+ it("creates a layerSource with features", function () {
12
+ const attr = {
13
+ features: [
14
+ new Feature({geometry: new Polygon([[[565086.1948534324, 5934664.461947621], [565657.6945448224, 5934738.54524095], [565625.9445619675, 5934357.545446689], [565234.3614400891, 5934346.962119071], [565086.1948534324, 5934664.461947621]]])}),
15
+ new Feature({geometry: new Point([565826.38, 5934174.40])})
16
+ ]
17
+ },
18
+ source = vectorBase.createLayerSource(attr);
19
+
20
+ expect(source).toBeInstanceOf(VectorSource);
21
+ });
22
+
23
+ it("creates a layerSource without features", function () {
24
+ const source = vectorBase.createLayerSource({});
10
25
 
11
26
  expect(source).toBeInstanceOf(VectorSource);
12
27
  });
@@ -135,7 +135,7 @@ describe("vectorTile.js", function () {
135
135
  1.3229159522920524,
136
136
  0.6614579761460262,
137
137
  0.2645831904584105,
138
- 0.13229159522920522
138
+ 0.1322915952292052
139
139
  ],
140
140
  tileSize: 512
141
141
  },
@@ -169,4 +169,4 @@ describe("vectorTile.js", function () {
169
169
  expect(featureStyle[0].getFill().getColor()).toBe("rgba(255,253,238,1)");
170
170
  });
171
171
  });
172
- });
172
+ });