@basemaps/cli-raster 8.11.0 → 8.11.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 (2) hide show
  1. package/dist/index.cjs +31 -15
  2. package/package.json +5 -5
package/dist/index.cjs CHANGED
@@ -75271,9 +75271,9 @@ var ulid2 = __toESM(require_index_umd(), 1);
75271
75271
  var CliInfo = {
75272
75272
  // Detect unlinked packages looks for this string since its a package name, slightly work around it
75273
75273
  package: "@basemaps/cli",
75274
- version: "v8.13.0",
75275
- hash: "5a1984ab0e9b3939aab0db451d2f5e7aee1919af",
75276
- buildId: "18264739226-1"
75274
+ version: "v8.14.0",
75275
+ hash: "eb807c6d0f091b41e4d6d972b77c24f584cec230",
75276
+ buildId: "18453645562-1"
75277
75277
  };
75278
75278
  var CliDate = (/* @__PURE__ */ new Date()).toISOString();
75279
75279
  var CliId = ulid2.ulid();
@@ -79576,7 +79576,7 @@ var ColorParser = z.object({
79576
79576
  alpha: z.number()
79577
79577
  });
79578
79578
  var PipelineTerrainRgbParser = z.object({ type: z.literal("terrain-rgb") });
79579
- var PipelineColorRampParser = z.object({ type: z.literal("color-ramp") });
79579
+ var PipelineColorRampParser = z.object({ type: z.literal("color-ramp"), ramp: z.string().optional() });
79580
79580
  var PipelineNdviParser = z.object({
79581
79581
  type: z.literal("ndvi"),
79582
79582
  nir: z.number(),
@@ -79795,6 +79795,8 @@ function getScale(band, color) {
79795
79795
  return Math.round(band.stats.mean + stdDevs * band.stats.stddev);
79796
79796
  }
79797
79797
  function getAlphaScale(band) {
79798
+ if (band == null)
79799
+ return void 0;
79798
79800
  if (band.type === "uint8")
79799
79801
  return void 0;
79800
79802
  if (band.stats == null)
@@ -79969,6 +79971,8 @@ var ConfigProviderMemory = class _ConfigProviderMemory extends BasemapsConfigPro
79969
79971
  const tileSet = this.objects.get(this.TileSet.id(l.name));
79970
79972
  if (tileSet.outputs)
79971
79973
  continue;
79974
+ if (tileSet.category === "Charts")
79975
+ continue;
79972
79976
  const newLayer = { ...l, minZoom: 32 };
79973
79977
  delete newLayer.maxZoom;
79974
79978
  layerByName.set(newLayer.name, { ...layerByName.get(l.name), ...newLayer });
@@ -81452,6 +81456,13 @@ var Env = {
81452
81456
  /** Index to use for storing analytic data */
81453
81457
  ElasticIndexName: "ELASTIC_INDEX_NAME"
81454
81458
  },
81459
+ /** Load a environment variable throw a exception if the value is empty */
81460
+ getRequired(envName) {
81461
+ const value = Env.get(envName);
81462
+ if (value == null || value === "")
81463
+ throw new Error(`Missing env $${envName}`);
81464
+ return value;
81465
+ },
81455
81466
  /** Load a environment var defaulting to defaultOutput if it does not exist */
81456
81467
  get(envName) {
81457
81468
  return process.env[envName];
@@ -85412,7 +85423,7 @@ function getTiffTagSize(fieldType) {
85412
85423
  case TiffTagValueType.Ifd8:
85413
85424
  return 8;
85414
85425
  default:
85415
- throw new Error(`Invalid fieldType ${fieldType}`);
85426
+ throw new Error(`Invalid fieldType ${String(fieldType)}`);
85416
85427
  }
85417
85428
  }
85418
85429
 
@@ -85586,10 +85597,14 @@ async function getValueAt(tiff, tag, index) {
85586
85597
  const bytes = await tiff.source.fetch(tag.dataOffset + index * dataTypeSize, dataTypeSize);
85587
85598
  const view = new DataView(bytes);
85588
85599
  const value2 = readValue(tiff, void 0, view, 0, tag.dataType, 1);
85600
+ if (typeof value2 !== "number")
85601
+ throw new Error("Value is not a number");
85589
85602
  tag.value[index] = value2;
85590
85603
  return value2;
85591
85604
  }
85592
85605
  const value = readValue(tiff, void 0, tag.view, index * dataTypeSize, tag.dataType, 1);
85606
+ if (typeof value !== "number")
85607
+ throw new Error("Value is not a number");
85593
85608
  tag.value[index] = value;
85594
85609
  return value;
85595
85610
  }
@@ -86357,8 +86372,6 @@ var Tiff = class _Tiff {
86357
86372
  const endian = bytes.getUint16(offset, this.isLittleEndian);
86358
86373
  offset += 2;
86359
86374
  this.isLittleEndian = endian === TiffEndian.Little;
86360
- if (!this.isLittleEndian)
86361
- throw new Error("Only little endian is supported");
86362
86375
  this.version = bytes.getUint16(offset, this.isLittleEndian);
86363
86376
  offset += 2;
86364
86377
  let nextOffsetIfd;
@@ -86378,7 +86391,7 @@ var Tiff = class _Tiff {
86378
86391
  nextOffsetIfd = getUint(bytes, offset, this.ifdConfig.pointer, this.isLittleEndian);
86379
86392
  offset += this.ifdConfig.pointer;
86380
86393
  } else {
86381
- throw new Error(`Only tiff supported version:${this.version}`);
86394
+ throw new Error(`Only tiff supported version:${String(this.version)}`);
86382
86395
  }
86383
86396
  const ghostSize = nextOffsetIfd - offset;
86384
86397
  if (ghostSize > 0 && ghostSize < 16 * 1024) {
@@ -86392,7 +86405,7 @@ var Tiff = class _Tiff {
86392
86405
  lastView = new DataView(bytes2);
86393
86406
  lastView.sourceOffset = nextOffsetIfd;
86394
86407
  }
86395
- nextOffsetIfd = await this.readIfd(nextOffsetIfd, lastView);
86408
+ nextOffsetIfd = this.readIfd(nextOffsetIfd, lastView);
86396
86409
  }
86397
86410
  await Promise.all(this.images.map((i) => i.init()));
86398
86411
  this.isInitialized = true;
@@ -86404,7 +86417,7 @@ var Tiff = class _Tiff {
86404
86417
  * @param offset file offset to read the header from
86405
86418
  * @param view offset that contains the bytes for the header
86406
86419
  */
86407
- async readIfd(offset, view) {
86420
+ readIfd(offset, view) {
86408
86421
  const viewOffset = offset - view.sourceOffset;
86409
86422
  const tagCount = getUint(view, viewOffset, this.ifdConfig.offset, this.isLittleEndian);
86410
86423
  const tags = /* @__PURE__ */ new Map();
@@ -88206,11 +88219,12 @@ var ConfigJson = class _ConfigJson {
88206
88219
  const imageryFetch = [];
88207
88220
  if (ts.type === TileSetType.Raster) {
88208
88221
  for (const layer of ts.layers) {
88222
+ const category = layer.category ?? ts.category;
88209
88223
  if (layer[2193] != null) {
88210
- imageryFetch.push(this.loadImagery(stringToUrlFolder(layer[2193]), layer.name, layer.title));
88224
+ imageryFetch.push(this.loadImagery(stringToUrlFolder(layer[2193]), layer.name, layer.title, category));
88211
88225
  }
88212
88226
  if (layer[3857] != null) {
88213
- imageryFetch.push(this.loadImagery(stringToUrlFolder(layer[3857]), layer.name, layer.title));
88227
+ imageryFetch.push(this.loadImagery(stringToUrlFolder(layer[3857]), layer.name, layer.title, category));
88214
88228
  }
88215
88229
  }
88216
88230
  }
@@ -88275,10 +88289,10 @@ var ConfigJson = class _ConfigJson {
88275
88289
  tileSet.aliases = ts.aliases;
88276
88290
  return tileSet;
88277
88291
  }
88278
- loadImagery(url, name, title) {
88292
+ loadImagery(url, name, title, category) {
88279
88293
  let existing = this.cache.get(url.href);
88280
88294
  if (existing == null) {
88281
- existing = this._loadImagery(url, name, title);
88295
+ existing = this._loadImagery(url, name, title, category);
88282
88296
  this.cache.set(url.href, existing);
88283
88297
  }
88284
88298
  return existing;
@@ -88287,7 +88301,7 @@ var ConfigJson = class _ConfigJson {
88287
88301
  initImageryFromTiffUrl(url) {
88288
88302
  return initImageryFromTiffUrl(url, this.Q, this.imageryConfigCache, this.logger);
88289
88303
  }
88290
- async _loadImagery(url, name, title) {
88304
+ async _loadImagery(url, name, title, category) {
88291
88305
  const imageId = guessIdFromUri(url.href) ?? sha256base58(url.href);
88292
88306
  const id = ConfigId.prefix(ConfigPrefix.Imagery, imageId);
88293
88307
  this.logger.trace({ url: url.href, imageId: id }, "Imagery:Fetch");
@@ -88295,6 +88309,8 @@ var ConfigJson = class _ConfigJson {
88295
88309
  img.id = id;
88296
88310
  img.name = name;
88297
88311
  img.title = title;
88312
+ if (category)
88313
+ img.category = category;
88298
88314
  delete img.collection;
88299
88315
  this.mem.put(img);
88300
88316
  return img;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basemaps/cli-raster",
3
- "version": "8.11.0",
3
+ "version": "8.11.1",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,10 +40,10 @@
40
40
  "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@basemaps/config": "^8.10.1",
44
- "@basemaps/config-loader": "^8.10.1",
43
+ "@basemaps/config": "^8.11.0",
44
+ "@basemaps/config-loader": "^8.11.0",
45
45
  "@basemaps/geo": "^8.9.0",
46
- "@basemaps/shared": "^8.9.2",
46
+ "@basemaps/shared": "^8.9.3",
47
47
  "@linzjs/geojson": "^8.0.0",
48
48
  "@linzjs/metrics": "^8.0.0",
49
49
  "cmd-ts": "^0.12.1",
@@ -57,5 +57,5 @@
57
57
  "build/",
58
58
  "dist/"
59
59
  ],
60
- "gitHead": "5a1984ab0e9b3939aab0db451d2f5e7aee1919af"
60
+ "gitHead": "eb807c6d0f091b41e4d6d972b77c24f584cec230"
61
61
  }