@geolibre/core 3.2.0 → 3.3.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/dist/index.d.mts +418 -3139
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1410 -1930
- package/dist/index.mjs.map +1 -1
- package/dist/joins-CGcRoTpc.mjs +1822 -0
- package/dist/joins-CGcRoTpc.mjs.map +1 -0
- package/dist/joins-CRZZcLqX.d.mts +3218 -0
- package/dist/joins-CRZZcLqX.d.mts.map +1 -0
- package/dist/worker-safe.d.mts +2 -0
- package/dist/worker-safe.mjs +2 -0
- package/package.json +6 -2
|
@@ -0,0 +1,3218 @@
|
|
|
1
|
+
//#region src/cesium-imagery.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Maps the project's basemap onto imagery the Cesium globe can render.
|
|
4
|
+
*
|
|
5
|
+
* The 2D panes render `basemapStyleUrl` through MapLibre, which understands
|
|
6
|
+
* vector GL styles and GeoLibre's `geolibre://` sentinels. Cesium understands
|
|
7
|
+
* neither: it draws imagery from tile providers only. So a globe pane that
|
|
8
|
+
* simply mounted the store basemap would show nothing, which is why the pane
|
|
9
|
+
* used to hardcode Ion World Imagery (with a token) or OpenStreetMap (without)
|
|
10
|
+
* and ignore the user's choice entirely — leaving a bright globe beside dark 2D
|
|
11
|
+
* panes and breaking the "same map, different projection" promise the multi-map
|
|
12
|
+
* grid makes.
|
|
13
|
+
*
|
|
14
|
+
* This module is the translation. It is deliberately **engine-free** — it
|
|
15
|
+
* returns a plain descriptor and never imports Cesium — so it lives in
|
|
16
|
+
* `@geolibre/core` beside the basemap catalogs it reads, the 2D and 3D
|
|
17
|
+
* renderers share one source of truth, and the Cesium chunk boundary in
|
|
18
|
+
* `vite.config.ts` stays intact.
|
|
19
|
+
*
|
|
20
|
+
* Three outcomes are possible, and the caller has to handle all three (see
|
|
21
|
+
* {@link CesiumBasemapImagery}): tiles to draw, nothing to draw, or "no raster
|
|
22
|
+
* equivalent exists — pick your own default".
|
|
23
|
+
*/
|
|
24
|
+
/** Stable project IDs and the corresponding Cesium bundled thumbnails / ion assets. */
|
|
25
|
+
declare const CESIUM_BASEMAPS: readonly [{
|
|
26
|
+
readonly id: "project";
|
|
27
|
+
readonly name: "Project basemap";
|
|
28
|
+
readonly icon: "naturalEarthII.png";
|
|
29
|
+
}, {
|
|
30
|
+
readonly id: "natural-earth";
|
|
31
|
+
readonly name: "Natural Earth II";
|
|
32
|
+
readonly icon: "naturalEarthII.png";
|
|
33
|
+
}, {
|
|
34
|
+
readonly id: "bing-aerial";
|
|
35
|
+
readonly name: "Bing Maps Aerial";
|
|
36
|
+
readonly icon: "bingAerial.png";
|
|
37
|
+
readonly assetId: 2;
|
|
38
|
+
}, {
|
|
39
|
+
readonly id: "bing-labels";
|
|
40
|
+
readonly name: "Bing Maps Aerial with Labels";
|
|
41
|
+
readonly icon: "bingAerialLabels.png";
|
|
42
|
+
readonly assetId: 3;
|
|
43
|
+
}, {
|
|
44
|
+
readonly id: "bing-roads";
|
|
45
|
+
readonly name: "Bing Maps Roads";
|
|
46
|
+
readonly icon: "bingRoads.png";
|
|
47
|
+
readonly assetId: 4;
|
|
48
|
+
}, {
|
|
49
|
+
readonly id: "sentinel-2";
|
|
50
|
+
readonly name: "Sentinel-2";
|
|
51
|
+
readonly icon: "sentinel-2.png";
|
|
52
|
+
readonly assetId: 3954;
|
|
53
|
+
}, {
|
|
54
|
+
readonly id: "blue-marble";
|
|
55
|
+
readonly name: "Blue Marble";
|
|
56
|
+
readonly icon: "blueMarble.png";
|
|
57
|
+
readonly assetId: 3845;
|
|
58
|
+
}, {
|
|
59
|
+
readonly id: "earth-at-night";
|
|
60
|
+
readonly name: "Earth at night";
|
|
61
|
+
readonly icon: "earthAtNight.png";
|
|
62
|
+
readonly assetId: 3812;
|
|
63
|
+
}, {
|
|
64
|
+
readonly id: "google-satellite";
|
|
65
|
+
readonly name: "Google Maps Satellite";
|
|
66
|
+
readonly icon: "googleSatellite.png";
|
|
67
|
+
readonly assetId: 3830182;
|
|
68
|
+
}, {
|
|
69
|
+
readonly id: "google-labels";
|
|
70
|
+
readonly name: "Google Maps Satellite with Labels";
|
|
71
|
+
readonly icon: "googleSatelliteLabels.png";
|
|
72
|
+
readonly assetId: 3830183;
|
|
73
|
+
}, {
|
|
74
|
+
readonly id: "google-roads";
|
|
75
|
+
readonly name: "Google Maps Roadmap";
|
|
76
|
+
readonly icon: "googleRoadmap.png";
|
|
77
|
+
readonly assetId: 3830184;
|
|
78
|
+
}, {
|
|
79
|
+
readonly id: "google-contour";
|
|
80
|
+
readonly name: "Google Maps Contour";
|
|
81
|
+
readonly icon: "googleContour.png";
|
|
82
|
+
readonly assetId: 3830186;
|
|
83
|
+
}, {
|
|
84
|
+
readonly id: "azure-aerial";
|
|
85
|
+
readonly name: "Azure Maps Aerial";
|
|
86
|
+
readonly icon: "azureAerial.png";
|
|
87
|
+
readonly assetId: 3891168;
|
|
88
|
+
}, {
|
|
89
|
+
readonly id: "azure-roads";
|
|
90
|
+
readonly name: "Azure Maps Roads";
|
|
91
|
+
readonly icon: "azureRoads.png";
|
|
92
|
+
readonly assetId: 3891169;
|
|
93
|
+
}, {
|
|
94
|
+
readonly id: "esri-imagery";
|
|
95
|
+
readonly name: "ArcGIS World Imagery";
|
|
96
|
+
readonly icon: "ArcGisMapServiceWorldImagery.png";
|
|
97
|
+
readonly category: "Other";
|
|
98
|
+
readonly service: "World_Imagery";
|
|
99
|
+
}, {
|
|
100
|
+
readonly id: "esri-hillshade";
|
|
101
|
+
readonly name: "ArcGIS World Hillshade";
|
|
102
|
+
readonly icon: "ArcGisMapServiceWorldHillshade.png";
|
|
103
|
+
readonly category: "Other";
|
|
104
|
+
readonly service: "Elevation/World_Hillshade";
|
|
105
|
+
}, {
|
|
106
|
+
readonly id: "esri-ocean";
|
|
107
|
+
readonly name: "Esri World Ocean";
|
|
108
|
+
readonly icon: "ArcGisMapServiceWorldOcean.png";
|
|
109
|
+
readonly category: "Other";
|
|
110
|
+
readonly service: "Ocean/World_Ocean_Base";
|
|
111
|
+
}, {
|
|
112
|
+
readonly id: "osm";
|
|
113
|
+
readonly name: "OpenStreetMap";
|
|
114
|
+
readonly icon: "openStreetMap.png";
|
|
115
|
+
readonly category: "Other";
|
|
116
|
+
}];
|
|
117
|
+
type CesiumBasemapId = (typeof CESIUM_BASEMAPS)[number]["id"];
|
|
118
|
+
declare function normalizeCesiumBasemap(value: unknown): CesiumBasemapId;
|
|
119
|
+
/**
|
|
120
|
+
* Missing credentials fall back to keyless imagery without changing the saved
|
|
121
|
+
* choice.
|
|
122
|
+
*
|
|
123
|
+
* The fallback is ArcGIS World Imagery rather than the project background: a
|
|
124
|
+
* globe wants to look like the Earth, and the project's own basemap is usually
|
|
125
|
+
* a vector street style whose raster analogue is mostly empty ocean from
|
|
126
|
+
* orbit. It needs no key, so the globe looks the same with or without an Ion
|
|
127
|
+
* token — only terrain and the Ion-only basemaps are lost.
|
|
128
|
+
*/
|
|
129
|
+
declare function availableCesiumBasemap(value: unknown, hasIonToken: boolean): CesiumBasemapId;
|
|
130
|
+
/**
|
|
131
|
+
* What the globe should draw underneath the project's data layers.
|
|
132
|
+
*
|
|
133
|
+
* - `xyz` — a tile template to render, with the credit and zoom bounds that go
|
|
134
|
+
* with it.
|
|
135
|
+
* - `none` — the user chose the blank basemap; draw a bare ellipsoid.
|
|
136
|
+
* - `default` — this basemap has no raster equivalent (a custom style URL, a
|
|
137
|
+
* provider style, an offline archive). The renderer falls back to whatever it
|
|
138
|
+
* can offer, which is Ion World Imagery when a token is configured and
|
|
139
|
+
* OpenStreetMap otherwise.
|
|
140
|
+
*/
|
|
141
|
+
type CesiumBasemapImagery = {
|
|
142
|
+
kind: "none";
|
|
143
|
+
} | {
|
|
144
|
+
kind: "default";
|
|
145
|
+
} | {
|
|
146
|
+
kind: "ion";
|
|
147
|
+
assetId: number;
|
|
148
|
+
} | {
|
|
149
|
+
kind: "natural-earth";
|
|
150
|
+
} | {
|
|
151
|
+
kind: "arcgis";
|
|
152
|
+
url: string;
|
|
153
|
+
} | {
|
|
154
|
+
kind: "xyz";
|
|
155
|
+
/** Tile template with `{z}`/`{x}`/`{y}` placeholders. */
|
|
156
|
+
template: string;
|
|
157
|
+
/** Credit to show on the globe, as the HTML the 2D map already uses. */
|
|
158
|
+
attribution: string;
|
|
159
|
+
/** Max native zoom of the source, so the globe overzooms rather than 404s. */
|
|
160
|
+
maximumLevel?: number;
|
|
161
|
+
/**
|
|
162
|
+
* Tile row ordering. `"tms"` numbers rows from the bottom; absent means
|
|
163
|
+
* standard XYZ. Cesium has no `scheme` option, so a TMS template needs
|
|
164
|
+
* `{y}` swapped for its `{reverseY}` placeholder at render time.
|
|
165
|
+
*/
|
|
166
|
+
scheme?: "tms";
|
|
167
|
+
/**
|
|
168
|
+
* A transparent overlay drawn directly above {@link template} — the
|
|
169
|
+
* roads-and-labels tiles a hybrid basemap (Amap Hybrid) bakes in, so one
|
|
170
|
+
* basemap selection still yields a labelled satellite globe.
|
|
171
|
+
*/
|
|
172
|
+
overlayTemplate?: string;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Whether two descriptors would draw the same thing.
|
|
176
|
+
*
|
|
177
|
+
* Descriptors are built fresh on every call, so two basemaps resolving to the
|
|
178
|
+
* same analogue — OpenFreeMap `liberty` and `bright` are both the streets
|
|
179
|
+
* tone — yield equal but distinct objects. A renderer that remembers the
|
|
180
|
+
* descriptor it drew (to skip redundant work) must compare by value: a
|
|
181
|
+
* reference check would miss that case and tear down and re-add an identical
|
|
182
|
+
* tile provider, costing a flash and a round of re-requested tiles for no
|
|
183
|
+
* visible change.
|
|
184
|
+
*/
|
|
185
|
+
declare function sameCesiumImagery(a: CesiumBasemapImagery, b: CesiumBasemapImagery): boolean;
|
|
186
|
+
/**
|
|
187
|
+
* Translate a basemap style URL into imagery for the Cesium globe.
|
|
188
|
+
*
|
|
189
|
+
* Planetary and regional basemaps are already raster tile sets, so they carry
|
|
190
|
+
* straight over — the globe shows the same Mars/Moon/Amap tiles the 2D panes
|
|
191
|
+
* do. GeoLibre's own vector styles map to a keyless raster basemap of matching
|
|
192
|
+
* tone, so switching the project to a dark basemap darkens the globe too.
|
|
193
|
+
* Everything else reports `default`, leaving the choice of fallback imagery to
|
|
194
|
+
* the renderer (which knows whether an Ion token is configured).
|
|
195
|
+
*
|
|
196
|
+
* A `geolibre://` sentinel that no longer resolves is treated as the default
|
|
197
|
+
* basemap, mirroring what `resolveMapStyle` does for the 2D map rather than
|
|
198
|
+
* handing the sentinel onward as if it were fetchable.
|
|
199
|
+
*
|
|
200
|
+
* @param styleUrl - The project's `basemapStyleUrl`.
|
|
201
|
+
* @returns What the globe should draw beneath the data layers.
|
|
202
|
+
*/
|
|
203
|
+
declare function basemapToCesiumImagery(styleUrl: string | undefined, cesiumBasemap?: CesiumBasemapId): CesiumBasemapImagery;
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region ../../node_modules/@types/geojson/index.d.ts
|
|
206
|
+
/**
|
|
207
|
+
* The value values for the "type" property of GeoJSON Objects.
|
|
208
|
+
* https://tools.ietf.org/html/rfc7946#section-1.4
|
|
209
|
+
*/
|
|
210
|
+
type GeoJsonTypes = GeoJSON$1["type"];
|
|
211
|
+
/**
|
|
212
|
+
* Bounding box
|
|
213
|
+
* https://tools.ietf.org/html/rfc7946#section-5
|
|
214
|
+
*/
|
|
215
|
+
type BBox = [number, number, number, number] | [number, number, number, number, number, number];
|
|
216
|
+
/**
|
|
217
|
+
* A Position is an array of coordinates.
|
|
218
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.1
|
|
219
|
+
* Array should contain between two and three elements.
|
|
220
|
+
* The previous GeoJSON specification allowed more elements (e.g., which could be used to represent M values),
|
|
221
|
+
* but the current specification only allows X, Y, and (optionally) Z to be defined.
|
|
222
|
+
*
|
|
223
|
+
* Note: the type will not be narrowed down to `[number, number] | [number, number, number]` due to
|
|
224
|
+
* marginal benefits and the large impact of breaking change.
|
|
225
|
+
*
|
|
226
|
+
* See previous discussions on the type narrowing:
|
|
227
|
+
* - {@link https://github.com/DefinitelyTyped/DefinitelyTyped/pull/21590|Nov 2017}
|
|
228
|
+
* - {@link https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/67773|Dec 2023}
|
|
229
|
+
* - {@link https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/71441| Dec 2024}
|
|
230
|
+
*
|
|
231
|
+
* One can use a
|
|
232
|
+
* {@link https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates|user-defined type guard that returns a type predicate}
|
|
233
|
+
* to determine if a position is a 2D or 3D position.
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* import type { Position } from 'geojson';
|
|
237
|
+
*
|
|
238
|
+
* type StrictPosition = [x: number, y: number] | [x: number, y: number, z: number]
|
|
239
|
+
*
|
|
240
|
+
* function isStrictPosition(position: Position): position is StrictPosition {
|
|
241
|
+
* return position.length === 2 || position.length === 3
|
|
242
|
+
* };
|
|
243
|
+
*
|
|
244
|
+
* let position: Position = [-116.91, 45.54];
|
|
245
|
+
*
|
|
246
|
+
* let x: number;
|
|
247
|
+
* let y: number;
|
|
248
|
+
* let z: number | undefined;
|
|
249
|
+
*
|
|
250
|
+
* if (isStrictPosition(position)) {
|
|
251
|
+
* // `tsc` would throw an error if we tried to destructure a fourth parameter
|
|
252
|
+
* [x, y, z] = position;
|
|
253
|
+
* } else {
|
|
254
|
+
* throw new TypeError("Position is not a 2D or 3D point");
|
|
255
|
+
* }
|
|
256
|
+
*/
|
|
257
|
+
type Position = number[];
|
|
258
|
+
/**
|
|
259
|
+
* The base GeoJSON object.
|
|
260
|
+
* https://tools.ietf.org/html/rfc7946#section-3
|
|
261
|
+
* The GeoJSON specification also allows foreign members
|
|
262
|
+
* (https://tools.ietf.org/html/rfc7946#section-6.1)
|
|
263
|
+
* Developers should use "&" type in TypeScript or extend the interface
|
|
264
|
+
* to add these foreign members.
|
|
265
|
+
*/
|
|
266
|
+
interface GeoJsonObject {
|
|
267
|
+
// Don't include foreign members directly into this type def.
|
|
268
|
+
// in order to preserve type safety.
|
|
269
|
+
// [key: string]: any;
|
|
270
|
+
/**
|
|
271
|
+
* Specifies the type of GeoJSON object.
|
|
272
|
+
*/
|
|
273
|
+
type: GeoJsonTypes;
|
|
274
|
+
/**
|
|
275
|
+
* Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections.
|
|
276
|
+
* The value of the bbox member is an array of length 2*n where n is the number of dimensions
|
|
277
|
+
* represented in the contained geometries, with all axes of the most southwesterly point
|
|
278
|
+
* followed by all axes of the more northeasterly point.
|
|
279
|
+
* The axes order of a bbox follows the axes order of geometries.
|
|
280
|
+
* https://tools.ietf.org/html/rfc7946#section-5
|
|
281
|
+
*/
|
|
282
|
+
bbox?: BBox | undefined;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Union of GeoJSON objects.
|
|
286
|
+
*/
|
|
287
|
+
type GeoJSON$1<G extends Geometry | null = Geometry, P = GeoJsonProperties> = G | Feature<G, P> | FeatureCollection<G, P>;
|
|
288
|
+
/**
|
|
289
|
+
* Geometry object.
|
|
290
|
+
* https://tools.ietf.org/html/rfc7946#section-3
|
|
291
|
+
*/
|
|
292
|
+
type Geometry = Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon | GeometryCollection;
|
|
293
|
+
/**
|
|
294
|
+
* Point geometry object.
|
|
295
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.2
|
|
296
|
+
*/
|
|
297
|
+
interface Point extends GeoJsonObject {
|
|
298
|
+
type: "Point";
|
|
299
|
+
coordinates: Position;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* MultiPoint geometry object.
|
|
303
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.3
|
|
304
|
+
*/
|
|
305
|
+
interface MultiPoint extends GeoJsonObject {
|
|
306
|
+
type: "MultiPoint";
|
|
307
|
+
coordinates: Position[];
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* LineString geometry object.
|
|
311
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.4
|
|
312
|
+
*/
|
|
313
|
+
interface LineString extends GeoJsonObject {
|
|
314
|
+
type: "LineString";
|
|
315
|
+
coordinates: Position[];
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* MultiLineString geometry object.
|
|
319
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.5
|
|
320
|
+
*/
|
|
321
|
+
interface MultiLineString extends GeoJsonObject {
|
|
322
|
+
type: "MultiLineString";
|
|
323
|
+
coordinates: Position[][];
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Polygon geometry object.
|
|
327
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.6
|
|
328
|
+
*/
|
|
329
|
+
interface Polygon extends GeoJsonObject {
|
|
330
|
+
type: "Polygon";
|
|
331
|
+
coordinates: Position[][];
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* MultiPolygon geometry object.
|
|
335
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.7
|
|
336
|
+
*/
|
|
337
|
+
interface MultiPolygon extends GeoJsonObject {
|
|
338
|
+
type: "MultiPolygon";
|
|
339
|
+
coordinates: Position[][][];
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Geometry Collection
|
|
343
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.8
|
|
344
|
+
*/
|
|
345
|
+
interface GeometryCollection<G extends Geometry = Geometry> extends GeoJsonObject {
|
|
346
|
+
type: "GeometryCollection";
|
|
347
|
+
geometries: G[];
|
|
348
|
+
}
|
|
349
|
+
type GeoJsonProperties = {
|
|
350
|
+
[name: string]: any;
|
|
351
|
+
} | null;
|
|
352
|
+
/**
|
|
353
|
+
* A feature object which contains a geometry and associated properties.
|
|
354
|
+
* https://tools.ietf.org/html/rfc7946#section-3.2
|
|
355
|
+
*/
|
|
356
|
+
interface Feature<G extends Geometry | null = Geometry, P = GeoJsonProperties> extends GeoJsonObject {
|
|
357
|
+
type: "Feature";
|
|
358
|
+
/**
|
|
359
|
+
* The feature's geometry
|
|
360
|
+
*/
|
|
361
|
+
geometry: G;
|
|
362
|
+
/**
|
|
363
|
+
* A value that uniquely identifies this feature in a
|
|
364
|
+
* https://tools.ietf.org/html/rfc7946#section-3.2.
|
|
365
|
+
*/
|
|
366
|
+
id?: string | number | undefined;
|
|
367
|
+
/**
|
|
368
|
+
* Properties associated with this feature.
|
|
369
|
+
*/
|
|
370
|
+
properties: P;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* A collection of feature objects.
|
|
374
|
+
* https://tools.ietf.org/html/rfc7946#section-3.3
|
|
375
|
+
*/
|
|
376
|
+
interface FeatureCollection<G extends Geometry | null = Geometry, P = GeoJsonProperties> extends GeoJsonObject {
|
|
377
|
+
type: "FeatureCollection";
|
|
378
|
+
features: Array<Feature<G, P>>;
|
|
379
|
+
}
|
|
380
|
+
//#endregion
|
|
381
|
+
//#region src/print-layout-config.d.ts
|
|
382
|
+
/**
|
|
383
|
+
* Print Layout composer settings that belong to a project.
|
|
384
|
+
*
|
|
385
|
+
* The Print Layout dialog composes a printable page out of the current map:
|
|
386
|
+
* a title block, page size and orientation, the cartographic furniture
|
|
387
|
+
* (legend, scale bar, north arrow), optional data blocks, and an atlas /
|
|
388
|
+
* map-series definition. All of that describes the *project's* map document,
|
|
389
|
+
* so it round-trips through `.geolibre.json` (GeoLibre discussion #1992 —
|
|
390
|
+
* before this, reopening a project lost the title, page format and
|
|
391
|
+
* orientation, and the dialog kept showing the previous project's settings).
|
|
392
|
+
*
|
|
393
|
+
* Deliberately **not** in here: everything that is per-session rather than
|
|
394
|
+
* part of the document — the captured map image, export progress, error and
|
|
395
|
+
* clipboard notices, the current atlas page, and the dialog's own chrome
|
|
396
|
+
* (panel widths, dialog size).
|
|
397
|
+
*
|
|
398
|
+
* The unions below are the storage contract. Their app-side counterparts
|
|
399
|
+
* (`PaperSizeId`, `Orientation`, `BodyCorner`, ... in
|
|
400
|
+
* `apps/geolibre-desktop/src/lib/`) are checked against these by ordinary
|
|
401
|
+
* assignment in the dialog's snapshot/restore paths, so adding a paper size or
|
|
402
|
+
* a corner on one side without the other fails the build.
|
|
403
|
+
*/
|
|
404
|
+
/** A page corner an overlay block can be pinned to. */
|
|
405
|
+
type PrintLayoutCorner = "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
406
|
+
/** Which features a data block covers when the atlas paginates the map. */
|
|
407
|
+
type PrintLayoutPageFilter = "all" | "contained" | "intersecting";
|
|
408
|
+
/** One hand-authored swatch in the composer's user-defined legend. */
|
|
409
|
+
interface PrintLayoutLegendEntry {
|
|
410
|
+
id: string;
|
|
411
|
+
label: string;
|
|
412
|
+
color: string;
|
|
413
|
+
}
|
|
414
|
+
interface PrintLayoutConfig {
|
|
415
|
+
title: string;
|
|
416
|
+
subtitle: string;
|
|
417
|
+
titlePlacement: "outside" | "inside";
|
|
418
|
+
titleAlign: "left" | "center" | "right";
|
|
419
|
+
paperSize: "a4" | "a3" | "letter" | "legal" | "tabloid" | "fullhd" | "hd" | "uhd4k" | "square" | "custom";
|
|
420
|
+
orientation: "portrait" | "landscape";
|
|
421
|
+
customWidth: number;
|
|
422
|
+
customHeight: number;
|
|
423
|
+
customUnit: "mm" | "px";
|
|
424
|
+
pageMargin: "normal" | "narrow" | "none";
|
|
425
|
+
showPageBorder: boolean;
|
|
426
|
+
pageBorderColor: string;
|
|
427
|
+
pageBorderWidth: number;
|
|
428
|
+
mapBorderColor: string;
|
|
429
|
+
mapBorderWidth: number;
|
|
430
|
+
mapBackground: string;
|
|
431
|
+
showTitle: boolean;
|
|
432
|
+
showSubtitle: boolean;
|
|
433
|
+
showLegend: boolean;
|
|
434
|
+
showScaleBar: boolean;
|
|
435
|
+
showNorthArrow: boolean;
|
|
436
|
+
navigationGrouped: boolean;
|
|
437
|
+
showFooter: boolean;
|
|
438
|
+
footerText: string;
|
|
439
|
+
showDate: boolean;
|
|
440
|
+
/** Blank means "today", resolved when the page is drawn. */
|
|
441
|
+
dateText: string;
|
|
442
|
+
showAttribution: boolean;
|
|
443
|
+
showColorbar: boolean;
|
|
444
|
+
colorbarRamp: string;
|
|
445
|
+
/** Kept as typed text so a half-entered value survives a round trip. */
|
|
446
|
+
colorbarMin: string;
|
|
447
|
+
colorbarMax: string;
|
|
448
|
+
colorbarLabel: string;
|
|
449
|
+
colorbarOrientation: "vertical" | "horizontal";
|
|
450
|
+
colorbarLength: number;
|
|
451
|
+
colorbarPosition: PrintLayoutCorner;
|
|
452
|
+
showCustomLegend: boolean;
|
|
453
|
+
customLegendTitle: string;
|
|
454
|
+
customLegendEntries: PrintLayoutLegendEntry[];
|
|
455
|
+
customLegendPosition: PrintLayoutCorner;
|
|
456
|
+
showDataTable: boolean;
|
|
457
|
+
tableLayerId: string;
|
|
458
|
+
tableTitle: string;
|
|
459
|
+
tableColumns: string[];
|
|
460
|
+
tableSortField: string;
|
|
461
|
+
tableSortDesc: boolean;
|
|
462
|
+
tableMaxRows: number;
|
|
463
|
+
tableFitRows: boolean;
|
|
464
|
+
tablePosition: PrintLayoutCorner;
|
|
465
|
+
tablePageFilter: PrintLayoutPageFilter;
|
|
466
|
+
tableFilterToAtlasFeature: boolean;
|
|
467
|
+
showDataChart: boolean;
|
|
468
|
+
chartLayerId: string;
|
|
469
|
+
chartTitle: string;
|
|
470
|
+
chartType: "bar" | "pie" | "line";
|
|
471
|
+
chartCategoryField: string;
|
|
472
|
+
chartAggregation: "count" | "sum" | "mean";
|
|
473
|
+
chartValueField: string;
|
|
474
|
+
chartPosition: PrintLayoutCorner;
|
|
475
|
+
chartPageFilter: PrintLayoutPageFilter;
|
|
476
|
+
showInfoBlock: boolean;
|
|
477
|
+
author: string;
|
|
478
|
+
projectNumber: string;
|
|
479
|
+
crs: string;
|
|
480
|
+
revision: string;
|
|
481
|
+
captureMode: "viewport" | "extent";
|
|
482
|
+
/** Drawn print extent as `[west, south, east, north]`; null when unset. */
|
|
483
|
+
extentBbox: [number, number, number, number] | null;
|
|
484
|
+
atlasEnabled: boolean;
|
|
485
|
+
atlasLayerId: string;
|
|
486
|
+
atlasCoverage: "features" | "line";
|
|
487
|
+
atlasSegmentKm: string;
|
|
488
|
+
atlasNameField: string;
|
|
489
|
+
atlasExtentMode: "margin" | "scale";
|
|
490
|
+
atlasMarginPct: number;
|
|
491
|
+
atlasMaskEnabled: boolean;
|
|
492
|
+
atlasScale: string;
|
|
493
|
+
atlasSortField: string;
|
|
494
|
+
atlasSortDescending: boolean;
|
|
495
|
+
atlasFilter: string;
|
|
496
|
+
atlasFilenamePattern: string;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Settings a project starts with, and the shape every partial or hand-edited
|
|
500
|
+
* `printLayout` is filled out against. Also the dialog's initial state, so
|
|
501
|
+
* "new project" and "a project saved before this feature" compose identically.
|
|
502
|
+
*/
|
|
503
|
+
declare const DEFAULT_PRINT_LAYOUT: PrintLayoutConfig;
|
|
504
|
+
/** A fresh copy of the defaults, safe to hand to a store or a component. */
|
|
505
|
+
declare function createDefaultPrintLayout(): PrintLayoutConfig;
|
|
506
|
+
/**
|
|
507
|
+
* Coerce an untrusted (possibly hand-edited, possibly partial) `printLayout`
|
|
508
|
+
* into a complete {@link PrintLayoutConfig}, filling every missing or
|
|
509
|
+
* malformed field from {@link DEFAULT_PRINT_LAYOUT}.
|
|
510
|
+
*
|
|
511
|
+
* @param value - The raw `printLayout` value read from a project file.
|
|
512
|
+
* @returns The normalized config, or null when the project carries none, so
|
|
513
|
+
* callers can tell "absent" from "explicitly default".
|
|
514
|
+
*/
|
|
515
|
+
declare function normalizePrintLayoutConfig(value: unknown): PrintLayoutConfig | null;
|
|
516
|
+
/**
|
|
517
|
+
* Whether a config is still the untouched default, so a project that never
|
|
518
|
+
* opened the composer serializes without a `printLayout` key and stays
|
|
519
|
+
* byte-identical to one saved before this feature.
|
|
520
|
+
*/
|
|
521
|
+
declare function isDefaultPrintLayout(config: PrintLayoutConfig): boolean;
|
|
522
|
+
/**
|
|
523
|
+
* Structural equality for two configs. Used to skip no-op store writes, so
|
|
524
|
+
* merely opening the Print Layout dialog never marks a project dirty.
|
|
525
|
+
*/
|
|
526
|
+
declare function printLayoutConfigsEqual(a: PrintLayoutConfig, b: PrintLayoutConfig): boolean;
|
|
527
|
+
/**
|
|
528
|
+
* Drop references to layers the project no longer carries, so a composer that
|
|
529
|
+
* pointed at a since-deleted layer opens with the block cleared instead of
|
|
530
|
+
* rendering nothing from a dangling id. Mirrors the widget/comment/legend
|
|
531
|
+
* scrubbing in `applyProjectToStore`.
|
|
532
|
+
*
|
|
533
|
+
* @param config - The config to scrub.
|
|
534
|
+
* @param existingLayerIds - Ids of the layers present in the project.
|
|
535
|
+
* @returns The same object when nothing referenced a missing layer.
|
|
536
|
+
*/
|
|
537
|
+
declare function scrubPrintLayoutForLayers(config: PrintLayoutConfig, existingLayerIds: ReadonlySet<string>): PrintLayoutConfig;
|
|
538
|
+
/**
|
|
539
|
+
* The delete-time counterpart, matching `scrubLegendForRemovedLayers` and its
|
|
540
|
+
* siblings: called when layers are removed from the open project so the saved
|
|
541
|
+
* file never carries a block pointing at a layer that is already gone.
|
|
542
|
+
*
|
|
543
|
+
* @param config - The config to scrub.
|
|
544
|
+
* @param layerIds - The removed layer id, or ids.
|
|
545
|
+
* @returns The same object when no block referenced a removed layer.
|
|
546
|
+
*/
|
|
547
|
+
declare function scrubPrintLayoutForRemovedLayers(config: PrintLayoutConfig, layerIds: string | Iterable<string>): PrintLayoutConfig;
|
|
548
|
+
//#endregion
|
|
549
|
+
//#region src/types.d.ts
|
|
550
|
+
declare const OPENFREEMAP_BASEMAPS: readonly [{
|
|
551
|
+
readonly id: "liberty";
|
|
552
|
+
readonly name: "Liberty";
|
|
553
|
+
readonly styleUrl: "https://tiles.openfreemap.org/styles/liberty";
|
|
554
|
+
}, {
|
|
555
|
+
readonly id: "liberty-3d";
|
|
556
|
+
readonly name: "Liberty 3D";
|
|
557
|
+
readonly styleUrl: "https://tiles.openfreemap.org/styles/liberty";
|
|
558
|
+
}, {
|
|
559
|
+
readonly id: "positron";
|
|
560
|
+
readonly name: "Positron";
|
|
561
|
+
readonly styleUrl: "https://tiles.openfreemap.org/styles/positron";
|
|
562
|
+
}, {
|
|
563
|
+
readonly id: "bright";
|
|
564
|
+
readonly name: "Bright";
|
|
565
|
+
readonly styleUrl: "https://tiles.openfreemap.org/styles/bright";
|
|
566
|
+
}, {
|
|
567
|
+
readonly id: "dark";
|
|
568
|
+
readonly name: "Dark";
|
|
569
|
+
readonly styleUrl: "https://tiles.openfreemap.org/styles/dark";
|
|
570
|
+
}, {
|
|
571
|
+
readonly id: "fiord";
|
|
572
|
+
readonly name: "Fiord";
|
|
573
|
+
readonly styleUrl: "https://tiles.openfreemap.org/styles/fiord";
|
|
574
|
+
}];
|
|
575
|
+
/**
|
|
576
|
+
* Protomaps v5 basemap flavors. These are resolved to full style URLs at use
|
|
577
|
+
* time by `getProtomapsStyleUrl`, which injects the `VITE_PROTOMAPS_API_KEY`
|
|
578
|
+
* runtime env var. The key is only present in builds configured with it (e.g.
|
|
579
|
+
* the GitHub Pages web demo), so consumers should hide these options when no
|
|
580
|
+
* key is available.
|
|
581
|
+
*/
|
|
582
|
+
declare const PROTOMAPS_BASEMAPS: readonly [{
|
|
583
|
+
readonly id: "protomaps-light";
|
|
584
|
+
readonly name: "Light";
|
|
585
|
+
readonly flavor: "light";
|
|
586
|
+
}, {
|
|
587
|
+
readonly id: "protomaps-dark";
|
|
588
|
+
readonly name: "Dark";
|
|
589
|
+
readonly flavor: "dark";
|
|
590
|
+
}, {
|
|
591
|
+
readonly id: "protomaps-white";
|
|
592
|
+
readonly name: "White";
|
|
593
|
+
readonly flavor: "white";
|
|
594
|
+
}, {
|
|
595
|
+
readonly id: "protomaps-grayscale";
|
|
596
|
+
readonly name: "Grayscale";
|
|
597
|
+
readonly flavor: "grayscale";
|
|
598
|
+
}, {
|
|
599
|
+
readonly id: "protomaps-black";
|
|
600
|
+
readonly name: "Black";
|
|
601
|
+
readonly flavor: "black";
|
|
602
|
+
}];
|
|
603
|
+
declare const DEFAULT_BASEMAP = "https://tiles.openfreemap.org/styles/liberty";
|
|
604
|
+
declare const BLANK_BASEMAP = "";
|
|
605
|
+
declare const PROJECT_VERSION = "0.2.0";
|
|
606
|
+
/**
|
|
607
|
+
* Every layer type, as a runtime list so untrusted input (an imported Layer
|
|
608
|
+
* Library bundle, a hand-edited project) can be validated against it.
|
|
609
|
+
* {@link LayerType} is derived from this array, so the two cannot drift.
|
|
610
|
+
*/
|
|
611
|
+
declare const LAYER_TYPES: readonly ["geojson", "raster", "wms", "wmts", "xyz", "vector-tiles", "arcgis", "pmtiles", "mbtiles", "zarr", "lidar", "gaussian-splat", "3d-tiles", "cog", "flatgeobuf", "geoparquet", "duckdb-query", "deckgl-viz", "video", "image"];
|
|
612
|
+
type LayerType = (typeof LAYER_TYPES)[number];
|
|
613
|
+
type VectorStyleMode = "single" | "graduated" | "categorized" | "rule-based" | "expression";
|
|
614
|
+
/**
|
|
615
|
+
* One entry in a {@link LayerStyle.vectorRules} rule-based renderer. Each rule
|
|
616
|
+
* pairs a MapLibre filter expression (a boolean expression array, serialized as
|
|
617
|
+
* JSON) with a symbol color. Rules are evaluated top to bottom; the first whose
|
|
618
|
+
* filter matches wins. The catch-all rule (`isElse`) has no filter and supplies
|
|
619
|
+
* the color for features no other rule matched. Mirrors the QGIS/ArcGIS
|
|
620
|
+
* rule-based renderer.
|
|
621
|
+
*/
|
|
622
|
+
interface VectorRule {
|
|
623
|
+
id: string;
|
|
624
|
+
/** Human-readable label shown in the editor and the legend. */
|
|
625
|
+
label: string;
|
|
626
|
+
/**
|
|
627
|
+
* A MapLibre boolean filter expression serialized as JSON, e.g.
|
|
628
|
+
* `["==", ["get", "TYPE"], "park"]`. Ignored when {@link isElse} is set or
|
|
629
|
+
* the JSON is invalid.
|
|
630
|
+
*/
|
|
631
|
+
filter: string;
|
|
632
|
+
/** The symbol fill/circle color for features this rule matches (6-digit hex). */
|
|
633
|
+
color: string;
|
|
634
|
+
/**
|
|
635
|
+
* When true this is the catch-all "else" rule: {@link filter} is unused and
|
|
636
|
+
* the rule is an unconditional fallback for features no other rule matched,
|
|
637
|
+
* so the {@link minZoom}/{@link maxZoom} and {@link parentId} fields are
|
|
638
|
+
* ignored on it. Its symbol overrides and {@link enabled} toggle do apply.
|
|
639
|
+
*/
|
|
640
|
+
isElse: boolean;
|
|
641
|
+
/**
|
|
642
|
+
* Whether the rule participates in rendering. `false` temporarily disables
|
|
643
|
+
* the rule (and, for a group, its whole subtree) without deleting it,
|
|
644
|
+
* mirroring the QGIS rule checkbox. Absent means enabled.
|
|
645
|
+
*/
|
|
646
|
+
enabled?: boolean;
|
|
647
|
+
/**
|
|
648
|
+
* Lowest zoom (inclusive) the rule applies at, mirroring MapLibre's layer
|
|
649
|
+
* `minzoom` convention. Absent means no lower bound.
|
|
650
|
+
*/
|
|
651
|
+
minZoom?: number;
|
|
652
|
+
/**
|
|
653
|
+
* Zoom the rule stops applying at (exclusive, like MapLibre's layer
|
|
654
|
+
* `maxzoom`). Absent means no upper bound. Together with {@link minZoom}
|
|
655
|
+
* this is the QGIS per-rule "scale range".
|
|
656
|
+
*/
|
|
657
|
+
maxZoom?: number;
|
|
658
|
+
/**
|
|
659
|
+
* The id of the parent rule when this rule is nested inside a group (QGIS
|
|
660
|
+
* rule tree). A child rule matches only features that also match every
|
|
661
|
+
* ancestor's filter, and inherits the intersection of the ancestors' zoom
|
|
662
|
+
* ranges and enabled state. A rule that has children acts as a group: its
|
|
663
|
+
* own symbol is not rendered; only leaf rules draw. Absent or dangling
|
|
664
|
+
* means a top-level rule.
|
|
665
|
+
*/
|
|
666
|
+
parentId?: string;
|
|
667
|
+
/**
|
|
668
|
+
* Per-rule stroke/outline color override (6-digit hex): the polygon outline
|
|
669
|
+
* and circle stroke color for matching features. Absent inherits the layer
|
|
670
|
+
* {@link LayerStyle.strokeColor}.
|
|
671
|
+
*/
|
|
672
|
+
strokeColor?: string;
|
|
673
|
+
/**
|
|
674
|
+
* Per-rule stroke width override in pixels: the line width (lines and
|
|
675
|
+
* polygon outlines) and circle stroke width for matching features. Absent
|
|
676
|
+
* inherits the layer {@link LayerStyle.strokeWidth}.
|
|
677
|
+
*/
|
|
678
|
+
strokeWidth?: number;
|
|
679
|
+
/**
|
|
680
|
+
* Per-rule fill/circle opacity override (0..1) for matching features.
|
|
681
|
+
* Absent inherits the layer {@link LayerStyle.fillOpacity}.
|
|
682
|
+
*/
|
|
683
|
+
fillOpacity?: number;
|
|
684
|
+
/**
|
|
685
|
+
* Per-rule circle radius override in pixels for matching point features.
|
|
686
|
+
* Absent inherits the layer {@link LayerStyle.circleRadius}.
|
|
687
|
+
*/
|
|
688
|
+
circleRadius?: number;
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* The fill pattern applied to polygon layers. `"none"` keeps a flat fill; the
|
|
692
|
+
* named patterns are generated as recolorable sprite tiles; `"svg"` rasterizes
|
|
693
|
+
* the user-supplied markup in {@link LayerStyle.fillPatternSvg}.
|
|
694
|
+
*/
|
|
695
|
+
type FillPattern = "none" | "hatch" | "cross-hatch" | "horizontal" | "vertical" | "dots" | "svg";
|
|
696
|
+
/**
|
|
697
|
+
* The built-in marker shape for a point layer, or `"custom"` to rasterize the
|
|
698
|
+
* user-supplied SVG in {@link LayerStyle.markerSvg}. Built-in shapes are drawn
|
|
699
|
+
* on a sprite tile and recolored via {@link LayerStyle.markerColor}.
|
|
700
|
+
*/
|
|
701
|
+
type MarkerShape = "circle" | "square" | "triangle" | "diamond" | "star" | "cross" | "pin" | "custom";
|
|
702
|
+
/**
|
|
703
|
+
* How a point layer is rendered: as individual markers, a density heatmap, or
|
|
704
|
+
* clustered bubbles. Only applies to point geometry.
|
|
705
|
+
*/
|
|
706
|
+
type PointRenderer = "single" | "heatmap" | "cluster";
|
|
707
|
+
/**
|
|
708
|
+
* The repeated decoration symbol drawn along line features (and polygon
|
|
709
|
+
* outlines), or `"none"` when decorations are off. Mirrors the QGIS
|
|
710
|
+
* marker-line / arrow symbol layers: `"arrow"` renders directional arrowheads
|
|
711
|
+
* that follow the line, the other shapes render as repeated markers.
|
|
712
|
+
*/
|
|
713
|
+
type LineDecoration = "none" | "arrow" | "triangle" | "circle" | "square";
|
|
714
|
+
/**
|
|
715
|
+
* The per-feature derived geometry rendered by the geometry generator, or
|
|
716
|
+
* `"none"` when the generator is off. Mirrors QGIS geometry-generator symbol
|
|
717
|
+
* layers: each feature's derived geometry (its centroid, bounding box, convex
|
|
718
|
+
* hull, or a buffer) is drawn as an extra symbol over the layer's normal
|
|
719
|
+
* symbology. `"centroid"` derives points; the rest derive polygons.
|
|
720
|
+
*/
|
|
721
|
+
type GeometryGeneratorType = "none" | "centroid" | "bounding-box" | "convex-hull" | "buffer";
|
|
722
|
+
/**
|
|
723
|
+
* Unit a stroke/line width is measured in. `"pixels"` is constant screen space;
|
|
724
|
+
* `"meters"` is ground distance, so the rendered width scales with the map
|
|
725
|
+
* scale (zoom). See {@link LayerStyle.strokeWidthUnit}.
|
|
726
|
+
*/
|
|
727
|
+
type StrokeWidthUnit = "pixels" | "meters";
|
|
728
|
+
/**
|
|
729
|
+
* The chart drawn on top of each feature by the diagram renderer (QGIS-style
|
|
730
|
+
* diagram symbology), or `"none"` when diagrams are off. Diagrams visualize
|
|
731
|
+
* several numeric attributes per feature at once — e.g. election results by
|
|
732
|
+
* party per county — and render through the shared deck.gl overlay on the
|
|
733
|
+
* feature's point location or polygon centroid.
|
|
734
|
+
*/
|
|
735
|
+
type DiagramType = "none" | "pie" | "donut" | "bar" | "stacked-bar";
|
|
736
|
+
/**
|
|
737
|
+
* How the overall diagram size is determined.
|
|
738
|
+
*
|
|
739
|
+
* - `"fixed"`: every diagram renders at {@link LayerStyle.diagramSize} pixels.
|
|
740
|
+
* - `"sum"`: scaled by the sum of the mapped attribute values, so the largest
|
|
741
|
+
* total renders at {@link LayerStyle.diagramSize} pixels (area-true square
|
|
742
|
+
* root scaling).
|
|
743
|
+
* - `"attribute"`: scaled the same way by the single numeric attribute in
|
|
744
|
+
* {@link LayerStyle.diagramSizeProperty}.
|
|
745
|
+
*/
|
|
746
|
+
type DiagramSizeMode = "fixed" | "sum" | "attribute";
|
|
747
|
+
/** One attribute rendered as a slice/bar of a feature diagram. */
|
|
748
|
+
interface DiagramField {
|
|
749
|
+
/** Numeric feature property visualized by this slice/bar. */
|
|
750
|
+
property: string;
|
|
751
|
+
/** Slice/bar color (6-digit hex). */
|
|
752
|
+
color: string;
|
|
753
|
+
}
|
|
754
|
+
interface VectorStyleStop {
|
|
755
|
+
value: string | number;
|
|
756
|
+
color: string;
|
|
757
|
+
label?: string;
|
|
758
|
+
}
|
|
759
|
+
/** Attribute-driven labeling for a vector layer (rendered as a MapLibre symbol layer). */
|
|
760
|
+
interface LabelStyle {
|
|
761
|
+
/** Whether labels are shown for the layer. */
|
|
762
|
+
enabled: boolean;
|
|
763
|
+
/** Attribute field whose value becomes the label text. */
|
|
764
|
+
field: string;
|
|
765
|
+
/**
|
|
766
|
+
* Optional MapLibre expression (JSON string) for the label text, which
|
|
767
|
+
* overrides {@link field} when non-empty (e.g. concatenating several fields).
|
|
768
|
+
*/
|
|
769
|
+
expression: string;
|
|
770
|
+
/** `"point"` labels at the feature/centroid; `"line"` places them along lines. */
|
|
771
|
+
placement: "point" | "line";
|
|
772
|
+
/** Label text size in pixels. */
|
|
773
|
+
size: number;
|
|
774
|
+
/** CSS color string for the label text. */
|
|
775
|
+
color: string;
|
|
776
|
+
/** CSS color string for the text halo drawn behind the label. */
|
|
777
|
+
haloColor: string;
|
|
778
|
+
/** Width of the text halo in pixels. */
|
|
779
|
+
haloWidth: number;
|
|
780
|
+
/** Scale range for labels; `0` / `24` inherit the layer's own zoom range. */
|
|
781
|
+
minZoom: number;
|
|
782
|
+
maxZoom: number;
|
|
783
|
+
/** Let labels overlap instead of hiding colliding ones. */
|
|
784
|
+
allowOverlap: boolean;
|
|
785
|
+
/**
|
|
786
|
+
* Where the label sits relative to its anchor point (MapLibre `text-anchor`),
|
|
787
|
+
* e.g. `"top"` places the text above the point. Ignored for line placement.
|
|
788
|
+
*/
|
|
789
|
+
anchor: LabelAnchor;
|
|
790
|
+
/** Horizontal label offset in ems (MapLibre `text-offset` x). */
|
|
791
|
+
offsetX: number;
|
|
792
|
+
/** Vertical label offset in ems (MapLibre `text-offset` y; positive is down). */
|
|
793
|
+
offsetY: number;
|
|
794
|
+
/** Label rotation in degrees clockwise (MapLibre `text-rotate`). */
|
|
795
|
+
rotation: number;
|
|
796
|
+
/** Maximum line width in ems before the label wraps (MapLibre `text-max-width`). */
|
|
797
|
+
maxWidth: number;
|
|
798
|
+
/** Letter-case transform applied to the label text (MapLibre `text-transform`). */
|
|
799
|
+
transform: LabelTransform;
|
|
800
|
+
/**
|
|
801
|
+
* Render a numeric {@link field} with the locale's thousands and decimal
|
|
802
|
+
* separators (issue #2336), so `1234567.5` labels as `1,234,567.5` instead
|
|
803
|
+
* of running together. Non-numeric values are unaffected, and it is not
|
|
804
|
+
* applied to {@link expression}, which formats its own output (MapLibre's
|
|
805
|
+
* `number-format`, offered in the Expression Builder).
|
|
806
|
+
*/
|
|
807
|
+
numberFormatEnabled: boolean;
|
|
808
|
+
/** Decimal places kept while {@link numberFormatEnabled} is on (0-10). */
|
|
809
|
+
numberDecimals: number;
|
|
810
|
+
/**
|
|
811
|
+
* BCP 47 tag picking the separators for {@link numberFormatEnabled}, from
|
|
812
|
+
* {@link LABEL_NUMBER_LOCALES}. Empty (the default) follows the app's own
|
|
813
|
+
* language, the way popup number fields do.
|
|
814
|
+
*/
|
|
815
|
+
numberLocale: string;
|
|
816
|
+
/**
|
|
817
|
+
* How to handle features that share a label.
|
|
818
|
+
*
|
|
819
|
+
* - `"off"`: every feature is labeled (the historical behavior).
|
|
820
|
+
* - `"unique"`: features stacked at the same point are collapsed to a single
|
|
821
|
+
* label, so co-located points (e.g. several antennas at one cell site) do not
|
|
822
|
+
* stack overlapping text.
|
|
823
|
+
* - `"concatenate"`: co-located points are merged into one label that joins
|
|
824
|
+
* their distinct {@link field} values, one per line.
|
|
825
|
+
*
|
|
826
|
+
* Applies to point layers rendered through the inline GeoJSON path and uses
|
|
827
|
+
* {@link field} (not {@link expression}) as the label value.
|
|
828
|
+
*/
|
|
829
|
+
dedupe: LabelDedupe;
|
|
830
|
+
/**
|
|
831
|
+
* Data-defined override for {@link size}: a MapLibre expression (JSON
|
|
832
|
+
* string) producing a number, e.g. sizing labels by population. Empty means
|
|
833
|
+
* "use the literal {@link size}". Like the other data-defined overrides
|
|
834
|
+
* below, it reads source feature attributes, so it is skipped while
|
|
835
|
+
* {@link dedupe} collapsing is active (the aggregated features carry only
|
|
836
|
+
* the label value).
|
|
837
|
+
*/
|
|
838
|
+
sizeExpression: string;
|
|
839
|
+
/**
|
|
840
|
+
* Data-defined override for {@link color}: a MapLibre expression (JSON
|
|
841
|
+
* string) producing a color, e.g. coloring labels by category.
|
|
842
|
+
*/
|
|
843
|
+
colorExpression: string;
|
|
844
|
+
/**
|
|
845
|
+
* Data-defined label opacity: a MapLibre expression (JSON string) producing
|
|
846
|
+
* a number in 0..1. When set it replaces the layer-wide opacity for labels
|
|
847
|
+
* (wrapping it would invalidate top-level `["zoom"]` interpolations).
|
|
848
|
+
*/
|
|
849
|
+
opacityExpression: string;
|
|
850
|
+
/**
|
|
851
|
+
* Per-feature label visibility: a MapLibre expression (JSON string)
|
|
852
|
+
* producing a boolean. Features evaluating false get no label (e.g. hide
|
|
853
|
+
* labels below an attribute threshold). Combined with the layer's other
|
|
854
|
+
* feature filters.
|
|
855
|
+
*/
|
|
856
|
+
visibilityExpression: string;
|
|
857
|
+
/**
|
|
858
|
+
* Per-feature placement priority: a MapLibre expression (JSON string)
|
|
859
|
+
* producing a number, applied as `symbol-sort-key`. Labels with lower
|
|
860
|
+
* values are placed first, so they win when space is tight.
|
|
861
|
+
*/
|
|
862
|
+
priorityExpression: string;
|
|
863
|
+
}
|
|
864
|
+
/** MapLibre `text-anchor` positions offered for {@link LabelStyle.anchor}. */
|
|
865
|
+
type LabelAnchor = "center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
866
|
+
/** Letter-case transform offered for {@link LabelStyle.transform}. */
|
|
867
|
+
type LabelTransform = "none" | "uppercase" | "lowercase";
|
|
868
|
+
/** Duplicate-label handling offered for {@link LabelStyle.dedupe}. */
|
|
869
|
+
type LabelDedupe = "off" | "unique" | "concatenate";
|
|
870
|
+
/**
|
|
871
|
+
* Cartographic blend modes offered for {@link LayerStyle.blendMode}.
|
|
872
|
+
*
|
|
873
|
+
* The list is bounded by what WebGL *fixed-function* blending can express --
|
|
874
|
+
* one `blendFunc` factor pair plus one `blendEquation` -- because that is the
|
|
875
|
+
* only blend state MapLibre's renderer exposes, and it applies to colour and
|
|
876
|
+
* alpha together. Two consequences shaped this list:
|
|
877
|
+
*
|
|
878
|
+
* - Modes needing the destination colour inside a fragment shader (`overlay`,
|
|
879
|
+
* `color-dodge`, `soft-light`, `difference`, and the non-separable HSL modes)
|
|
880
|
+
* are absent. MapLibre draws straight into the map framebuffer, which a
|
|
881
|
+
* shader cannot sample, so computing them would need an extra copy pass.
|
|
882
|
+
* - `darken` and `subtract` are absent even though `MIN` and
|
|
883
|
+
* `FUNC_REVERSE_SUBTRACT` look like they would serve. Both also apply to the
|
|
884
|
+
* alpha channel, where they drive the map canvas transparent: `MIN` takes the
|
|
885
|
+
* whole canvas to `min(0, dst) = 0` everywhere the layer does not cover, and
|
|
886
|
+
* `FUNC_REVERSE_SUBTRACT` leaves `dstA - srcA` inside it. Correcting either
|
|
887
|
+
* needs `blendEquationSeparate` / `blendFuncSeparate`, which MapLibre's state
|
|
888
|
+
* tracker does not offer.
|
|
889
|
+
*
|
|
890
|
+
* Every mode here leaves the canvas opaque and leaves the map untouched
|
|
891
|
+
* wherever the layer contributes nothing. See `docs/user-guide/layers.md`.
|
|
892
|
+
*/
|
|
893
|
+
declare const BLEND_MODES: readonly ["normal", "multiply", "screen", "lighten", "add"];
|
|
894
|
+
/**
|
|
895
|
+
* How a layer's pixels combine with the map beneath it. `"normal"` is ordinary
|
|
896
|
+
* alpha compositing (the default, and what every layer did before blend modes
|
|
897
|
+
* existed). See {@link BLEND_MODES}.
|
|
898
|
+
*/
|
|
899
|
+
type BlendMode = (typeof BLEND_MODES)[number];
|
|
900
|
+
/**
|
|
901
|
+
* The mode a layer renders with unless it says otherwise. Declared separately
|
|
902
|
+
* from {@link DEFAULT_LAYER_STYLE} so consumers get a non-optional
|
|
903
|
+
* {@link BlendMode} to fall back to: `blendMode` is optional on
|
|
904
|
+
* {@link LayerStyle}, so `DEFAULT_LAYER_STYLE.blendMode` is typed
|
|
905
|
+
* `BlendMode | undefined` however it is initialized.
|
|
906
|
+
*/
|
|
907
|
+
declare const DEFAULT_BLEND_MODE: BlendMode;
|
|
908
|
+
interface LayerStyle {
|
|
909
|
+
minZoom: number;
|
|
910
|
+
maxZoom: number;
|
|
911
|
+
fillColor: string;
|
|
912
|
+
strokeColor: string;
|
|
913
|
+
strokeWidth: number;
|
|
914
|
+
/**
|
|
915
|
+
* Unit the {@link strokeWidth} value is expressed in.
|
|
916
|
+
*
|
|
917
|
+
* - `"pixels"` (default): a constant screen-space width that never changes
|
|
918
|
+
* with zoom — the historical behavior.
|
|
919
|
+
* - `"meters"`: a ground-distance width, so the rendered line stays
|
|
920
|
+
* proportional to the map scale (thicker zoomed in, thinner zoomed out),
|
|
921
|
+
* matching QGIS "map units". Only affects line/polygon-outline rendering;
|
|
922
|
+
* point/circle outlines remain pixel-based.
|
|
923
|
+
*/
|
|
924
|
+
strokeWidthUnit: StrokeWidthUnit;
|
|
925
|
+
fillOpacity: number;
|
|
926
|
+
circleRadius: number;
|
|
927
|
+
textColor: string;
|
|
928
|
+
textHaloColor: string;
|
|
929
|
+
textHaloWidth: number;
|
|
930
|
+
textSize: number;
|
|
931
|
+
labels: LabelStyle;
|
|
932
|
+
extrusionEnabled: boolean;
|
|
933
|
+
extrusionColor: string;
|
|
934
|
+
extrusionOpacity: number;
|
|
935
|
+
extrusionHeightProperty: string;
|
|
936
|
+
extrusionHeightScale: number;
|
|
937
|
+
extrusionBase: number;
|
|
938
|
+
extrusionAdvancedStyleEnabled: boolean;
|
|
939
|
+
extrusionColorExpression: string;
|
|
940
|
+
extrusionHeightExpression: string;
|
|
941
|
+
/**
|
|
942
|
+
* When true, a vector layer whose coordinates carry Z values (e.g. a GPX
|
|
943
|
+
* track with elevations) renders in true 3D through the shared deck.gl
|
|
944
|
+
* overlay instead of MapLibre's flat 2D layers, so features sit at their
|
|
945
|
+
* own altitude. Orthogonal to {@link extrusionEnabled}, which extrudes flat
|
|
946
|
+
* polygons by an attribute; only one of the two should be on at a time.
|
|
947
|
+
*/
|
|
948
|
+
elevation3dEnabled: boolean;
|
|
949
|
+
/** Multiplier applied to each coordinate's Z value (vertical exaggeration). */
|
|
950
|
+
elevation3dVerticalScale: number;
|
|
951
|
+
/** Constant altitude offset in meters added after the vertical scale. */
|
|
952
|
+
elevation3dOffset: number;
|
|
953
|
+
vectorStyleMode: VectorStyleMode;
|
|
954
|
+
vectorStyleProperty: string;
|
|
955
|
+
vectorStyleClassCount: number;
|
|
956
|
+
vectorStyleColorRamp: string;
|
|
957
|
+
vectorStyleClassificationScheme: string;
|
|
958
|
+
vectorStyleStops: VectorStyleStop[];
|
|
959
|
+
vectorStyleExpression: string;
|
|
960
|
+
/**
|
|
961
|
+
* Ordered rules for the `"rule-based"` {@link vectorStyleMode}. Compiled to a
|
|
962
|
+
* MapLibre `case` color expression (first matching filter wins, catch-all
|
|
963
|
+
* last). See {@link VectorRule}.
|
|
964
|
+
*/
|
|
965
|
+
vectorRules: VectorRule[];
|
|
966
|
+
/**
|
|
967
|
+
* When true, the point circle radius (or line width) is sized by a numeric
|
|
968
|
+
* field via an `interpolate` between {@link proportionalSizeMinValue} ..
|
|
969
|
+
* {@link proportionalSizeMaxValue} mapped onto {@link proportionalSizeMinRadius}
|
|
970
|
+
* .. {@link proportionalSizeMaxRadius} (QGIS "graduated → size" / proportional
|
|
971
|
+
* symbols). Orthogonal to the color {@link vectorStyleMode}.
|
|
972
|
+
*/
|
|
973
|
+
proportionalSizeEnabled: boolean;
|
|
974
|
+
proportionalSizeProperty: string;
|
|
975
|
+
proportionalSizeMinValue: number;
|
|
976
|
+
proportionalSizeMaxValue: number;
|
|
977
|
+
proportionalSizeMinRadius: number;
|
|
978
|
+
proportionalSizeMaxRadius: number;
|
|
979
|
+
/**
|
|
980
|
+
* Polygon fill pattern. `"none"` keeps the flat fill; other values render a
|
|
981
|
+
* recolorable sprite tile ({@link fillPatternColor}); `"svg"` rasterizes
|
|
982
|
+
* {@link fillPatternSvg}. See {@link FillPattern}.
|
|
983
|
+
*/
|
|
984
|
+
fillPattern: FillPattern;
|
|
985
|
+
fillPatternColor: string;
|
|
986
|
+
/** Raw SVG markup (or a data URL) used when {@link fillPattern} is `"svg"`. */
|
|
987
|
+
fillPatternSvg: string;
|
|
988
|
+
/**
|
|
989
|
+
* When true, point features render as a marker icon ({@link markerShape})
|
|
990
|
+
* instead of a plain circle. Built-in shapes are recolored via
|
|
991
|
+
* {@link markerColor}; `"custom"` rasterizes {@link markerSvg}.
|
|
992
|
+
*/
|
|
993
|
+
markerEnabled: boolean;
|
|
994
|
+
markerShape: MarkerShape;
|
|
995
|
+
markerColor: string;
|
|
996
|
+
markerSize: number;
|
|
997
|
+
/** Raw SVG markup (or a data URL) used when {@link markerShape} is `"custom"`. */
|
|
998
|
+
markerSvg: string;
|
|
999
|
+
/**
|
|
1000
|
+
* When true, per-feature [simplestyle-spec](https://github.com/mapbox/simplestyle-spec)
|
|
1001
|
+
* properties (`fill`, `fill-opacity`, `stroke`, `stroke-width`,
|
|
1002
|
+
* `stroke-opacity`, `marker-color`) override the flat layer style on a
|
|
1003
|
+
* per-feature basis. Set automatically when a GeoJSON layer is added whose
|
|
1004
|
+
* features carry these properties (e.g. styled KML/KMZ), so embedded
|
|
1005
|
+
* symbology renders without manual configuration.
|
|
1006
|
+
*/
|
|
1007
|
+
simpleStyleEnabled: boolean;
|
|
1008
|
+
/**
|
|
1009
|
+
* Per-feature chart symbology (QGIS-style diagrams). `"none"` disables it;
|
|
1010
|
+
* any other value renders one {@link DiagramType} chart per feature over the
|
|
1011
|
+
* layer's normal symbology, built from the numeric attributes in
|
|
1012
|
+
* {@link diagramFields}. See `@geolibre/core`'s `diagram.ts` helpers.
|
|
1013
|
+
*/
|
|
1014
|
+
diagramType: DiagramType;
|
|
1015
|
+
/** Attributes (and their colors) charted by the diagram renderer, in order. */
|
|
1016
|
+
diagramFields: DiagramField[];
|
|
1017
|
+
/** How the per-feature diagram size is determined. */
|
|
1018
|
+
diagramSizeMode: DiagramSizeMode;
|
|
1019
|
+
/**
|
|
1020
|
+
* Diagram size in pixels: the rendered diameter/height for `"fixed"` sizing,
|
|
1021
|
+
* or the diameter/height of the largest feature for scaled sizing.
|
|
1022
|
+
*/
|
|
1023
|
+
diagramSize: number;
|
|
1024
|
+
/** Numeric attribute driving `"attribute"` sizing (see {@link DiagramSizeMode}). */
|
|
1025
|
+
diagramSizeProperty: string;
|
|
1026
|
+
/** Minimum zoom at which diagrams are drawn, to avoid clutter when zoomed out. */
|
|
1027
|
+
diagramMinZoom: number;
|
|
1028
|
+
/**
|
|
1029
|
+
* When true, diagrams that would overlap an already-placed diagram on screen
|
|
1030
|
+
* are skipped (largest first), decluttering dense areas. Recomputed as the
|
|
1031
|
+
* view changes.
|
|
1032
|
+
*/
|
|
1033
|
+
diagramDeclutter: boolean;
|
|
1034
|
+
pointRenderer: PointRenderer;
|
|
1035
|
+
heatmapRadius: number;
|
|
1036
|
+
heatmapIntensity: number;
|
|
1037
|
+
/** Built-in color ramp used by the heatmap density renderer. */
|
|
1038
|
+
heatmapColorRamp: string;
|
|
1039
|
+
/** Numeric feature property used as heatmap weight; blank gives every point equal weight. */
|
|
1040
|
+
heatmapWeightProperty: string;
|
|
1041
|
+
clusterRadius: number;
|
|
1042
|
+
clusterMaxZoom: number;
|
|
1043
|
+
/**
|
|
1044
|
+
* When true, the polygon fill renders *inverted*: the area outside the
|
|
1045
|
+
* features is filled (with {@link fillColor}/{@link fillOpacity}) and the
|
|
1046
|
+
* features themselves become holes, mirroring the QGIS "Inverted polygons"
|
|
1047
|
+
* renderer. Feature outlines still render normally. Only applies to layers
|
|
1048
|
+
* with polygon geometry; ignored while {@link extrusionEnabled} is on.
|
|
1049
|
+
*/
|
|
1050
|
+
invertedFillEnabled: boolean;
|
|
1051
|
+
/**
|
|
1052
|
+
* Repeated decoration symbol drawn along line features and polygon outlines
|
|
1053
|
+
* (QGIS marker-line / arrow lines). `"none"` disables it. See
|
|
1054
|
+
* {@link LineDecoration}.
|
|
1055
|
+
*/
|
|
1056
|
+
lineDecoration: LineDecoration;
|
|
1057
|
+
/**
|
|
1058
|
+
* Decoration symbol color (6-digit hex). An empty string inherits
|
|
1059
|
+
* {@link strokeColor} so decorations follow the stroke by default.
|
|
1060
|
+
*/
|
|
1061
|
+
lineDecorationColor: string;
|
|
1062
|
+
/** Decoration symbol size in pixels. */
|
|
1063
|
+
lineDecorationSize: number;
|
|
1064
|
+
/** Distance between consecutive decoration symbols in pixels. */
|
|
1065
|
+
lineDecorationSpacing: number;
|
|
1066
|
+
/**
|
|
1067
|
+
* Per-feature derived geometry drawn over the layer's normal symbology
|
|
1068
|
+
* (QGIS geometry generator). `"none"` disables it. See
|
|
1069
|
+
* {@link GeometryGeneratorType}.
|
|
1070
|
+
*/
|
|
1071
|
+
geometryGenerator: GeometryGeneratorType;
|
|
1072
|
+
/** Buffer distance in meters for the `"buffer"` generator. */
|
|
1073
|
+
geometryGeneratorBufferDistance: number;
|
|
1074
|
+
/**
|
|
1075
|
+
* Attribute driving the `"buffer"` generator's distance, so each feature is
|
|
1076
|
+
* buffered by its own value in meters (QGIS data-defined override on a
|
|
1077
|
+
* geometry-generator symbol). An empty string buffers every feature by the
|
|
1078
|
+
* flat {@link geometryGeneratorBufferDistance}, which also stands in for
|
|
1079
|
+
* features whose value is missing or non-numeric.
|
|
1080
|
+
*/
|
|
1081
|
+
geometryGeneratorBufferProperty: string;
|
|
1082
|
+
/** Fill color (6-digit hex) for generated polygons and centroid points. */
|
|
1083
|
+
geometryGeneratorFillColor: string;
|
|
1084
|
+
/** Outline color (6-digit hex) for generated geometry. */
|
|
1085
|
+
geometryGeneratorStrokeColor: string;
|
|
1086
|
+
/** Outline width in pixels for generated geometry. */
|
|
1087
|
+
geometryGeneratorStrokeWidth: number;
|
|
1088
|
+
/** Fill opacity (0..1) for generated polygons and centroid points. */
|
|
1089
|
+
geometryGeneratorOpacity: number;
|
|
1090
|
+
/** Circle radius in pixels for generated centroid points. */
|
|
1091
|
+
geometryGeneratorCircleRadius: number;
|
|
1092
|
+
/**
|
|
1093
|
+
* Attribute driving the radius of generated centroid points, scaling them
|
|
1094
|
+
* between {@link geometryGeneratorSizeMinRadius} and
|
|
1095
|
+
* {@link geometryGeneratorSizeMaxRadius} across
|
|
1096
|
+
* {@link geometryGeneratorSizeMinValue} ..
|
|
1097
|
+
* {@link geometryGeneratorSizeMaxValue} (proportional symbols on the derived
|
|
1098
|
+
* centroids). An empty string draws every centroid at the flat
|
|
1099
|
+
* {@link geometryGeneratorCircleRadius}.
|
|
1100
|
+
*
|
|
1101
|
+
* Deliberately separate from {@link proportionalSizeProperty}: that one also
|
|
1102
|
+
* drives line width, so reusing it here would resize a polygon layer's
|
|
1103
|
+
* outlines as a side effect of sizing its centroids.
|
|
1104
|
+
*/
|
|
1105
|
+
geometryGeneratorSizeProperty: string;
|
|
1106
|
+
geometryGeneratorSizeMinValue: number;
|
|
1107
|
+
geometryGeneratorSizeMaxValue: number;
|
|
1108
|
+
geometryGeneratorSizeMinRadius: number;
|
|
1109
|
+
geometryGeneratorSizeMaxRadius: number;
|
|
1110
|
+
rasterBrightnessMin: number;
|
|
1111
|
+
rasterBrightnessMax: number;
|
|
1112
|
+
rasterSaturation: number;
|
|
1113
|
+
rasterContrast: number;
|
|
1114
|
+
rasterHueRotate: number;
|
|
1115
|
+
/**
|
|
1116
|
+
* How this layer composites onto whatever is drawn beneath it. `"normal"`
|
|
1117
|
+
* (the default) is ordinary alpha compositing; `"multiply"` is the classic
|
|
1118
|
+
* cartographic case of laying colour over a hillshade so the relief still
|
|
1119
|
+
* reads through. Applies to the layer's own rendered geometry and raster
|
|
1120
|
+
* tiles, not to its labels, which stay legible on top. See
|
|
1121
|
+
* {@link BLEND_MODES} for the available modes and why the list is what it is.
|
|
1122
|
+
*/
|
|
1123
|
+
blendMode?: BlendMode;
|
|
1124
|
+
}
|
|
1125
|
+
declare const DEFAULT_LAYER_STYLE: LayerStyle;
|
|
1126
|
+
/**
|
|
1127
|
+
* Read a layer style property, falling back to the shared default when the
|
|
1128
|
+
* layer does not define it. Shared by `@geolibre/map` and the desktop app so
|
|
1129
|
+
* the two consumers cannot drift.
|
|
1130
|
+
*/
|
|
1131
|
+
declare function styleValue<K extends keyof LayerStyle>(style: LayerStyle, key: K): LayerStyle[K];
|
|
1132
|
+
/**
|
|
1133
|
+
* Feature-count threshold above which a local vector (GeoJSON) layer is rendered
|
|
1134
|
+
* through client-side vector tiles (geojson-vt / supercluster served by a custom
|
|
1135
|
+
* MapLibre protocol) instead of one in-memory geojson source pushed via
|
|
1136
|
+
* `setData`. Small layers stay on the simpler inline path. Mirrors the
|
|
1137
|
+
* `MAX_CEREUS_FEATURES` precedent in the desktop SQL engine.
|
|
1138
|
+
*/
|
|
1139
|
+
declare const LARGE_VECTOR_FEATURE_THRESHOLD = 50000;
|
|
1140
|
+
/**
|
|
1141
|
+
* Decide whether a GeoJSON layer should use the tiled rendering path.
|
|
1142
|
+
*
|
|
1143
|
+
* @param geojson - The layer's feature collection (may be undefined for
|
|
1144
|
+
* non-vector layers).
|
|
1145
|
+
* @returns `true` when the collection exceeds
|
|
1146
|
+
* {@link LARGE_VECTOR_FEATURE_THRESHOLD} features.
|
|
1147
|
+
*/
|
|
1148
|
+
declare function shouldUseTiledRendering(geojson: GeoJSON.FeatureCollection | undefined): boolean;
|
|
1149
|
+
/**
|
|
1150
|
+
* Match statistics from the last time a {@link LayerJoin} was applied, shown in
|
|
1151
|
+
* the Joins UI so silent key mismatches are visible (mirrors QGIS's join
|
|
1152
|
+
* feedback). Recomputed on every apply; persisted harmlessly with the join.
|
|
1153
|
+
*/
|
|
1154
|
+
interface LayerJoinStats {
|
|
1155
|
+
/** Target features whose key matched a join-table row. */
|
|
1156
|
+
matchedCount: number;
|
|
1157
|
+
/** Target features with no matching join-table row (their joined columns are null). */
|
|
1158
|
+
unmatchedTargetCount: number;
|
|
1159
|
+
/** Join-table rows (with a non-empty key) that matched no target feature. */
|
|
1160
|
+
unmatchedJoinCount: number;
|
|
1161
|
+
}
|
|
1162
|
+
/**
|
|
1163
|
+
* A persistent attribute join attached to a layer (QGIS Layer Properties →
|
|
1164
|
+
* Joins): a live left join that augments the layer's attribute table with
|
|
1165
|
+
* columns from another layer (typically a geometry-less table added via
|
|
1166
|
+
* Delimited Text with no coordinate fields) matched on a key field. Unlike the
|
|
1167
|
+
* Processing → Vector attribute join, the layer keeps its identity — styles,
|
|
1168
|
+
* labels, and position — and the joined columns refresh whenever the join
|
|
1169
|
+
* table's data changes. Definitions persist in `.geolibre.json` and re-resolve
|
|
1170
|
+
* on project load. See `joins.ts` for the engine.
|
|
1171
|
+
*/
|
|
1172
|
+
interface LayerJoin {
|
|
1173
|
+
/** Stable id for list edits. */
|
|
1174
|
+
id: string;
|
|
1175
|
+
/** Id of the layer providing the joined columns (its geometry is ignored). */
|
|
1176
|
+
joinLayerId: string;
|
|
1177
|
+
/** Key field on the layer that owns this join. */
|
|
1178
|
+
targetField: string;
|
|
1179
|
+
/** Key field on the join layer. */
|
|
1180
|
+
joinField: string;
|
|
1181
|
+
/**
|
|
1182
|
+
* Join-layer fields to bring over; `undefined` brings every field except the
|
|
1183
|
+
* key. Names are the join layer's own (pre-prefix) field names.
|
|
1184
|
+
*/
|
|
1185
|
+
fields?: string[];
|
|
1186
|
+
/** Optional prefix prepended to every joined column name (as in QGIS). */
|
|
1187
|
+
prefix?: string;
|
|
1188
|
+
/** `false` detaches the joined columns without deleting the definition. */
|
|
1189
|
+
enabled?: boolean;
|
|
1190
|
+
/**
|
|
1191
|
+
* Bookkeeping written by the engine: the output column names this join added
|
|
1192
|
+
* to the layer's features. Applying joins strips these first, which makes
|
|
1193
|
+
* re-application idempotent without keeping a duplicate copy of the base
|
|
1194
|
+
* data (base columns always win a name collision, so a joined column never
|
|
1195
|
+
* shadows one). Not user-editable.
|
|
1196
|
+
*/
|
|
1197
|
+
addedFields?: string[];
|
|
1198
|
+
/** Last-run match statistics; see {@link LayerJoinStats}. */
|
|
1199
|
+
stats?: LayerJoinStats;
|
|
1200
|
+
}
|
|
1201
|
+
/** Edit-widget kinds the Attribute Form designer can assign to a field. */
|
|
1202
|
+
type AttributeFormWidget = "text" | "number" | "range" | "checkbox" | "date" | "valueMap";
|
|
1203
|
+
/** One selectable entry of a `valueMap` widget (stored value + display label). */
|
|
1204
|
+
interface AttributeFormValueMapEntry {
|
|
1205
|
+
/** The value written to the feature property (compared as a string). */
|
|
1206
|
+
value: string;
|
|
1207
|
+
/** Human-readable label shown in the dropdown; defaults to {@link value}. */
|
|
1208
|
+
label?: string;
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Per-field configuration authored in the Attribute Form designer (layer
|
|
1212
|
+
* properties → Attributes Form, QGIS-style): which edit widget the attribute
|
|
1213
|
+
* editing surfaces render for the field, plus optional expression-based
|
|
1214
|
+
* constraints and conditional visibility. Consumed by the attribute table's
|
|
1215
|
+
* inline editor and the Field Collection capture form; helpers live in
|
|
1216
|
+
* `attribute-form.ts`.
|
|
1217
|
+
*/
|
|
1218
|
+
interface AttributeFormFieldConfig {
|
|
1219
|
+
/** Feature property key this configuration applies to. */
|
|
1220
|
+
field: string;
|
|
1221
|
+
widget: AttributeFormWidget;
|
|
1222
|
+
/** Display label override shown in forms instead of the raw field name. */
|
|
1223
|
+
alias?: string;
|
|
1224
|
+
/**
|
|
1225
|
+
* When true, a null/empty value fails validation. Checkbox widgets are
|
|
1226
|
+
* exempt: unchecked is a valid state, not a missing value.
|
|
1227
|
+
*/
|
|
1228
|
+
required?: boolean;
|
|
1229
|
+
/** Dropdown entries for the `valueMap` widget. */
|
|
1230
|
+
valueMap?: AttributeFormValueMapEntry[];
|
|
1231
|
+
/** Lower bound for `number`/`range` widgets (inclusive). */
|
|
1232
|
+
min?: number;
|
|
1233
|
+
/** Upper bound for `number`/`range` widgets (inclusive). */
|
|
1234
|
+
max?: number;
|
|
1235
|
+
/** Step for the `range` widget's input. */
|
|
1236
|
+
step?: number;
|
|
1237
|
+
/**
|
|
1238
|
+
* Boolean MapLibre expression that must evaluate to `true` against the
|
|
1239
|
+
* feature's (candidate) properties for the value to be accepted, e.g.
|
|
1240
|
+
* `[">", ["get", "population"], 0]`. Stored as the expression source string
|
|
1241
|
+
* the Expression Builder edits.
|
|
1242
|
+
*/
|
|
1243
|
+
constraintExpression?: string;
|
|
1244
|
+
/** Human-readable message shown when the constraint fails. */
|
|
1245
|
+
constraintDescription?: string;
|
|
1246
|
+
/**
|
|
1247
|
+
* Boolean MapLibre expression controlling whether the field is shown in
|
|
1248
|
+
* attribute forms; `false` hides the field (and skips its validation).
|
|
1249
|
+
* Empty/invalid expressions fail open so a typo cannot hide data entry.
|
|
1250
|
+
*/
|
|
1251
|
+
visibilityExpression?: string;
|
|
1252
|
+
}
|
|
1253
|
+
/** The Attribute Form designer's whole per-layer configuration. */
|
|
1254
|
+
interface AttributeFormConfig {
|
|
1255
|
+
fields: AttributeFormFieldConfig[];
|
|
1256
|
+
}
|
|
1257
|
+
/** Point of contact recorded in a layer's {@link LayerDescriptiveMetadata}. */
|
|
1258
|
+
interface LayerMetadataContact {
|
|
1259
|
+
name?: string;
|
|
1260
|
+
email?: string;
|
|
1261
|
+
organization?: string;
|
|
1262
|
+
}
|
|
1263
|
+
/** A related resource recorded in a layer's {@link LayerDescriptiveMetadata}. */
|
|
1264
|
+
interface LayerMetadataLink {
|
|
1265
|
+
/** Absolute URL of the resource. */
|
|
1266
|
+
href: string;
|
|
1267
|
+
/** Relation type (STAC/IANA link relation such as `"license"` or `"related"`). */
|
|
1268
|
+
rel?: string;
|
|
1269
|
+
/** Human-readable label. */
|
|
1270
|
+
title?: string;
|
|
1271
|
+
}
|
|
1272
|
+
/**
|
|
1273
|
+
* Time span the layer's data covers. Each bound is an ISO 8601 date
|
|
1274
|
+
* (`YYYY-MM-DD`) or date-time; either may be omitted for an open interval.
|
|
1275
|
+
*/
|
|
1276
|
+
interface LayerMetadataTemporalExtent {
|
|
1277
|
+
start?: string;
|
|
1278
|
+
end?: string;
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* User-authored, catalog-style description of a layer (issue #2858), edited in
|
|
1282
|
+
* the layer's Metadata dialog and exported as a STAC Item. Distinct from the
|
|
1283
|
+
* internal {@link GeoLibreLayer.metadata} record the renderers and plugins key
|
|
1284
|
+
* off: every field here is free-form documentation that changes nothing about
|
|
1285
|
+
* how the layer renders. Helpers live in `layer-descriptive-metadata.ts`.
|
|
1286
|
+
*/
|
|
1287
|
+
interface LayerDescriptiveMetadata {
|
|
1288
|
+
title?: string;
|
|
1289
|
+
/** Free-text summary of the data (STAC `description`, ISO abstract). */
|
|
1290
|
+
abstract?: string;
|
|
1291
|
+
keywords?: string[];
|
|
1292
|
+
/** SPDX license identifier (e.g. `"CC-BY-4.0"`) or free text. */
|
|
1293
|
+
license?: string;
|
|
1294
|
+
/** Credit line for the data's producers. */
|
|
1295
|
+
attribution?: string;
|
|
1296
|
+
contact?: LayerMetadataContact;
|
|
1297
|
+
/** How the data was produced: sources and processing steps. */
|
|
1298
|
+
lineage?: string;
|
|
1299
|
+
temporalExtent?: LayerMetadataTemporalExtent;
|
|
1300
|
+
links?: LayerMetadataLink[];
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* How a popup renders one field's value (issue #2113). `"auto"` reproduces the
|
|
1304
|
+
* untyped rendering the Identify popup has always done — sanitized KML
|
|
1305
|
+
* `description` markup, an inline `data:image/*;base64` value as a thumbnail,
|
|
1306
|
+
* anything else stringified. The remaining kinds are explicit author choices
|
|
1307
|
+
* so a popup never has to guess from the value.
|
|
1308
|
+
*/
|
|
1309
|
+
type PopupFieldKind = "auto" | "text" | "number" | "date" | "link" | "image";
|
|
1310
|
+
/** How a `"date"` field's value is written out. */
|
|
1311
|
+
type PopupDateFormat = "date" | "datetime" | "time" | "iso" | "year";
|
|
1312
|
+
/** Value formatting for one popup field. Every part is optional. */
|
|
1313
|
+
interface PopupFieldFormat {
|
|
1314
|
+
/** Fixed number of decimals for a `"number"` field. */
|
|
1315
|
+
decimals?: number;
|
|
1316
|
+
/** Group thousands with the locale's separator (`"number"` fields). */
|
|
1317
|
+
thousands?: boolean;
|
|
1318
|
+
/** Date rendering for a `"date"` field; defaults to `"date"`. */
|
|
1319
|
+
dateFormat?: PopupDateFormat;
|
|
1320
|
+
/** Text placed before the formatted value. */
|
|
1321
|
+
prefix?: string;
|
|
1322
|
+
/** Text placed after the formatted value, e.g. a unit suffix. */
|
|
1323
|
+
suffix?: string;
|
|
1324
|
+
/** Link text for a `"link"` field; the value itself is used when unset. */
|
|
1325
|
+
linkLabel?: string;
|
|
1326
|
+
}
|
|
1327
|
+
/** One field's entry in a layer's popup configuration. */
|
|
1328
|
+
interface PopupFieldConfig {
|
|
1329
|
+
/** Feature property key. */
|
|
1330
|
+
field: string;
|
|
1331
|
+
/** Display label shown instead of the raw field name. */
|
|
1332
|
+
label?: string;
|
|
1333
|
+
/** How the value renders; defaults to `"auto"`. */
|
|
1334
|
+
kind?: PopupFieldKind;
|
|
1335
|
+
format?: PopupFieldFormat;
|
|
1336
|
+
/** Include this field in the hover tooltip's short subset. */
|
|
1337
|
+
hover?: boolean;
|
|
1338
|
+
}
|
|
1339
|
+
/**
|
|
1340
|
+
* Per-layer configuration for what a viewer sees when they interact with a
|
|
1341
|
+
* feature (issue #2113): which fields the Identify popup shows, in what order,
|
|
1342
|
+
* under what labels and formatting, plus an optional hover tooltip.
|
|
1343
|
+
*
|
|
1344
|
+
* A layer with no `popup` block behaves exactly as it did before this existed:
|
|
1345
|
+
* the layer name as the heading, then every property as a key/value row.
|
|
1346
|
+
* {@link GeoLibreLayer.fieldVisibility} stays authoritative — a `"hidden"` or
|
|
1347
|
+
* `"excluded"` field is dropped even when a popup config names it.
|
|
1348
|
+
*/
|
|
1349
|
+
interface LayerPopupConfig {
|
|
1350
|
+
/** `false` suppresses the Identify popup for this layer. Defaults to `true`. */
|
|
1351
|
+
click?: boolean;
|
|
1352
|
+
/** `true` shows a hover tooltip built from the `hover` fields. Defaults to `false`. */
|
|
1353
|
+
hover?: boolean;
|
|
1354
|
+
/** Field whose value titles the popup instead of the layer name. */
|
|
1355
|
+
titleField?: string;
|
|
1356
|
+
/**
|
|
1357
|
+
* MapLibre expression source producing the popup title. Wins over
|
|
1358
|
+
* {@link titleField}; when it fails or produces nothing the title falls
|
|
1359
|
+
* through to `titleField`, and only then to the layer name.
|
|
1360
|
+
*/
|
|
1361
|
+
titleExpression?: string;
|
|
1362
|
+
/**
|
|
1363
|
+
* MapLibre expression source producing the whole popup body as text, for
|
|
1364
|
+
* authors who want a sentence rather than a table. When it evaluates, it
|
|
1365
|
+
* replaces the field rows.
|
|
1366
|
+
*/
|
|
1367
|
+
bodyExpression?: string;
|
|
1368
|
+
/** `false` drops the synthetic `id` row. Defaults to `true`. */
|
|
1369
|
+
showFeatureId?: boolean;
|
|
1370
|
+
/**
|
|
1371
|
+
* Widest the click popup may grow, in CSS pixels. Unset keeps the default
|
|
1372
|
+
* (520px, or 420px for a popup carrying an image). Clamped to the range
|
|
1373
|
+
* `resolvePopupMaxWidth` enforces and always capped by the viewport, so a
|
|
1374
|
+
* value wider than the window still leaves the map usable.
|
|
1375
|
+
*/
|
|
1376
|
+
maxWidth?: number;
|
|
1377
|
+
/**
|
|
1378
|
+
* Tallest an `"image"` field's thumbnail may draw inside the popup, in CSS
|
|
1379
|
+
* pixels. Unset keeps the default (`min(50vh, 420px)`). Clamped by
|
|
1380
|
+
* `resolvePopupImageHeight`. Pair it with {@link maxWidth} for a
|
|
1381
|
+
* bigger picture: the thumbnail keeps its aspect ratio, so widening the
|
|
1382
|
+
* popup is what lets a landscape photo use the extra height.
|
|
1383
|
+
*/
|
|
1384
|
+
imageHeight?: number;
|
|
1385
|
+
/**
|
|
1386
|
+
* The fields to show and their order. An empty or absent list keeps today's
|
|
1387
|
+
* behavior: every visible property, in the feature's own key order.
|
|
1388
|
+
*/
|
|
1389
|
+
fields?: PopupFieldConfig[];
|
|
1390
|
+
}
|
|
1391
|
+
/**
|
|
1392
|
+
* A virtual field attached to a vector layer (QGIS Field Calculator → "Create
|
|
1393
|
+
* virtual field", issue #1321): a column defined by a MapLibre expression that
|
|
1394
|
+
* recomputes live instead of being written once as static values. The engine
|
|
1395
|
+
* (`virtual-fields.ts`) materializes the computed values into the layer's
|
|
1396
|
+
* feature properties — so the attribute table, Expression Builder,
|
|
1397
|
+
* data-driven styling, labels, and selection all see the column with no
|
|
1398
|
+
* further wiring — and re-derives them whenever the layer's data (or its
|
|
1399
|
+
* joins) change. Definitions persist in `.geolibre.json` and re-resolve on
|
|
1400
|
+
* project load; the expression is a declarative MapLibre expression (never
|
|
1401
|
+
* arbitrary code), so re-evaluating it from a shared project file is safe.
|
|
1402
|
+
*/
|
|
1403
|
+
interface LayerVirtualField {
|
|
1404
|
+
/** Stable id for list edits. */
|
|
1405
|
+
id: string;
|
|
1406
|
+
/** The output column name. A name already taken by a base column is skipped. */
|
|
1407
|
+
name: string;
|
|
1408
|
+
/**
|
|
1409
|
+
* MapLibre expression source (JSON text, e.g. `["/", ["get", "pop"],
|
|
1410
|
+
* ["get", "area_km2"]]`) evaluated against each feature.
|
|
1411
|
+
*/
|
|
1412
|
+
expression: string;
|
|
1413
|
+
/** `false` detaches the computed column without deleting the definition. */
|
|
1414
|
+
enabled?: boolean;
|
|
1415
|
+
/**
|
|
1416
|
+
* Bookkeeping written by the engine: the column name actually materialized
|
|
1417
|
+
* on the last apply, absent when the field was disabled, failed to compile,
|
|
1418
|
+
* or was skipped because the name collided with an existing column.
|
|
1419
|
+
* Applying virtual fields strips these first, which makes re-application
|
|
1420
|
+
* idempotent (an existing column is never shadowed, so stripping exactly
|
|
1421
|
+
* restores the pre-apply properties). Not user-editable.
|
|
1422
|
+
*/
|
|
1423
|
+
addedField?: string;
|
|
1424
|
+
/** Compile error from the last apply, when the expression failed to parse. */
|
|
1425
|
+
error?: string;
|
|
1426
|
+
/**
|
|
1427
|
+
* Features whose evaluation threw at runtime on the last apply (their cell
|
|
1428
|
+
* is null). Surfaced so the UI can warn without one bad feature aborting
|
|
1429
|
+
* the whole column.
|
|
1430
|
+
*/
|
|
1431
|
+
errorCount?: number;
|
|
1432
|
+
}
|
|
1433
|
+
/**
|
|
1434
|
+
* Quick filters (issue #2114): the data-driven filter controls a layer offers
|
|
1435
|
+
* in its Quick Filters section. What persists is the *control state* — field,
|
|
1436
|
+
* kind, chosen values — not the compiled output; `quick-filters.ts` compiles it
|
|
1437
|
+
* to a MapLibre filter at sync time so a saved filter can always be reopened
|
|
1438
|
+
* and edited.
|
|
1439
|
+
*/
|
|
1440
|
+
/** Which control a quick filter renders, and how it compiles. */
|
|
1441
|
+
type QuickFilterKind = "categorical" | "range" | "date" | "text";
|
|
1442
|
+
/** The comparison a `text` quick filter applies (always case-insensitive). */
|
|
1443
|
+
type QuickFilterTextOperator = "contains" | "startsWith" | "equals";
|
|
1444
|
+
/**
|
|
1445
|
+
* How a date field stores its values, deciding whether a `date` quick filter
|
|
1446
|
+
* compares ISO text or epoch numbers. `iso` covers both `YYYY-MM-DD` and full
|
|
1447
|
+
* `YYYY-MM-DDTHH:MM:SSZ` timestamps: only the leading `YYYY-MM-DD` slice is
|
|
1448
|
+
* compared, so a trailing time, a milliseconds fraction, or a `Z` cannot break
|
|
1449
|
+
* a boundary. Mirrors (deliberately, in a smaller form) the value kinds the
|
|
1450
|
+
* Time Slider's `detectValueKind` reports.
|
|
1451
|
+
*/
|
|
1452
|
+
type QuickFilterDateKind = "iso" | "epochMs" | "epochS";
|
|
1453
|
+
/** A single filter control persisted on a layer. */
|
|
1454
|
+
interface LayerQuickFilter {
|
|
1455
|
+
/** Stable id, used as the React key and for edits/removal. */
|
|
1456
|
+
id: string;
|
|
1457
|
+
/** The feature property this control narrows. */
|
|
1458
|
+
field: string;
|
|
1459
|
+
kind: QuickFilterKind;
|
|
1460
|
+
/**
|
|
1461
|
+
* `false` keeps the control configured but inert, so a filter can be muted
|
|
1462
|
+
* without losing the values chosen for it. Defaults to enabled.
|
|
1463
|
+
*/
|
|
1464
|
+
enabled?: boolean;
|
|
1465
|
+
/**
|
|
1466
|
+
* `categorical`: the chosen values. An empty (or omitted) selection means
|
|
1467
|
+
* "every value" and compiles to nothing — unchecking the last box clears the
|
|
1468
|
+
* filter rather than emptying the map.
|
|
1469
|
+
*/
|
|
1470
|
+
values?: (string | number | boolean)[];
|
|
1471
|
+
/** `range`: inclusive bounds. `null`/omitted leaves that side open. */
|
|
1472
|
+
min?: number | null;
|
|
1473
|
+
max?: number | null;
|
|
1474
|
+
/**
|
|
1475
|
+
* `date`: inclusive `YYYY-MM-DD` bounds. The end day is included in full, so
|
|
1476
|
+
* a timestamp field filtered to a single day keeps that whole day.
|
|
1477
|
+
*/
|
|
1478
|
+
start?: string | null;
|
|
1479
|
+
end?: string | null;
|
|
1480
|
+
/** `date`: how the field stores its values. Defaults to `iso`. */
|
|
1481
|
+
dateKind?: QuickFilterDateKind;
|
|
1482
|
+
/** `text`: the comparison. Defaults to `contains`. */
|
|
1483
|
+
operator?: QuickFilterTextOperator;
|
|
1484
|
+
/** `text`: the needle. Blank means no constraint. */
|
|
1485
|
+
text?: string;
|
|
1486
|
+
}
|
|
1487
|
+
/** Persisted refresh policy and most recent synchronization result for a layer. */
|
|
1488
|
+
interface LayerConnection {
|
|
1489
|
+
/** Owning layer id. Repeated here so records remain self-describing when exported. */
|
|
1490
|
+
layerId: string;
|
|
1491
|
+
/** Automatic refresh cadence in seconds, or null for manual synchronization only. */
|
|
1492
|
+
interval: number | null;
|
|
1493
|
+
/** ISO timestamp of the most recent successful synchronization. */
|
|
1494
|
+
lastSyncedAt: string | null;
|
|
1495
|
+
/** Most recent synchronization error. Cleared by a successful synchronization. */
|
|
1496
|
+
lastError: string | null;
|
|
1497
|
+
/** Whether a failed synchronization retains the last good data or clears it. */
|
|
1498
|
+
onFailure: "keep-last" | "clear";
|
|
1499
|
+
}
|
|
1500
|
+
/**
|
|
1501
|
+
* Configuration for automatic feature editor tracking (Issue #1677).
|
|
1502
|
+
* Maintains `created_by`, `created_at`, `edited_by`, `edited_at` fields
|
|
1503
|
+
* automatically when features are created or updated.
|
|
1504
|
+
*/
|
|
1505
|
+
interface EditorTrackingConfig {
|
|
1506
|
+
/** `true` enables automatic creation/edit timestamp and author stamping. */
|
|
1507
|
+
enabled: boolean;
|
|
1508
|
+
/** Field name for creation author (default `"created_by"`). */
|
|
1509
|
+
createdByField?: string;
|
|
1510
|
+
/** Field name for creation timestamp (default `"created_at"`). */
|
|
1511
|
+
createdAtField?: string;
|
|
1512
|
+
/** Field name for last-edit author (default `"edited_by"`). */
|
|
1513
|
+
editedByField?: string;
|
|
1514
|
+
/** Field name for last-edit timestamp (default `"edited_at"`). */
|
|
1515
|
+
editedAtField?: string;
|
|
1516
|
+
}
|
|
1517
|
+
/**
|
|
1518
|
+
* Visibility of a layer's attribute field.
|
|
1519
|
+
* - "hidden": Not shown in the attribute table, identify popup, tooltips, or field pickers, but remains in the data.
|
|
1520
|
+
* - "excluded": Removed entirely from the data when the project is shared or exported.
|
|
1521
|
+
*/
|
|
1522
|
+
type FieldVisibility = "hidden" | "excluded";
|
|
1523
|
+
/**
|
|
1524
|
+
* Explicit capability flags defining what actions a user/session may perform on a layer.
|
|
1525
|
+
* Any omitted capability falls back to the inferred default behavior for that layer's source.
|
|
1526
|
+
*/
|
|
1527
|
+
interface LayerCapabilities {
|
|
1528
|
+
/** Can the layer's features or attributes be queried / identified. */
|
|
1529
|
+
query?: boolean;
|
|
1530
|
+
/** Can new features be created/added to the layer. */
|
|
1531
|
+
create?: boolean;
|
|
1532
|
+
/** Can existing features/attributes be modified. */
|
|
1533
|
+
update?: boolean;
|
|
1534
|
+
/** Can features be deleted from the layer. */
|
|
1535
|
+
delete?: boolean;
|
|
1536
|
+
/** Can the layer data/symbology be exported/downloaded. */
|
|
1537
|
+
export?: boolean;
|
|
1538
|
+
}
|
|
1539
|
+
/**
|
|
1540
|
+
* Application privilege identifiers defining discrete capabilities in GeoLibre.
|
|
1541
|
+
*/
|
|
1542
|
+
type AppPrivilege = "layers:edit" | "layers:add-remote" | "layers:add-local" | "processing:run" | "processing:sidecar" | "project:save" | "project:share" | "project:share-public" | "plugins:install" | "assistant:use" | "connections:manage" | "export:data" | "export:image" | "settings:manage";
|
|
1543
|
+
/**
|
|
1544
|
+
* Standard named roles bundling application privileges.
|
|
1545
|
+
*/
|
|
1546
|
+
type AppRole = "viewer" | "editor" | "publisher" | "administrator" | "custom";
|
|
1547
|
+
/**
|
|
1548
|
+
* Ephemeral application capabilities state defining the active role, effective privileges,
|
|
1549
|
+
* and optional restriction reason for the current session/deployment.
|
|
1550
|
+
*/
|
|
1551
|
+
interface AppCapabilities {
|
|
1552
|
+
/**
|
|
1553
|
+
* The assigned application role. `custom` once an ad-hoc `grantAppPrivilege` /
|
|
1554
|
+
* `revokeAppPrivilege` has moved the set away from the bundle a named role
|
|
1555
|
+
* defines, so the role never claims a shape the privileges do not have.
|
|
1556
|
+
*/
|
|
1557
|
+
role: AppRole;
|
|
1558
|
+
/** List of granted privileges for the active role or custom configuration. */
|
|
1559
|
+
privileges: AppPrivilege[];
|
|
1560
|
+
/**
|
|
1561
|
+
* Optional human-readable reason covering the whole set (e.g. "Action disabled
|
|
1562
|
+
* by deployment policy"), used for any privilege without its own.
|
|
1563
|
+
*/
|
|
1564
|
+
reason?: string;
|
|
1565
|
+
/**
|
|
1566
|
+
* Per-privilege reasons, and why they exist: two privileges can be withheld by
|
|
1567
|
+
* different causes — a role bundle plus a licence limit, say — and a single
|
|
1568
|
+
* `reason` would make the second revocation relabel the first, so every gate
|
|
1569
|
+
* would explain itself with whichever cause happened to be recorded last.
|
|
1570
|
+
* Takes precedence over `reason` for the privileges it names.
|
|
1571
|
+
*/
|
|
1572
|
+
privilegeReasons?: Partial<Record<AppPrivilege, string>>;
|
|
1573
|
+
}
|
|
1574
|
+
interface GeoLibreLayer {
|
|
1575
|
+
id: string;
|
|
1576
|
+
name: string;
|
|
1577
|
+
type: LayerType;
|
|
1578
|
+
source: Record<string, unknown>;
|
|
1579
|
+
visible: boolean;
|
|
1580
|
+
opacity: number;
|
|
1581
|
+
style: LayerStyle;
|
|
1582
|
+
metadata: Record<string, unknown>;
|
|
1583
|
+
beforeId?: string;
|
|
1584
|
+
geojson?: FeatureCollection;
|
|
1585
|
+
/** A SQL Server write needs a successful table reread before it may be submitted again. */
|
|
1586
|
+
mssqlWritebackPending?: boolean;
|
|
1587
|
+
/**
|
|
1588
|
+
* Explicit capability set for the layer (query, create, update, delete, export).
|
|
1589
|
+
* Unset capabilities default to the inferred behavior for the layer's source kind.
|
|
1590
|
+
*/
|
|
1591
|
+
capabilities?: LayerCapabilities;
|
|
1592
|
+
/**
|
|
1593
|
+
* Automatic editor tracking configuration for feature creation/updates.
|
|
1594
|
+
*/
|
|
1595
|
+
editorTracking?: EditorTrackingConfig;
|
|
1596
|
+
/**
|
|
1597
|
+
* Field-level visibility overrides. Fields marked as "excluded" are physically
|
|
1598
|
+
* removed from the data during export and sharing.
|
|
1599
|
+
*/
|
|
1600
|
+
fieldVisibility?: Record<string, FieldVisibility>;
|
|
1601
|
+
/**
|
|
1602
|
+
* Per-field edit-widget, constraint, and visibility configuration authored
|
|
1603
|
+
* in the Attribute Form designer. Applied by the attribute editing surfaces
|
|
1604
|
+
* (attribute table inline editor, Field Collection capture form); persists
|
|
1605
|
+
* with the project like {@link joins}.
|
|
1606
|
+
*/
|
|
1607
|
+
attributeForm?: AttributeFormConfig;
|
|
1608
|
+
/**
|
|
1609
|
+
* Popup and hover-tooltip design for this layer, authored in the Style
|
|
1610
|
+
* panel's Popup section. Absent means the default full-property dump.
|
|
1611
|
+
*/
|
|
1612
|
+
popup?: LayerPopupConfig;
|
|
1613
|
+
/**
|
|
1614
|
+
* User-authored catalog metadata (title, abstract, keywords, license,
|
|
1615
|
+
* contact, lineage, temporal extent, links), edited in the layer's Metadata
|
|
1616
|
+
* dialog. Absent when nothing has been entered; an empty record is never
|
|
1617
|
+
* written to a project file.
|
|
1618
|
+
*/
|
|
1619
|
+
descriptiveMetadata?: LayerDescriptiveMetadata;
|
|
1620
|
+
/**
|
|
1621
|
+
* Persistent attribute joins applied to this layer's features, in order.
|
|
1622
|
+
* The joined columns are materialized into `geojson` feature properties (so
|
|
1623
|
+
* the attribute table, Expression Builder, styling, and labels all see them)
|
|
1624
|
+
* and re-derived whenever the layer's or a join table's data changes.
|
|
1625
|
+
*/
|
|
1626
|
+
joins?: LayerJoin[];
|
|
1627
|
+
/**
|
|
1628
|
+
* Expression-backed virtual fields computed for this layer's features, in
|
|
1629
|
+
* order. Applied after joins (so an expression can read joined columns) and
|
|
1630
|
+
* materialized into `geojson` feature properties; re-derived whenever the
|
|
1631
|
+
* layer's data changes. See {@link LayerVirtualField}.
|
|
1632
|
+
*/
|
|
1633
|
+
virtualFields?: LayerVirtualField[];
|
|
1634
|
+
/**
|
|
1635
|
+
* Transient MapLibre filter expression applied on top of every rendered
|
|
1636
|
+
* sub-layer's geometry filter. The Time Slider plugin sets this on a bound
|
|
1637
|
+
* vector layer so scrubbing the timeline narrows the visible features to the
|
|
1638
|
+
* current time window, while the layer's own styling and opacity stay
|
|
1639
|
+
* untouched. It is derived from the slider's current date, so it is NOT
|
|
1640
|
+
* persisted (stripped by `prepareLayerForSave`); the binding config lives in
|
|
1641
|
+
* `metadata.timeBinding` and the filter is recomputed live on the next
|
|
1642
|
+
* activation. `undefined` means no time filter is applied.
|
|
1643
|
+
*/
|
|
1644
|
+
timeFilter?: unknown[];
|
|
1645
|
+
/** Transient MapLibre expression applied by the iframe embed API. */
|
|
1646
|
+
embedFilter?: unknown[];
|
|
1647
|
+
/**
|
|
1648
|
+
* Project-persisted boolean MapLibre expression that narrows the features
|
|
1649
|
+
* rendered for this layer. Unlike a selection, this leaves the source data
|
|
1650
|
+
* intact and keeps non-matching features hidden until the filter is cleared.
|
|
1651
|
+
* It is composed with transient filters, quick filters, and rule visibility
|
|
1652
|
+
* by the map renderers.
|
|
1653
|
+
*/
|
|
1654
|
+
filterExpression?: unknown[];
|
|
1655
|
+
/**
|
|
1656
|
+
* Data-driven filter controls authored in the layer's Quick Filters section
|
|
1657
|
+
* (issue #2114). Unlike {@link timeFilter} and {@link embedFilter} this is
|
|
1658
|
+
* persisted control *state*, not a compiled expression: `@geolibre/map`
|
|
1659
|
+
* compiles it at sync time (see `compileQuickFilters`) and combines the
|
|
1660
|
+
* result with the transient filters and the rule-based visibility filter, so
|
|
1661
|
+
* a host page's filter and a user's filter narrow the layer together.
|
|
1662
|
+
*/
|
|
1663
|
+
quickFilters?: LayerQuickFilter[];
|
|
1664
|
+
sourcePath?: string;
|
|
1665
|
+
/**
|
|
1666
|
+
* Id of the {@link LayerGroup} this layer belongs to, or `undefined` when the
|
|
1667
|
+
* layer sits at the top level of the layer panel. Layers sharing a `groupId`
|
|
1668
|
+
* are kept contiguous in the store's flat `layers` array so the group renders
|
|
1669
|
+
* as one block; see `@geolibre/core`'s `layer-groups` helpers.
|
|
1670
|
+
*/
|
|
1671
|
+
groupId?: string;
|
|
1672
|
+
/**
|
|
1673
|
+
* Project-persisted connection policy for reloadable layers. Runtime timers
|
|
1674
|
+
* are reconstructed from this record when a project opens.
|
|
1675
|
+
*/
|
|
1676
|
+
connection?: LayerConnection;
|
|
1677
|
+
}
|
|
1678
|
+
/**
|
|
1679
|
+
* Options for {@link AppState.addTileLayer}: a native raster tile layer (XYZ,
|
|
1680
|
+
* WMS, or WMTS) that appears in the Layers panel and persists with the project,
|
|
1681
|
+
* just like a layer added through the Add Data dialog. Mirrors the raster
|
|
1682
|
+
* `source` fields MapLibre understands so an external plugin can register tile
|
|
1683
|
+
* layers without touching the map directly.
|
|
1684
|
+
*/
|
|
1685
|
+
interface AddTileLayerOptions {
|
|
1686
|
+
/**
|
|
1687
|
+
* One or more XYZ tile URL templates (with `{x}`/`{y}`/`{z}` placeholders).
|
|
1688
|
+
* At least one non-empty template is required, or the layer renders nothing.
|
|
1689
|
+
*/
|
|
1690
|
+
tiles: string[];
|
|
1691
|
+
/**
|
|
1692
|
+
* Layer discriminator, controlling how the layer is labelled and (for WMS)
|
|
1693
|
+
* dev-server proxied. Defaults to `"xyz"`. The layer's `source.type` is
|
|
1694
|
+
* always `"raster"`, so any other value (such as `"vector-tiles"` from an
|
|
1695
|
+
* untyped JS caller) throws rather than persisting a mislabelled source.
|
|
1696
|
+
*/
|
|
1697
|
+
type?: "xyz" | "wms" | "wmts" | "raster";
|
|
1698
|
+
/** Service or base URL recorded on the source for display and restore. */
|
|
1699
|
+
url?: string;
|
|
1700
|
+
/** Tile size in pixels (default 256). */
|
|
1701
|
+
tileSize?: number;
|
|
1702
|
+
/** Attribution string shown in the map's attribution control. */
|
|
1703
|
+
attribution?: string;
|
|
1704
|
+
/** Visible extent as `[west, south, east, north]` in WGS84 degrees. */
|
|
1705
|
+
bounds?: [number, number, number, number];
|
|
1706
|
+
/** Minimum zoom at which tiles are requested. */
|
|
1707
|
+
minzoom?: number;
|
|
1708
|
+
/** Maximum zoom at which tiles are requested. */
|
|
1709
|
+
maxzoom?: number;
|
|
1710
|
+
/** Tile y-axis scheme; `"tms"` flips the y origin. Defaults to `"xyz"`. */
|
|
1711
|
+
scheme?: "xyz" | "tms";
|
|
1712
|
+
/** Initial visibility (default true). */
|
|
1713
|
+
visible?: boolean;
|
|
1714
|
+
/** Initial opacity in [0, 1] (default 1). */
|
|
1715
|
+
opacity?: number;
|
|
1716
|
+
/**
|
|
1717
|
+
* Extra source fields merged onto the layer's `source` (e.g. the WMS
|
|
1718
|
+
* `layers`/`styles`/`format` recorded for restore). The required `type`,
|
|
1719
|
+
* `tiles`, and `tileSize` always win over keys supplied here.
|
|
1720
|
+
*/
|
|
1721
|
+
source?: Record<string, unknown>;
|
|
1722
|
+
/** Extra metadata merged onto the layer record. */
|
|
1723
|
+
metadata?: Record<string, unknown>;
|
|
1724
|
+
}
|
|
1725
|
+
/**
|
|
1726
|
+
* A named, collapsible folder in the layer panel that organizes a contiguous
|
|
1727
|
+
* run of layers. Groups may be nested by referencing another group as their
|
|
1728
|
+
* parent; the root groups omit `parentId`.
|
|
1729
|
+
*
|
|
1730
|
+
* The group's `visible` flag and `opacity` multiplier are folded into each
|
|
1731
|
+
* child layer's effective render state by `applyGroupEffects` before the map
|
|
1732
|
+
* syncs, so children keep their own stored `visible`/`opacity` values.
|
|
1733
|
+
*/
|
|
1734
|
+
interface LayerGroup {
|
|
1735
|
+
id: string;
|
|
1736
|
+
name: string;
|
|
1737
|
+
/** Parent folder id, or undefined when this folder is at the panel root. */
|
|
1738
|
+
parentId?: string;
|
|
1739
|
+
/** When true, the group's children are hidden in the panel (not on the map). */
|
|
1740
|
+
collapsed: boolean;
|
|
1741
|
+
/** Group-level visibility; ANDed with each child layer's own visibility. */
|
|
1742
|
+
visible: boolean;
|
|
1743
|
+
/** Group-level opacity in [0, 1]; multiplied into each child's opacity. */
|
|
1744
|
+
opacity: number;
|
|
1745
|
+
}
|
|
1746
|
+
/**
|
|
1747
|
+
* Metadata `sourceKind` marking a live SQL query layer: a GeoJSON-backed layer
|
|
1748
|
+
* created from a SQL Workspace result whose DuckDB statement is stored on the
|
|
1749
|
+
* layer metadata and re-executed on refresh. Defined here so the desktop app
|
|
1750
|
+
* (which owns the query/refresh logic) and `@geolibre/plugins` (which excludes
|
|
1751
|
+
* these layers from in-place geometry editing) share one value.
|
|
1752
|
+
*/
|
|
1753
|
+
declare const SQL_QUERY_SOURCE_KIND = "sql-query";
|
|
1754
|
+
/**
|
|
1755
|
+
* Metadata `sourceKind` marking a NetCDF/HDF grid baked into an `image` overlay,
|
|
1756
|
+
* as opposed to the KML ground overlays that otherwise use that layer type.
|
|
1757
|
+
*
|
|
1758
|
+
* Defined here so `@geolibre/map` (which must not run its feature-query identify
|
|
1759
|
+
* on these) and the desktop app (which owns the symbology panel, the pixel
|
|
1760
|
+
* readout, and the spectral profile) share one value.
|
|
1761
|
+
*/
|
|
1762
|
+
declare const NETCDF_IMAGE_SOURCE_KIND = "netcdf-image";
|
|
1763
|
+
/**
|
|
1764
|
+
* Detect a DuckDB query layer rendered through the plugin's external deck.gl
|
|
1765
|
+
* overlay. Shared by `@geolibre/map`, `@geolibre/plugins`, and the desktop
|
|
1766
|
+
* app so the detection criteria cannot drift.
|
|
1767
|
+
*/
|
|
1768
|
+
declare function isDuckDBQueryLayer(layer: Pick<GeoLibreLayer, "metadata" | "type"> | undefined): boolean;
|
|
1769
|
+
interface MapViewState {
|
|
1770
|
+
center: [number, number];
|
|
1771
|
+
zoom: number;
|
|
1772
|
+
bearing: number;
|
|
1773
|
+
pitch: number;
|
|
1774
|
+
bbox?: [number, number, number, number];
|
|
1775
|
+
}
|
|
1776
|
+
/**
|
|
1777
|
+
* Multi-map (split/grid) support. The workspace can show several map panes in a
|
|
1778
|
+
* `rows x cols` grid. Pane 0 is always the *primary* map: it keeps the existing
|
|
1779
|
+
* single-map wiring (the global `mapView` + `basemap*` fields, the layer/style
|
|
1780
|
+
* panels, plugins, deck.gl). Panes 1..N are *secondary* maps described by
|
|
1781
|
+
* `SecondaryMapView` records: every pane shares the same basemap and the same
|
|
1782
|
+
* `layers`, but each secondary pane may override which layers are visible so
|
|
1783
|
+
* different panes can show different layers. When `syncView` is on,
|
|
1784
|
+
* panning/zooming any pane mirrors the camera to every other pane.
|
|
1785
|
+
*/
|
|
1786
|
+
interface MapGridLayout {
|
|
1787
|
+
/** Grid rows (>= 1). */
|
|
1788
|
+
rows: number;
|
|
1789
|
+
/** Grid columns (>= 1). `rows * cols` is the total number of panes. */
|
|
1790
|
+
cols: number;
|
|
1791
|
+
/** When true, all panes share a synchronized camera. */
|
|
1792
|
+
syncView: boolean;
|
|
1793
|
+
}
|
|
1794
|
+
/**
|
|
1795
|
+
* Which engine draws a map pane.
|
|
1796
|
+
*
|
|
1797
|
+
* `"maplibre"` is the 2D MapLibre GL map that owns the app's plugin, styling,
|
|
1798
|
+
* and deck.gl integrations. `"cesium"` is the 3D globe (see `CesiumCanvas`),
|
|
1799
|
+
* which renders the same shared store state — camera, basemap, layers, group
|
|
1800
|
+
* effects — through CesiumJS. `"mapbox"` is Mapbox GL JS and `"arcgis"` the
|
|
1801
|
+
* ArcGIS Maps SDK for JavaScript, loaded from Esri's CDN at runtime (see
|
|
1802
|
+
* `ArcgisCanvas`); both draw the same store state through their own engines.
|
|
1803
|
+
*
|
|
1804
|
+
* Used both for secondary panes ({@link SecondaryMapView.viewKind}) and for the
|
|
1805
|
+
* primary workspace ({@link GeoLibreProject.primaryRenderer}), so the two never
|
|
1806
|
+
* drift apart.
|
|
1807
|
+
*/
|
|
1808
|
+
type MapRendererKind = "maplibre" | "cesium" | "mapbox" | "arcgis";
|
|
1809
|
+
/**
|
|
1810
|
+
* The engine that draws the primary map area when a project says nothing. The
|
|
1811
|
+
* 2D map: it is the renderer every tool, plugin, and panel is wired to, so an
|
|
1812
|
+
* existing project (and a new one) opens exactly as it always did.
|
|
1813
|
+
*/
|
|
1814
|
+
declare const DEFAULT_PRIMARY_RENDERER: MapRendererKind;
|
|
1815
|
+
/**
|
|
1816
|
+
* A non-primary map pane: shares the primary map's basemap and layers, with its
|
|
1817
|
+
* own camera and per-layer visibility overrides.
|
|
1818
|
+
*/
|
|
1819
|
+
interface SecondaryMapView {
|
|
1820
|
+
/** Stable id, used as the React key and the sync-group registration id. */
|
|
1821
|
+
id: string;
|
|
1822
|
+
view: MapViewState;
|
|
1823
|
+
/** Optional user-entered label shown on the pane (e.g. a date or scenario). */
|
|
1824
|
+
label?: string;
|
|
1825
|
+
/**
|
|
1826
|
+
* Which rendering engine draws this pane. Defaults to `"maplibre"` (the 2D
|
|
1827
|
+
* map) when absent, so existing projects and panes are unchanged. `"cesium"`
|
|
1828
|
+
* renders a 3D globe (see {@link CesiumCanvas}) over the same shared layers.
|
|
1829
|
+
*/
|
|
1830
|
+
viewKind?: MapRendererKind;
|
|
1831
|
+
/**
|
|
1832
|
+
* Per-layer visibility overrides keyed by layer id. A layer absent from this
|
|
1833
|
+
* map inherits the primary map's visibility (`layer.visible`); an entry forces
|
|
1834
|
+
* the layer visible (`true`) or hidden (`false`) in this pane only.
|
|
1835
|
+
*/
|
|
1836
|
+
layerVisibility: Record<string, boolean>;
|
|
1837
|
+
}
|
|
1838
|
+
/** The default single-map grid (one pane, sync enabled so it turns on cleanly). */
|
|
1839
|
+
declare const DEFAULT_MAP_GRID_LAYOUT: MapGridLayout;
|
|
1840
|
+
/** Maximum rows or columns in the map grid (so at most a 4x4 = 16-pane grid). */
|
|
1841
|
+
declare const MAX_MAP_GRID_DIM = 4;
|
|
1842
|
+
/**
|
|
1843
|
+
* Live multi-user collaboration (issue #307). These types describe the
|
|
1844
|
+
* *ephemeral* session state the store holds while a live session is active. It
|
|
1845
|
+
* is intentionally never written to the `.geolibre.json` project file (the
|
|
1846
|
+
* `project.ts` serializers never read it) and never tracked in undo history (the
|
|
1847
|
+
* store's `partialize` never lists it), so it resets cleanly on reload.
|
|
1848
|
+
*/
|
|
1849
|
+
type CollaborationRole = "host" | "guest";
|
|
1850
|
+
/** Whether guests may edit (`co-edit`) or only watch (`view-only`). */
|
|
1851
|
+
type CollaborationMode = "view-only" | "co-edit";
|
|
1852
|
+
interface ParticipantIdentity {
|
|
1853
|
+
provider: string;
|
|
1854
|
+
userId: string;
|
|
1855
|
+
username: string;
|
|
1856
|
+
}
|
|
1857
|
+
interface CollabInvite {
|
|
1858
|
+
token: string;
|
|
1859
|
+
role: CollaborationMode;
|
|
1860
|
+
createdAt: number;
|
|
1861
|
+
maxUses?: number;
|
|
1862
|
+
useCount: number;
|
|
1863
|
+
revoked: boolean;
|
|
1864
|
+
}
|
|
1865
|
+
interface CollaborationParticipant {
|
|
1866
|
+
clientId: string;
|
|
1867
|
+
displayName: string;
|
|
1868
|
+
color: string;
|
|
1869
|
+
role: CollaborationRole;
|
|
1870
|
+
/**
|
|
1871
|
+
* Host-set per-participant edit override (#754). `null` follows the session
|
|
1872
|
+
* `mode`; `true`/`false` pins this participant to can-edit / view-only. Always
|
|
1873
|
+
* `null` for the host (the host can always edit).
|
|
1874
|
+
*/
|
|
1875
|
+
editOverride: boolean | null;
|
|
1876
|
+
/** Optional account identity when signed-in identity binding is enabled. */
|
|
1877
|
+
identity?: ParticipantIdentity | null;
|
|
1878
|
+
}
|
|
1879
|
+
/** A remote participant's live cursor + viewport, used to render presence. */
|
|
1880
|
+
interface CollaborationPresence {
|
|
1881
|
+
displayName: string;
|
|
1882
|
+
color: string;
|
|
1883
|
+
cursor?: {
|
|
1884
|
+
lng: number;
|
|
1885
|
+
lat: number;
|
|
1886
|
+
} | null;
|
|
1887
|
+
view?: MapViewState | null;
|
|
1888
|
+
}
|
|
1889
|
+
/** One in-session chat message (#754). Ephemeral; never persisted to a project. */
|
|
1890
|
+
interface CollaborationChatMessage {
|
|
1891
|
+
/** Server-assigned id (stable React key / dedupe). */
|
|
1892
|
+
id: string;
|
|
1893
|
+
/** clientId of the author. */
|
|
1894
|
+
clientId: string;
|
|
1895
|
+
displayName: string;
|
|
1896
|
+
color: string;
|
|
1897
|
+
text: string;
|
|
1898
|
+
/** Optional map coordinate the author attached; clickable to recenter. */
|
|
1899
|
+
coordinate?: {
|
|
1900
|
+
lng: number;
|
|
1901
|
+
lat: number;
|
|
1902
|
+
} | null;
|
|
1903
|
+
/** Server-assigned epoch-ms timestamp. */
|
|
1904
|
+
ts: number;
|
|
1905
|
+
}
|
|
1906
|
+
interface CollaborationState {
|
|
1907
|
+
/** True once connected and joined to a session. */
|
|
1908
|
+
isActive: boolean;
|
|
1909
|
+
/** True while connecting/reconnecting (UI shows a spinner). */
|
|
1910
|
+
connecting: boolean;
|
|
1911
|
+
sessionId: string | null;
|
|
1912
|
+
clientId: string | null;
|
|
1913
|
+
role: CollaborationRole | null;
|
|
1914
|
+
mode: CollaborationMode;
|
|
1915
|
+
selfName: string;
|
|
1916
|
+
selfColor: string;
|
|
1917
|
+
participants: CollaborationParticipant[];
|
|
1918
|
+
/** Remote presence keyed by participant clientId (never includes self). */
|
|
1919
|
+
presence: Record<string, CollaborationPresence>;
|
|
1920
|
+
/** When true, this participant's camera follows the host's viewport. */
|
|
1921
|
+
followHost: boolean;
|
|
1922
|
+
/** Recent session chat, oldest first, capped to a bounded window (#754). */
|
|
1923
|
+
chat: CollaborationChatMessage[];
|
|
1924
|
+
/** Session flag requiring participants to be signed in. */
|
|
1925
|
+
requireIdentity: boolean;
|
|
1926
|
+
/**
|
|
1927
|
+
* Whether the connected relay has an identity issuer configured. False (the
|
|
1928
|
+
* default) means it cannot verify a sign-in, so the host UI hides the
|
|
1929
|
+
* "require a signed-in account" toggle instead of offering a gate that would
|
|
1930
|
+
* lock every guest out.
|
|
1931
|
+
*/
|
|
1932
|
+
identitySupported: boolean;
|
|
1933
|
+
/** Layer IDs marked locked by the host. */
|
|
1934
|
+
lockedLayerIds: string[];
|
|
1935
|
+
/** Active session invites minted by host. */
|
|
1936
|
+
invites: CollabInvite[];
|
|
1937
|
+
/** Last human-readable error, surfaced in the Collaborate dialog. */
|
|
1938
|
+
error: string | null;
|
|
1939
|
+
}
|
|
1940
|
+
/** Map projection the renderer uses. Mirrors the GlobeControl toggle. */
|
|
1941
|
+
type MapProjection = "globe" | "mercator";
|
|
1942
|
+
/**
|
|
1943
|
+
* Unit system the scale bar reports distances in. `"metric"` uses m/km,
|
|
1944
|
+
* `"imperial"` uses ft/mi, and `"nautical"` uses nautical miles.
|
|
1945
|
+
*/
|
|
1946
|
+
type MapScaleUnit = "metric" | "imperial" | "nautical";
|
|
1947
|
+
interface MapPreferences {
|
|
1948
|
+
restrictBounds: boolean;
|
|
1949
|
+
bounds: [number, number, number, number];
|
|
1950
|
+
minZoom: number;
|
|
1951
|
+
maxZoom: number;
|
|
1952
|
+
maxPitch: number;
|
|
1953
|
+
renderWorldCopies: boolean;
|
|
1954
|
+
projection: MapProjection;
|
|
1955
|
+
/**
|
|
1956
|
+
* Celestial body / ellipsoid the project's coordinates describe (keys into the
|
|
1957
|
+
* ellipsoid registry in `@geolibre/core`). Drives measurement radii and pairs
|
|
1958
|
+
* with planetary basemaps. Defaults to `"earth"` (WGS 84).
|
|
1959
|
+
*/
|
|
1960
|
+
ellipsoidId: string;
|
|
1961
|
+
/**
|
|
1962
|
+
* Unit system the scale bar displays. Defaults to `"metric"`; switch to
|
|
1963
|
+
* `"imperial"` for feet/miles or `"nautical"` for nautical miles.
|
|
1964
|
+
*/
|
|
1965
|
+
scaleUnit: MapScaleUnit;
|
|
1966
|
+
/**
|
|
1967
|
+
* Whether the status bar resolves and shows the ground elevation under the
|
|
1968
|
+
* pointer (issue #1813). **Defaults to `false`**: with 3D terrain off the
|
|
1969
|
+
* lookup falls back to the public Open-Meteo service, so hovering would send
|
|
1970
|
+
* coordinates off the device for a readout the user never asked for. Toggled
|
|
1971
|
+
* from Controls -> Elevation.
|
|
1972
|
+
*/
|
|
1973
|
+
showPointerElevation: boolean;
|
|
1974
|
+
/** Whether the built-in 3D terrain control and terrain surface are enabled. */
|
|
1975
|
+
terrainEnabled: boolean;
|
|
1976
|
+
/** Mapbox-only style. New projects use Streets; absent follows the shared basemap. */
|
|
1977
|
+
mapboxStyleUrl?: string;
|
|
1978
|
+
/**
|
|
1979
|
+
* ArcGIS-only basemap: an Esri basemap style id (`arcgis/streets`,
|
|
1980
|
+
* `arcgis/imagery`, `osm/standard`, ...). New projects use Streets. Absent
|
|
1981
|
+
* follows the shared basemap, translated to tiles the SDK can draw; the id
|
|
1982
|
+
* is also set aside when no ArcGIS API key is configured, since Esri's
|
|
1983
|
+
* basemap styles service requires one.
|
|
1984
|
+
*/
|
|
1985
|
+
arcgisBasemap?: string;
|
|
1986
|
+
/** Cesium imagery override; absent follows the shared project basemap. */
|
|
1987
|
+
cesiumBasemap?: CesiumBasemapId;
|
|
1988
|
+
/**
|
|
1989
|
+
* Notation the status bar reports the pointer coordinate in: `"dd"` decimal
|
|
1990
|
+
* degrees (default), `"dms"` degrees/minutes/seconds, `"ddm"` degrees and
|
|
1991
|
+
* decimal minutes, `"utm"` zone easting/northing, `"mgrs"`/`"usng"` grid
|
|
1992
|
+
* references, or `"epsg"` x/y in the CRS named by `coordinateEpsgCode`.
|
|
1993
|
+
* Stored as a string rather than a union so `@geolibre/core` does not have to
|
|
1994
|
+
* depend on the formatter, which lives with the app's DMS helpers and the
|
|
1995
|
+
* Gridlines plugin's UTM projection; the app normalises unknown values to
|
|
1996
|
+
* `"dd"`.
|
|
1997
|
+
*/
|
|
1998
|
+
coordinateFormat: string;
|
|
1999
|
+
/**
|
|
2000
|
+
* EPSG code the `"epsg"` coordinate format projects the pointer into, e.g.
|
|
2001
|
+
* `3857` or `32618`. Kept beside `coordinateFormat` rather than inside it so
|
|
2002
|
+
* the code survives cycling through the other notations. Absent means the
|
|
2003
|
+
* app default (EPSG:3857).
|
|
2004
|
+
*/
|
|
2005
|
+
coordinateEpsgCode?: number;
|
|
2006
|
+
/**
|
|
2007
|
+
* Whether the map fits to a layer's extent after data is added (Add Data
|
|
2008
|
+
* menus, drag-and-drop, file import, tool outputs). Defaults to `true`; turn
|
|
2009
|
+
* it off to keep the current view. Explicit "Zoom to layer" actions always
|
|
2010
|
+
* fit regardless of this setting.
|
|
2011
|
+
*/
|
|
2012
|
+
zoomToNewLayers: boolean;
|
|
2013
|
+
}
|
|
2014
|
+
interface RuntimeEnvironmentVariable {
|
|
2015
|
+
key: string;
|
|
2016
|
+
value: string;
|
|
2017
|
+
enabled: boolean;
|
|
2018
|
+
/**
|
|
2019
|
+
* Absent or `true`: the value is a secret (desktop keeps it in the OS
|
|
2020
|
+
* keychain; every egress removes it). `false`: an ordinary value saved in the
|
|
2021
|
+
* project and kept on share/export.
|
|
2022
|
+
*/
|
|
2023
|
+
secret?: boolean;
|
|
2024
|
+
}
|
|
2025
|
+
declare global {
|
|
2026
|
+
interface Window {
|
|
2027
|
+
__GEOLIBRE_RUNTIME_ENV__?: Record<string, string>;
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
/**
|
|
2031
|
+
* Geocoding backend selection persisted in the project. The provider id keys
|
|
2032
|
+
* into the geocoding registry in `@geolibre/core`; API keys are stored per
|
|
2033
|
+
* provider so switching backends does not discard the others' keys. Empty
|
|
2034
|
+
* endpoint overrides fall back to the provider's default endpoints.
|
|
2035
|
+
*/
|
|
2036
|
+
interface GeocodingPreferences {
|
|
2037
|
+
providerId: string;
|
|
2038
|
+
/** Per-provider API key / access token, keyed by provider id. */
|
|
2039
|
+
apiKeys: Record<string, string>;
|
|
2040
|
+
/** Optional custom forward endpoint (else the provider default). */
|
|
2041
|
+
forwardEndpoint?: string;
|
|
2042
|
+
/** Optional custom reverse endpoint (else the provider default). */
|
|
2043
|
+
reverseEndpoint?: string;
|
|
2044
|
+
/** Contact email sent to identify the client (used by Nominatim). */
|
|
2045
|
+
email?: string;
|
|
2046
|
+
}
|
|
2047
|
+
interface ProjectPreferences {
|
|
2048
|
+
map: MapPreferences;
|
|
2049
|
+
environmentVariables: RuntimeEnvironmentVariable[];
|
|
2050
|
+
geocoding: GeocodingPreferences;
|
|
2051
|
+
}
|
|
2052
|
+
type ProjectPluginControlPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
2053
|
+
interface ProjectPluginState {
|
|
2054
|
+
manifestUrls: string[];
|
|
2055
|
+
activePluginIds: string[];
|
|
2056
|
+
mapControlPositions: Record<string, ProjectPluginControlPosition>;
|
|
2057
|
+
settings: Record<string, unknown>;
|
|
2058
|
+
}
|
|
2059
|
+
declare const DEFAULT_PROJECT_PREFERENCES: ProjectPreferences;
|
|
2060
|
+
/**
|
|
2061
|
+
* A single user override for one legend item, keyed in {@link LegendConfig.overrides}
|
|
2062
|
+
* by a stable item key (a layer id for a whole entry, or `${layerId}::${index}`
|
|
2063
|
+
* for an individual class within a graduated/categorized entry).
|
|
2064
|
+
*/
|
|
2065
|
+
interface LegendItemOverride {
|
|
2066
|
+
/** User-supplied label that replaces the auto-generated one. */
|
|
2067
|
+
label?: string;
|
|
2068
|
+
/** When true, the item is omitted from the rendered legend. */
|
|
2069
|
+
hidden?: boolean;
|
|
2070
|
+
}
|
|
2071
|
+
/** Swatch shape for a hand-authored legend item. */
|
|
2072
|
+
type LegendCustomShape = "square" | "circle" | "line";
|
|
2073
|
+
/** One hand-authored legend item: a color swatch plus its label. */
|
|
2074
|
+
interface LegendCustomItem {
|
|
2075
|
+
/** Display label (e.g. an NLCD class name). */
|
|
2076
|
+
label: string;
|
|
2077
|
+
/** Swatch color as a CSS color (typically `#rrggbb`). */
|
|
2078
|
+
color: string;
|
|
2079
|
+
/** Swatch shape; defaults to `"square"`. */
|
|
2080
|
+
shape?: LegendCustomShape;
|
|
2081
|
+
/**
|
|
2082
|
+
* Symbol size in map pixels (circle radius / line width). Carried so that
|
|
2083
|
+
* customizing a proportional-symbol entry keeps the graduated sizes it was
|
|
2084
|
+
* seeded from instead of flattening every symbol to one size.
|
|
2085
|
+
*/
|
|
2086
|
+
size?: number;
|
|
2087
|
+
}
|
|
2088
|
+
/**
|
|
2089
|
+
* A hand-authored legend entry. Keyed by layer id it REPLACES that layer's
|
|
2090
|
+
* auto-derived classes (the fallback when automatic derivation is wrong or
|
|
2091
|
+
* impossible, e.g. a paletted land-cover raster like NLCD); keyed by a
|
|
2092
|
+
* `custom:` id it renders as a standalone section not tied to any layer.
|
|
2093
|
+
*/
|
|
2094
|
+
interface LegendCustomEntry {
|
|
2095
|
+
/** Optional heading; a layer-keyed entry falls back to the layer name. */
|
|
2096
|
+
title?: string;
|
|
2097
|
+
/** The items to render, top to bottom. */
|
|
2098
|
+
items: LegendCustomItem[];
|
|
2099
|
+
}
|
|
2100
|
+
/** Map corner the on-map legend panel docks to. */
|
|
2101
|
+
type LegendPanelPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
2102
|
+
/**
|
|
2103
|
+
* User customizations for the legend (the on-map Legend panel and the Print
|
|
2104
|
+
* Layout legend). The legend itself is always derived from the visible layers'
|
|
2105
|
+
* symbology; this record only stores the edits layered on top (title, ordering,
|
|
2106
|
+
* per-item rename/hide, hand-authored entries), so it survives layer additions
|
|
2107
|
+
* and removals and is persisted in the `.geolibre.json` project.
|
|
2108
|
+
*/
|
|
2109
|
+
interface LegendConfig {
|
|
2110
|
+
/** Heading drawn above the legend entries. */
|
|
2111
|
+
title: string;
|
|
2112
|
+
/** When true, classes are grouped under a per-layer heading. */
|
|
2113
|
+
groupByLayer: boolean;
|
|
2114
|
+
/**
|
|
2115
|
+
* Custom top-level entry order by layer id, top-first. Layer ids not listed
|
|
2116
|
+
* keep their default order after the listed ones.
|
|
2117
|
+
*/
|
|
2118
|
+
order: string[];
|
|
2119
|
+
/** Per-item overrides keyed by stable item key. */
|
|
2120
|
+
overrides: Record<string, LegendItemOverride>;
|
|
2121
|
+
/**
|
|
2122
|
+
* Hand-authored entries keyed by layer id (replacing that layer's
|
|
2123
|
+
* auto-derived classes) or by a standalone `custom:` id. See
|
|
2124
|
+
* {@link LegendCustomEntry}.
|
|
2125
|
+
*/
|
|
2126
|
+
customEntries?: Record<string, LegendCustomEntry>;
|
|
2127
|
+
/** Whether the on-map Legend panel is open (persisted with the project). */
|
|
2128
|
+
panelVisible?: boolean;
|
|
2129
|
+
/** Whether the open panel is collapsed to just its header bar. */
|
|
2130
|
+
panelCollapsed?: boolean;
|
|
2131
|
+
/** Map corner the on-map Legend panel docks to; defaults to `"top-left"`. */
|
|
2132
|
+
panelPosition?: LegendPanelPosition;
|
|
2133
|
+
/**
|
|
2134
|
+
* User-resized panel width in px (via the corner drag handles). Absent means
|
|
2135
|
+
* the default width; height absent means auto-fit to content within the map.
|
|
2136
|
+
*/
|
|
2137
|
+
panelWidth?: number;
|
|
2138
|
+
/** User-resized panel height in px. See {@link LegendConfig.panelWidth}. */
|
|
2139
|
+
panelHeight?: number;
|
|
2140
|
+
}
|
|
2141
|
+
declare const DEFAULT_LEGEND_CONFIG: LegendConfig;
|
|
2142
|
+
/**
|
|
2143
|
+
* Camera target captured for a story chapter. `pitch` and `bearing` are
|
|
2144
|
+
* optional in memory: a location built in code may omit them, and every engine
|
|
2145
|
+
* then keeps that part of the current camera (see `storyLocationView`). A
|
|
2146
|
+
* chapter read from a project file or a CSV never omits them: loading fills an
|
|
2147
|
+
* absent value with 0 (`normalizeStoryChapter`, `parseStoryMapCsv`), so a file
|
|
2148
|
+
* without them still plays north-up and flat, as it always has.
|
|
2149
|
+
*/
|
|
2150
|
+
interface StoryChapterLocation {
|
|
2151
|
+
center: [number, number];
|
|
2152
|
+
zoom: number;
|
|
2153
|
+
pitch?: number;
|
|
2154
|
+
bearing?: number;
|
|
2155
|
+
}
|
|
2156
|
+
/** Where a chapter's text panel sits over the map. */
|
|
2157
|
+
type StoryChapterAlignment = "left" | "center" | "right" | "full";
|
|
2158
|
+
/** How the map transitions to a chapter's location. */
|
|
2159
|
+
type StoryChapterAnimation = "flyTo" | "easeTo" | "jumpTo";
|
|
2160
|
+
/** A layer opacity change triggered when a chapter is entered or exited. */
|
|
2161
|
+
interface StoryLayerOpacityChange {
|
|
2162
|
+
/** Stable identity for React list keys; optional for older project files. */
|
|
2163
|
+
id?: string;
|
|
2164
|
+
/** GeoLibre store layer id whose opacity should change. */
|
|
2165
|
+
layerId: string;
|
|
2166
|
+
opacity: number;
|
|
2167
|
+
/** Transition duration in milliseconds. */
|
|
2168
|
+
duration?: number;
|
|
2169
|
+
}
|
|
2170
|
+
/** A single scene in a scroll-driven story map. */
|
|
2171
|
+
interface StoryChapter {
|
|
2172
|
+
id: string;
|
|
2173
|
+
title: string;
|
|
2174
|
+
description: string;
|
|
2175
|
+
/** Optional image shown in the chapter panel (URL or data URI). */
|
|
2176
|
+
image?: string;
|
|
2177
|
+
alignment: StoryChapterAlignment;
|
|
2178
|
+
/** Hide the text panel while still transitioning the map. */
|
|
2179
|
+
hidden: boolean;
|
|
2180
|
+
location: StoryChapterLocation;
|
|
2181
|
+
mapAnimation: StoryChapterAnimation;
|
|
2182
|
+
/** Slowly rotate the camera once the transition settles. */
|
|
2183
|
+
rotateAnimation: boolean;
|
|
2184
|
+
onChapterEnter: StoryLayerOpacityChange[];
|
|
2185
|
+
onChapterExit: StoryLayerOpacityChange[];
|
|
2186
|
+
}
|
|
2187
|
+
type StoryInsetPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
2188
|
+
/**
|
|
2189
|
+
* A non-chapter intro/outro slide shown before the first or after the last
|
|
2190
|
+
* chapter (#998). `"none"` disables it. The remaining modes are:
|
|
2191
|
+
* - `"blank"` a solid screen in the panel theme color,
|
|
2192
|
+
* - `"black"` a solid black screen,
|
|
2193
|
+
* - `"global"` a zoomed-out global view of the map with no text,
|
|
2194
|
+
* - `"adjacent"` the camera of the neighboring chapter (the first chapter for
|
|
2195
|
+
* the start slide, the last chapter for the closing slide) with all text and
|
|
2196
|
+
* media hidden, so the presenter can zoom into the full content next.
|
|
2197
|
+
*/
|
|
2198
|
+
type StorySlideMode = "none" | "blank" | "black" | "global" | "adjacent";
|
|
2199
|
+
/** A start/closing slide that is actually shown (every mode except `"none"`). */
|
|
2200
|
+
type StoryActiveSlideMode = Exclude<StorySlideMode, "none">;
|
|
2201
|
+
/** Scroll-driven story map authored on top of a GeoLibre project. */
|
|
2202
|
+
interface StoryMap {
|
|
2203
|
+
title: string;
|
|
2204
|
+
subtitle: string;
|
|
2205
|
+
byline: string;
|
|
2206
|
+
footer: string;
|
|
2207
|
+
theme: "light" | "dark";
|
|
2208
|
+
showMarkers: boolean;
|
|
2209
|
+
markerColor: string;
|
|
2210
|
+
inset: boolean;
|
|
2211
|
+
insetPosition: StoryInsetPosition;
|
|
2212
|
+
/**
|
|
2213
|
+
* Start the presentation with the chapter itinerary/navigation panel hidden,
|
|
2214
|
+
* revealing chapters one at a time instead of listing every upcoming location
|
|
2215
|
+
* up front (#995). The presenter still offers a toggle to open the list.
|
|
2216
|
+
*/
|
|
2217
|
+
hideChapterNav: boolean;
|
|
2218
|
+
/** Optional intro slide shown before the first chapter (#998). */
|
|
2219
|
+
startSlide: StorySlideMode;
|
|
2220
|
+
/** Optional closing slide shown after the last chapter (#998). */
|
|
2221
|
+
endSlide: StorySlideMode;
|
|
2222
|
+
chapters: StoryChapter[];
|
|
2223
|
+
}
|
|
2224
|
+
declare const DEFAULT_STORY_MAP: StoryMap;
|
|
2225
|
+
/**
|
|
2226
|
+
* One step in a {@link ProcessingModel}: a processing tool invoked with a fixed
|
|
2227
|
+
* set of parameters. The runner chains steps by feeding each step's output layer
|
|
2228
|
+
* into the next step's input layer parameter (`inputParam`, default `"layer"`),
|
|
2229
|
+
* so a step's stored `parameters` for that input is ignored for every step after
|
|
2230
|
+
* the first.
|
|
2231
|
+
*/
|
|
2232
|
+
interface ProcessingModelStep {
|
|
2233
|
+
/** Stable id, unique within the model (used as the React key and run label). */
|
|
2234
|
+
id: string;
|
|
2235
|
+
/** The processing tool's registry id (e.g. `"buffer"`). */
|
|
2236
|
+
toolId: string;
|
|
2237
|
+
/** Parameter values keyed by the tool's parameter ids. */
|
|
2238
|
+
parameters: Record<string, unknown>;
|
|
2239
|
+
/**
|
|
2240
|
+
* Which `type: "layer"` parameter receives the previous step's output. Defaults
|
|
2241
|
+
* to `"layer"`; set it for tools whose primary input is named differently.
|
|
2242
|
+
*/
|
|
2243
|
+
inputParam?: string;
|
|
2244
|
+
}
|
|
2245
|
+
/**
|
|
2246
|
+
* What flows along a model edge. Vector nodes exchange FeatureCollections;
|
|
2247
|
+
* raster nodes exchange GeoTIFF bytes. A port declaring `"any"` accepts either
|
|
2248
|
+
* and is resolved to a concrete kind at run time by whatever is wired into it.
|
|
2249
|
+
*/
|
|
2250
|
+
type ModelPortKind = "vector" | "raster" | "any";
|
|
2251
|
+
/** One connection point on a {@link ModelGraphNode}. */
|
|
2252
|
+
interface ModelGraphPort {
|
|
2253
|
+
/**
|
|
2254
|
+
* Port id, unique within its node and direction. For a tool node's inputs
|
|
2255
|
+
* this is the underlying tool parameter id, so wiring an edge and setting the
|
|
2256
|
+
* parameter by hand are the same operation.
|
|
2257
|
+
*/
|
|
2258
|
+
id: string;
|
|
2259
|
+
label: string;
|
|
2260
|
+
kind: ModelPortKind;
|
|
2261
|
+
/** Inputs only: the run fails when nothing is wired in and no value is set. */
|
|
2262
|
+
required?: boolean;
|
|
2263
|
+
}
|
|
2264
|
+
/**
|
|
2265
|
+
* What a node does. `input` sources an existing project layer, `tool` runs a
|
|
2266
|
+
* processing algorithm, and `output` names a result to add back to the map.
|
|
2267
|
+
*/
|
|
2268
|
+
type ModelGraphNodeKind = "input" | "tool" | "output";
|
|
2269
|
+
/** One node on the Model Builder canvas. */
|
|
2270
|
+
interface ModelGraphNode {
|
|
2271
|
+
/** Stable id, unique within the graph; referenced by {@link ModelGraphEdge}. */
|
|
2272
|
+
id: string;
|
|
2273
|
+
kind: ModelGraphNodeKind;
|
|
2274
|
+
/** Canvas position in graph coordinates (unscaled by zoom). */
|
|
2275
|
+
x: number;
|
|
2276
|
+
y: number;
|
|
2277
|
+
/** `input` nodes: the project layer id this node sources. */
|
|
2278
|
+
layerId?: string;
|
|
2279
|
+
/**
|
|
2280
|
+
* `tool` nodes: the tool's id within {@link provider}'s registry. Kept
|
|
2281
|
+
* separate from the provider so the same short id can exist in both.
|
|
2282
|
+
*/
|
|
2283
|
+
toolId?: string;
|
|
2284
|
+
/** `tool` nodes: which registry resolves {@link toolId}. */
|
|
2285
|
+
provider?: ModelToolProvider;
|
|
2286
|
+
/** `tool` nodes: parameter values for everything not supplied by an edge. */
|
|
2287
|
+
parameters?: Record<string, unknown>;
|
|
2288
|
+
/** `output` nodes: the layer name given to the result added to the map. */
|
|
2289
|
+
name?: string;
|
|
2290
|
+
}
|
|
2291
|
+
/**
|
|
2292
|
+
* A directed connection from one node's output port to another node's input
|
|
2293
|
+
* port. Ports are named, so a tool with several inputs (Clip's target and
|
|
2294
|
+
* overlay, say) wires each one unambiguously.
|
|
2295
|
+
*/
|
|
2296
|
+
interface ModelGraphEdge {
|
|
2297
|
+
id: string;
|
|
2298
|
+
from: string;
|
|
2299
|
+
fromPort: string;
|
|
2300
|
+
to: string;
|
|
2301
|
+
toPort: string;
|
|
2302
|
+
}
|
|
2303
|
+
/** The node-and-edge graph authored on the Model Builder canvas. */
|
|
2304
|
+
interface ProcessingModelGraph {
|
|
2305
|
+
nodes: ModelGraphNode[];
|
|
2306
|
+
edges: ModelGraphEdge[];
|
|
2307
|
+
}
|
|
2308
|
+
/** Which registry a {@link ModelGraphNode.toolId} is resolved against. */
|
|
2309
|
+
type ModelToolProvider = "vector" | "whitebox";
|
|
2310
|
+
/**
|
|
2311
|
+
* A reusable processing pipeline ("model" in QGIS Graphical Modeler / ArcGIS
|
|
2312
|
+
* ModelBuilder terms), saved in the project file so it can be reloaded and
|
|
2313
|
+
* re-run.
|
|
2314
|
+
*
|
|
2315
|
+
* Two shapes coexist. {@link steps} is the original strictly linear chain, and
|
|
2316
|
+
* remains the only thing older builds understand. {@link graph} is the
|
|
2317
|
+
* Model Builder's directed graph, which supports multi-input tools, branches
|
|
2318
|
+
* and merges. When both are present `graph` wins; a model saved by the canvas
|
|
2319
|
+
* also writes a `steps` projection whenever its graph happens to be a single
|
|
2320
|
+
* chain, so older builds can still run it.
|
|
2321
|
+
*/
|
|
2322
|
+
interface ProcessingModel {
|
|
2323
|
+
id: string;
|
|
2324
|
+
name: string;
|
|
2325
|
+
steps: ProcessingModelStep[];
|
|
2326
|
+
graph?: ProcessingModelGraph;
|
|
2327
|
+
}
|
|
2328
|
+
/**
|
|
2329
|
+
* Which dialog family executed a {@link ProcessingRun}. Drives the History
|
|
2330
|
+
* panel's re-run routing: each kind maps to the dialog (and store open-flag)
|
|
2331
|
+
* that can be reopened pre-filled with the run's parameters.
|
|
2332
|
+
*/
|
|
2333
|
+
type ProcessingRunKind = "vector" | "statistics" | "network" | "whitebox" | "raster" | "conversion" | "algorithm";
|
|
2334
|
+
type ProcessingRunStatus = "success" | "error";
|
|
2335
|
+
/** Upper bound on persisted processing-history entries (oldest are dropped). */
|
|
2336
|
+
declare const MAX_PROCESSING_HISTORY = 100;
|
|
2337
|
+
/**
|
|
2338
|
+
* One recorded processing tool run (issue #1292). Appended by every processing
|
|
2339
|
+
* dialog when a run finishes and persisted in the project file, so a saved
|
|
2340
|
+
* project documents how its derived layers were produced. Parameter values are
|
|
2341
|
+
* stored exactly as the dialog dispatched them (layer parameters hold layer
|
|
2342
|
+
* ids), which is what re-run pre-fills and "Copy as Python" emit.
|
|
2343
|
+
*/
|
|
2344
|
+
interface ProcessingRun {
|
|
2345
|
+
/** Stable id, unique within the project (React key and update key). */
|
|
2346
|
+
id: string;
|
|
2347
|
+
kind: ProcessingRunKind;
|
|
2348
|
+
/** The tool's registry id (e.g. `"buffer"`, `"slope"`). */
|
|
2349
|
+
toolId: string;
|
|
2350
|
+
/** Human-readable tool name captured at run time. */
|
|
2351
|
+
toolName: string;
|
|
2352
|
+
/** Engine that executed the run: `client`, `wasm`, `sidecar`, `pyodide`, `browser`. */
|
|
2353
|
+
engine: string;
|
|
2354
|
+
/** Parameter values keyed by the tool's parameter ids. */
|
|
2355
|
+
parameters: Record<string, unknown>;
|
|
2356
|
+
/** Names of input layers referenced by layer parameters, keyed by layer id. */
|
|
2357
|
+
inputLayerNames?: Record<string, string>;
|
|
2358
|
+
/** Names of layers the run added to the map. */
|
|
2359
|
+
outputLayerNames?: string[];
|
|
2360
|
+
/** Input file path/name, for file-based tools (raster/conversion). */
|
|
2361
|
+
inputPath?: string;
|
|
2362
|
+
/** Output file path/name, for file-based tools (raster/conversion). */
|
|
2363
|
+
outputPath?: string;
|
|
2364
|
+
/** ISO timestamp of when the run started. */
|
|
2365
|
+
startedAt: string;
|
|
2366
|
+
/** Wall-clock duration of the run in milliseconds. */
|
|
2367
|
+
durationMs?: number;
|
|
2368
|
+
status: ProcessingRunStatus;
|
|
2369
|
+
/** Error message when `status` is `"error"`. */
|
|
2370
|
+
error?: string;
|
|
2371
|
+
}
|
|
2372
|
+
/**
|
|
2373
|
+
* A pending "re-run from History" request. The History panel writes it to the
|
|
2374
|
+
* store and opens the target dialog; the dialog consumes it (pre-filling its
|
|
2375
|
+
* parameter form) and clears it. `autoRun` asks the dialog to start the run
|
|
2376
|
+
* immediately after pre-filling (plain Re-run vs Edit & re-run).
|
|
2377
|
+
*/
|
|
2378
|
+
interface ProcessingRerunRequest {
|
|
2379
|
+
kind: ProcessingRunKind;
|
|
2380
|
+
toolId: string;
|
|
2381
|
+
parameters: Record<string, unknown>;
|
|
2382
|
+
/** Engine to preselect, when the dialog offers a choice. */
|
|
2383
|
+
engine?: string;
|
|
2384
|
+
autoRun?: boolean;
|
|
2385
|
+
}
|
|
2386
|
+
/** Column-count bounds for the Dashboard panel's widget grid. */
|
|
2387
|
+
declare const MIN_DASHBOARD_COLUMNS = 1;
|
|
2388
|
+
declare const MAX_DASHBOARD_COLUMNS = 6;
|
|
2389
|
+
declare const DEFAULT_DASHBOARD_COLUMNS = 2;
|
|
2390
|
+
/** The chart a {@link DashboardWidget} draws. Mirrors the attribute Charts
|
|
2391
|
+
* panel's types so a widget reuses the same rendering. The `"indicator"` type
|
|
2392
|
+
* is a non-chart KPI tile (issue #1381). */
|
|
2393
|
+
type DashboardWidgetType = "histogram" | "scatter" | "bar" | "line" | "box" | "pie" | "indicator" | "selector" | "list";
|
|
2394
|
+
/** How a bar widget reduces its category groups. */
|
|
2395
|
+
type DashboardWidgetAggregation = "count" | "sum" | "mean";
|
|
2396
|
+
/**
|
|
2397
|
+
* One chart in the Dashboard panel: a chart type bound to a layer and the
|
|
2398
|
+
* field(s) it plots. Which `field*`/`category`/`aggregation` keys apply depends
|
|
2399
|
+
* on `type` (histogram/line/box use `field`; scatter uses `xField`/`yField`;
|
|
2400
|
+
* bar uses `category` + `aggregation` and, for sum/mean, `valueField`). Unused
|
|
2401
|
+
* keys are simply ignored, so the record stays flat and easy to hand-edit.
|
|
2402
|
+
* Saved in the project file so a dashboard reopens with its widgets intact.
|
|
2403
|
+
*/
|
|
2404
|
+
interface DashboardWidget {
|
|
2405
|
+
/** Stable id, unique within the project (React key and store key). */
|
|
2406
|
+
id: string;
|
|
2407
|
+
/** The layer whose features feed this widget. */
|
|
2408
|
+
layerId: string;
|
|
2409
|
+
/** The chart to draw. */
|
|
2410
|
+
type: DashboardWidgetType;
|
|
2411
|
+
/** Optional custom title; the panel derives a label from the fields if absent. */
|
|
2412
|
+
title?: string;
|
|
2413
|
+
/** Optional hex color (`#rgb`/`#rrggbb`) for the chart's marks. Single-series
|
|
2414
|
+
* charts use it as the series color; bar/pie use it as the base of a
|
|
2415
|
+
* monochromatic ramp. Defaults to the theme primary / multi-color palette. */
|
|
2416
|
+
color?: string;
|
|
2417
|
+
/** Value field for histogram/line/box. */
|
|
2418
|
+
field?: string;
|
|
2419
|
+
/** X-axis field for scatter. */
|
|
2420
|
+
xField?: string;
|
|
2421
|
+
/** Y-axis field for scatter. */
|
|
2422
|
+
yField?: string;
|
|
2423
|
+
/** Number of bins for a histogram. */
|
|
2424
|
+
bins?: number;
|
|
2425
|
+
/** Category field for a bar chart. */
|
|
2426
|
+
category?: string;
|
|
2427
|
+
/** Aggregation for a bar chart (default `count`). */
|
|
2428
|
+
aggregation?: DashboardWidgetAggregation;
|
|
2429
|
+
/** Value field a bar chart's sum/mean reduces (ignored for `count`). */
|
|
2430
|
+
valueField?: string;
|
|
2431
|
+
/** Indicator widget: aggregation function for the KPI value (issue #1381).
|
|
2432
|
+
* Extends bar aggregation with min, max, and median. */
|
|
2433
|
+
indicatorAggregation?: IndicatorAggregation;
|
|
2434
|
+
/** Indicator widget: optional prefix (e.g. "€", "$"). */
|
|
2435
|
+
prefix?: string;
|
|
2436
|
+
/** Indicator widget: optional suffix (e.g. " kg", " ha"). */
|
|
2437
|
+
suffix?: string;
|
|
2438
|
+
/** Selector widget: whether multiple values can be picked (default false). */
|
|
2439
|
+
multiple?: boolean;
|
|
2440
|
+
/** List widget: columns to display. */
|
|
2441
|
+
listFields?: string[];
|
|
2442
|
+
/** List widget: field to sort by. */
|
|
2443
|
+
sortBy?: string;
|
|
2444
|
+
/** List widget: sort direction (default "desc"). */
|
|
2445
|
+
sortDir?: "asc" | "desc";
|
|
2446
|
+
/** List widget: max rows to show (default 20). */
|
|
2447
|
+
limit?: number;
|
|
2448
|
+
}
|
|
2449
|
+
/** Aggregation functions for indicator widgets (issue #1381). Extends the bar
|
|
2450
|
+
* widget aggregation with min, max, and median. */
|
|
2451
|
+
type IndicatorAggregation = "count" | "sum" | "mean" | "min" | "max" | "median";
|
|
2452
|
+
/**
|
|
2453
|
+
* What slice of a layer's styling a Style Manager entry captures (issue #1294).
|
|
2454
|
+
*
|
|
2455
|
+
* - `"style"`: the layer's complete {@link LayerStyle} snapshot.
|
|
2456
|
+
* - `"symbol"`: fill/stroke/marker/pattern symbology only, so it can restyle a
|
|
2457
|
+
* layer without touching its labels or renderer configuration.
|
|
2458
|
+
* - `"labels"`: the {@link LabelStyle} block only.
|
|
2459
|
+
* - `"ramp"`: the color ramp + classification settings only (ramp name, class
|
|
2460
|
+
* count, classification scheme), independent of the attribute the target
|
|
2461
|
+
* layer classifies on.
|
|
2462
|
+
*/
|
|
2463
|
+
type StyleLibraryEntryKind = "style" | "symbol" | "labels" | "ramp";
|
|
2464
|
+
/**
|
|
2465
|
+
* One saved, reusable style in the Style Manager library (issue #1294). The
|
|
2466
|
+
* payload is a {@link LayerStyle} subset chosen by {@link kind}; applying an
|
|
2467
|
+
* entry merges that subset onto the target layer's style. Entries live either
|
|
2468
|
+
* in the app-level library (persisted across projects) or embedded in a
|
|
2469
|
+
* project file's `styleLibrary` array.
|
|
2470
|
+
*/
|
|
2471
|
+
interface StyleLibraryEntry {
|
|
2472
|
+
/** Stable id, used as the IndexedDB/store key; upserts overwrite by id. */
|
|
2473
|
+
id: string;
|
|
2474
|
+
/** Display name shown in the Style Manager. */
|
|
2475
|
+
name: string;
|
|
2476
|
+
/** Which style subset {@link style} carries. */
|
|
2477
|
+
kind: StyleLibraryEntryKind;
|
|
2478
|
+
/** Free-form tags for filtering the library. */
|
|
2479
|
+
tags: string[];
|
|
2480
|
+
/** The saved {@link LayerStyle} subset (see {@link kind}). */
|
|
2481
|
+
style: Partial<LayerStyle>;
|
|
2482
|
+
/** ISO timestamp of the last save; empty for built-in presets. */
|
|
2483
|
+
updatedAt: string;
|
|
2484
|
+
}
|
|
2485
|
+
/**
|
|
2486
|
+
* One saved, re-addable layer in the Layer Library (issue #1520) — the "My
|
|
2487
|
+
* Data" section of the Browser panel. Stores the layer's **source
|
|
2488
|
+
* specification** plus its full presentation state (style, labels, filters,
|
|
2489
|
+
* joins, virtual fields, attribute form), deliberately *not* the data, so the
|
|
2490
|
+
* library stays small and an entry always reflects the current contents of its
|
|
2491
|
+
* source.
|
|
2492
|
+
*
|
|
2493
|
+
* The exception is a layer whose features exist only in memory (drawn features,
|
|
2494
|
+
* processing output) or in a local file: those have no re-fetchable source, so
|
|
2495
|
+
* their features are embedded in {@link geojson} behind a size cap. See
|
|
2496
|
+
* `layer-library.ts` for how an entry is captured and re-added.
|
|
2497
|
+
*/
|
|
2498
|
+
interface LayerLibraryEntry {
|
|
2499
|
+
/** Stable id, used as the IndexedDB/store key; upserts overwrite by id. */
|
|
2500
|
+
id: string;
|
|
2501
|
+
/** Display name shown in the Browser panel's My Data section. */
|
|
2502
|
+
name: string;
|
|
2503
|
+
/** ISO timestamp of the last save. */
|
|
2504
|
+
addedAt: string;
|
|
2505
|
+
/** The layer type to recreate ({@link GeoLibreLayer.type}). */
|
|
2506
|
+
layerType: LayerType;
|
|
2507
|
+
/** The MapLibre/plugin source spec to recreate the layer from. */
|
|
2508
|
+
source: Record<string, unknown>;
|
|
2509
|
+
/** The saved layer's complete {@link LayerStyle} (labels included). */
|
|
2510
|
+
style: LayerStyle;
|
|
2511
|
+
/** Layer opacity in [0, 1]. */
|
|
2512
|
+
opacity: number;
|
|
2513
|
+
/** The layer metadata the renderers and plugin sync modules key off. */
|
|
2514
|
+
metadata: Record<string, unknown>;
|
|
2515
|
+
/** Absolute local path, for a layer read from a file on disk. */
|
|
2516
|
+
sourcePath?: string;
|
|
2517
|
+
/** Persistent attribute joins to reapply. */
|
|
2518
|
+
joins?: LayerJoin[];
|
|
2519
|
+
/** Expression-backed virtual fields to reapply. */
|
|
2520
|
+
virtualFields?: LayerVirtualField[];
|
|
2521
|
+
/** Per-field edit-widget/constraint configuration to reapply. */
|
|
2522
|
+
attributeForm?: AttributeFormConfig;
|
|
2523
|
+
/** Popup/tooltip design to reapply. */
|
|
2524
|
+
popup?: LayerPopupConfig;
|
|
2525
|
+
/** User-authored catalog metadata to reapply. */
|
|
2526
|
+
descriptiveMetadata?: LayerDescriptiveMetadata;
|
|
2527
|
+
/**
|
|
2528
|
+
* Embedded features, present only for a layer whose source cannot be
|
|
2529
|
+
* re-read (in-memory features) or whose local file may be unavailable.
|
|
2530
|
+
*/
|
|
2531
|
+
geojson?: FeatureCollection;
|
|
2532
|
+
/**
|
|
2533
|
+
* True when the entry can only be re-added by a host that can read
|
|
2534
|
+
* {@link sourcePath} — i.e. its features were too large to embed, so the
|
|
2535
|
+
* desktop app must re-read the file and the browser build cannot.
|
|
2536
|
+
*/
|
|
2537
|
+
needsLocalFile?: boolean;
|
|
2538
|
+
}
|
|
2539
|
+
/** One saved template in the Template Library. */
|
|
2540
|
+
interface ProjectTemplateEntry {
|
|
2541
|
+
id: string;
|
|
2542
|
+
name: string;
|
|
2543
|
+
description?: string;
|
|
2544
|
+
project: GeoLibreProject;
|
|
2545
|
+
createdAt: string;
|
|
2546
|
+
updatedAt: string;
|
|
2547
|
+
}
|
|
2548
|
+
interface GeoLibreProject {
|
|
2549
|
+
id?: string;
|
|
2550
|
+
version: string;
|
|
2551
|
+
name: string;
|
|
2552
|
+
mapView: MapViewState;
|
|
2553
|
+
basemapStyleUrl: string;
|
|
2554
|
+
basemapVisible: boolean;
|
|
2555
|
+
basemapOpacity: number;
|
|
2556
|
+
/** Custom colour for the Blank background. Null uses the current theme default. */
|
|
2557
|
+
blankBackgroundColor?: string | null;
|
|
2558
|
+
layers: GeoLibreLayer[];
|
|
2559
|
+
/**
|
|
2560
|
+
* Layer selected in the Layers panel when the project was saved. Omitted by
|
|
2561
|
+
* legacy projects; `null` deliberately restores no active layer.
|
|
2562
|
+
*/
|
|
2563
|
+
selectedLayerId?: string | null;
|
|
2564
|
+
/** Named folders that organize the flat `layers` list in the layer panel. */
|
|
2565
|
+
layerGroups?: LayerGroup[];
|
|
2566
|
+
styles: Record<string, LayerStyle>;
|
|
2567
|
+
preferences: ProjectPreferences;
|
|
2568
|
+
plugins?: ProjectPluginState;
|
|
2569
|
+
/** User customizations for the Print Layout legend. */
|
|
2570
|
+
legend?: LegendConfig;
|
|
2571
|
+
/**
|
|
2572
|
+
* Print Layout composer settings (title, page size, orientation, blocks,
|
|
2573
|
+
* atlas). Omitted while the composer is untouched, so projects that never
|
|
2574
|
+
* opened it are unaffected (GeoLibre discussion #1992).
|
|
2575
|
+
*/
|
|
2576
|
+
printLayout?: PrintLayoutConfig;
|
|
2577
|
+
storymap?: StoryMap;
|
|
2578
|
+
/** Saved processing pipelines (batch/model chaining; issue #344). */
|
|
2579
|
+
models?: ProcessingModel[];
|
|
2580
|
+
/** Recorded processing tool runs (Processing History; issue #1292). */
|
|
2581
|
+
processingHistory?: ProcessingRun[];
|
|
2582
|
+
/** Saved Dashboard panel chart widgets (issue #401). */
|
|
2583
|
+
widgets?: DashboardWidget[];
|
|
2584
|
+
/** Number of columns in the Dashboard widget grid; omitted when default. */
|
|
2585
|
+
dashboardColumns?: number;
|
|
2586
|
+
/**
|
|
2587
|
+
* Multi-map grid layout; omitted (single 1x1 pane) for default projects so
|
|
2588
|
+
* legacy readers and single-map files are unaffected.
|
|
2589
|
+
*/
|
|
2590
|
+
mapLayout?: MapGridLayout;
|
|
2591
|
+
/**
|
|
2592
|
+
* Secondary map panes (everything past the primary pane). Omitted when the
|
|
2593
|
+
* grid is a single pane. The primary pane uses the top-level `mapView` /
|
|
2594
|
+
* `basemap*` fields.
|
|
2595
|
+
*/
|
|
2596
|
+
secondaryMapViews?: SecondaryMapView[];
|
|
2597
|
+
/** User-entered label for the primary pane; omitted when empty. */
|
|
2598
|
+
primaryMapLabel?: string;
|
|
2599
|
+
/**
|
|
2600
|
+
* Which engine draws the primary map area (issue #2217). Omitted for the
|
|
2601
|
+
* default 2D map, so every project written before this existed — and every
|
|
2602
|
+
* project that never leaves MapLibre — is byte-identical to before. A project
|
|
2603
|
+
* saved as `"cesium"` reopens directly on the 3D globe.
|
|
2604
|
+
*
|
|
2605
|
+
* This is independent of {@link mapLayout}: a 1x1 workspace can be either
|
|
2606
|
+
* renderer, and a multi-pane grid can still mix the two through each pane's
|
|
2607
|
+
* {@link SecondaryMapView.viewKind}.
|
|
2608
|
+
*/
|
|
2609
|
+
primaryRenderer?: MapRendererKind;
|
|
2610
|
+
/**
|
|
2611
|
+
* Project-scoped Style Manager entries (issue #1294), so a project can carry
|
|
2612
|
+
* its reusable styles to teammates. Omitted when empty; the app-level
|
|
2613
|
+
* library is persisted outside the project file and never serialized here.
|
|
2614
|
+
*/
|
|
2615
|
+
styleLibrary?: StyleLibraryEntry[];
|
|
2616
|
+
/** Anchored review comments on map points or features (issue #1518). */
|
|
2617
|
+
comments?: ProjectComment[];
|
|
2618
|
+
/**
|
|
2619
|
+
* Interaction state applied when the project opens: the Identify target and
|
|
2620
|
+
* which map controls and toolbar panels start shown (issue #2688). Written by
|
|
2621
|
+
* the Python `geolibre` package from `set_identify` / `show_control`, so a
|
|
2622
|
+
* saved or HTML-exported notebook map opens the way it was set up. Omitted
|
|
2623
|
+
* by default; the app keeps what it loaded and writes it back unchanged.
|
|
2624
|
+
*/
|
|
2625
|
+
interaction?: ProjectInteraction;
|
|
2626
|
+
metadata: Record<string, unknown>;
|
|
2627
|
+
}
|
|
2628
|
+
/**
|
|
2629
|
+
* Startup interaction state carried by a project (see
|
|
2630
|
+
* {@link GeoLibreProject.interaction}).
|
|
2631
|
+
*/
|
|
2632
|
+
interface ProjectInteraction {
|
|
2633
|
+
/**
|
|
2634
|
+
* Identify target on open: a layer id, `"all"` for every visible queryable
|
|
2635
|
+
* layer, a list of layer ids to identify only those, or `null` for off.
|
|
2636
|
+
*/
|
|
2637
|
+
identify?: string | string[] | null;
|
|
2638
|
+
/**
|
|
2639
|
+
* Map control or toolbar panel name (`"search"`, `"bookmark"`, `"globe"`,
|
|
2640
|
+
* ...) to whether it starts shown. Unknown names are ignored on open.
|
|
2641
|
+
*/
|
|
2642
|
+
controls?: Record<string, boolean>;
|
|
2643
|
+
}
|
|
2644
|
+
type CommentAnchor = {
|
|
2645
|
+
type: "point";
|
|
2646
|
+
lngLat: [number, number];
|
|
2647
|
+
} | {
|
|
2648
|
+
type: "feature";
|
|
2649
|
+
layerId: string;
|
|
2650
|
+
featureId: string | number;
|
|
2651
|
+
lngLat?: [number, number];
|
|
2652
|
+
};
|
|
2653
|
+
interface CommentAuthor {
|
|
2654
|
+
name: string;
|
|
2655
|
+
color: string;
|
|
2656
|
+
}
|
|
2657
|
+
interface CommentReply {
|
|
2658
|
+
id: string;
|
|
2659
|
+
author: CommentAuthor;
|
|
2660
|
+
body: string;
|
|
2661
|
+
createdAt: string;
|
|
2662
|
+
}
|
|
2663
|
+
interface ProjectComment {
|
|
2664
|
+
id: string;
|
|
2665
|
+
anchor: CommentAnchor;
|
|
2666
|
+
author: CommentAuthor;
|
|
2667
|
+
body: string;
|
|
2668
|
+
createdAt: string;
|
|
2669
|
+
resolved: boolean;
|
|
2670
|
+
replies: CommentReply[];
|
|
2671
|
+
}
|
|
2672
|
+
interface RecentProjectEntry {
|
|
2673
|
+
path: string;
|
|
2674
|
+
name: string;
|
|
2675
|
+
openedAt: string;
|
|
2676
|
+
}
|
|
2677
|
+
/**
|
|
2678
|
+
* Size at or above which a local vector file is read through DuckDB instead of
|
|
2679
|
+
* the in-memory JavaScript readers, and the feature count above which the user
|
|
2680
|
+
* is asked before every feature is materialized as GeoJSON.
|
|
2681
|
+
*
|
|
2682
|
+
* These live in core so the desktop loaders (`duckdb-vector-guard.ts`) and the
|
|
2683
|
+
* Add Vector Layer panel (`@geolibre/plugins`, which configures the
|
|
2684
|
+
* `maplibre-gl-vector` control's `autoThreshold`) switch strategy at the *same*
|
|
2685
|
+
* numbers. Before they were unified the two entry points disagreed — the panel
|
|
2686
|
+
* tiled at 25 MB / 50k while drag-and-drop stayed in memory to 100 MB — so the
|
|
2687
|
+
* same file behaved differently depending on how it was added, and no single
|
|
2688
|
+
* number could be documented.
|
|
2689
|
+
*/
|
|
2690
|
+
declare const DUCKDB_VECTOR_ROUTE_BYTES: number;
|
|
2691
|
+
declare const DUCKDB_VECTOR_FEATURE_WARN_COUNT = 100000;
|
|
2692
|
+
/** A collection whose coordinates cannot be WGS84 longitude/latitude. */
|
|
2693
|
+
interface NonGeographicCoordinates {
|
|
2694
|
+
/** How many coordinates were inspected. */
|
|
2695
|
+
sampled: number;
|
|
2696
|
+
/** The largest |x| seen — a longitude may not exceed 180. */
|
|
2697
|
+
maxAbsX: number;
|
|
2698
|
+
/** The largest |y| seen — a latitude may not exceed 90. */
|
|
2699
|
+
maxAbsY: number;
|
|
2700
|
+
}
|
|
2701
|
+
/**
|
|
2702
|
+
* Detect a collection that declares (or is assumed to be) WGS84 but carries
|
|
2703
|
+
* projected coordinates — the failure mode where a layer loads cleanly, appears
|
|
2704
|
+
* in the Layers panel, and renders nowhere because its "longitude" is a easting
|
|
2705
|
+
* in metres or feet.
|
|
2706
|
+
*
|
|
2707
|
+
* GeoLibre honours whatever CRS a file declares, so a file that declares
|
|
2708
|
+
* `CRS84`/`GCS_WGS_1984` while holding State Plane or Albers coordinates is
|
|
2709
|
+
* passed through untouched and lands off the map with no error. Callers use
|
|
2710
|
+
* this to warn instead of failing silently; it does not guess the true CRS,
|
|
2711
|
+
* which only the user knows.
|
|
2712
|
+
*
|
|
2713
|
+
* Sampling stops at `sampleLimit` coordinates: out-of-range values are a
|
|
2714
|
+
* property of the whole file, so a prefix is enough and a 3-million-coordinate
|
|
2715
|
+
* collection is not walked twice.
|
|
2716
|
+
*
|
|
2717
|
+
* @returns Details when a coordinate is out of geographic range, else null.
|
|
2718
|
+
*/
|
|
2719
|
+
declare function detectNonGeographicCoordinates(geojson: GeoJSON.FeatureCollection | undefined, sampleLimit?: number): NonGeographicCoordinates | null;
|
|
2720
|
+
//#endregion
|
|
2721
|
+
//#region src/ellipsoids.d.ts
|
|
2722
|
+
/**
|
|
2723
|
+
* Celestial-body ellipsoids and the planetary basemaps that pair with them.
|
|
2724
|
+
*
|
|
2725
|
+
* GeoLibre is Earth-centric by construction: MapLibre only renders Web Mercator
|
|
2726
|
+
* and all vector data is kept as WGS84 lon/lat GeoJSON. This module does *not*
|
|
2727
|
+
* change that — MapLibre still treats the planet as a unit sphere and there is
|
|
2728
|
+
* no true multi-CRS rendering (see maplibre-gl-js#168). What it adds is a
|
|
2729
|
+
* per-project notion of *which body* the coordinates describe, so that:
|
|
2730
|
+
*
|
|
2731
|
+
* - distance / area / scale measurements use that body's radius instead of a
|
|
2732
|
+
* hardcoded Earth radius, and
|
|
2733
|
+
* - Moon / Mars basemaps (published in a Web-Mercator tiling scheme) can be
|
|
2734
|
+
* selected like any other basemap.
|
|
2735
|
+
*
|
|
2736
|
+
* The active ellipsoid is a lightweight module-level singleton kept in sync with
|
|
2737
|
+
* the project's map preferences (see the store's `setPreferences`). Measurement
|
|
2738
|
+
* helpers read it lazily at call time, so callers in other packages don't need
|
|
2739
|
+
* the value threaded through their signatures — a deliberate prototype-friendly
|
|
2740
|
+
* shortcut over a full CRS/context refactor.
|
|
2741
|
+
*/
|
|
2742
|
+
/** A biaxial (rotational) ellipsoid describing a celestial body. */
|
|
2743
|
+
interface Ellipsoid {
|
|
2744
|
+
/** Stable id persisted in the project (`map.ellipsoidId`). */
|
|
2745
|
+
id: string;
|
|
2746
|
+
/** Human-readable name shown in the UI. */
|
|
2747
|
+
name: string;
|
|
2748
|
+
/** Equatorial (semi-major) radius in metres — the "web mercator" radius. */
|
|
2749
|
+
semiMajorAxisMeters: number;
|
|
2750
|
+
/**
|
|
2751
|
+
* Inverse flattening `1/f`. `0` denotes a perfect sphere (Moon), in which case
|
|
2752
|
+
* the polar radius equals {@link semiMajorAxisMeters}.
|
|
2753
|
+
*/
|
|
2754
|
+
inverseFlattening: number;
|
|
2755
|
+
}
|
|
2756
|
+
/**
|
|
2757
|
+
* Built-in ellipsoids. Earth is WGS 84; every other body uses IAU-adopted
|
|
2758
|
+
* figures. Only Earth and Mars are appreciably oblate; the rest are modelled as
|
|
2759
|
+
* spheres (`inverseFlattening: 0`), which is how the IAU/USGS simple-cylindrical
|
|
2760
|
+
* products treat them and is well within the accuracy MapLibre's unit-sphere
|
|
2761
|
+
* rendering can represent anyway.
|
|
2762
|
+
*/
|
|
2763
|
+
declare const ELLIPSOIDS: readonly [{
|
|
2764
|
+
readonly id: "earth";
|
|
2765
|
+
readonly name: "Earth (WGS 84)";
|
|
2766
|
+
readonly semiMajorAxisMeters: 6378137;
|
|
2767
|
+
readonly inverseFlattening: 298.257223563;
|
|
2768
|
+
}, {
|
|
2769
|
+
readonly id: "moon";
|
|
2770
|
+
readonly name: "Moon";
|
|
2771
|
+
readonly semiMajorAxisMeters: 1737400;
|
|
2772
|
+
readonly inverseFlattening: 0;
|
|
2773
|
+
}, {
|
|
2774
|
+
readonly id: "mars";
|
|
2775
|
+
readonly name: "Mars (IAU 2000)";
|
|
2776
|
+
readonly semiMajorAxisMeters: 3396190;
|
|
2777
|
+
readonly inverseFlattening: 169.894447;
|
|
2778
|
+
}, {
|
|
2779
|
+
readonly id: "mercury";
|
|
2780
|
+
readonly name: "Mercury";
|
|
2781
|
+
readonly semiMajorAxisMeters: 2439400;
|
|
2782
|
+
readonly inverseFlattening: 0;
|
|
2783
|
+
}, {
|
|
2784
|
+
readonly id: "venus";
|
|
2785
|
+
readonly name: "Venus";
|
|
2786
|
+
readonly semiMajorAxisMeters: 6051800;
|
|
2787
|
+
readonly inverseFlattening: 0;
|
|
2788
|
+
}, {
|
|
2789
|
+
readonly id: "io";
|
|
2790
|
+
readonly name: "Io";
|
|
2791
|
+
readonly semiMajorAxisMeters: 1821600;
|
|
2792
|
+
readonly inverseFlattening: 0;
|
|
2793
|
+
}, {
|
|
2794
|
+
readonly id: "europa";
|
|
2795
|
+
readonly name: "Europa";
|
|
2796
|
+
readonly semiMajorAxisMeters: 1560800;
|
|
2797
|
+
readonly inverseFlattening: 0;
|
|
2798
|
+
}, {
|
|
2799
|
+
readonly id: "ganymede";
|
|
2800
|
+
readonly name: "Ganymede";
|
|
2801
|
+
readonly semiMajorAxisMeters: 2631200;
|
|
2802
|
+
readonly inverseFlattening: 0;
|
|
2803
|
+
}, {
|
|
2804
|
+
readonly id: "callisto";
|
|
2805
|
+
readonly name: "Callisto";
|
|
2806
|
+
readonly semiMajorAxisMeters: 2410300;
|
|
2807
|
+
readonly inverseFlattening: 0;
|
|
2808
|
+
}, {
|
|
2809
|
+
readonly id: "titan";
|
|
2810
|
+
readonly name: "Titan";
|
|
2811
|
+
readonly semiMajorAxisMeters: 2574730;
|
|
2812
|
+
readonly inverseFlattening: 0;
|
|
2813
|
+
}, {
|
|
2814
|
+
readonly id: "pluto";
|
|
2815
|
+
readonly name: "Pluto";
|
|
2816
|
+
readonly semiMajorAxisMeters: 1188300;
|
|
2817
|
+
readonly inverseFlattening: 0;
|
|
2818
|
+
}, {
|
|
2819
|
+
readonly id: "charon";
|
|
2820
|
+
readonly name: "Charon";
|
|
2821
|
+
readonly semiMajorAxisMeters: 606000;
|
|
2822
|
+
readonly inverseFlattening: 0;
|
|
2823
|
+
}];
|
|
2824
|
+
type EllipsoidId = (typeof ELLIPSOIDS)[number]["id"];
|
|
2825
|
+
declare const DEFAULT_ELLIPSOID_ID: EllipsoidId;
|
|
2826
|
+
/** Look an ellipsoid up by id, falling back to Earth for unknown ids. */
|
|
2827
|
+
declare function getEllipsoid(id: string | undefined): Ellipsoid;
|
|
2828
|
+
/**
|
|
2829
|
+
* Mean radius `R = (2a + b) / 3` in metres, where `b` is the polar radius
|
|
2830
|
+
* derived from the inverse flattening. This is the radius used for spherical
|
|
2831
|
+
* (haversine) distance and area math.
|
|
2832
|
+
*/
|
|
2833
|
+
declare function meanRadiusMeters(ellipsoid: Ellipsoid): number;
|
|
2834
|
+
/** Earth's mean radius in metres — the radius Turf.js and MapLibre bake in. */
|
|
2835
|
+
declare const EARTH_MEAN_RADIUS_METERS: number;
|
|
2836
|
+
/**
|
|
2837
|
+
* Point the measurement helpers at a body. Unknown ids fall back to Earth so a
|
|
2838
|
+
* malformed project can never break measurements. Safe to call on every
|
|
2839
|
+
* preferences change; it is a cheap assignment.
|
|
2840
|
+
*/
|
|
2841
|
+
declare function setActiveEllipsoidId(id: string | undefined): void;
|
|
2842
|
+
declare function getActiveEllipsoid(): Ellipsoid;
|
|
2843
|
+
/** Mean radius (metres) of the active body — for haversine distance/area. */
|
|
2844
|
+
declare function getActiveMeanRadiusMeters(): number;
|
|
2845
|
+
/** Semi-major axis (metres) of the active body — for its Web-Mercator scale. */
|
|
2846
|
+
declare function getActiveSemiMajorAxisMeters(): number;
|
|
2847
|
+
/**
|
|
2848
|
+
* The active body's mean radius as a fraction of Earth's — `R_body / R_earth`,
|
|
2849
|
+
* and exactly `1` on Earth.
|
|
2850
|
+
*
|
|
2851
|
+
* Everything GeoLibre measures ultimately comes from lon/lat *angles*, and the
|
|
2852
|
+
* only thing that turns an angle into a ground distance is the radius it is
|
|
2853
|
+
* multiplied by. Turf.js hardcodes Earth's, with no per-call override (that is
|
|
2854
|
+
* the "Turf is Earth-locked" half of GeoLibre#1128), so rather than patch or
|
|
2855
|
+
* replace Turf we post-scale what it returns and pre-scale what we hand it. The
|
|
2856
|
+
* result is exact for a sphere, which is how every non-Earth body GeoLibre
|
|
2857
|
+
* offers is modelled anyway, and within Mars' 0.6% flattening at worst.
|
|
2858
|
+
*
|
|
2859
|
+
* Suggested by @thareUSGS (USGS Astrogeology) on GeoLibre#1128 as the practical
|
|
2860
|
+
* workaround planetary web maps have long used on Earth-locked engines.
|
|
2861
|
+
*/
|
|
2862
|
+
declare function getActiveBodyRadiusRatio(): number;
|
|
2863
|
+
/**
|
|
2864
|
+
* Convert a length Turf.js measured on Earth into the active body's true ground
|
|
2865
|
+
* length. A no-op on Earth.
|
|
2866
|
+
*
|
|
2867
|
+
* Use on anything Turf *returns* — a distance, a length, a perimeter.
|
|
2868
|
+
*
|
|
2869
|
+
* The correction is a dimensionless ratio, so it is unit-agnostic: pass the
|
|
2870
|
+
* length in whatever unit Turf gave it back (metres, kilometres, miles) and the
|
|
2871
|
+
* result is in that same unit. There is no hidden unit conversion here.
|
|
2872
|
+
*/
|
|
2873
|
+
declare function earthLengthToBody(length: number): number;
|
|
2874
|
+
/**
|
|
2875
|
+
* Convert a true ground length on the active body into the Earth-equivalent
|
|
2876
|
+
* length to hand Turf.js. A no-op on Earth.
|
|
2877
|
+
*
|
|
2878
|
+
* Use on anything passed *into* Turf as a distance — a buffer width, a circle
|
|
2879
|
+
* or sector radius, a search threshold — so the resulting geometry spans that
|
|
2880
|
+
* distance on this body rather than on Earth.
|
|
2881
|
+
*
|
|
2882
|
+
* Unit-agnostic like {@link earthLengthToBody}: pass the length in whatever
|
|
2883
|
+
* unit you are about to hand Turf alongside it, and the result is in that unit.
|
|
2884
|
+
*/
|
|
2885
|
+
declare function bodyLengthToEarth(length: number): number;
|
|
2886
|
+
/**
|
|
2887
|
+
* Convert an area Turf.js measured on Earth into the active body's true ground
|
|
2888
|
+
* area. A no-op on Earth.
|
|
2889
|
+
*
|
|
2890
|
+
* Areas scale with the *square* of the radius ratio, so this is not the same
|
|
2891
|
+
* correction as {@link earthLengthToBody}. Unit-agnostic in the same way, for
|
|
2892
|
+
* whatever squared unit the area is expressed in.
|
|
2893
|
+
*/
|
|
2894
|
+
declare function earthAreaToBody(area: number): number;
|
|
2895
|
+
/**
|
|
2896
|
+
* A raster basemap for a celestial body — the Moon and Mars mosaics, plus the
|
|
2897
|
+
* Earth satellite imagery the planet switcher pairs with Earth. The tiles are
|
|
2898
|
+
* XYZ (or TMS, see {@link scheme}) images in that body's Web-Mercator scheme, so
|
|
2899
|
+
* MapLibre renders them directly. The `styleUrl` is a `geolibre://basemap/<id>`
|
|
2900
|
+
* sentinel; the map controller expands it into a raster style at apply time (it
|
|
2901
|
+
* is not a fetchable URL).
|
|
2902
|
+
*/
|
|
2903
|
+
interface PlanetaryBasemap {
|
|
2904
|
+
id: string;
|
|
2905
|
+
name: string;
|
|
2906
|
+
/** Sentinel stored as the basemap style URL. */
|
|
2907
|
+
styleUrl: string;
|
|
2908
|
+
/** XYZ (or TMS, see {@link scheme}) tile template. */
|
|
2909
|
+
tileUrl: string;
|
|
2910
|
+
/**
|
|
2911
|
+
* Tile row ordering. OpenPlanetaryMap's single-layer raster mosaics (the S3
|
|
2912
|
+
* datasets) are published as **TMS** (tile origin bottom-left, Y flipped),
|
|
2913
|
+
* whereas the CARTO `opmbuilder` named maps are standard **XYZ**. Omit for
|
|
2914
|
+
* XYZ; MapLibre defaults to `"xyz"` when `scheme` is absent.
|
|
2915
|
+
*/
|
|
2916
|
+
scheme?: "tms";
|
|
2917
|
+
/** Max native zoom of the source (MapLibre overzooms beyond this). */
|
|
2918
|
+
maxZoom: number;
|
|
2919
|
+
/** Attribution shown on the map. */
|
|
2920
|
+
attribution: string;
|
|
2921
|
+
/** The body this basemap depicts, so selecting it can set the ellipsoid. */
|
|
2922
|
+
ellipsoidId: EllipsoidId;
|
|
2923
|
+
}
|
|
2924
|
+
declare const PLANETARY_BASEMAP_SENTINEL_PREFIX = "geolibre://basemap/";
|
|
2925
|
+
declare const PLANETARY_BASEMAPS: readonly PlanetaryBasemap[];
|
|
2926
|
+
/**
|
|
2927
|
+
* The section a planetary basemap is grouped under in the New Project and
|
|
2928
|
+
* Change Basemap pickers. The Moon and Mars keep dedicated sections (they are
|
|
2929
|
+
* the most-used bodies and each has several mosaics); every other body is
|
|
2930
|
+
* collapsed into a single "other" section so the picker isn't a wall of
|
|
2931
|
+
* one-item headings.
|
|
2932
|
+
*/
|
|
2933
|
+
type PlanetaryBasemapSectionId = "moon" | "mars" | "other";
|
|
2934
|
+
/** A picker section paired with the planetary basemaps it lists. */
|
|
2935
|
+
interface PlanetaryBasemapGroup {
|
|
2936
|
+
id: PlanetaryBasemapSectionId;
|
|
2937
|
+
basemaps: readonly PlanetaryBasemap[];
|
|
2938
|
+
}
|
|
2939
|
+
/**
|
|
2940
|
+
* {@link PLANETARY_BASEMAPS} grouped for the pickers: one section each for the
|
|
2941
|
+
* Moon and Mars, then a single "Other celestial bodies" section for the rest,
|
|
2942
|
+
* in {@link PLANETARY_BASEMAPS} order (grouped by body). Empty sections are
|
|
2943
|
+
* dropped.
|
|
2944
|
+
*/
|
|
2945
|
+
declare const PLANETARY_BASEMAP_GROUPS: readonly PlanetaryBasemapGroup[];
|
|
2946
|
+
/** Resolve a `geolibre://basemap/<id>` sentinel to its planetary basemap. */
|
|
2947
|
+
declare function getPlanetaryBasemapByStyleUrl(styleUrl: string | undefined): PlanetaryBasemap | undefined;
|
|
2948
|
+
/** Look a planetary basemap up by its stable id. */
|
|
2949
|
+
declare function getPlanetaryBasemapById(id: string): PlanetaryBasemap | undefined;
|
|
2950
|
+
/**
|
|
2951
|
+
* The celestial bodies offered by the Layers-panel planet switcher, in menu
|
|
2952
|
+
* order (like Google Earth's planet dropdown). Each body is paired with the
|
|
2953
|
+
* basemap the switcher applies for it — USGS satellite imagery for Earth, the
|
|
2954
|
+
* OpenPlanetaryMap Hillshaded Albedo mosaic for the Moon, and the OpenPlanetaryMap
|
|
2955
|
+
* Viking mosaic for Mars.
|
|
2956
|
+
*/
|
|
2957
|
+
declare const PLANET_SWITCHER_OPTIONS: readonly [{
|
|
2958
|
+
readonly ellipsoidId: "earth";
|
|
2959
|
+
readonly basemapId: "earth-usgs-imagery";
|
|
2960
|
+
}, {
|
|
2961
|
+
readonly ellipsoidId: "moon";
|
|
2962
|
+
readonly basemapId: "moon-hillshaded-albedo";
|
|
2963
|
+
}, {
|
|
2964
|
+
readonly ellipsoidId: "mars";
|
|
2965
|
+
readonly basemapId: "mars-viking-mdim21";
|
|
2966
|
+
}, {
|
|
2967
|
+
readonly ellipsoidId: "callisto";
|
|
2968
|
+
readonly basemapId: "callisto-galileo-voyager";
|
|
2969
|
+
}, {
|
|
2970
|
+
readonly ellipsoidId: "charon";
|
|
2971
|
+
readonly basemapId: "charon-mosaic";
|
|
2972
|
+
}, {
|
|
2973
|
+
readonly ellipsoidId: "europa";
|
|
2974
|
+
readonly basemapId: "europa-galileo-voyager";
|
|
2975
|
+
}, {
|
|
2976
|
+
readonly ellipsoidId: "ganymede";
|
|
2977
|
+
readonly basemapId: "ganymede-galileo-voyager";
|
|
2978
|
+
}, {
|
|
2979
|
+
readonly ellipsoidId: "io";
|
|
2980
|
+
readonly basemapId: "io-galileo-color";
|
|
2981
|
+
}, {
|
|
2982
|
+
readonly ellipsoidId: "mercury";
|
|
2983
|
+
readonly basemapId: "mercury-messenger-color";
|
|
2984
|
+
}, {
|
|
2985
|
+
readonly ellipsoidId: "pluto";
|
|
2986
|
+
readonly basemapId: "pluto-mosaic";
|
|
2987
|
+
}, {
|
|
2988
|
+
readonly ellipsoidId: "titan";
|
|
2989
|
+
readonly basemapId: "titan-cassini";
|
|
2990
|
+
}, {
|
|
2991
|
+
readonly ellipsoidId: "venus";
|
|
2992
|
+
readonly basemapId: "venus-magellan-color";
|
|
2993
|
+
}];
|
|
2994
|
+
//#endregion
|
|
2995
|
+
//#region src/geojson-z.d.ts
|
|
2996
|
+
/**
|
|
2997
|
+
* Helpers for vector data whose coordinates carry a Z value (elevation), e.g.
|
|
2998
|
+
* GPX tracks with `<ele>` readings or LineStringZ/PointZ geometries. MapLibre's
|
|
2999
|
+
* 2D style layers ignore the third coordinate, so layers that want to render
|
|
3000
|
+
* their Z values use these helpers to detect and rescale elevations before
|
|
3001
|
+
* handing the data to a deck.gl overlay. The same data can carry its elevation
|
|
3002
|
+
* in a `bbox` member too, which `horizontalBbox` trims back to two dimensions.
|
|
3003
|
+
*/
|
|
3004
|
+
/**
|
|
3005
|
+
* Reduces a bounding box to its horizontal extent, `[west, south, east, north]`.
|
|
3006
|
+
*
|
|
3007
|
+
* RFC 7946 §5 lets a `bbox` member carry elevation, in which case it holds six
|
|
3008
|
+
* values — `[west, south, minAltitude, east, north, maxAltitude]` — and
|
|
3009
|
+
* `@turf/bbox` returns a collection's own member verbatim rather than
|
|
3010
|
+
* recomputing it. A consumer reading such a box as four values takes the
|
|
3011
|
+
* altitude for a longitude and the east edge for a latitude; that is how a 3D
|
|
3012
|
+
* feed reached MapLibre as an out-of-range latitude (#2358).
|
|
3013
|
+
*
|
|
3014
|
+
* Returns null when there is no usable horizontal extent: a box of any other
|
|
3015
|
+
* length, or one carrying a non-finite value anywhere — an empty collection, or
|
|
3016
|
+
* one whose features all have a null geometry, bboxes to ±Infinity, and a box
|
|
3017
|
+
* whose altitudes are not finite is not one to trust the rest of.
|
|
3018
|
+
*
|
|
3019
|
+
* @param box - A GeoJSON or Turf bounding box, of four or six values.
|
|
3020
|
+
*/
|
|
3021
|
+
declare function horizontalBbox(box: readonly number[] | null | undefined): [number, number, number, number] | null;
|
|
3022
|
+
/**
|
|
3023
|
+
* Returns true when any coordinate in the GeoJSON carries a finite, non-zero
|
|
3024
|
+
* Z value. All-zero Z arrays are treated as flat data because rendering them
|
|
3025
|
+
* "in 3D" would be indistinguishable from the 2D result. The result is
|
|
3026
|
+
* cached per GeoJSON object, so repeated calls on the same data are free.
|
|
3027
|
+
*
|
|
3028
|
+
* @param geojson - Any GeoJSON object (geometry, feature, or collection).
|
|
3029
|
+
* @param includeZero - Accept zero elevations when explicit absolute-height placement matters.
|
|
3030
|
+
*/
|
|
3031
|
+
declare function geojsonHasZCoordinates(geojson: GeoJSON$1 | null | undefined, includeZero?: boolean): boolean;
|
|
3032
|
+
/**
|
|
3033
|
+
* Returns a copy of the GeoJSON with every coordinate's Z value mapped to
|
|
3034
|
+
* `z * verticalScale + offset` (missing or non-finite Z treated as 0). Used
|
|
3035
|
+
* to apply vertical exaggeration and a constant altitude offset before 3D
|
|
3036
|
+
* rendering. The identity transform (`verticalScale === 1 && offset === 0`)
|
|
3037
|
+
* still produces a copy so the non-finite-Z sanitization applies on every
|
|
3038
|
+
* path — WebGL does not handle NaN positions gracefully.
|
|
3039
|
+
*
|
|
3040
|
+
* @param geojson - The feature collection to transform.
|
|
3041
|
+
* @param verticalScale - Multiplier applied to each Z value.
|
|
3042
|
+
* @param offset - Constant altitude in meters added after scaling.
|
|
3043
|
+
*/
|
|
3044
|
+
declare function transformGeojsonElevation(geojson: FeatureCollection, verticalScale: number, offset: number): FeatureCollection;
|
|
3045
|
+
//#endregion
|
|
3046
|
+
//#region src/polyline.d.ts
|
|
3047
|
+
/**
|
|
3048
|
+
* Pure TypeScript Google Encoded Polyline algorithm codec.
|
|
3049
|
+
*
|
|
3050
|
+
* Supports arbitrary precision:
|
|
3051
|
+
* - precision = 5: Google Maps standard, OSRM, HERE (factor 1e5, ~1.1m precision)
|
|
3052
|
+
* - precision = 6: Valhalla, Mapbox, Open Source Routing Machine 6 (factor 1e6, ~0.11m precision)
|
|
3053
|
+
*
|
|
3054
|
+
* Coordinates are represented as `[lon, lat]` pairs in GeoJSON format.
|
|
3055
|
+
*/
|
|
3056
|
+
/**
|
|
3057
|
+
* Unescapes backslashes in a polyline string.
|
|
3058
|
+
*
|
|
3059
|
+
* When polyline strings are copied from JSON payloads, log files, or source code,
|
|
3060
|
+
* backslashes are frequently double-escaped as `\\` or formatted with escape sequences.
|
|
3061
|
+
*
|
|
3062
|
+
* @param str - Input string with potentially escaped backslashes.
|
|
3063
|
+
* @returns Cleaned polyline string.
|
|
3064
|
+
*/
|
|
3065
|
+
declare function unescapePolyline(str: string): string;
|
|
3066
|
+
interface PolylineDecodeResult {
|
|
3067
|
+
coordinates: [number, number][];
|
|
3068
|
+
complete: boolean;
|
|
3069
|
+
}
|
|
3070
|
+
/**
|
|
3071
|
+
* Decodes an encoded polyline string into an array of `[lon, lat]` coordinates,
|
|
3072
|
+
* along with a `complete` flag indicating whether the entire string was consumed
|
|
3073
|
+
* as complete coordinate pairs without truncation or malformed characters.
|
|
3074
|
+
*
|
|
3075
|
+
* @param encoded - The ASCII-encoded polyline string.
|
|
3076
|
+
* @param precision - Number of decimal digits (default: 5).
|
|
3077
|
+
* @param unescape - Whether to unescape double-escaped backslashes before decoding (default: false).
|
|
3078
|
+
* @returns Object with decoded `coordinates` and `complete` boolean status.
|
|
3079
|
+
*/
|
|
3080
|
+
declare function decodePolylineDetailed(encoded: string, precision?: number, unescape?: boolean): PolylineDecodeResult;
|
|
3081
|
+
/**
|
|
3082
|
+
* Decodes an encoded polyline string into an array of `[lon, lat]` coordinates.
|
|
3083
|
+
*
|
|
3084
|
+
* @param encoded - The ASCII-encoded polyline string.
|
|
3085
|
+
* @param precision - Number of decimal digits (default: 5).
|
|
3086
|
+
* @param unescape - Whether to unescape double-escaped backslashes before decoding (default: false).
|
|
3087
|
+
* @returns Array of `[lon, lat]` coordinate pairs in GeoJSON order.
|
|
3088
|
+
*/
|
|
3089
|
+
declare function decodePolyline(encoded: string, precision?: number, unescape?: boolean): [number, number][];
|
|
3090
|
+
/**
|
|
3091
|
+
* Encodes an array of `[lon, lat]` coordinates into a Google Encoded Polyline string.
|
|
3092
|
+
*
|
|
3093
|
+
* @param coordinates - Array of `[lon, lat]` coordinate pairs.
|
|
3094
|
+
* @param precision - Number of decimal digits (default: 5).
|
|
3095
|
+
* @returns The encoded polyline string.
|
|
3096
|
+
*/
|
|
3097
|
+
declare function encodePolyline(coordinates: [number, number][], precision?: number): string;
|
|
3098
|
+
/**
|
|
3099
|
+
* Decodes an encoded polyline string into a GeoJSON `Feature<LineString>`.
|
|
3100
|
+
*
|
|
3101
|
+
* @param encoded - The polyline string.
|
|
3102
|
+
* @param precision - Coordinate precision (default: 5).
|
|
3103
|
+
* @param properties - Optional feature properties.
|
|
3104
|
+
* @returns A GeoJSON LineString Feature.
|
|
3105
|
+
*/
|
|
3106
|
+
declare function polylineStrToGeoJSON(encoded: string, precision?: number, properties?: GeoJsonProperties): Feature<LineString>;
|
|
3107
|
+
/**
|
|
3108
|
+
* Encodes a GeoJSON LineString, MultiLineString, Feature, or FeatureCollection into encoded polyline string(s).
|
|
3109
|
+
*
|
|
3110
|
+
* @param geojson - The GeoJSON input geometry or feature.
|
|
3111
|
+
* @param precision - Coordinate precision (default: 5).
|
|
3112
|
+
* @returns An encoded polyline string for LineString, or an array of strings for MultiLineString / FeatureCollection.
|
|
3113
|
+
*/
|
|
3114
|
+
declare function geoJSONToPolylineStr(geojson: LineString | MultiLineString | Feature<LineString | MultiLineString> | FeatureCollection<LineString | MultiLineString>, precision?: number): string | string[];
|
|
3115
|
+
interface PolylineBatchOptions {
|
|
3116
|
+
/** Coordinate precision (default: 5) */
|
|
3117
|
+
precision?: number;
|
|
3118
|
+
/** Whether to unescape `\\` backslashes (default: true) */
|
|
3119
|
+
unescape?: boolean;
|
|
3120
|
+
/** Custom delimiter string or RegExp separating individual polylines (default: newline) */
|
|
3121
|
+
delimiter?: string | RegExp;
|
|
3122
|
+
/** Whether to merge lines into a single MultiLineString feature (default: false) */
|
|
3123
|
+
asMultiLine?: boolean;
|
|
3124
|
+
/** Optional base properties to assign to output features */
|
|
3125
|
+
baseProperties?: GeoJsonProperties;
|
|
3126
|
+
}
|
|
3127
|
+
/**
|
|
3128
|
+
* Parses and batch-decodes multiple polylines from a text block or file content.
|
|
3129
|
+
*
|
|
3130
|
+
* @param input - Multiline string or delimited text containing encoded polylines.
|
|
3131
|
+
* @param options - Decoding and parsing configuration.
|
|
3132
|
+
* @returns A FeatureCollection containing LineString (or MultiLineString) features.
|
|
3133
|
+
*/
|
|
3134
|
+
declare function batchDecodePolylines(input: string, options?: PolylineBatchOptions): FeatureCollection<LineString | MultiLineString>;
|
|
3135
|
+
//#endregion
|
|
3136
|
+
//#region src/joins.d.ts
|
|
3137
|
+
/**
|
|
3138
|
+
* Match key for a persistent join: empty values (null/undefined/NaN/empty
|
|
3139
|
+
* string) never match a row, mirroring a SQL/pandas NaN join key. Non-empty
|
|
3140
|
+
* values are keyed by their string form, so a numeric `5` and the string `"5"`
|
|
3141
|
+
* join while a zero-padded code like `"01001"` only matches another `"01001"`.
|
|
3142
|
+
* Kept in sync with the Processing attribute join's `attributeJoinKey`.
|
|
3143
|
+
*/
|
|
3144
|
+
declare function layerJoinKey(value: unknown): string | null;
|
|
3145
|
+
/**
|
|
3146
|
+
* Remove every column previously added by `joins` (per their `addedFields`
|
|
3147
|
+
* bookkeeping) from a copy of `features`, restoring the pre-join properties.
|
|
3148
|
+
* Features without any tracked column are returned unchanged (same reference).
|
|
3149
|
+
*/
|
|
3150
|
+
declare function stripJoinFields(features: Feature[], joins: LayerJoin[] | undefined): Feature[];
|
|
3151
|
+
/** Result of {@link applyLayerJoins}: joined features plus refreshed join records. */
|
|
3152
|
+
interface ApplyLayerJoinsResult {
|
|
3153
|
+
features: Feature[];
|
|
3154
|
+
/** Input joins with `addedFields` and `stats` recomputed for this run. */
|
|
3155
|
+
joins: LayerJoin[];
|
|
3156
|
+
}
|
|
3157
|
+
/**
|
|
3158
|
+
* Apply `joins` in order to base (already-stripped) `features`, returning new
|
|
3159
|
+
* feature objects with the joined columns merged into their properties.
|
|
3160
|
+
*
|
|
3161
|
+
* Semantics per join: left join, first matching join row wins, and joined
|
|
3162
|
+
* columns are null-filled on unmatched features so the schema stays
|
|
3163
|
+
* consistent. An output name (prefix + field) that collides with an existing
|
|
3164
|
+
* column — from the base data or an earlier join — drops that one column;
|
|
3165
|
+
* the join's other columns still apply. A disabled join, or one whose source
|
|
3166
|
+
* cannot be resolved, contributes nothing and gets empty `addedFields` and no
|
|
3167
|
+
* stats.
|
|
3168
|
+
*
|
|
3169
|
+
* @param features - The layer's base features (strip previous joins first).
|
|
3170
|
+
* @param joins - Join definitions in application order.
|
|
3171
|
+
* @param resolveSource - Maps a join's `joinLayerId` to that layer's current
|
|
3172
|
+
* feature collection, or `undefined` when the layer is gone (or is the
|
|
3173
|
+
* target itself; self-joins are refused by the caller).
|
|
3174
|
+
*/
|
|
3175
|
+
declare function applyLayerJoins(features: Feature[], joins: LayerJoin[] | undefined, resolveSource: (joinLayerId: string) => FeatureCollection | undefined): ApplyLayerJoinsResult;
|
|
3176
|
+
/**
|
|
3177
|
+
* Strip-and-reapply this layer's derived columns — persistent joins, then
|
|
3178
|
+
* virtual fields (so an expression can read joined columns) — resolving join
|
|
3179
|
+
* sources from `allLayers`. Pass `nextJoins`/`nextVirtualFields` to replace
|
|
3180
|
+
* the definitions (the layer's current bookkeeping still drives the strip, so
|
|
3181
|
+
* removed definitions clean up after themselves); omit them to refresh the
|
|
3182
|
+
* existing definitions against current data. Layers without a feature
|
|
3183
|
+
* collection are returned unchanged.
|
|
3184
|
+
*/
|
|
3185
|
+
declare function applyJoinsToLayer(layer: GeoLibreLayer, allLayers: GeoLibreLayer[], nextJoins?: LayerJoin[], nextVirtualFields?: LayerVirtualField[]): GeoLibreLayer;
|
|
3186
|
+
/**
|
|
3187
|
+
* Ids of every layer whose data (directly or transitively) feeds `layerId`'s
|
|
3188
|
+
* joins, following `joinLayerId` edges through each source's own joins.
|
|
3189
|
+
* Disabled joins count too: re-enabling one must not spring a cycle. The Joins
|
|
3190
|
+
* UI uses this to keep a layer that already consumes the target — however
|
|
3191
|
+
* indirectly — out of the join-source picker, so circular joins cannot be
|
|
3192
|
+
* authored (the refresh cascade still breaks them defensively for hand-edited
|
|
3193
|
+
* projects).
|
|
3194
|
+
*/
|
|
3195
|
+
declare function collectTransitiveJoinSourceIds(layers: GeoLibreLayer[], layerId: string): Set<string>;
|
|
3196
|
+
/**
|
|
3197
|
+
* Refresh every layer whose joins (directly or transitively) consume the
|
|
3198
|
+
* layer identified by `seedId`, after that layer's data changed — or after it
|
|
3199
|
+
* was removed (a gone source resolves to nothing, so its frozen columns strip
|
|
3200
|
+
* away). The affected layers re-derive in topological dependency order, so a
|
|
3201
|
+
* layer joining two other affected layers sees both of them fresh regardless
|
|
3202
|
+
* of their positions in the layer panel. The seed itself is not touched.
|
|
3203
|
+
*/
|
|
3204
|
+
declare function cascadeLayerJoinRefresh(layers: GeoLibreLayer[], seedId: string): GeoLibreLayer[];
|
|
3205
|
+
/**
|
|
3206
|
+
* Re-resolve every layer's persistent joins against the freshly loaded layer
|
|
3207
|
+
* set (project open). Layers re-derive in topological order of their join
|
|
3208
|
+
* dependencies, so a chain (`C joins A, A joins B`) resolves A before C; a
|
|
3209
|
+
* hand-edited cycle is broken by forcing one of its members through first
|
|
3210
|
+
* (see {@link topologicalJoinOrder}), so consumers downstream of the cycle
|
|
3211
|
+
* still re-derive after it. Layers with virtual fields but no joins re-derive
|
|
3212
|
+
* too (their expressions run against the freshly loaded features). Layer sets
|
|
3213
|
+
* without joins or virtual fields pass through by reference.
|
|
3214
|
+
*/
|
|
3215
|
+
declare function reapplyLayerJoins(layers: GeoLibreLayer[]): GeoLibreLayer[];
|
|
3216
|
+
//#endregion
|
|
3217
|
+
export { BLANK_BASEMAP as $, QuickFilterKind as $n, LayerPopupConfig as $t, PlanetaryBasemap as A, OPENFREEMAP_BASEMAPS as An, isDefaultPrintLayout as Ar, FieldVisibility as At, getEllipsoid as B, ProcessingModelGraph as Bn, Point as Br, LabelDedupe as Bt, ELLIPSOIDS as C, ModelGraphNode as Cn, styleValue as Cr, DashboardWidget as Ct, PLANETARY_BASEMAP_GROUPS as D, ModelToolProvider as Dn, PrintLayoutLegendEntry as Dr, DiagramSizeMode as Dt, PLANETARY_BASEMAPS as E, ModelPortKind as En, PrintLayoutCorner as Er, DiagramField as Et, earthLengthToBody as F, PopupDateFormat as Fn, Feature as Fr, GeometryGeneratorType as Ft, AddTileLayerOptions as G, ProcessingRunStatus as Gn, availableCesiumBasemap as Gr, LayerDescriptiveMetadata as Gt, getPlanetaryBasemapByStyleUrl as H, ProcessingRerunRequest as Hn, CESIUM_BASEMAPS as Hr, LabelTransform as Ht, getActiveBodyRadiusRatio as I, PopupFieldConfig as In, FeatureCollection as Ir, IndicatorAggregation as It, AppRole as J, ProjectPluginControlPosition as Jn, sameCesiumImagery as Jr, LayerJoinStats as Jt, AppCapabilities as K, ProjectComment as Kn, basemapToCesiumImagery as Kr, LayerGroup as Kt, getActiveEllipsoid as L, PopupFieldFormat as Ln, Geometry as Lr, LARGE_VECTOR_FEATURE_THRESHOLD as Lt, PlanetaryBasemapSectionId as M, PROTOMAPS_BASEMAPS as Mn, printLayoutConfigsEqual as Mr, GeoLibreLayer as Mt, bodyLengthToEarth as N, ParticipantIdentity as Nn, scrubPrintLayoutForLayers as Nr, GeoLibreProject as Nt, PLANETARY_BASEMAP_SENTINEL_PREFIX as O, NETCDF_IMAGE_SOURCE_KIND as On, PrintLayoutPageFilter as Or, DiagramType as Ot, earthAreaToBody as P, PointRenderer as Pn, scrubPrintLayoutForRemovedLayers as Pr, GeocodingPreferences as Pt, AttributeFormWidget as Q, QuickFilterDateKind as Qn, LayerMetadataTemporalExtent as Qt, getActiveMeanRadiusMeters as R, PopupFieldKind as Rn, LineString as Rr, LAYER_TYPES as Rt, EARTH_MEAN_RADIUS_METERS as S, ModelGraphEdge as Sn, shouldUseTiledRendering as Sr, DUCKDB_VECTOR_ROUTE_BYTES as St, EllipsoidId as T, ModelGraphPort as Tn, PrintLayoutConfig as Tr, DashboardWidgetType as Tt, meanRadiusMeters as U, ProcessingRun as Un, CesiumBasemapId as Ur, LayerCapabilities as Ut, getPlanetaryBasemapById as V, ProcessingModelStep as Vn, Polygon as Vr, LabelStyle as Vt, setActiveEllipsoidId as W, ProcessingRunKind as Wn, CesiumBasemapImagery as Wr, LayerConnection as Wt, AttributeFormFieldConfig as X, ProjectPreferences as Xn, LayerMetadataContact as Xt, AttributeFormConfig as Y, ProjectPluginState as Yn, LayerLibraryEntry as Yt, AttributeFormValueMapEntry as Z, ProjectTemplateEntry as Zn, LayerMetadataLink as Zt, unescapePolyline as _, MapProjection as _n, VectorRule as _r, DEFAULT_MAP_GRID_LAYOUT as _t, collectTransitiveJoinSourceIds as a, LegendCustomEntry as an, StoryActiveSlideMode as ar, CollaborationParticipant as at, transformGeojsonElevation as b, MapViewState as bn, detectNonGeographicCoordinates as br, DEFAULT_STORY_MAP as bt, stripJoinFields as c, LegendItemOverride as cn, StoryChapterAnimation as cr, CollaborationState as ct, batchDecodePolylines as d, MAX_DASHBOARD_COLUMNS as dn, StoryLayerOpacityChange as dr, CommentReply as dt, LayerQuickFilter as en, QuickFilterTextOperator as er, BLEND_MODES as et, decodePolyline as f, MAX_MAP_GRID_DIM as fn, StoryMap as fr, DEFAULT_BASEMAP as ft, polylineStrToGeoJSON as g, MapPreferences as gn, StyleLibraryEntryKind as gr, DEFAULT_LEGEND_CONFIG as gt, geoJSONToPolylineStr as h, MapGridLayout as hn, StyleLibraryEntry as hr, DEFAULT_LAYER_STYLE as ht, cascadeLayerJoinRefresh as i, LegendConfig as in, SecondaryMapView as ir, CollaborationMode as it, PlanetaryBasemapGroup as j, PROJECT_VERSION as jn, normalizePrintLayoutConfig as jr, FillPattern as jt, PLANET_SWITCHER_OPTIONS as k, NonGeographicCoordinates as kn, createDefaultPrintLayout as kr, EditorTrackingConfig as kt, PolylineBatchOptions as l, LegendPanelPosition as ln, StoryChapterLocation as lr, CommentAnchor as lt, encodePolyline as m, MIN_DASHBOARD_COLUMNS as mn, StrokeWidthUnit as mr, DEFAULT_DASHBOARD_COLUMNS as mt, applyJoinsToLayer as n, LayerType as nn, RuntimeEnvironmentVariable as nr, CollabInvite as nt, layerJoinKey as o, LegendCustomItem as on, StoryChapter as or, CollaborationPresence as ot, decodePolylineDetailed as p, MAX_PROCESSING_HISTORY as pn, StorySlideMode as pr, DEFAULT_BLEND_MODE as pt, AppPrivilege as q, ProjectInteraction as qn, normalizeCesiumBasemap as qr, LayerJoin as qt, applyLayerJoins as r, LayerVirtualField as rn, SQL_QUERY_SOURCE_KIND as rr, CollaborationChatMessage as rt, reapplyLayerJoins as s, LegendCustomShape as sn, StoryChapterAlignment as sr, CollaborationRole as st, ApplyLayerJoinsResult as t, LayerStyle as tn, RecentProjectEntry as tr, BlendMode as tt, PolylineDecodeResult as u, LineDecoration as un, StoryInsetPosition as ur, CommentAuthor as ut, geojsonHasZCoordinates as v, MapRendererKind as vn, VectorStyleMode as vr, DEFAULT_PRIMARY_RENDERER as vt, Ellipsoid as w, ModelGraphNodeKind as wn, DEFAULT_PRINT_LAYOUT as wr, DashboardWidgetAggregation as wt, DEFAULT_ELLIPSOID_ID as x, MarkerShape as xn, isDuckDBQueryLayer as xr, DUCKDB_VECTOR_FEATURE_WARN_COUNT as xt, horizontalBbox as y, MapScaleUnit as yn, VectorStyleStop as yr, DEFAULT_PROJECT_PREFERENCES as yt, getActiveSemiMajorAxisMeters as z, ProcessingModel as zn, MultiPolygon as zr, LabelAnchor as zt };
|
|
3218
|
+
//# sourceMappingURL=joins-CRZZcLqX.d.mts.map
|