@geospatial-sdk/core 0.0.5-dev.41 → 0.0.5-dev.43
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/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/model/events.d.ts +2 -2
- package/dist/model/events.d.ts.map +1 -1
- package/dist/model/events.js +1 -1
- package/dist/model/index.d.ts +3 -3
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +3 -3
- package/dist/model/map-context-diff.d.ts +1 -1
- package/dist/model/map-context-diff.d.ts.map +1 -1
- package/dist/model/map-context.d.ts +1 -1
- package/dist/model/map-context.d.ts.map +1 -1
- package/dist/model/style.d.ts +1 -1
- package/dist/model/style.d.ts.map +1 -1
- package/dist/utils/index.d.ts +6 -6
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +6 -6
- package/dist/utils/map-context-diff.d.ts +1 -1
- package/dist/utils/map-context-diff.d.ts.map +1 -1
- package/dist/utils/map-context-diff.js +7 -4
- package/dist/utils/map-context.d.ts +1 -1
- package/dist/utils/map-context.d.ts.map +1 -1
- package/dist/utils/map-context.js +4 -4
- package/dist/utils/view.d.ts +1 -1
- package/dist/utils/view.d.ts.map +1 -1
- package/dist/utils/view.js +60 -78
- package/lib/index.ts +2 -2
- package/lib/model/events.ts +2 -2
- package/lib/model/index.ts +3 -3
- package/lib/model/map-context-diff.ts +1 -1
- package/lib/model/map-context.ts +1 -1
- package/lib/model/style.ts +1 -1
- package/lib/utils/index.ts +6 -6
- package/lib/utils/map-context-diff.ts +2 -2
- package/lib/utils/map-context.ts +2 -2
- package/lib/utils/view.ts +7 -7
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./utils";
|
|
2
|
-
export * from "./model";
|
|
1
|
+
export * from "./utils/index.js";
|
|
2
|
+
export * from "./model/index.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AACA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// PUBLIC API
|
|
2
|
-
export * from "./utils";
|
|
3
|
-
export * from "./model";
|
|
2
|
+
export * from "./utils/index.js";
|
|
3
|
+
export * from "./model/index.js";
|
package/dist/model/events.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EndpointError } from "@camptocamp/ogc-client";
|
|
2
2
|
import { Feature } from "geojson";
|
|
3
|
-
import BaseEvent from "ol/events/Event";
|
|
4
|
-
import { Extent } from "ol/extent";
|
|
3
|
+
import BaseEvent from "ol/events/Event.js";
|
|
4
|
+
import { Extent } from "ol/extent.js";
|
|
5
5
|
export declare const FeaturesClickEventType = "features-click";
|
|
6
6
|
export interface FeaturesClickEvent {
|
|
7
7
|
type: typeof FeaturesClickEventType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../lib/model/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../lib/model/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,SAAS,MAAM,oBAAoB,CA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export * from "./map-context-diff";
|
|
3
|
-
export * from "./events";
|
|
1
|
+
export * from "./map-context.js";
|
|
2
|
+
export * from "./map-context-diff.js";
|
|
3
|
+
export * from "./events.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/model/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/model/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC"}
|
package/dist/model/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./map-context";
|
|
2
|
-
export * from "./map-context-diff";
|
|
3
|
-
export * from "./events";
|
|
1
|
+
export * from "./map-context.js";
|
|
2
|
+
export * from "./map-context-diff.js";
|
|
3
|
+
export * from "./events.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-context-diff.d.ts","sourceRoot":"","sources":["../../lib/model/map-context-diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"map-context-diff.d.ts","sourceRoot":"","sources":["../../lib/model/map-context-diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEnE;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,eAAe,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,yBAAyB,EAAE,CAAC;IAC3C,eAAe,EAAE,wBAAwB,EAAE,CAAC;IAC5C,aAAa,EAAE,yBAAyB,EAAE,CAAC;IAC3C,WAAW,EAAE,yBAAyB,EAAE,CAAC;IACzC,WAAW,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;CACrC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FeatureCollection, Geometry } from "geojson";
|
|
2
|
-
import { VectorStyle } from "./style";
|
|
2
|
+
import { VectorStyle } from "./style.js";
|
|
3
3
|
export type LayerDimensions = Record<string, string>;
|
|
4
4
|
export type LayerExtras = Record<string, unknown>;
|
|
5
5
|
export interface MapContextBaseLayer {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-context.d.ts","sourceRoot":"","sources":["../../lib/model/map-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"map-context.d.ts","sourceRoot":"","sources":["../../lib/model/map-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAErD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAElD,MAAM,WAAW,mBAAmB;IAClC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,E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UAAU;IACzB,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;CAC7B"}
|
package/dist/model/style.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../lib/model/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../lib/model/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,MAAM,WAAW,GAAG,aAAa,CAAC"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from "./url";
|
|
2
|
-
export * from "./freeze";
|
|
3
|
-
export * from "./hash";
|
|
4
|
-
export { computeMapContextDiff } from "./map-context-diff";
|
|
5
|
-
export { getLayerPosition, addLayerToContext, removeLayerFromContext, replaceLayerInContext, changeLayerPositionInContext, } from "./map-context";
|
|
6
|
-
export { createViewFromLayer } from "./view";
|
|
1
|
+
export * from "./url.js";
|
|
2
|
+
export * from "./freeze.js";
|
|
3
|
+
export * from "./hash.js";
|
|
4
|
+
export { computeMapContextDiff } from "./map-context-diff.js";
|
|
5
|
+
export { getLayerPosition, addLayerToContext, removeLayerFromContext, replaceLayerInContext, changeLayerPositionInContext, } from "./map-context.js";
|
|
6
|
+
export { createViewFromLayer } from "./view.js";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from "./url";
|
|
2
|
-
export * from "./freeze";
|
|
3
|
-
export * from "./hash";
|
|
4
|
-
export { computeMapContextDiff } from "./map-context-diff";
|
|
5
|
-
export { getLayerPosition, addLayerToContext, removeLayerFromContext, replaceLayerInContext, changeLayerPositionInContext, } from "./map-context";
|
|
6
|
-
export { createViewFromLayer } from "./view";
|
|
1
|
+
export * from "./url.js";
|
|
2
|
+
export * from "./freeze.js";
|
|
3
|
+
export * from "./hash.js";
|
|
4
|
+
export { computeMapContextDiff } from "./map-context-diff.js";
|
|
5
|
+
export { getLayerPosition, addLayerToContext, removeLayerFromContext, replaceLayerInContext, changeLayerPositionInContext, } from "./map-context.js";
|
|
6
|
+
export { createViewFromLayer } from "./view.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MapContext, MapContextDiff } from "../model";
|
|
1
|
+
import { MapContext, MapContextDiff } from "../model/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* The following logic is produced by identifying layers in both context
|
|
4
4
|
* and determining whether they have been added, removed, changed or reordered.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-context-diff.d.ts","sourceRoot":"","sources":["../../lib/utils/map-context-diff.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,cAAc,EAIf,MAAM,
|
|
1
|
+
{"version":3,"file":"map-context-diff.d.ts","sourceRoot":"","sources":["../../lib/utils/map-context-diff.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,cAAc,EAIf,MAAM,mBAAmB,CAAC;AAG3B;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,UAAU,EACvB,eAAe,EAAE,UAAU,GAC1B,cAAc,CA0EhB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isLayerSame, isLayerSameAndUnchanged } from "./map-context";
|
|
1
|
+
import { isLayerSame, isLayerSameAndUnchanged } from "./map-context.js";
|
|
2
2
|
/**
|
|
3
3
|
* The following logic is produced by identifying layers in both context
|
|
4
4
|
* and determining whether they have been added, removed, changed or reordered.
|
|
@@ -70,10 +70,13 @@ export function computeMapContextDiff(nextContext, previousContext) {
|
|
|
70
70
|
}
|
|
71
71
|
let viewChanges = nextContext.view !== previousContext.view ? nextContext.view : undefined;
|
|
72
72
|
if (viewChanges !== null && viewChanges !== undefined) {
|
|
73
|
-
viewChanges =
|
|
73
|
+
viewChanges = { ...viewChanges }; // copy the view to avoid unexpected mutations
|
|
74
74
|
}
|
|
75
|
-
return
|
|
75
|
+
return {
|
|
76
|
+
layersAdded,
|
|
76
77
|
layersChanged,
|
|
77
78
|
layersRemoved,
|
|
78
|
-
layersReordered
|
|
79
|
+
layersReordered,
|
|
80
|
+
...(viewChanges !== undefined && { viewChanges }),
|
|
81
|
+
};
|
|
79
82
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MapContext, MapContextLayer } from "../model";
|
|
1
|
+
import { MapContext, MapContextLayer } from "../model/index.js";
|
|
2
2
|
export declare function getLayerHash(layer: MapContextLayer, includeExtras?: boolean): string;
|
|
3
3
|
export declare function isLayerSame(layerA: MapContextLayer, layerB: MapContextLayer): boolean;
|
|
4
4
|
export declare function isLayerSameAndUnchanged(layerA: MapContextLayer, layerB: MapContextLayer): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-context.d.ts","sourceRoot":"","sources":["../../lib/utils/map-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"map-context.d.ts","sourceRoot":"","sources":["../../lib/utils/map-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGhE,wBAAgB,YAAY,CAC1B,KAAK,EAAE,eAAe,EACtB,aAAa,UAAQ,GACpB,MAAM,CAER;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,eAAe,GACtB,OAAO,CAKT;AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,eAAe,GACtB,OAAO,CAKT;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,UAAU,EACnB,UAAU,EAAE,eAAe,GAC1B,MAAM,CAER;AAED;;;;;;;GAOG;AAEH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,UAAU,EACnB,UAAU,EAAE,eAAe,EAC3B,QAAQ,CAAC,EAAE,MAAM,GAChB,UAAU,CAQZ;AAED;;;;;;GAMG;AAEH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,UAAU,EACnB,UAAU,EAAE,eAAe,GAC1B,UAAU,CAOZ;AAED;;;;;;;GAOG;AAEH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,UAAU,EACnB,UAAU,EAAE,eAAe,EAC3B,WAAW,EAAE,eAAe,GAC3B,UAAU,CAOZ;AAED;;;;;;;GAOG;AAEH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,UAAU,EACnB,UAAU,EAAE,eAAe,EAC3B,QAAQ,EAAE,MAAM,GACf,UAAU,CAGZ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getHash } from "./hash";
|
|
1
|
+
import { getHash } from "./hash.js";
|
|
2
2
|
export function getLayerHash(layer, includeExtras = false) {
|
|
3
3
|
return getHash(layer, includeExtras ? [] : ["extras"]);
|
|
4
4
|
}
|
|
@@ -26,7 +26,7 @@ export function getLayerPosition(context, layerModel) {
|
|
|
26
26
|
* @returns {MapContext} - The new map context with the added layer.
|
|
27
27
|
*/
|
|
28
28
|
export function addLayerToContext(context, layerModel, position) {
|
|
29
|
-
const newContext =
|
|
29
|
+
const newContext = { ...context, layers: [...context.layers] };
|
|
30
30
|
if (position !== undefined) {
|
|
31
31
|
newContext.layers.splice(position, 0, layerModel);
|
|
32
32
|
}
|
|
@@ -43,7 +43,7 @@ export function addLayerToContext(context, layerModel, position) {
|
|
|
43
43
|
* @returns {MapContext} - The new map context without the removed layer.
|
|
44
44
|
*/
|
|
45
45
|
export function removeLayerFromContext(context, layerModel) {
|
|
46
|
-
const newContext =
|
|
46
|
+
const newContext = { ...context, layers: [...context.layers] };
|
|
47
47
|
const position = getLayerPosition(context, layerModel);
|
|
48
48
|
if (position >= 0) {
|
|
49
49
|
newContext.layers.splice(position, 1);
|
|
@@ -59,7 +59,7 @@ export function removeLayerFromContext(context, layerModel) {
|
|
|
59
59
|
* @returns {MapContext} - The new map context with the replaced layer.
|
|
60
60
|
*/
|
|
61
61
|
export function replaceLayerInContext(context, layerModel, replacement) {
|
|
62
|
-
const newContext =
|
|
62
|
+
const newContext = { ...context, layers: [...context.layers] };
|
|
63
63
|
const position = getLayerPosition(context, layerModel);
|
|
64
64
|
if (position >= 0) {
|
|
65
65
|
newContext.layers.splice(position, 1, replacement);
|
package/dist/utils/view.d.ts
CHANGED
package/dist/utils/view.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../lib/utils/view.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,eAAe,EAIf,cAAc,EAEf,MAAM,
|
|
1
|
+
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../lib/utils/view.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,eAAe,EAIf,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAK3B,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAYhC"}
|
package/dist/utils/view.js
CHANGED
|
@@ -1,38 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { transformExtent } from "ol/proj";
|
|
1
|
+
import { transformExtent } from "ol/proj.js";
|
|
11
2
|
import { WfsEndpoint, WmsEndpoint, WmtsEndpoint } from "@camptocamp/ogc-client";
|
|
12
|
-
import { LONLAT_CRS_CODES } from "../constant/projections";
|
|
13
|
-
import { fromEPSGCode, register } from "ol/proj/proj4";
|
|
14
|
-
import GeoJSON from "ol/format/GeoJSON";
|
|
15
|
-
import { extend } from "ol/extent";
|
|
3
|
+
import { LONLAT_CRS_CODES } from "../constant/projections.js";
|
|
4
|
+
import { fromEPSGCode, register } from "ol/proj/proj4.js";
|
|
5
|
+
import GeoJSON from "ol/format/GeoJSON.js";
|
|
6
|
+
import { extend } from "ol/extent.js";
|
|
16
7
|
import proj4 from "proj4";
|
|
17
8
|
const GEOJSON = new GeoJSON();
|
|
18
|
-
export function createViewFromLayer(layer) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
});
|
|
9
|
+
export async function createViewFromLayer(layer) {
|
|
10
|
+
if (layer.type === "wms") {
|
|
11
|
+
return await getWmsLayerExtent(layer);
|
|
12
|
+
}
|
|
13
|
+
else if (layer.type === "wmts") {
|
|
14
|
+
return await getWmtsLayerExtent(layer);
|
|
15
|
+
}
|
|
16
|
+
else if (layer.type === "geojson" && layer.data) {
|
|
17
|
+
return computeExtentFromGeojson(layer.data);
|
|
18
|
+
}
|
|
19
|
+
else if (layer.type === "wfs") {
|
|
20
|
+
return await getWfsLayerExtent(layer);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
throw new Error(`Unsupported layer type: ${layer.type}`);
|
|
24
|
+
}
|
|
36
25
|
}
|
|
37
26
|
function computeExtentFromGeojson(data) {
|
|
38
27
|
const geojson = typeof data === "string" ? JSON.parse(data) : data;
|
|
@@ -47,52 +36,45 @@ function computeExtentFromGeojson(data) {
|
|
|
47
36
|
extent,
|
|
48
37
|
};
|
|
49
38
|
}
|
|
50
|
-
function getWmsLayerExtent(layer) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (lonLatCRS) {
|
|
59
|
-
return {
|
|
60
|
-
extent: boundingBoxes[lonLatCRS],
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
const availableEPSGCode = Object.keys(boundingBoxes)[0];
|
|
65
|
-
register(proj4);
|
|
66
|
-
const proj = yield fromEPSGCode(availableEPSGCode);
|
|
67
|
-
return {
|
|
68
|
-
extent: transformExtent(boundingBoxes[availableEPSGCode], proj, "EPSG:4326"),
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
function getWmtsLayerExtent(layer) {
|
|
74
|
-
var _a;
|
|
75
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
const endpoint = yield new WmtsEndpoint(layer.url).isReady();
|
|
77
|
-
const layerName = (_a = endpoint.getSingleLayerName()) !== null && _a !== void 0 ? _a : layer.name;
|
|
78
|
-
const wmtsLayer = endpoint.getLayerByName(layerName);
|
|
79
|
-
return wmtsLayer.latLonBoundingBox
|
|
80
|
-
? {
|
|
81
|
-
extent: wmtsLayer.latLonBoundingBox,
|
|
82
|
-
}
|
|
83
|
-
: null;
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
function getWfsLayerExtent(layer) {
|
|
87
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
const endpoint = yield new WfsEndpoint(layer.url).isReady();
|
|
89
|
-
const featureTypeSummary = endpoint.getFeatureTypeSummary(layer.featureType);
|
|
90
|
-
const boundingBox = featureTypeSummary === null || featureTypeSummary === void 0 ? void 0 : featureTypeSummary.boundingBox;
|
|
91
|
-
if (!boundingBox) {
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
39
|
+
async function getWmsLayerExtent(layer) {
|
|
40
|
+
const endpoint = await new WmsEndpoint(layer.url).isReady();
|
|
41
|
+
const { boundingBoxes } = endpoint.getLayerByName(layer.name);
|
|
42
|
+
if (!Object.keys(boundingBoxes).length) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
const lonLatCRS = Object.keys(boundingBoxes).find((crs) => LONLAT_CRS_CODES.includes(crs));
|
|
46
|
+
if (lonLatCRS) {
|
|
94
47
|
return {
|
|
95
|
-
extent:
|
|
48
|
+
extent: boundingBoxes[lonLatCRS],
|
|
96
49
|
};
|
|
97
|
-
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
const availableEPSGCode = Object.keys(boundingBoxes)[0];
|
|
53
|
+
register(proj4);
|
|
54
|
+
const proj = await fromEPSGCode(availableEPSGCode);
|
|
55
|
+
return {
|
|
56
|
+
extent: transformExtent(boundingBoxes[availableEPSGCode], proj, "EPSG:4326"),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async function getWmtsLayerExtent(layer) {
|
|
61
|
+
const endpoint = await new WmtsEndpoint(layer.url).isReady();
|
|
62
|
+
const layerName = endpoint.getSingleLayerName() ?? layer.name;
|
|
63
|
+
const wmtsLayer = endpoint.getLayerByName(layerName);
|
|
64
|
+
return wmtsLayer.latLonBoundingBox
|
|
65
|
+
? {
|
|
66
|
+
extent: wmtsLayer.latLonBoundingBox,
|
|
67
|
+
}
|
|
68
|
+
: null;
|
|
69
|
+
}
|
|
70
|
+
async function getWfsLayerExtent(layer) {
|
|
71
|
+
const endpoint = await new WfsEndpoint(layer.url).isReady();
|
|
72
|
+
const featureTypeSummary = endpoint.getFeatureTypeSummary(layer.featureType);
|
|
73
|
+
const boundingBox = featureTypeSummary?.boundingBox;
|
|
74
|
+
if (!boundingBox) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
extent: boundingBox,
|
|
79
|
+
};
|
|
98
80
|
}
|
package/lib/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// PUBLIC API
|
|
2
|
-
export * from "./utils";
|
|
3
|
-
export * from "./model";
|
|
2
|
+
export * from "./utils/index.js";
|
|
3
|
+
export * from "./model/index.js";
|
package/lib/model/events.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EndpointError } from "@camptocamp/ogc-client";
|
|
2
2
|
import { Feature } from "geojson";
|
|
3
|
-
import BaseEvent from "ol/events/Event";
|
|
4
|
-
import { Extent } from "ol/extent";
|
|
3
|
+
import BaseEvent from "ol/events/Event.js";
|
|
4
|
+
import { Extent } from "ol/extent.js";
|
|
5
5
|
|
|
6
6
|
export const FeaturesClickEventType = "features-click";
|
|
7
7
|
export interface FeaturesClickEvent {
|
package/lib/model/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./map-context";
|
|
2
|
-
export * from "./map-context-diff";
|
|
3
|
-
export * from "./events";
|
|
1
|
+
export * from "./map-context.js";
|
|
2
|
+
export * from "./map-context-diff.js";
|
|
3
|
+
export * from "./events.js";
|
package/lib/model/map-context.ts
CHANGED
package/lib/model/style.ts
CHANGED
package/lib/utils/index.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export * from "./url";
|
|
2
|
-
export * from "./freeze";
|
|
3
|
-
export * from "./hash";
|
|
4
|
-
export { computeMapContextDiff } from "./map-context-diff";
|
|
1
|
+
export * from "./url.js";
|
|
2
|
+
export * from "./freeze.js";
|
|
3
|
+
export * from "./hash.js";
|
|
4
|
+
export { computeMapContextDiff } from "./map-context-diff.js";
|
|
5
5
|
export {
|
|
6
6
|
getLayerPosition,
|
|
7
7
|
addLayerToContext,
|
|
8
8
|
removeLayerFromContext,
|
|
9
9
|
replaceLayerInContext,
|
|
10
10
|
changeLayerPositionInContext,
|
|
11
|
-
} from "./map-context";
|
|
12
|
-
export { createViewFromLayer } from "./view";
|
|
11
|
+
} from "./map-context.js";
|
|
12
|
+
export { createViewFromLayer } from "./view.js";
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
MapContextLayer,
|
|
5
5
|
MapContextLayerPositioned,
|
|
6
6
|
MapContextLayerReordered,
|
|
7
|
-
} from "../model";
|
|
8
|
-
import { isLayerSame, isLayerSameAndUnchanged } from "./map-context";
|
|
7
|
+
} from "../model/index.js";
|
|
8
|
+
import { isLayerSame, isLayerSameAndUnchanged } from "./map-context.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* The following logic is produced by identifying layers in both context
|
package/lib/utils/map-context.ts
CHANGED
package/lib/utils/view.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { transformExtent } from "ol/proj";
|
|
1
|
+
import { transformExtent } from "ol/proj.js";
|
|
2
2
|
import { WfsEndpoint, WmsEndpoint, WmtsEndpoint } from "@camptocamp/ogc-client";
|
|
3
|
-
import { LONLAT_CRS_CODES } from "../constant/projections";
|
|
4
|
-
import { fromEPSGCode, register } from "ol/proj/proj4";
|
|
5
|
-
import GeoJSON from "ol/format/GeoJSON";
|
|
6
|
-
import { extend } from "ol/extent";
|
|
7
|
-
import Feature from "ol/Feature";
|
|
3
|
+
import { LONLAT_CRS_CODES } from "../constant/projections.js";
|
|
4
|
+
import { fromEPSGCode, register } from "ol/proj/proj4.js";
|
|
5
|
+
import GeoJSON from "ol/format/GeoJSON.js";
|
|
6
|
+
import { extend } from "ol/extent.js";
|
|
7
|
+
import Feature from "ol/Feature.js";
|
|
8
8
|
import proj4 from "proj4";
|
|
9
9
|
import {
|
|
10
10
|
Extent,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
MapContextLayerWmts,
|
|
15
15
|
MapContextView,
|
|
16
16
|
ViewByExtent,
|
|
17
|
-
} from "../model";
|
|
17
|
+
} from "../model/index.js";
|
|
18
18
|
import { FeatureCollection, Geometry } from "geojson";
|
|
19
19
|
|
|
20
20
|
const GEOJSON = new GeoJSON();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geospatial-sdk/core",
|
|
3
|
-
"version": "0.0.5-dev.
|
|
3
|
+
"version": "0.0.5-dev.43+a7f100d",
|
|
4
4
|
"description": "Core functions and models for the SDK",
|
|
5
5
|
"author": "Olivia <olivia.guyot@camptocamp.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"test": "vitest",
|
|
23
23
|
"build": "tsc"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "a7f100dfebe66dff0f44abb4c630917db89453fd",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"proj4": "^2.9.2"
|
|
28
28
|
},
|