@geospatial-sdk/core 0.0.5-dev.50 → 0.0.5-dev.52
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/model/events.d.ts +4 -1
- package/dist/model/events.d.ts.map +1 -1
- package/dist/model/map-context.d.ts +11 -10
- 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 +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/style.d.ts +4 -0
- package/dist/utils/style.d.ts.map +1 -0
- package/dist/utils/style.js +69 -0
- package/lib/model/events.ts +5 -1
- package/lib/model/map-context.ts +23 -17
- package/lib/model/style.ts +1 -1
- package/lib/utils/index.ts +1 -0
- package/lib/utils/style.ts +72 -0
- package/lib/utils/view.ts +1 -1
- package/package.json +6 -3
package/dist/model/events.d.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { EndpointError } from "@camptocamp/ogc-client";
|
|
2
2
|
import { Feature } from "geojson";
|
|
3
3
|
import BaseEvent from "ol/events/Event.js";
|
|
4
|
-
import { Extent } from "ol/extent.js";
|
|
4
|
+
import type { Extent } from "ol/extent.js";
|
|
5
|
+
export type FeaturesByLayerIndex = Map<number, Feature[]>;
|
|
5
6
|
export declare const FeaturesClickEventType = "features-click";
|
|
6
7
|
export interface FeaturesClickEvent {
|
|
7
8
|
type: typeof FeaturesClickEventType;
|
|
8
9
|
features: Feature[];
|
|
10
|
+
featuresByLayer: FeaturesByLayerIndex;
|
|
9
11
|
}
|
|
10
12
|
export declare const FeaturesHoverEventType = "features-hover";
|
|
11
13
|
export interface FeaturesHoverEvent {
|
|
12
14
|
type: typeof FeaturesHoverEventType;
|
|
13
15
|
features: Feature[];
|
|
16
|
+
featuresByLayer: FeaturesByLayerIndex;
|
|
14
17
|
}
|
|
15
18
|
export declare const MapClickEventType = "map-click";
|
|
16
19
|
export interface MapClickEvent {
|
|
@@ -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,oBAAoB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
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,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,MAAM,oBAAoB,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;AAE1D,eAAO,MAAM,sBAAsB,mBAAmB,CAAC;AACvD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,sBAAsB,CAAC;IACpC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,eAAe,EAAE,oBAAoB,CAAC;CACvC;AAED,eAAO,MAAM,sBAAsB,mBAAmB,CAAC;AACvD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,sBAAsB,CAAC;IACpC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,eAAe,EAAE,oBAAoB,CAAC;CACvC;AAED,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAC7C,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,OAAO,iBAAiB,CAAC;IAC/B,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,eAAO,MAAM,wBAAwB,sBAAsB,CAAC;AAC5D,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,OAAO,wBAAwB,CAAC;IACtC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,mBAAmB,sBAAsB,CAAC;AACvD,qBAAa,oBAAqB,SAAQ,SAAS;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;gBACR,KAAK,EAAE,aAAa,GAAG,KAAK,GAAG,QAAQ;CAiBpD;AAED,MAAM,WAAW,eAAe;IAC9B,CAAC,sBAAsB,CAAC,EAAE,kBAAkB,CAAC;IAC7C,CAAC,sBAAsB,CAAC,EAAE,kBAAkB,CAAC;IAC7C,CAAC,iBAAiB,CAAC,EAAE,aAAa,CAAC;IACnC,CAAC,wBAAwB,CAAC,EAAE,oBAAoB,CAAC;IACjD,CAAC,mBAAmB,CAAC,EAAE,oBAAoB,CAAC;CAC7C"}
|
|
@@ -38,21 +38,24 @@ export interface MapContextLayerWmts extends MapContextBaseLayer {
|
|
|
38
38
|
dimensions?: LayerDimensions;
|
|
39
39
|
style?: string;
|
|
40
40
|
}
|
|
41
|
-
export interface
|
|
41
|
+
export interface MapContextLayerVector {
|
|
42
|
+
style?: VectorStyle;
|
|
43
|
+
hoverStyle?: VectorStyle;
|
|
44
|
+
enableHover?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export type MapContextLayerWfs = MapContextBaseLayer & MapContextLayerVector & {
|
|
42
47
|
type: "wfs";
|
|
43
48
|
url: string;
|
|
44
49
|
featureType: string;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
export interface MapContextLayerOgcApi extends MapContextBaseLayer {
|
|
50
|
+
};
|
|
51
|
+
export type MapContextLayerOgcApi = MapContextBaseLayer & MapContextLayerVector & {
|
|
48
52
|
type: "ogcapi";
|
|
49
53
|
url: string;
|
|
50
54
|
collection: string;
|
|
51
55
|
useTiles?: "vector" | "map";
|
|
52
56
|
tileMatrixSet?: string;
|
|
53
57
|
options?: Record<string, string>;
|
|
54
|
-
|
|
55
|
-
}
|
|
58
|
+
};
|
|
56
59
|
export interface MapContextLayerMapLibreStyle extends MapContextBaseLayer {
|
|
57
60
|
type: "maplibre-style";
|
|
58
61
|
styleUrl: string;
|
|
@@ -63,10 +66,9 @@ export interface MapContextLayerXyz extends MapContextBaseLayer {
|
|
|
63
66
|
url: string;
|
|
64
67
|
tileFormat?: "application/vnd.mapbox-vector-tile";
|
|
65
68
|
}
|
|
66
|
-
|
|
69
|
+
export type LayerGeojson = MapContextBaseLayer & MapContextLayerVector & {
|
|
67
70
|
type: "geojson";
|
|
68
|
-
|
|
69
|
-
}
|
|
71
|
+
};
|
|
70
72
|
export interface LayerGeojsonWithUrl extends LayerGeojson {
|
|
71
73
|
url: string;
|
|
72
74
|
data?: never;
|
|
@@ -126,5 +128,4 @@ export interface MapContext {
|
|
|
126
128
|
layers: MapContextLayer[];
|
|
127
129
|
view: MapContextView | null;
|
|
128
130
|
}
|
|
129
|
-
export {};
|
|
130
131
|
//# sourceMappingURL=map-context.d.ts.map
|
|
@@ -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,YAAY,CAAC;AAEzC;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAErD;;;GAGG;AACH,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,C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;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,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,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../lib/model/style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,MAAM,WAAW,GAAG,aAAa,CAAC"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -9,4 +9,5 @@ export { computeMapContextDiff } from "./map-context-diff.js";
|
|
|
9
9
|
export { getLayerPosition, addLayerToContext, removeLayerFromContext, replaceLayerInContext, changeLayerPositionInContext, updateLayerInContext, } from "./map-context.js";
|
|
10
10
|
export { updateLayer } from "./map-context-layer.js";
|
|
11
11
|
export { createViewFromLayer } from "./view.js";
|
|
12
|
+
export * from "./style.js";
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/utils/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,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,EAC5B,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/utils/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,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,EAC5B,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,cAAc,YAAY,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -9,3 +9,4 @@ export { computeMapContextDiff } from "./map-context-diff.js";
|
|
|
9
9
|
export { getLayerPosition, addLayerToContext, removeLayerFromContext, replaceLayerInContext, changeLayerPositionInContext, updateLayerInContext, } from "./map-context.js";
|
|
10
10
|
export { updateLayer } from "./map-context-layer.js";
|
|
11
11
|
export { createViewFromLayer } from "./view.js";
|
|
12
|
+
export * from "./style.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../lib/utils/style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKtD,eAAO,MAAM,YAAY,EAAE,aA+B1B,CAAC;AAIF,eAAO,MAAM,qBAAqB,EAAE,aA+BnC,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import chroma from "chroma-js";
|
|
2
|
+
const color = "rgb(0, 0, 255)";
|
|
3
|
+
const fillColor = chroma(color).alpha(0.25).css();
|
|
4
|
+
export const defaultStyle = [
|
|
5
|
+
{
|
|
6
|
+
filter: ["==", ["geometry-type"], "LineString"],
|
|
7
|
+
style: [
|
|
8
|
+
{
|
|
9
|
+
"stroke-color": "white",
|
|
10
|
+
"stroke-width": 6,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"stroke-color": color,
|
|
14
|
+
"stroke-width": 2,
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
filter: ["==", ["geometry-type"], "Polygon"],
|
|
20
|
+
style: {
|
|
21
|
+
"stroke-color": "white",
|
|
22
|
+
"stroke-width": 2,
|
|
23
|
+
"fill-color": fillColor,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
filter: ["==", ["geometry-type"], "Point"],
|
|
28
|
+
style: {
|
|
29
|
+
"circle-fill-color": color,
|
|
30
|
+
"circle-radius": 7,
|
|
31
|
+
"circle-stroke-color": "white",
|
|
32
|
+
"circle-stroke-width": 2,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
const hlColor = "rgb(0, 0, 255)";
|
|
37
|
+
const hlFillColor = chroma(hlColor).alpha(0.25).css();
|
|
38
|
+
export const defaultHighlightStyle = [
|
|
39
|
+
{
|
|
40
|
+
filter: ["==", ["geometry-type"], "LineString"],
|
|
41
|
+
style: [
|
|
42
|
+
{
|
|
43
|
+
"stroke-color": "white",
|
|
44
|
+
"stroke-width": 8,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"stroke-color": hlColor,
|
|
48
|
+
"stroke-width": 3,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
filter: ["==", ["geometry-type"], "Polygon"],
|
|
54
|
+
style: {
|
|
55
|
+
"stroke-color": "white",
|
|
56
|
+
"stroke-width": 3,
|
|
57
|
+
"fill-color": hlFillColor,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
filter: ["==", ["geometry-type"], "Point"],
|
|
62
|
+
style: {
|
|
63
|
+
"circle-fill-color": hlColor,
|
|
64
|
+
"circle-radius": 8,
|
|
65
|
+
"circle-stroke-color": "white",
|
|
66
|
+
"circle-stroke-width": 3,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
];
|
package/lib/model/events.ts
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { EndpointError } from "@camptocamp/ogc-client";
|
|
2
2
|
import { Feature } from "geojson";
|
|
3
3
|
import BaseEvent from "ol/events/Event.js";
|
|
4
|
-
import { Extent } from "ol/extent.js";
|
|
4
|
+
import type { Extent } from "ol/extent.js";
|
|
5
|
+
|
|
6
|
+
export type FeaturesByLayerIndex = Map<number, Feature[]>;
|
|
5
7
|
|
|
6
8
|
export const FeaturesClickEventType = "features-click";
|
|
7
9
|
export interface FeaturesClickEvent {
|
|
8
10
|
type: typeof FeaturesClickEventType;
|
|
9
11
|
features: Feature[];
|
|
12
|
+
featuresByLayer: FeaturesByLayerIndex;
|
|
10
13
|
}
|
|
11
14
|
|
|
12
15
|
export const FeaturesHoverEventType = "features-hover";
|
|
13
16
|
export interface FeaturesHoverEvent {
|
|
14
17
|
type: typeof FeaturesHoverEventType;
|
|
15
18
|
features: Feature[];
|
|
19
|
+
featuresByLayer: FeaturesByLayerIndex;
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
export const MapClickEventType = "map-click";
|
package/lib/model/map-context.ts
CHANGED
|
@@ -45,22 +45,28 @@ export interface MapContextLayerWmts extends MapContextBaseLayer {
|
|
|
45
45
|
style?: string;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
export interface
|
|
49
|
-
type: "wfs";
|
|
50
|
-
url: string;
|
|
51
|
-
featureType: string;
|
|
48
|
+
export interface MapContextLayerVector {
|
|
52
49
|
style?: VectorStyle;
|
|
50
|
+
hoverStyle?: VectorStyle;
|
|
51
|
+
enableHover?: boolean;
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
export
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
54
|
+
export type MapContextLayerWfs = MapContextBaseLayer &
|
|
55
|
+
MapContextLayerVector & {
|
|
56
|
+
type: "wfs";
|
|
57
|
+
url: string;
|
|
58
|
+
featureType: string;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export type MapContextLayerOgcApi = MapContextBaseLayer &
|
|
62
|
+
MapContextLayerVector & {
|
|
63
|
+
type: "ogcapi";
|
|
64
|
+
url: string;
|
|
65
|
+
collection: string;
|
|
66
|
+
useTiles?: "vector" | "map";
|
|
67
|
+
tileMatrixSet?: string;
|
|
68
|
+
options?: Record<string, string>;
|
|
69
|
+
};
|
|
64
70
|
|
|
65
71
|
// Layer pointing to a MapLibre Style spec, see https://maplibre.org/maplibre-style-spec/
|
|
66
72
|
export interface MapContextLayerMapLibreStyle extends MapContextBaseLayer {
|
|
@@ -75,10 +81,10 @@ export interface MapContextLayerXyz extends MapContextBaseLayer {
|
|
|
75
81
|
tileFormat?: "application/vnd.mapbox-vector-tile"; // If not specified, the system will automatically assume tiles are images.
|
|
76
82
|
}
|
|
77
83
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
84
|
+
export type LayerGeojson = MapContextBaseLayer &
|
|
85
|
+
MapContextLayerVector & {
|
|
86
|
+
type: "geojson";
|
|
87
|
+
};
|
|
82
88
|
export interface LayerGeojsonWithUrl extends LayerGeojson {
|
|
83
89
|
url: string;
|
|
84
90
|
data?: never;
|
package/lib/model/style.ts
CHANGED
package/lib/utils/index.ts
CHANGED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { FlatStyleLike } from "ol/style/flat.js";
|
|
2
|
+
import chroma from "chroma-js";
|
|
3
|
+
|
|
4
|
+
const color = "rgb(0, 0, 255)";
|
|
5
|
+
const fillColor = chroma(color).alpha(0.25).css();
|
|
6
|
+
export const defaultStyle: FlatStyleLike = [
|
|
7
|
+
{
|
|
8
|
+
filter: ["==", ["geometry-type"], "LineString"],
|
|
9
|
+
style: [
|
|
10
|
+
{
|
|
11
|
+
"stroke-color": "white",
|
|
12
|
+
"stroke-width": 6,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"stroke-color": color,
|
|
16
|
+
"stroke-width": 2,
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
filter: ["==", ["geometry-type"], "Polygon"],
|
|
22
|
+
style: {
|
|
23
|
+
"stroke-color": "white",
|
|
24
|
+
"stroke-width": 2,
|
|
25
|
+
"fill-color": fillColor,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
filter: ["==", ["geometry-type"], "Point"],
|
|
30
|
+
style: {
|
|
31
|
+
"circle-fill-color": color,
|
|
32
|
+
"circle-radius": 7,
|
|
33
|
+
"circle-stroke-color": "white",
|
|
34
|
+
"circle-stroke-width": 2,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
const hlColor = "rgb(0, 0, 255)";
|
|
40
|
+
const hlFillColor = chroma(hlColor).alpha(0.25).css();
|
|
41
|
+
export const defaultHighlightStyle: FlatStyleLike = [
|
|
42
|
+
{
|
|
43
|
+
filter: ["==", ["geometry-type"], "LineString"],
|
|
44
|
+
style: [
|
|
45
|
+
{
|
|
46
|
+
"stroke-color": "white",
|
|
47
|
+
"stroke-width": 8,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"stroke-color": hlColor,
|
|
51
|
+
"stroke-width": 3,
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
filter: ["==", ["geometry-type"], "Polygon"],
|
|
57
|
+
style: {
|
|
58
|
+
"stroke-color": "white",
|
|
59
|
+
"stroke-width": 3,
|
|
60
|
+
"fill-color": hlFillColor,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
filter: ["==", ["geometry-type"], "Point"],
|
|
65
|
+
style: {
|
|
66
|
+
"circle-fill-color": hlColor,
|
|
67
|
+
"circle-radius": 8,
|
|
68
|
+
"circle-stroke-color": "white",
|
|
69
|
+
"circle-stroke-width": 3,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
];
|
package/lib/utils/view.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { LONLAT_CRS_CODES } from "../constant/projections.js";
|
|
|
4
4
|
import { fromEPSGCode, register } from "ol/proj/proj4.js";
|
|
5
5
|
import GeoJSON from "ol/format/GeoJSON.js";
|
|
6
6
|
import { extend } from "ol/extent.js";
|
|
7
|
-
import Feature from "ol/Feature.js";
|
|
7
|
+
import type Feature from "ol/Feature.js";
|
|
8
8
|
import proj4 from "proj4";
|
|
9
9
|
import {
|
|
10
10
|
Extent,
|
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.52+73ea489",
|
|
4
4
|
"description": "Core functions and models for the SDK",
|
|
5
5
|
"author": "Olivia <olivia.guyot@camptocamp.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -22,11 +22,14 @@
|
|
|
22
22
|
"test": "vitest",
|
|
23
23
|
"build": "tsc"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "73ea4890e493aae5379e23af6b7679bab253db92",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"proj4": "^2.9.2"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"ol": "^
|
|
30
|
+
"ol": "^10.7.0"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"ol": ">9.x"
|
|
31
34
|
}
|
|
32
35
|
}
|