webdggrid 1.0.4 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,64 +1,159 @@
1
1
  // @ts-ignore
2
2
  import { loadWasm, unloadWasm } from './libdggrid.wasm.js';
3
3
  /**
4
- * Cell Topology
4
+ * The shape of each cell in the Discrete Global Grid System.
5
+ *
6
+ * DGGRID supports four cell topologies. The most common choice for geospatial
7
+ * analysis is `HEXAGON` because hexagonal cells have equal adjacency (every
8
+ * neighbour shares an edge), uniform area, and minimal boundary-to-area ratio.
5
9
  *
6
10
  * @export
7
- * @enum {String}
11
+ * @enum {string}
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { Topology } from 'webdggrid';
16
+ *
17
+ * dggs.setDggs({ topology: Topology.HEXAGON, ... }, 4);
18
+ * ```
8
19
  */
9
20
  export var Topology;
10
21
  (function (Topology) {
22
+ /** Six-sided cells — the default and most widely used topology. */
11
23
  Topology["HEXAGON"] = "HEXAGON";
24
+ /** Three-sided cells. */
12
25
  Topology["TRIANGLE"] = "TRIANGLE";
26
+ /** Four-sided square cells. */
13
27
  Topology["SQUARE"] = "SQUARE";
28
+ /** Four-sided diamond cells (squares rotated 45°). */
14
29
  Topology["DIAMOND"] = "DIAMOND";
15
30
  })(Topology || (Topology = {}));
16
31
  /**
17
- * Projection type
32
+ * The map projection used to place the polyhedron faces onto the sphere.
33
+ *
34
+ * - **ISEA** (Icosahedral Snyder Equal Area) — preserves cell area at the cost
35
+ * of shape distortion. Recommended for most analytical use-cases.
36
+ * - **FULLER** (Fuller/Dymaxion) — minimises shape distortion but does not
37
+ * preserve equal area.
18
38
  *
19
39
  * @export
20
- * @enum {number}
40
+ * @enum {string}
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * import { Projection } from 'webdggrid';
45
+ *
46
+ * dggs.setDggs({ projection: Projection.ISEA, ... }, 4);
47
+ * ```
21
48
  */
22
49
  export var Projection;
23
50
  (function (Projection) {
51
+ /** Icosahedral Snyder Equal Area projection — equal-area cells. */
24
52
  Projection["ISEA"] = "ISEA";
53
+ /** Fuller/Dymaxion projection — shape-preserving cells. */
25
54
  Projection["FULLER"] = "FULLER";
26
55
  })(Projection || (Projection = {}));
56
+ /**
57
+ * Rewraps a polygon ring that crosses the antimeridian so that all longitudes
58
+ * are in a contiguous range (some may exceed 180°). This is the format
59
+ * expected by MapLibre GL / Mapbox GL globe projection for antimeridian cells.
60
+ * For renderers that require standard [-180, 180] coordinates, use the raw
61
+ * output from {@link Webdggrid.sequenceNumToGrid} directly.
62
+ */
63
+ export function unwrapAntimeridianRing(ring) {
64
+ const lons = ring.map((p) => p[0]);
65
+ const minLon = Math.min(...lons);
66
+ const maxLon = Math.max(...lons);
67
+ if (maxLon - minLon <= 180)
68
+ return ring;
69
+ return ring.map(([lon, lat]) => [lon < 0 ? lon + 360 : lon, lat]);
70
+ }
27
71
  const DEFAULT_RESOLUTION = 1;
28
72
  const DEFAULT_DGGS = {
29
73
  poleCoordinates: { lat: 0, lng: 0 },
30
74
  azimuth: 0,
31
75
  topology: Topology.HEXAGON,
32
76
  projection: Projection.ISEA,
33
- aperture: 7
77
+ aperture: 4
34
78
  };
79
+ /**
80
+ * Main entry point for the WebDggrid library.
81
+ *
82
+ * `Webdggrid` wraps the DGGRID C++ library compiled to WebAssembly and exposes
83
+ * methods for:
84
+ * - **Grid configuration** — choose topology, projection, aperture, and
85
+ * resolution via {@link setDggs} / {@link setResolution}.
86
+ * - **Coordinate conversion** — convert between geographic coordinates and
87
+ * DGGS cell IDs (sequence numbers) with {@link geoToSequenceNum} and
88
+ * {@link sequenceNumToGeo}.
89
+ * - **Grid geometry** — retrieve the polygon boundary of any cell with
90
+ * {@link sequenceNumToGrid} or export a ready-to-render GeoJSON
91
+ * `FeatureCollection` with {@link sequenceNumToGridFeatureCollection}.
92
+ * - **Grid statistics** — query cell counts, areas, and spacings with
93
+ * {@link nCells}, {@link cellAreaKM}, and {@link cellDistKM}.
94
+ *
95
+ * ## Quick start
96
+ *
97
+ * ```ts
98
+ * import { Webdggrid } from 'webdggrid';
99
+ *
100
+ * const dggs = await Webdggrid.load();
101
+ *
102
+ * // Convert a geographic point to its DGGS cell ID at resolution 5
103
+ * const [cellId] = dggs.geoToSequenceNum([[-73.9857, 40.7484]], 5);
104
+ *
105
+ * // Get the polygon boundary of that cell as GeoJSON
106
+ * const geojson = dggs.sequenceNumToGridFeatureCollection([cellId], 5);
107
+ * ```
108
+ *
109
+ * ## Lifecycle
110
+ *
111
+ * The WASM module is a singleton. Call {@link Webdggrid.load} once and reuse
112
+ * the returned instance throughout your application. Call
113
+ * {@link Webdggrid.unload} when you are completely done to free memory.
114
+ */
35
115
  export class Webdggrid {
36
116
  constructor(_module) {
37
117
  this._module = _module;
118
+ /**
119
+ * The active DGGS configuration used by all conversion and statistics
120
+ * methods. Change it at any time via {@link setDggs}.
121
+ *
122
+ * Defaults to ISEA4H (ISEA projection, aperture 4, hexagon topology,
123
+ * pole at 0° N 0° E, azimuth 0°).
124
+ */
38
125
  this.dggs = DEFAULT_DGGS;
126
+ /**
127
+ * The active grid resolution. Higher values produce finer, smaller cells.
128
+ * The valid range depends on the aperture — for aperture 4 the practical
129
+ * limit is around resolution 15 before cell counts become unwieldy.
130
+ *
131
+ * Change via {@link setResolution} or pass an explicit `resolution`
132
+ * argument to any conversion method.
133
+ *
134
+ * Defaults to `1`.
135
+ */
39
136
  this.resolution = DEFAULT_RESOLUTION;
40
- this._wVectorToArray = (vector) => {
41
- if (vector.size() === 0) {
42
- return [];
43
- }
44
- const objectType = vector.$$.ptrType.name;
45
- switch (objectType) {
46
- case 'BigIntegerVector*':
47
- return this._vectorToArray(vector);
48
- default:
49
- return [];
50
- }
51
- };
52
137
  this._module = _module;
53
138
  }
54
139
  /**
55
- * Compiles and instantiates the raw wasm.
140
+ * Compiles and instantiates the DGGRID WebAssembly module.
141
+ *
142
+ * This is the only way to construct a `Webdggrid` instance. The method is
143
+ * asynchronous because WebAssembly compilation is prohibited on the main
144
+ * thread for buffers larger than 4 KB.
145
+ *
146
+ * ```ts
147
+ * const dggs = await Webdggrid.load();
148
+ * ```
56
149
  *
57
150
  * ::: info
58
- * In general WebAssembly compilation is disallowed on the main thread if the buffer size is larger than 4KB, hence forcing `load` to be asynchronous;
151
+ * In general WebAssembly compilation is disallowed on the main thread if
152
+ * the buffer size is larger than 4 KB, hence forcing `load` to be
153
+ * asynchronous.
59
154
  * :::
60
155
  *
61
- * @returns A promise to an instance of the Webdggrid class.
156
+ * @returns A promise that resolves to a fully initialised `Webdggrid` instance.
62
157
  */
63
158
  static load() {
64
159
  return loadWasm().then((module) => {
@@ -66,99 +161,232 @@ export class Webdggrid {
66
161
  }).catch(console.log);
67
162
  }
68
163
  /**
69
- * Unloades the compiled wasm instance.
164
+ * Releases the compiled WASM instance and frees its memory.
165
+ *
166
+ * Call this when your application no longer needs the library. After
167
+ * calling `unload`, any existing `Webdggrid` instances become unusable —
168
+ * you must call {@link load} again to create a new one.
70
169
  */
71
170
  static unload() {
72
171
  unloadWasm();
73
172
  }
74
173
  /**
75
- * @returns The Webdggrid c++ version
174
+ * Returns the version string of the underlying DGGRID C++ library.
175
+ *
176
+ * ```ts
177
+ * console.log(dggs.version()); // e.g. "8.3b"
178
+ * ```
179
+ *
180
+ * @returns The DGGRID C++ library version string.
76
181
  */
77
182
  version() {
78
183
  return this._module.Webdggrid.prototype.version();
79
184
  }
80
185
  /**
81
- * Set the main dggs configuration
82
- * @param dggs A dggs object
186
+ * Sets both the DGGS configuration and the resolution in one call.
187
+ *
188
+ * All subsequent conversion and statistics methods will use this
189
+ * configuration unless they receive an explicit `resolution` argument.
190
+ *
191
+ * ```ts
192
+ * dggs.setDggs({
193
+ * poleCoordinates: { lat: 0, lng: 0 },
194
+ * azimuth: 0,
195
+ * aperture: 4,
196
+ * topology: Topology.HEXAGON,
197
+ * projection: Projection.ISEA,
198
+ * }, 5);
199
+ * ```
200
+ *
201
+ * @param dggs - The new DGGS configuration. Defaults to ISEA4H at pole (0,0).
202
+ * @param resolution - The new resolution level. Defaults to `1`.
83
203
  */
84
204
  setDggs(dggs = DEFAULT_DGGS, resolution = DEFAULT_RESOLUTION) {
85
205
  this.dggs = dggs;
86
206
  this.resolution = resolution;
87
207
  }
88
208
  /**
89
- * Get the resolution of the current dggs
90
- * @returns {number} the current dggs resolution
91
- * @memberof WebDggrid
209
+ * Returns the currently active grid resolution.
210
+ *
211
+ * ```ts
212
+ * dggs.setResolution(7);
213
+ * console.log(dggs.getResolution()); // 7
214
+ * ```
215
+ *
216
+ * @returns The current resolution level.
92
217
  */
93
218
  getResolution() {
94
219
  return this.resolution;
95
220
  }
96
221
  /**
97
- * Set the resolution of the dggs
98
- * @param {number} [resolution=DEFAULT_RESOLUTION] the resolution. It should be a valid integer
99
- * @memberof WebDggrid
222
+ * Sets the grid resolution used by default in all conversion and
223
+ * statistics methods.
224
+ *
225
+ * ```ts
226
+ * dggs.setResolution(5);
227
+ * const count = dggs.nCells(); // uses resolution 5
228
+ * ```
229
+ *
230
+ * @param resolution - The new resolution level. Must be a positive integer.
100
231
  */
101
232
  setResolution(resolution) {
102
233
  this.resolution = resolution;
103
234
  }
104
235
  /**
105
- * test function
106
- *
107
- * @return {*}
108
- * @memberof WebDggrid
236
+ * Internal test helper that invokes the WASM module's `_main` entry point.
237
+ * Not intended for production use.
238
+ * @internal
109
239
  */
110
240
  _main() {
111
241
  return this._module._main();
112
242
  }
113
243
  /**
114
- * @follow Hi
115
- * Returns the number of the cells in specific resolution
116
- * @param {number} [resolution=DEFAULT_RESOLUTION]
117
- * @return {number}
118
- * @memberof WebDggrid
244
+ * Returns the total number of cells that tile the entire globe at the
245
+ * given resolution under the current DGGS configuration.
246
+ *
247
+ * Cell counts grow exponentially with resolution. For the default ISEA4H
248
+ * grid:
249
+ *
250
+ * | Resolution | Approx. cell count |
251
+ * |---|---|
252
+ * | 1 | 42 |
253
+ * | 2 | 162 |
254
+ * | 3 | 642 |
255
+ * | 4 | 2 562 |
256
+ * | 5 | 10 242 |
257
+ * | 6 | 40 962 |
258
+ *
259
+ * ```ts
260
+ * const total = dggs.nCells(3); // 642
261
+ * ```
262
+ *
263
+ * @param resolution - Resolution level to query. Defaults to the instance's
264
+ * current {@link resolution}.
265
+ * @returns Total number of cells at the given resolution.
119
266
  */
120
267
  nCells(resolution = DEFAULT_RESOLUTION) {
121
268
  const { poleCoordinates: { lat, lng }, azimuth, topology, projection, aperture, } = this.dggs;
122
- const cellCount = this._module.nCells(lat, lng, azimuth, aperture, resolution, topology, projection);
269
+ const cellCount = this._module.nCells(lng, lat, azimuth, aperture, resolution, topology, projection);
123
270
  return cellCount;
124
271
  }
272
+ /**
273
+ * Returns the average area of a single cell in square kilometres at the
274
+ * given resolution.
275
+ *
276
+ * Because ISEA guarantees equal-area cells, all cells have the same area
277
+ * when using the `ISEA` projection. With `FULLER` the value is an average.
278
+ *
279
+ * ```ts
280
+ * const areakm2 = dggs.cellAreaKM(5);
281
+ * ```
282
+ *
283
+ * @param resolution - Resolution level to query. Defaults to the instance's
284
+ * current {@link resolution}.
285
+ * @returns Average cell area in km².
286
+ */
125
287
  cellAreaKM(resolution = DEFAULT_RESOLUTION) {
126
288
  const { poleCoordinates: { lat, lng }, azimuth, topology, projection, aperture, } = this.dggs;
127
- const cellCount = this._module.nCells(lat, lng, azimuth, aperture, resolution, topology, projection);
289
+ const cellCount = this._module.cellAreaKM(lng, lat, azimuth, aperture, resolution, topology, projection);
128
290
  return cellCount;
129
291
  }
292
+ /**
293
+ * Returns the average centre-to-centre distance between neighbouring cells
294
+ * in kilometres at the given resolution.
295
+ *
296
+ * This is useful for estimating spatial join radii or selecting a
297
+ * resolution that matches a target spatial scale.
298
+ *
299
+ * ```ts
300
+ * const spacingKm = dggs.cellDistKM(5);
301
+ * ```
302
+ *
303
+ * @param resolution - Resolution level to query. Defaults to the instance's
304
+ * current {@link resolution}.
305
+ * @returns Average cell spacing in km.
306
+ */
130
307
  cellDistKM(resolution = DEFAULT_RESOLUTION) {
131
308
  const { poleCoordinates: { lat, lng }, azimuth, topology, projection, aperture, } = this.dggs;
132
- const cellCount = this._module.nCells(lat, lng, azimuth, aperture, resolution, topology, projection);
309
+ const cellCount = this._module.cellDistKM(lng, lat, azimuth, aperture, resolution, topology, projection);
133
310
  return cellCount;
134
311
  }
312
+ /**
313
+ * Returns the characteristic length scale (CLS) of the grid at the given
314
+ * resolution — defined as the square root of the average cell area.
315
+ *
316
+ * CLS provides a single scalar that summarises the spatial granularity of
317
+ * the grid, useful for comparing resolutions across different DGGS
318
+ * configurations.
319
+ *
320
+ * ```ts
321
+ * const cls = dggs.gridStatCLS(4);
322
+ * ```
323
+ *
324
+ * @param resolution - Resolution level to query. Defaults to the instance's
325
+ * current {@link resolution}.
326
+ * @returns Grid CLS value.
327
+ */
135
328
  gridStatCLS(resolution = DEFAULT_RESOLUTION) {
136
329
  const { poleCoordinates: { lat, lng }, azimuth, topology, projection, aperture, } = this.dggs;
137
- const cellCount = this._module.nCells(lat, lng, azimuth, aperture, resolution, topology, projection);
330
+ const cellCount = this._module.gridStatCLS(lng, lat, azimuth, aperture, resolution, topology, projection);
138
331
  return cellCount;
139
332
  }
140
333
  /**
141
- * Converts an array of geography coordinates to the list of the sequence numbers AKA DggId
142
- * @param coordinates A 2d array of [[lng, lat]] values
143
- * @param resolution [resolution=DEFAULT_RESOLUTION] The dggs resolution
144
- * @returns An array of the DggIds
334
+ * Converts an array of geographic coordinates to their corresponding DGGS
335
+ * cell sequence numbers (cell IDs) at the given resolution.
336
+ *
337
+ * Each coordinate is mapped to the single cell whose boundary contains it.
338
+ * Multiple coordinates that fall within the same cell will return the same
339
+ * sequence number.
340
+ *
341
+ * Coordinates must be supplied in **`[lng, lat]`** order (GeoJSON
342
+ * convention), **not** `[lat, lng]`.
343
+ *
344
+ * ```ts
345
+ * // New York City
346
+ * const ids = dggs.geoToSequenceNum([[-74.006, 40.7128]], 5);
347
+ * console.log(ids); // [12345n]
348
+ *
349
+ * // Multiple points at once
350
+ * const ids2 = dggs.geoToSequenceNum(
351
+ * [[-74.006, 40.7128], [2.3522, 48.8566]],
352
+ * 5
353
+ * );
354
+ * ```
355
+ *
356
+ * @param coordinates - Array of `[lng, lat]` pairs in decimal degrees.
357
+ * @param resolution - Resolution at which to perform the lookup. Defaults
358
+ * to the instance's current {@link resolution}.
359
+ * @returns Array of `BigInt` sequence numbers, one per input coordinate,
360
+ * in the same order.
145
361
  */
146
362
  geoToSequenceNum(coordinates, resolution = DEFAULT_RESOLUTION) {
147
363
  const { poleCoordinates: { lat, lng }, azimuth, topology, projection, aperture, } = this.dggs;
148
364
  const xCoords = coordinates.map((coord) => coord[0]);
149
365
  const yCoords = coordinates.map((coord) => coord[1]);
150
- const resultArray = this._module.DgGEO_to_SEQNUM(lat, lng, azimuth, aperture, resolution, topology, projection, xCoords, yCoords);
366
+ const resultArray = this._module.DgGEO_to_SEQNUM(lng, lat, azimuth, aperture, resolution, topology, projection, xCoords, yCoords);
151
367
  return resultArray;
152
368
  }
153
369
  /**
154
- * Convert a sequence number to the [lng,lat] of the center of the related cell
155
- * @param sequenceNum
156
- * @param resolution [resolution=DEFAULT_RESOLUTION]
157
- * @returns An array of [lng,lat]
370
+ * Converts an array of DGGS cell sequence numbers to the geographic
371
+ * coordinates of their centroids.
372
+ *
373
+ * The returned coordinates are in **`[lng, lat]`** order (GeoJSON
374
+ * convention).
375
+ *
376
+ * ```ts
377
+ * const centroids = dggs.sequenceNumToGeo([1n, 2n, 3n], 3);
378
+ * // [[lng0, lat0], [lng1, lat1], [lng2, lat2]]
379
+ * ```
380
+ *
381
+ * @param sequenceNum - Array of `BigInt` cell IDs to look up.
382
+ * @param resolution - Resolution at which the IDs were generated. Defaults
383
+ * to the instance's current {@link resolution}.
384
+ * @returns Array of `[lng, lat]` centroid positions, one per input ID, in
385
+ * the same order.
158
386
  */
159
387
  sequenceNumToGeo(sequenceNum, resolution = DEFAULT_RESOLUTION) {
160
388
  const { poleCoordinates: { lat, lng }, azimuth, topology, projection, aperture, } = this.dggs;
161
- const resultArray = this._module.SEQNUM_to_GEO(lat, lng, azimuth, aperture, resolution, topology, projection, sequenceNum);
389
+ const resultArray = this._module.SEQNUM_to_GEO(lng, lat, azimuth, aperture, resolution, topology, projection, sequenceNum);
162
390
  const size = resultArray.length / 2;
163
391
  const arrayOfArrays = [];
164
392
  for (let i = 0; i < size; i += 1) {
@@ -167,16 +395,37 @@ export class Webdggrid {
167
395
  return arrayOfArrays;
168
396
  }
169
397
  /**
170
- * Converts a set of coordinates to the cell centroid values
171
- * @param coordinates A 2d array of lng and lat values
172
- * @param resolution [resolution=DEFAULT_RESOLUTION] The resolution of the dggs
173
- * @returns An array of dggs cell centroid coordinates
398
+ * Snaps an array of geographic coordinates to the centroid of the DGGS
399
+ * cell that contains each point.
400
+ *
401
+ * This is equivalent to calling {@link geoToSequenceNum} followed by
402
+ * {@link sequenceNumToGeo} but is more efficient because it avoids
403
+ * returning the intermediate sequence numbers.
404
+ *
405
+ * Useful for spatial aggregation: all points that fall within the same
406
+ * cell will map to the identical centroid coordinate.
407
+ *
408
+ * Coordinates must be in **`[lng, lat]`** order.
409
+ *
410
+ * ```ts
411
+ * const snapped = dggs.geoToGeo(
412
+ * [[-74.006, 40.7128], [-74.010, 40.720]],
413
+ * 5
414
+ * );
415
+ * // Both points snap to the same centroid if they share a cell
416
+ * ```
417
+ *
418
+ * @param coordinates - Array of `[lng, lat]` pairs in decimal degrees.
419
+ * @param resolution - Resolution at which to perform the snapping. Defaults
420
+ * to the instance's current {@link resolution}.
421
+ * @returns Array of `[lng, lat]` cell centroid positions, one per input
422
+ * coordinate, in the same order.
174
423
  */
175
424
  geoToGeo(coordinates, resolution = DEFAULT_RESOLUTION) {
176
425
  const { poleCoordinates: { lat, lng }, azimuth, topology, projection, aperture, } = this.dggs;
177
426
  const xCoords = coordinates.map((coord) => coord[0]);
178
427
  const yCoords = coordinates.map((coord) => coord[1]);
179
- const resultArray = this._module.GEO_to_GEO(lat, lng, azimuth, aperture, resolution, topology, projection, xCoords, yCoords);
428
+ const resultArray = this._module.GEO_to_GEO(lng, lat, azimuth, aperture, resolution, topology, projection, xCoords, yCoords);
180
429
  const size = resultArray.length / 2;
181
430
  const arrayOfArrays = [];
182
431
  for (let i = 0; i < size; i += 1) {
@@ -184,20 +433,114 @@ export class Webdggrid {
184
433
  }
185
434
  return arrayOfArrays;
186
435
  }
187
- _is2dArray(array) { return array.some((item) => Array.isArray(item)); }
188
- _arrayToVector(array) {
189
- const is2d = this._is2dArray(array);
190
- if (is2d) {
191
- const dDVector = new this._module.DoubleVectorVector();
192
- array.forEach((item) => {
193
- const dVector = new this._module.DoubleVector();
194
- dVector.push_back(item[0]);
195
- dVector.push_back(item[1]);
196
- dDVector.push_back(dVector);
197
- });
198
- return dDVector;
436
+ /**
437
+ * Returns the polygon boundary vertices for each cell in `sequenceNum`.
438
+ *
439
+ * Each cell is represented as an array of `[lng, lat]` vertex positions.
440
+ * The ring is **not** automatically closed (the first and last vertex are
441
+ * different) close it yourself if your renderer requires it.
442
+ *
443
+ * Prefer {@link sequenceNumToGridFeatureCollection} when you need
444
+ * GeoJSON output ready for a mapping library.
445
+ *
446
+ * ```ts
447
+ * const rings = dggs.sequenceNumToGrid([1n, 2n], 3);
448
+ * // rings[0] = [[lng0,lat0], [lng1,lat1], ..., [lng5,lat5]] (hexagon)
449
+ * ```
450
+ *
451
+ * @param sequenceNum - Array of `BigInt` cell IDs whose boundaries to
452
+ * retrieve.
453
+ * @param resolution - Resolution at which the IDs were generated. Defaults
454
+ * to the instance's current {@link resolution}.
455
+ * @returns A 2-D array: `result[i]` is the vertex ring of `sequenceNum[i]`.
456
+ * Each vertex is a `[lng, lat]` position.
457
+ * @throws If the WASM module encounters an invalid cell ID.
458
+ */
459
+ sequenceNumToGrid(sequenceNum, resolution = DEFAULT_RESOLUTION) {
460
+ const { poleCoordinates: { lat, lng }, azimuth, topology, projection, aperture, } = this.dggs;
461
+ const inputSize = sequenceNum.length;
462
+ let resultArray = [];
463
+ try {
464
+ resultArray = this._module.SeqNumGrid(lng, lat, azimuth, aperture, resolution, topology, projection, sequenceNum);
465
+ }
466
+ catch (e) {
467
+ console.error(this._module.getExceptionMessage(e).toString());
468
+ throw (e);
469
+ }
470
+ const allShapeVertexes = resultArray.slice(0, inputSize);
471
+ const sumVertexes = allShapeVertexes.reduce((accumulator, currentValue) => {
472
+ return accumulator + currentValue;
473
+ }, 0);
474
+ const featureSet = [];
475
+ let xOffset = inputSize;
476
+ let yOffset = inputSize + sumVertexes;
477
+ for (let i = 0; i < allShapeVertexes.length; i += 1) {
478
+ const numVertexes = allShapeVertexes[i];
479
+ const currentShapeXVertexes = resultArray.slice(xOffset, xOffset + numVertexes);
480
+ const currentShapeYVertexes = resultArray.slice(yOffset, yOffset + numVertexes);
481
+ const coordinates = [];
482
+ for (let i = 0; i < numVertexes; i += 1) {
483
+ coordinates.push([currentShapeXVertexes[i], currentShapeYVertexes[i]]);
484
+ }
485
+ featureSet.push(unwrapAntimeridianRing(coordinates));
486
+ xOffset += numVertexes;
487
+ yOffset += numVertexes;
199
488
  }
489
+ return featureSet;
490
+ }
491
+ /**
492
+ * Converts an array of DGGS cell IDs into a GeoJSON `FeatureCollection`
493
+ * where each `Feature` is a `Polygon` representing the cell boundary.
494
+ *
495
+ * This is the primary method for rendering DGGS cells with mapping
496
+ * libraries such as MapLibre GL JS, Leaflet, or deck.gl.
497
+ *
498
+ * Each feature includes:
499
+ * - `geometry` — a closed `Polygon` in `[lng, lat]` coordinate order.
500
+ * - `id` — the cell sequence number (converted to `string` recommended
501
+ * before passing to MapLibre to avoid BigInt serialisation errors).
502
+ * - `properties.id` — same value as `id`, accessible inside layer
503
+ * expressions.
504
+ *
505
+ * ```ts
506
+ * const ids = dggs.geoToSequenceNum([[-74.006, 40.7128]], 5);
507
+ * const fc = dggs.sequenceNumToGridFeatureCollection(ids, 5);
508
+ *
509
+ * // MapLibre / structured-clone safe: convert BigInt → string
510
+ * fc.features.forEach(f => {
511
+ * if (typeof f.id === 'bigint') f.id = f.id.toString();
512
+ * if (f.properties?.id) f.properties.id = f.properties.id.toString();
513
+ * });
514
+ *
515
+ * map.getSource('grid').setData(fc);
516
+ * ```
517
+ *
518
+ * @param sequenceNum - Array of `BigInt` cell IDs to convert.
519
+ * @param resolution - Resolution at which the IDs were generated. Defaults
520
+ * to the instance's current {@link resolution}.
521
+ * @returns A GeoJSON `FeatureCollection` of `Polygon` features, one per
522
+ * input cell ID.
523
+ */
524
+ sequenceNumToGridFeatureCollection(sequenceNum, resolution = DEFAULT_RESOLUTION) {
525
+ const coordinatesArray = this.sequenceNumToGrid(sequenceNum, resolution);
526
+ const features = coordinatesArray.map((coordinates, index) => {
527
+ const seqNum = sequenceNum[index];
528
+ return {
529
+ type: 'Feature',
530
+ geometry: {
531
+ type: 'Polygon',
532
+ coordinates: [coordinates]
533
+ },
534
+ id: seqNum,
535
+ properties: {
536
+ id: seqNum
537
+ }
538
+ };
539
+ });
540
+ return {
541
+ type: 'FeatureCollection',
542
+ features,
543
+ };
200
544
  }
201
- _vectorToArray(vector) { return new Array(vector.size()).fill(0).map((_, id) => vector.get(id)); }
202
545
  }
203
546
  //# sourceMappingURL=webdggrid.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webdggrid.js","sourceRoot":"","sources":["../src-ts/webdggrid.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,CAAN,IAAY,QAKX;AALD,WAAY,QAAQ;IAChB,+BAAqB,CAAA;IACrB,iCAAuB,CAAA;IACvB,6BAAmB,CAAA;IACnB,+BAAqB,CAAA;AACzB,CAAC,EALW,QAAQ,KAAR,QAAQ,QAKnB;AACD;;;;;GAKG;AACH,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,2BAAe,CAAA;IACf,+BAAmB,CAAA;AACvB,CAAC,EAHW,UAAU,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