@versatiles/versatiles-rs 4.8.0 → 4.9.1

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.
Files changed (7) hide show
  1. package/README.md +71 -4
  2. package/index.cjs +57 -54
  3. package/index.d.ts +227 -19
  4. package/index.js +58 -55
  5. package/package.json +11 -11
  6. package/vpl.d.ts +430 -142
  7. package/vpl.js +99 -33
package/vpl.d.ts CHANGED
@@ -100,326 +100,614 @@ export declare function parseCstResult(vpl: string): CstParseResult;
100
100
  export declare function parseCst(vpl: string): CstFile;
101
101
  /** Write a lossless syntax tree back out as VPL text. */
102
102
  export declare function stringifyCst(cst: CstFile): string;
103
+ /**
104
+ * Reformat a syntax tree, keeping its comments.
105
+ *
106
+ * Whitespace and nothing else is rewritten: parameters keep the order they were written in
107
+ * and values keep the quotes the author chose. Every comment keeps the token it was attached
108
+ * to and takes that token's line and indentation. The returned tree carries fresh spans.
109
+ */
110
+ export declare function formatCst(cst: CstFile): CstFile;
103
111
  export interface FromColorOptions {
104
- /** Hex color in RGB or RGBA format (e.g., "FF5733" or "FF573380"). Defaults to "000000" (black). */
112
+ /**
113
+ * Hex colour, `RRGGBB` or `RRGGBBAA`. Defaults to `000000`.
114
+ *
115
+ * @default 000000
116
+ */
105
117
  color?: string;
106
- /** Tile size in pixels (256 or 512). Defaults to 512. */
118
+ /**
119
+ * Tile size in pixels, `256` or `512`. Defaults to `512`.
120
+ *
121
+ * @default 512
122
+ */
107
123
  size?: number;
108
- /** Tile format: one of "avif", "jpg", "png", or "webp". Defaults to "png". */
109
- format?: "avif" | "bin" | "geojson" | "jpg" | "json" | "mvt" | "png" | "svg" | "topojson" | "webp";
124
+ /**
125
+ * Format to encode the tiles in. Defaults to `png`.
126
+ *
127
+ * @default png
128
+ */
129
+ format?: "avif" | "jpg" | "png" | "webp";
110
130
  }
111
131
  export interface FromContainerOptions {
112
- /** The filename of the tile container (relative to the VPL file path), or a URL (http/https). For example: `filename="world.versatiles"` or `filename="https://example.com/world.versatiles"`. */
132
+ /** Path to the container, or an `http`, `https` or `sftp` URL. */
113
133
  filename: string;
134
+ /** Private key for this one `sftp://` source. Defaults to the global setting. */
135
+ sshIdentity?: string;
114
136
  }
115
137
  export interface FromCsvOptions {
116
- /** Filename of the CSV file (relative to the VPL file path). */
138
+ /** Path to the CSV file. */
117
139
  filename: string;
118
- /** Header column name holding the longitude (degrees, WGS84). Required. */
140
+ /** Column holding the longitude, in WGS84 degrees. */
119
141
  lonColumn: string;
120
- /** Header column name holding the latitude (degrees, WGS84). Required. */
142
+ /** Column holding the latitude, in WGS84 degrees. */
121
143
  latColumn: string;
122
- /** Optional column to expose as the MVT feature `id` (numeric if it parses as `u64`, else string). */
144
+ /** Column to expose as the feature id. Defaults to emitting no id. */
123
145
  idColumn?: string;
124
- /** Field delimiter as a single ASCII character. Defaults to `,`. */
146
+ /**
147
+ * Character separating a row's fields. Defaults to `,`.
148
+ *
149
+ * @default ,
150
+ */
125
151
  delimiter?: string;
126
- /** Whether row 1 contains column names. Defaults to `true`. Header-less CSVs aren't supported in v1. */
152
+ /**
153
+ * Whether the first row holds column names; `false` is not supported yet. Defaults to `true`.
154
+ *
155
+ * @default true
156
+ */
127
157
  hasHeader?: boolean;
128
- /** Name of the MVT layer in the output tiles. Defaults to the filename stem. */
158
+ /** Name of the layer to write into. Defaults to the file's stem. */
129
159
  layerName?: string;
130
- /** Lowest zoom level emitted (default 0). */
160
+ /**
161
+ * Lowest zoom level to emit. Defaults to `0`.
162
+ *
163
+ * @default 0
164
+ */
131
165
  minZoom?: number;
132
- /** Highest zoom level emitted. Defaults to an auto-heuristic (median feature size ≈ 4 tile-pixels, capped at 14). For point-only inputs the heuristic returns 14. */
166
+ /** Highest zoom level to emit. Defaults to a heuristic capped at `14`. */
133
167
  maxZoom?: number;
134
- /** Bounding-box clip in degrees `[w, s, e, n]`. Not supported in v1; setting this errors out. */
168
+ /** Area to clip to, in WGS84 degrees. Not implemented yet. Defaults to no clipping. */
135
169
  bbox?: [number, number, number, number];
136
- /** Property whitelist: keep only the named columns as feature properties, drop everything else. Mutually exclusive with `properties_exclude`. (`lon_column` / `lat_column` / `id_column` are consumed earlier by the CSV adapter and aren't affected.) */
170
+ /** Columns to keep as properties. Mutually exclusive with `properties_exclude`. Defaults to all. */
137
171
  propertiesInclude?: unknown;
138
- /** Property blacklist: drop the named properties, keep everything else. Mutually exclusive with `properties_include`. */
172
+ /** Columns to drop. Mutually exclusive with `properties_include`. Defaults to none. */
139
173
  propertiesExclude?: unknown;
140
- /** Point reduction strategy: `none` / `drop_rate` / `min_distance` (default `min_distance`). */
174
+ /**
175
+ * How to thin out points too close to distinguish. Defaults to `min_distance`.
176
+ *
177
+ * @default min_distance
178
+ */
141
179
  pointReduction?: "none" | "drop_rate" | "min_distance";
142
- /** Numeric value whose meaning depends on `point_reduction`: - `min_distance` (default): minimum distance between kept points, in tile-pixels at the current zoom. Defaults to 16. - `drop_rate`: per-zoom keep-fraction in `[0, 1]`. Defaults to 0.5. - `none`: ignored. */
180
+ /** Distance in tile-pixels for `min_distance`, keep-fraction for `drop_rate`. Defaults to `16`/`0.5`. */
143
181
  pointReductionValue?: number;
144
- /** Tile-compression applied before the tiles leave this operation: `gzip` (default), `brotli`, `zstd`, or `none`. */
182
+ /**
183
+ * Compression applied before the tiles leave. Defaults to `gzip`.
184
+ *
185
+ * @default gzip
186
+ */
145
187
  compression?: "none" | "gzip" | "brotli" | "zstd";
146
- /** Maximum encoded tile size in bytes before a tile is considered broken and dropped (streaming path) / errors out (single-tile path). Defaults to 1048576 (1 MiB). Raise it when a legitimate low-zoom tile exceeds the default (e.g. `max_tile_bytes=2097152` for 2 MiB), or set `max_tile_bytes=none` to emit tiles at any size. The soft-cap warning threshold (200 KB at the default cap) scales with this value. */
188
+ /**
189
+ * Size in bytes above which a tile counts as broken. Defaults to `1048576`.
190
+ *
191
+ * @default 1048576
192
+ */
147
193
  maxTileBytes?: number | "none";
148
194
  }
149
195
  export interface FromDebugOptions {
150
- /** Target tile format: one of `"mvt"` (default), `"avif"`, `"jpg"`, `"png"` or `"webp"` */
151
- format?: "avif" | "bin" | "geojson" | "jpg" | "json" | "mvt" | "png" | "svg" | "topojson" | "webp";
196
+ /**
197
+ * Format to generate the tiles in. Defaults to `mvt`.
198
+ *
199
+ * @default mvt
200
+ */
201
+ format?: "mvt" | "avif" | "jpg" | "png" | "webp";
152
202
  }
153
203
  export interface FromGeoOptions {
154
- /** Filename of the input (relative to the VPL file path). Format is detected from the extension: - `.geojson` / `.json` — GeoJSON `FeatureCollection` - `.ndjson` / `.geojsonl` / `.ndgeojson` / `.geojsonseq` — line-delimited GeoJSON (one feature per line; `.geojsonseq` may use the RFC 8142 record-separator prefix `U+001E`) - `.shp` — Esri Shapefile */
204
+ /** Path to the input file; its format comes from the extension. */
155
205
  filename: string;
156
- /** Name of the MVT layer in the output tiles. Defaults to the filename stem. */
206
+ /** Name of the layer to write into. Defaults to the file's stem. */
157
207
  layerName?: string;
158
- /** Lowest zoom level emitted (default 0). */
208
+ /**
209
+ * Lowest zoom level to emit. Defaults to `0`.
210
+ *
211
+ * @default 0
212
+ */
159
213
  minZoom?: number;
160
- /** Highest zoom level emitted. Defaults to an auto-heuristic (median feature size ≈ 4 tile-pixels, capped at 14). */
214
+ /** Highest zoom level to emit. Defaults to a heuristic capped at `14`. */
161
215
  maxZoom?: number;
162
- /** Bounding-box clip in degrees `[w, s, e, n]`. Not supported in v1; setting this errors out. */
216
+ /** Area to clip to, in WGS84 degrees. Not implemented yet. Defaults to no clipping. */
163
217
  bbox?: [number, number, number, number];
164
- /** Property whitelist: keep only the named properties, drop everything else. Mutually exclusive with `properties_exclude`. */
218
+ /** Properties to keep. Mutually exclusive with `properties_exclude`. Defaults to all. */
165
219
  propertiesInclude?: unknown;
166
- /** Property blacklist: drop the named properties, keep everything else. Mutually exclusive with `properties_include`. */
220
+ /** Properties to drop. Mutually exclusive with `properties_include`. Defaults to none. */
167
221
  propertiesExclude?: unknown;
168
- /** Drop polygons whose area is below this many tile-pixels² (default 4). */
222
+ /**
223
+ * Area in square tile-pixels below which a polygon is dropped. Defaults to `4`.
224
+ *
225
+ * @default 4
226
+ */
169
227
  polygonMinArea?: number;
170
- /** Douglas-Peucker tolerance for polygons, in tile-pixels (default 4). */
228
+ /**
229
+ * Douglas-Peucker tolerance for polygons, in tile-pixels. Defaults to `4`.
230
+ *
231
+ * @default 4
232
+ */
171
233
  polygonSimplify?: number;
172
- /** Drop lines whose length is below this many tile-pixels (default 4). */
234
+ /**
235
+ * Length in tile-pixels below which a line is dropped. Defaults to `4`.
236
+ *
237
+ * @default 4
238
+ */
173
239
  lineMinLength?: number;
174
- /** Douglas-Peucker tolerance for lines, in tile-pixels (default 4). */
240
+ /**
241
+ * Douglas-Peucker tolerance for lines, in tile-pixels. Defaults to `4`.
242
+ *
243
+ * @default 4
244
+ */
175
245
  lineSimplify?: number;
176
- /** Point reduction strategy: `none` / `drop_rate` / `min_distance` (default `min_distance`). */
246
+ /**
247
+ * How to thin out points too close to distinguish. Defaults to `min_distance`.
248
+ *
249
+ * @default min_distance
250
+ */
177
251
  pointReduction?: "none" | "drop_rate" | "min_distance";
178
- /** Numeric value whose meaning depends on `point_reduction`: - `min_distance` (default): minimum distance between kept points, in tile-pixels at the current zoom. Defaults to 16. - `drop_rate`: per-zoom keep-fraction in `[0, 1]`. Defaults to 0.5. - `none`: ignored. */
252
+ /** Distance in tile-pixels for `min_distance`, keep-fraction for `drop_rate`. Defaults to `16`/`0.5`. */
179
253
  pointReductionValue?: number;
180
- /** Tile-compression applied before the tiles leave this operation: `gzip` (default), `brotli`, `zstd`, or `none`. */
254
+ /**
255
+ * Compression applied before the tiles leave. Defaults to `gzip`.
256
+ *
257
+ * @default gzip
258
+ */
181
259
  compression?: "none" | "gzip" | "brotli" | "zstd";
182
- /** Maximum encoded tile size in bytes before a tile is considered broken and dropped (streaming path) / errors out (single-tile path). Defaults to 1048576 (1 MiB). Raise it when a legitimate low-zoom tile exceeds the default (e.g. `max_tile_bytes=2097152` for 2 MiB), or set `max_tile_bytes=none` to emit tiles at any size. The soft-cap warning threshold (200 KB at the default cap) scales with this value. */
260
+ /**
261
+ * Size in bytes above which a tile counts as broken. Defaults to `1048576`.
262
+ *
263
+ * @default 1048576
264
+ */
183
265
  maxTileBytes?: number | "none";
184
- /** If `true`, drop the GeoJSON / Shapefile `id` field from every feature before encoding. Useful for sources where the id is a string (e.g. USGS earthquakes — those would be silently dropped at MVT encode anyway, since MVT requires `uint64` ids), or when the id is just noise. Defaults to `false` — keep the id when it's a non-negative integer. */
266
+ /**
267
+ * Whether to drop each feature's `id` before encoding. Defaults to `false`.
268
+ *
269
+ * @default false
270
+ */
185
271
  ignoreId?: boolean;
186
272
  }
273
+ export interface FromGridOptions {
274
+ /** EPSG code of the grid's coordinate reference system. */
275
+ epsg: number;
276
+ /** Edge length of a cell, in the CRS's units — meters, or degrees for `epsg=4326`. */
277
+ size: number;
278
+ /** Area to cover, as `[west, south, east, north]` in WGS84 degrees. */
279
+ bbox: [number, number, number, number];
280
+ /**
281
+ * Lower-left corner of cell `(0, 0)`, in CRS units. Defaults to `[0,0]`.
282
+ *
283
+ * @default [0,0]
284
+ */
285
+ offset?: unknown;
286
+ /**
287
+ * Roughly how many cells one tile may hold. Defaults to `1024`.
288
+ *
289
+ * @default 1024
290
+ */
291
+ maxCellsPerTile?: number;
292
+ /** Highest zoom level to generate. Defaults to three above the derived minimum. */
293
+ maxZoom?: number;
294
+ /**
295
+ * Ready-made id format. Overridden by `id_template`. Defaults to `inspire`.
296
+ *
297
+ * @default inspire
298
+ */
299
+ idPreset?: "inspire" | "geostat";
300
+ /** Id format spelled out, with `{x}` and `{y}` for the corner. Defaults to `id_preset`. */
301
+ idTemplate?: string;
302
+ /**
303
+ * Property holding the cell id. Defaults to `id`.
304
+ *
305
+ * @default id
306
+ */
307
+ idField?: string;
308
+ /**
309
+ * Property holding the corner's easting. Defaults to `x`.
310
+ *
311
+ * @default x
312
+ */
313
+ xField?: string;
314
+ /**
315
+ * Property holding the corner's northing. Defaults to `y`.
316
+ *
317
+ * @default y
318
+ */
319
+ yField?: string;
320
+ /**
321
+ * How far a cell edge may stray from its true curve, in tile pixels. Defaults to `0.5`.
322
+ *
323
+ * @default 0.5
324
+ */
325
+ densifyTolerance?: number;
326
+ /**
327
+ * Name of the layer to write into. Defaults to `grid`.
328
+ *
329
+ * @default grid
330
+ */
331
+ layerName?: string;
332
+ }
333
+ export interface FromH3Options {
334
+ /** H3 resolution, `0` (coarsest) to `15` (finest). */
335
+ resolution: number;
336
+ /** Area to cover, as `[west, south, east, north]` in WGS84 degrees. */
337
+ bbox: [number, number, number, number];
338
+ /**
339
+ * Roughly how many cells one tile may hold. Defaults to `1024`.
340
+ *
341
+ * @default 1024
342
+ */
343
+ maxCellsPerTile?: number;
344
+ /** Highest zoom level to generate. Defaults to three above the derived minimum. */
345
+ maxZoom?: number;
346
+ /**
347
+ * Name of the layer to write into. Defaults to `grid`.
348
+ *
349
+ * @default grid
350
+ */
351
+ layerName?: string;
352
+ /**
353
+ * Property holding the H3 index. Defaults to `h3`.
354
+ *
355
+ * @default h3
356
+ */
357
+ idField?: string;
358
+ }
187
359
  export interface FromStackedRasterOptions {
188
- /** The tile format to use for the output tiles. Default: format of the first source. */
189
- format?: "avif" | "bin" | "geojson" | "jpg" | "json" | "mvt" | "png" | "svg" | "topojson" | "webp";
190
- /** Whether to automatically wrap each source with `raster_overscale` so that sources missing native tiles at the requested zoom level still contribute via upscaled tiles. When all sources overlapping a requested bbox are overscaled (none have native data), this operation returns an empty stream. Place a `raster_overscale` *after* `from_stacked_raster` in the pipeline to cover those tiles — it is more efficient to upscale one blended tile than N individual tiles. Default: `false`. */
360
+ /** Format to encode the blended tiles in. Defaults to the first source's. */
361
+ format?: "avif" | "jpg" | "png" | "webp";
362
+ /**
363
+ * Whether to wrap each source in `raster_overscale`. Defaults to `false`.
364
+ *
365
+ * @default false
366
+ */
191
367
  autoOverscale?: boolean;
192
368
  }
193
369
  export interface FromTileOptions {
194
- /** The filename of the tile. Supported formats: png, jpg/jpeg, webp, avif, pbf/mvt. The format is automatically detected from the file extension. */
370
+ /** Path to the tile file; its format comes from the extension. */
195
371
  filename: string;
196
372
  }
197
373
  export interface FromTilejsonOptions {
198
- /** The URL of the TileJSON endpoint. For example: `url="https://example.com/tiles.json"`. */
374
+ /** URL of the TileJSON endpoint. */
199
375
  url: string;
200
- /** Maximum number of retries per tile request (default: 3). */
376
+ /**
377
+ * How often to retry a failed tile request. Defaults to `3`.
378
+ *
379
+ * @default 3
380
+ */
201
381
  maxRetries?: number;
202
- /** Maximum number of concurrent tile requests (default: io_bound concurrency limit). */
382
+ /** How many tile requests may be in flight. Defaults to the I/O concurrency limit. */
203
383
  maxConcurrentRequests?: number;
204
384
  }
205
385
  export interface FilterOptions {
206
- /** Bounding box in WGS84: [min lng, min lat, max lng, max lat]. */
386
+ /** Area to keep, in WGS84 degrees. Defaults to the source's own bounds. */
207
387
  bbox?: [number, number, number, number];
208
- /** minimal zoom level */
388
+ /**
389
+ * Ring of extra tiles kept around `bbox`, per zoom level. Requires `bbox`. Defaults to `0`.
390
+ *
391
+ * @default 0
392
+ */
393
+ bboxBorder?: number;
394
+ /** Lowest zoom level to keep. Defaults to the source's lowest. */
209
395
  levelMin?: number;
210
- /** maximal zoom level */
396
+ /** Highest zoom level to keep. Defaults to the source's highest. */
211
397
  levelMax?: number;
212
- /** Path to a tile container used as a coordinate allow-list. Only tiles whose coordinates exist in this container are passed through. Accepts the same path/URL syntax as `from_container`. Note: opening the container and building the allow-list requires I/O at pipeline build time. */
398
+ /** Tile container whose coordinates act as an allow-list. Defaults to no allow-list. */
213
399
  filename?: string;
214
400
  }
215
401
  export interface MetaUpdateOptions {
216
- /** Attribution text. */
402
+ /** Attribution text. Defaults to the source's. */
217
403
  attribution?: string;
218
- /** Geographic bounding box [west, south, east, north]. */
404
+ /** Area covered, as `[west, south, east, north]` in WGS84 degrees. Defaults to the source's. */
219
405
  bounds?: [number, number, number, number];
220
- /** Default center [longitude, latitude, zoom]. */
406
+ /** Where a client should open the map, as `[lon, lat, zoom]`. Defaults to the source's. */
221
407
  center?: [number, number, number];
222
- /** Description text. */
408
+ /** Description text. Defaults to the source's. */
223
409
  description?: string;
224
- /** Fill zoom level. */
410
+ /** Zoom level from which clients should fill from the parent tile. Defaults to the source's. */
225
411
  fillzoom?: number;
226
- /** Legend text. */
412
+ /** Legend text. Defaults to the source's. */
227
413
  legend?: string;
228
- /** Name text. */
414
+ /** Name of the tileset. Defaults to the source's. */
229
415
  name?: string;
230
- /** Tile schema, allowed values: "rgb", "rgba", "dem/mapbox", "dem/terrarium", "dem/versatiles", "openmaptiles", "shortbread@1.0", "other", "unknown" */
416
+ /** What the tiles contain. Defaults to the source's. */
231
417
  schema?: "rgb" | "rgba" | "dem/mapbox" | "dem/terrarium" | "dem/versatiles" | "openmaptiles" | "shortbread@1.0" | "other";
232
- /** A complete TileJSON document (JSON string) used as the basis for the new metadata. When given, the new metadata starts from this document instead of the source's; the other parameters then override individual fields on top of it. */
418
+ /** Complete TileJSON document, as a JSON string. Defaults to the source's metadata. */
233
419
  tilejson?: string;
234
- /** Path to a file containing a complete TileJSON document, resolved relative to the VPL file. Use instead of `tilejson` to avoid inline JSON quoting. Mutually exclusive with `tilejson`. */
420
+ /** Path to a file holding a complete TileJSON document. Defaults to the source's metadata. */
235
421
  tilejsonFile?: string;
236
- /** A partial TileJSON document (JSON string) merged onto the current metadata. Scalar fields (e.g. `name`, `attribution`) and `vector_layers` overwrite; `bounds` and the zoom range are widened to the union. The individual parameters still take precedence. */
422
+ /** Partial TileJSON document to merge on, as a JSON string. Defaults to merging nothing. */
237
423
  tilejsonUpdate?: string;
238
- /** Path to a file containing a partial TileJSON document, resolved relative to the VPL file. Use instead of `tilejson_update`. Mutually exclusive with `tilejson_update`. */
424
+ /** Path to a file holding a partial TileJSON document. Defaults to merging nothing. */
239
425
  tilejsonUpdateFile?: string;
240
- /** The `vector_layers` array as a JSON string. It is parsed and validated against the TileJSON spec before replacing the source's `vector_layers`. */
426
+ /** The `vector_layers` array as a JSON string. Defaults to the source's. */
241
427
  vectorLayers?: string;
242
- /** Path to a file containing the `vector_layers` array as JSON, resolved relative to the VPL file. Use instead of `vector_layers`. Mutually exclusive with `vector_layers`. */
428
+ /** Path to a file holding the `vector_layers` array as JSON. Defaults to the source's. */
243
429
  vectorLayersFile?: string;
244
430
  }
431
+ export interface RemapCoordsOptions {
432
+ /**
433
+ * Whether to mirror horizontally, so `x` becomes `2^z - 1 - x`. Defaults to `false`.
434
+ *
435
+ * @default false
436
+ */
437
+ flipX?: boolean;
438
+ /**
439
+ * Whether to mirror vertically, so `y` becomes `2^z - 1 - y`. Defaults to `false`.
440
+ *
441
+ * @default false
442
+ */
443
+ flipY?: boolean;
444
+ /**
445
+ * Whether to exchange the axes, so `(x, y)` becomes `(y, x)`. Defaults to `false`.
446
+ *
447
+ * @default false
448
+ */
449
+ swapXy?: boolean;
450
+ }
245
451
  export interface DemOverviewOptions {
246
- /** Use this zoom level to build the overview. Defaults to the maximum zoom level of the source. */
452
+ /** Zoom level to build the overview from. Defaults to the source's highest. */
247
453
  level?: number;
248
- /** Override auto-detection of DEM encoding. Values: "mapbox", "terrarium". */
249
- encoding?: string;
454
+ /** DEM encoding of the source. Defaults to the encoding its tile schema implies. */
455
+ encoding?: "mapbox" | "terrarium";
250
456
  }
251
457
  export interface DemQuantizeOptions {
252
- /** Allowed elevation error as fraction of pixel ground size. E.g. 0.1 means for a 10 m pixel, allow up to 1 m elevation error. Defaults to 0.1. */
458
+ /**
459
+ * Allowed elevation error as a fraction of the pixel's ground size. Defaults to `0.1`.
460
+ *
461
+ * @default 0.1
462
+ */
253
463
  elevationError?: number;
254
- /** Maximum allowed slope change in degrees due to quantization. Defaults to 1.0. */
464
+ /**
465
+ * Largest slope change in degrees that quantization may introduce. Defaults to `1.0`.
466
+ *
467
+ * @default 1.0
468
+ */
255
469
  slopeError?: number;
256
- /** Override auto-detection of DEM encoding. Values: "mapbox", "terrarium". */
257
- encoding?: string;
470
+ /** DEM encoding of the source. Defaults to the encoding its tile schema implies. */
471
+ encoding?: "mapbox" | "terrarium";
258
472
  }
259
473
  export interface DemTileResizeOptions {
260
- /** Target tile size in pixels. Must be 256 or 512. */
261
- tileSize?: number;
262
- /** Override auto-detection of DEM encoding. Values: "mapbox", "terrarium". */
263
- encoding?: string;
474
+ /** Target tile size in pixels, `256` or `512`, and it must differ from the source's. */
475
+ tileSize: number;
476
+ /** DEM encoding of the source. Defaults to the encoding its tile schema implies. */
477
+ encoding?: "mapbox" | "terrarium";
264
478
  }
265
479
  export interface RasterFlattenOptions {
266
- /** background color to use for the flattened tiles, in RGB format. Defaults to white. */
480
+ /** Background colour, as `[r, g, b]`. Defaults to white. */
267
481
  color?: [number, number, number];
268
482
  }
269
483
  export interface RasterFormatOptions {
270
- /** The desired tile format. Allowed values are: AVIF, JPG, PNG or WEBP. If not specified, the source format will be used. */
484
+ /** Format to encode the tiles into. Defaults to the source's. */
271
485
  format?: "avif" | "jpg" | "png" | "webp";
272
- /** Quality level for the tile compression (only AVIF, JPG or WEBP), between 0 (worst) and 100 (lossless). To allow different quality levels for different zoom levels, this can also be a comma-separated list like this: "70,14:50,15:20", where the first value is the default quality, and the other values specify the quality for the specified zoom level (and higher). */
486
+ /** Encoder quality, `0` (worst) to `100` (lossless). Defaults to the encoder's own. */
273
487
  quality?: string;
274
- /** Quality level for translucent (semi-transparent) tiles, using the same zoom-dependent syntax as quality. When set, tiles are checked for opacity: opaque tiles use the normal quality setting, while translucent tiles use this value (typically 100 for lossless). */
488
+ /** Encoder quality for tiles with translucent pixels. Defaults to using `quality` throughout. */
275
489
  qualityTranslucent?: string;
276
- /** Compression effort, between 0 (fastest) and 100 (slowest/best). */
490
+ /** Encoder effort, `0` (fastest) to `100` (smallest). Defaults to the encoder's own. */
277
491
  effort?: number;
278
492
  }
279
493
  export interface RasterLevelsOptions {
280
- /** Brightness adjustment, between -255 and 255. Defaults to 0.0 (no change). */
494
+ /**
495
+ * Offset added to every channel, `-255` to `255`. Defaults to `0.0`.
496
+ *
497
+ * @default 0.0
498
+ */
281
499
  brightness?: number;
282
- /** Contrast adjustment, between 0 and infinity. Defaults to 1.0 (no change). */
500
+ /**
501
+ * Factor applied around mid-grey, above `0`. Defaults to `1.0`.
502
+ *
503
+ * @default 1.0
504
+ */
283
505
  contrast?: number;
284
- /** Gamma adjustment, between 0 and infinity. Defaults to 1.0 (no change). */
506
+ /**
507
+ * Gamma exponent, above `0`. Defaults to `1.0`.
508
+ *
509
+ * @default 1.0
510
+ */
285
511
  gamma?: number;
286
512
  }
287
513
  export interface RasterMaskOptions {
288
- /** Path to GeoJSON file with Polygon or MultiPolygon geometry. */
514
+ /** Path to a GeoJSON file holding a Polygon or MultiPolygon. */
289
515
  geojson: string;
290
- /** Buffer distance in meters. Positive values expand the mask, negative values shrink it. Default: 0 */
516
+ /**
517
+ * Distance in meters by which to grow the mask, or shrink it when negative. Defaults to `0`.
518
+ *
519
+ * @default 0
520
+ */
291
521
  buffer?: number;
292
- /** Edge blur distance in meters. Creates a soft transition at the mask edge. Default: 0 */
522
+ /**
523
+ * Width in meters of the soft transition at the mask edge. Defaults to `0`.
524
+ *
525
+ * @default 0
526
+ */
293
527
  blur?: number;
294
- /** Blur falloff function: "linear" or "cosine". Default: "linear" */
295
- blurFunction?: string;
528
+ /**
529
+ * Falloff curve across the `blur` band. Defaults to `linear`.
530
+ *
531
+ * @default linear
532
+ */
533
+ blurFunction?: "linear" | "cosine";
296
534
  }
297
535
  export interface RasterOverscaleOptions {
298
- /** The zoom level to use as the source for overscaling. Tiles at this level and below are passed through unchanged. Tiles above this level are generated by extracting and upscaling from this level. Defaults to the maximum zoom level of the source. */
536
+ /** Zoom level to upscale from. Defaults to the source's highest. */
299
537
  levelBase?: number;
300
- /** The maximum zoom level to support. Defaults to 30. Requests above this level will not return tiles. */
538
+ /**
539
+ * Highest zoom level to serve. Defaults to `30`.
540
+ *
541
+ * @default 30
542
+ */
301
543
  levelMax?: number;
302
- /** Enable tile climbing when the expected source tile doesn't exist. When true, the operation will search parent tiles at lower zoom levels until it finds an existing tile, then extract and upscale from there. Defaults to false. */
544
+ /**
545
+ * Whether to climb to lower levels when the `level_base` tile is missing. Defaults to `false`.
546
+ *
547
+ * @default false
548
+ */
303
549
  enableClimbing?: boolean;
304
550
  }
305
551
  export interface RasterOverviewOptions {
306
- /** use this zoom level to build the overview. Defaults to the maximum zoom level of the source. */
552
+ /** Zoom level to build the overview from. Defaults to the source's highest. */
307
553
  level?: number;
308
554
  }
309
555
  export interface RasterTileResizeOptions {
310
- /** Target tile size in pixels. A value of `256` expects source tiles of 512px, which will be split into four 256px output tiles at the next higher zoom level. Level 0 is downscaled instead. A value of `512` expects source tiles measuring 256px, which will be merged into 512px output tiles at the next lower zoom level. */
311
- tileSize?: number;
556
+ /** Target tile size in pixels, `256` or `512`, and it must differ from the source's. */
557
+ tileSize: number;
312
558
  }
313
559
  export interface VectorFilterFeaturesOptions {
314
- /** Layers the expression applies to, as a VPL array of strings. Features in all other layers are left unchanged. Example: `layer=["poi","place"]`. */
560
+ /** Layers the expression applies to, for example `layer=["poi","place"]`. */
315
561
  layer: unknown;
316
- /** CEL (Common Expression Language) boolean expression. Feature properties are available as `props["key"]`; properties whose names are valid CEL identifiers (letters, digits, underscore) are also exposed as top-level identifiers. Missing keys resolve to null; use `name != null` (for identifier-safe keys) or `has(props.key)` (for any key) for explicit presence checks. See `versatiles help` for a CEL operator cheat-sheet. */
562
+ /** Boolean CEL expression over the feature's properties. */
317
563
  expr: string;
318
564
  }
319
565
  export interface VectorFilterLayersOptions {
320
- /** Layer names to remove from the tiles, e.g. `filter=["pois","ocean"]`. */
566
+ /** Layer names to remove, for example `filter=["pois","ocean"]`. */
321
567
  filter: unknown;
322
- /** If set, inverts the filter logic (i.e., keeps only layers matching the filter). */
568
+ /**
569
+ * Whether to keep the named layers instead of removing them. Defaults to `false`.
570
+ *
571
+ * @default false
572
+ */
323
573
  invert?: boolean;
324
574
  }
325
575
  export interface VectorFilterPropertiesOptions {
326
- /** A regular expression pattern that should match property names to be removed from all features. The property names contain the layer name as a prefix, e.g., `layer_name/property_name`, so an expression like `regex="^layer_name/"` will match all properties of that layer or `regex="/name_.*$"` will match all properties starting with `name_` in all layers. */
576
+ /** Regular expression matched against each property's prefixed name. */
327
577
  regex: string;
328
- /** If set, inverts the filter logic (i.e., keeps only properties matching the filter). */
578
+ /**
579
+ * Whether to keep the matching properties instead of removing them. Defaults to `false`.
580
+ *
581
+ * @default false
582
+ */
329
583
  invert?: boolean;
330
584
  }
331
585
  export interface VectorOverzoomOptions {
332
- /** The zoom level to use as the source for overzooming. Tiles at this level and below are passed through unchanged. Tiles above this level are generated by clipping and rescaling features from the corresponding parent tile at this level. Defaults to the maximum zoom level of the source. */
586
+ /** Zoom level to overzoom from. Defaults to the source's highest. */
333
587
  levelBase?: number;
334
- /** The maximum zoom level to support. Defaults to `level_base + 4` (each extra level quadruples the tile count, so 4 levels = 256× — usually the sweet spot before the pyramid becomes unwieldy). Set explicitly if you want to overzoom further. Capped at 30. */
588
+ /** Highest zoom level to serve, capped at `30`. Defaults to `level_base + 4`. */
335
589
  levelMax?: number;
336
- /** Enable tile climbing when the expected source tile doesn't exist. When true, the operation will search parent tiles at lower zoom levels until it finds an existing tile, then clip and rescale from there. Defaults to false. */
590
+ /**
591
+ * Whether to climb to lower levels when the `level_base` tile is missing. Defaults to `false`.
592
+ *
593
+ * @default false
594
+ */
337
595
  enableClimbing?: boolean;
338
- /** Clip buffer in tile-extent units, applied to the child tile's sub-region so that features straddling tile boundaries (labels, lines) survive intact. Defaults to 80. */
596
+ /**
597
+ * Clip buffer in tile-extent units, so edge-straddling features survive. Defaults to `80`.
598
+ *
599
+ * @default 80
600
+ */
339
601
  buffer?: number;
340
602
  }
341
603
  export interface VectorRepairOptions {
342
- /** Drop features that cannot be decoded rather than leaving them in place. Defaults to false. */
604
+ /**
605
+ * Whether to remove features whose geometry cannot be decoded. Defaults to `false`.
606
+ *
607
+ * @default false
608
+ */
343
609
  dropOffenders?: boolean;
344
610
  }
345
611
  export interface VectorUpdatePropertiesOptions {
346
- /** Path to the CSV/TSV data file: The file must have a header row. Each subsequent row will be matched to vector features using the ID fields. */
612
+ /** Path to the CSV or TSV file, which must have a header row. */
347
613
  dataSourcePath: string;
348
- /** Name of the vector layer to update: Only features in this layer will be modified. Other layers pass through unchanged. */
614
+ /** Name of the layer whose features are updated. */
349
615
  layerName: string;
350
- /** Field name in the vector tiles that contains the feature ID: This field is used to match features with rows in the data source. */
616
+ /** Feature property holding the id to match on. */
351
617
  idFieldTiles: string;
352
- /** Column name in the data source that contains the matching ID: This column is used to look up data for each feature. */
618
+ /** Column in the data file holding the id to match on. */
353
619
  idFieldData: string;
354
- /** If `true`, replaces all existing properties with the data source values. If `false` (default), merges new properties with existing ones. */
620
+ /**
621
+ * Whether to replace a feature's properties instead of merging. Defaults to `false`.
622
+ *
623
+ * @default false
624
+ */
355
625
  replaceProperties?: boolean;
356
- /** If `true`, removes features that don't have a matching row in the data source. If `false` (default), non-matching features are kept unchanged. */
626
+ /**
627
+ * Whether to drop features that have no matching row. Defaults to `false`.
628
+ *
629
+ * @default false
630
+ */
357
631
  removeNonMatching?: boolean;
358
- /** If `true`, includes the ID field from the data source in the output properties. If `false` (default), the ID field is excluded from the merged properties. */
632
+ /**
633
+ * Whether to keep the id column among the written properties. Defaults to `false`.
634
+ *
635
+ * @default false
636
+ */
359
637
  includeId?: boolean;
360
- /** Field separator character for the data file: Default for `.csv` files is `,` (comma). Default for `.tsv` files is `\t` (tab, auto-detected) */
638
+ /** Character separating a row's fields. Defaults to `,` for `.csv` and a tab for `.tsv`. */
361
639
  fieldSeparator?: string;
362
- /** Decimal separator character for parsing numbers: Default is `.` (US/UK format). Use `,` (comma) e.g. for German/European number format like `1.234,56` */
640
+ /**
641
+ * Decimal separator for parsing numbers, so `,` reads `1.234,56`. Defaults to `.`.
642
+ *
643
+ * @default .
644
+ */
363
645
  decimalSeparator?: string;
364
646
  }
365
647
  export declare class VPL {
366
648
  private steps;
367
649
  private constructor();
368
- /** Generates solid-color tiles of the specified size and format. */
650
+ /** Generates raster tiles of a single solid colour. */
369
651
  static fromColor(options?: FromColorOptions): VPL;
370
652
  /** Reads a tile container, such as a `*.versatiles`, `*.mbtiles`, `*.pmtiles` or `*.tar` file. */
371
653
  static fromContainer(options: FromContainerOptions): VPL;
372
- /** Reads a CSV file with longitude/latitude columns and emits MVT point tiles. */
654
+ /** Reads a CSV file with longitude and latitude columns and emits MVT point tiles. */
373
655
  static fromCsv(options: FromCsvOptions): VPL;
374
- /** Generates debug tiles that display their coordinates as text. */
656
+ /** Generates tiles that draw their own coordinates, for inspecting a pipeline. */
375
657
  static fromDebug(options?: FromDebugOptions): VPL;
376
658
  /** Reads a GeoJSON or Shapefile and emits MVT vector tiles. */
377
659
  static fromGeo(options: FromGeoOptions): VPL;
378
- /** Merges multiple vector tile sources. */
660
+ /** Generates vector tiles holding the cells of a projected square grid. */
661
+ static fromGrid(options: FromGridOptions): VPL;
662
+ /** Generates vector tiles holding H3 hexagons. */
663
+ static fromH3(options: FromH3Options): VPL;
664
+ /** Merges several vector tile sources into one, keeping every feature. */
379
665
  static fromMergedVector(sources: VPL[]): VPL;
380
- /** Overlays multiple raster tile sources on top of each other. */
666
+ /** Blends several raster tile sources into one by alpha-compositing them. */
381
667
  static fromStackedRaster(sources: VPL[], options?: Omit<FromStackedRasterOptions, 'sources'>): VPL;
382
- /** Overlays multiple tile sources, using the tile from the first source that provides it. */
668
+ /** Overlays several tile sources, taking each tile from the first source that has it. */
383
669
  static fromStacked(sources: VPL[]): VPL;
384
- /** Reads a single tile file and uses it as a template for all tile requests. */
670
+ /** Reads one tile file and returns it for every requested coordinate. */
385
671
  static fromTile(options: FromTileOptions): VPL;
386
- /** Reads tiles from a remote tile server via a TileJSON endpoint. */
672
+ /** Reads tiles from a remote tile server described by a TileJSON endpoint. */
387
673
  static fromTilejson(options: FromTilejsonOptions): VPL;
388
- /** Filter tiles by bounding box, zoom levels, and/or the tile coordinates present in another container. */
674
+ /** Filters tiles by bounding box, zoom range, or the coordinates present in another container. */
389
675
  filter(options?: FilterOptions): VPL;
390
- /** Update metadata, see also <https://github.com/mapbox/tilejson-spec/tree/master/3.0.0> */
676
+ /** Overwrites fields of the source's TileJSON metadata. */
391
677
  metaUpdate(options?: MetaUpdateOptions): VPL;
392
- /** Generate lower-zoom DEM overview tiles by averaging 24-bit elevation values. */
678
+ /** Relabels tile coordinates, correcting a source that uses TMS row order or `z/y/x` paths. */
679
+ remapCoords(options?: RemapCoordsOptions): VPL;
680
+ /** Generates lower-zoom DEM overview tiles by averaging 24-bit elevation values. */
393
681
  demOverview(options?: DemOverviewOptions): VPL;
394
- /** Quantize DEM (elevation) raster tiles by rounding to a per-tile power-of-two step. */
682
+ /** Quantizes DEM raster tiles by rounding elevations to a per-tile power-of-two step. */
395
683
  demQuantize(options?: DemQuantizeOptions): VPL;
396
- /** Convert DEM tile size between 256px and 512px by splitting or merging tiles. */
397
- demTileResize(options?: DemTileResizeOptions): VPL;
398
- /** Flattens (translucent) raster tiles onto a background */
684
+ /** Converts DEM tiles between 256 and 512 pixels by splitting or merging them. */
685
+ demTileResize(options: DemTileResizeOptions): VPL;
686
+ /** Composites translucent raster tiles onto an opaque background colour. */
399
687
  rasterFlatten(options?: RasterFlattenOptions): VPL;
400
- /** Convert raster tiles to a different image format and/or adjust quality/effort settings. */
688
+ /** Re-encodes raster tiles into another image format, quality or effort setting. */
401
689
  rasterFormat(options?: RasterFormatOptions): VPL;
402
- /** Adjust brightness, contrast and gamma of raster tiles. */
690
+ /** Adjusts the brightness, contrast and gamma of raster tiles. */
403
691
  rasterLevels(options?: RasterLevelsOptions): VPL;
404
- /** Apply a polygon mask from GeoJSON to raster tiles. */
692
+ /** Makes raster pixels outside a GeoJSON polygon transparent. */
405
693
  rasterMask(options: RasterMaskOptions): VPL;
406
- /** Raster overscale operation - generates tiles beyond the source's native resolution. */
694
+ /** Serves raster tiles above the source's native resolution by upscaling. */
407
695
  rasterOverscale(options?: RasterOverscaleOptions): VPL;
408
- /** Generate lower-zoom overview tiles by downscaling from a base zoom level. */
696
+ /** Generates the lower zoom levels of a raster pyramid by downscaling. */
409
697
  rasterOverview(options?: RasterOverviewOptions): VPL;
410
- /** Convert the size of tiles by splitting or merging them to a width of 256px or 512px. */
411
- rasterTileResize(options?: RasterTileResizeOptions): VPL;
412
- /** Drops vector features in selected layers that do not satisfy a boolean CEL expression. */
698
+ /** Converts raster tiles between 256 and 512 pixels by splitting or merging them. */
699
+ rasterTileResize(options: RasterTileResizeOptions): VPL;
700
+ /** Drops vector features in selected layers that do not satisfy a boolean expression. */
413
701
  vectorFilterFeatures(options: VectorFilterFeaturesOptions): VPL;
414
- /** Filters vector tile layers by name. */
702
+ /** Removes whole layers from vector tiles by name. */
415
703
  vectorFilterLayers(options: VectorFilterLayersOptions): VPL;
416
- /** Filters properties based on a regular expressions. */
704
+ /** Removes feature properties from vector tiles by matching their names against a regex. */
417
705
  vectorFilterProperties(options: VectorFilterPropertiesOptions): VPL;
418
- /** Vector overzoom operation - generates vector tiles beyond the source's native max zoom. */
706
+ /** Serves vector tiles above the source's highest zoom level by clipping and rescaling. */
419
707
  vectorOverzoom(options?: VectorOverzoomOptions): VPL;
420
- /** Repairs vector tiles to conform to MVT 2.1. */
708
+ /** Repairs vector tiles so that they conform to MVT 2.1. */
421
709
  vectorRepair(options?: VectorRepairOptions): VPL;
422
- /** Arguments for the `vector_update_properties` operation. */
710
+ /** Joins tabular data onto vector features, matching on an id column. */
423
711
  vectorUpdateProperties(options: VectorUpdatePropertiesOptions): VPL;
424
712
  /** Serialize this VPL pipeline to a string. */
425
713
  toString(): string;