@geospatial-sdk/openlayers 0.0.5-dev.14 → 0.0.5-dev.16

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.
@@ -1 +1 @@
1
- {"version":3,"file":"create-map.d.ts","sourceRoot":"","sources":["../../lib/map/create-map.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,eAAe,EACf,cAAc,EAEf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,GAAG,MAAM,QAAQ,CAAC;AACzB,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,MAAM,gBAAgB,CAAC;AAyBnC,wBAAsB,WAAW,CAAC,UAAU,EAAE,eAAe,GAAG,OAAO,CAAC,KAAK,CAAC,CA8K7E;AAED,wBAAgB,UAAU,CAAC,SAAS,EAAE,cAAc,EAAE,GAAG,EAAE,GAAG,GAAG,IAAI,CAyBpE;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,UAAU,EACnB,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,GAC5B,OAAO,CAAC,GAAG,CAAC,CAKd;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,GAAG,CAAC,CAQd"}
1
+ {"version":3,"file":"create-map.d.ts","sourceRoot":"","sources":["../../lib/map/create-map.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,eAAe,EACf,cAAc,EAEf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,GAAG,MAAM,QAAQ,CAAC;AACzB,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,MAAM,gBAAgB,CAAC;AA0BnC,wBAAsB,WAAW,CAAC,UAAU,EAAE,eAAe,GAAG,OAAO,CAAC,KAAK,CAAC,CAqL7E;AAED,wBAAgB,UAAU,CAAC,SAAS,EAAE,cAAc,EAAE,GAAG,EAAE,GAAG,GAAG,IAAI,CAyBpE;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,UAAU,EACnB,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,GAC5B,OAAO,CAAC,GAAG,CAAC,CAKd;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,GAAG,CAAC,CAQd"}
@@ -23,6 +23,7 @@ import VectorTileLayer from "ol/layer/VectorTile";
23
23
  import { OGCMapTile, OGCVectorTile, WMTS } from "ol/source";
24
24
  import { MVT } from "ol/format";
25
25
  import { OgcApiEndpoint, WfsEndpoint, WmtsEndpoint, } from "@camptocamp/ogc-client";
26
+ import { MapboxVectorLayer } from "ol-mapbox-style";
26
27
  const GEOJSON = new GeoJSON();
27
28
  const WFS_MAX_FEATURES = 10000;
28
29
  export function createLayer(layerModel) {
@@ -105,6 +106,13 @@ export function createLayer(layerModel) {
105
106
  layer = olLayer;
106
107
  break;
107
108
  }
109
+ case "maplibre-style": {
110
+ layer = new MapboxVectorLayer({
111
+ styleUrl: layerModel.styleUrl,
112
+ accessToken: layerModel.accessToken,
113
+ });
114
+ break;
115
+ }
108
116
  case "geojson": {
109
117
  if (layerModel.url !== undefined) {
110
118
  layer = new VectorLayer({
@@ -142,7 +150,7 @@ export function createLayer(layerModel) {
142
150
  break;
143
151
  }
144
152
  case "ogcapi": {
145
- const ogcEndpoint = yield new OgcApiEndpoint(layerModel.url);
153
+ const ogcEndpoint = new OgcApiEndpoint(layerModel.url);
146
154
  let layerUrl;
147
155
  if (layerModel.useTiles) {
148
156
  if (layerModel.useTiles === "vector") {
@@ -12,6 +12,7 @@ import {
12
12
  MAP_CTX_FIXTURE,
13
13
  MAP_CTX_LAYER_GEOJSON_FIXTURE,
14
14
  MAP_CTX_LAYER_GEOJSON_REMOTE_FIXTURE,
15
+ MAP_CTX_LAYER_MAPBLIBRE_STYLE_FIXTURE,
15
16
  MAP_CTX_LAYER_OGCAPI_FIXTURE,
16
17
  MAP_CTX_LAYER_WFS_FIXTURE,
17
18
  MAP_CTX_LAYER_WMS_FIXTURE,
@@ -32,6 +33,8 @@ import {
32
33
  resetMapFromContext,
33
34
  } from "./create-map";
34
35
  import WMTS from "ol/source/WMTS";
36
+ import { VectorTile } from "ol/source";
37
+ import { MapboxVectorLayer } from "ol-mapbox-style";
35
38
 
36
39
  describe("MapContextService", () => {
37
40
  describe("#createLayer", () => {
@@ -291,6 +294,26 @@ describe("MapContextService", () => {
291
294
  ]);
292
295
  });
293
296
  });
297
+
298
+ describe("Maplibre Style", () => {
299
+ beforeEach(async () => {
300
+ (layerModel = MAP_CTX_LAYER_MAPBLIBRE_STYLE_FIXTURE),
301
+ (layer = await createLayer(layerModel));
302
+ });
303
+ it("create a tile layer", () => {
304
+ expect(layer).toBeTruthy();
305
+ expect(layer).toBeInstanceOf(MapboxVectorLayer);
306
+ });
307
+ it("set correct layer properties", () => {
308
+ expect(layer.getVisible()).toBe(true);
309
+ expect(layer.getOpacity()).toBe(1);
310
+ expect(layer.get("label")).toBeUndefined();
311
+ });
312
+ it("create a Vector Tile source", () => {
313
+ const source = layer.getSource();
314
+ expect(source).toBeInstanceOf(VectorTile);
315
+ });
316
+ });
294
317
  });
295
318
 
296
319
  describe("#createView", () => {
@@ -27,6 +27,7 @@ import {
27
27
  WfsEndpoint,
28
28
  WmtsEndpoint,
29
29
  } from "@camptocamp/ogc-client";
30
+ import { MapboxVectorLayer } from "ol-mapbox-style";
30
31
 
31
32
  const GEOJSON = new GeoJSON();
32
33
  const WFS_MAX_FEATURES = 10000;
@@ -112,6 +113,13 @@ export async function createLayer(layerModel: MapContextLayer): Promise<Layer> {
112
113
  layer = olLayer;
113
114
  break;
114
115
  }
116
+ case "maplibre-style": {
117
+ layer = new MapboxVectorLayer({
118
+ styleUrl: layerModel.styleUrl,
119
+ accessToken: layerModel.accessToken,
120
+ }) as unknown as Layer;
121
+ break;
122
+ }
115
123
  case "geojson": {
116
124
  if (layerModel.url !== undefined) {
117
125
  layer = new VectorLayer({
@@ -147,7 +155,7 @@ export async function createLayer(layerModel: MapContextLayer): Promise<Layer> {
147
155
  break;
148
156
  }
149
157
  case "ogcapi": {
150
- const ogcEndpoint = await new OgcApiEndpoint(layerModel.url);
158
+ const ogcEndpoint = new OgcApiEndpoint(layerModel.url);
151
159
  let layerUrl: string;
152
160
  if (layerModel.useTiles) {
153
161
  if (layerModel.useTiles === "vector") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geospatial-sdk/openlayers",
3
- "version": "0.0.5-dev.14+cde890f",
3
+ "version": "0.0.5-dev.16+4001375",
4
4
  "description": "OpenLayers-related utilities",
5
5
  "keywords": [
6
6
  "ol",
@@ -29,14 +29,15 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/chroma-js": "^2.4.3",
32
- "ol": "^8.2.0"
32
+ "ol": "^8.2.0",
33
+ "ol-mapbox-style": "^12.3.5"
33
34
  },
34
35
  "peerDependencies": {
35
36
  "ol": ">6.x"
36
37
  },
37
38
  "dependencies": {
38
- "@geospatial-sdk/core": "^0.0.5-dev.14+cde890f",
39
+ "@geospatial-sdk/core": "^0.0.5-dev.16+4001375",
39
40
  "chroma-js": "^2.4.2"
40
41
  },
41
- "gitHead": "cde890ff1c4f9dc9bb07b1c33bcbed68e06550c9"
42
+ "gitHead": "400137529b7bf0df095702ce7b899e0d51634c91"
42
43
  }