@gisatcz/deckgl-geolib 2.2.2 → 2.3.1-dev.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.
package/dist/esm/index.js CHANGED
@@ -5253,7 +5253,7 @@ class TerrainGenerator {
5253
5253
  attributes = newAttributes;
5254
5254
  triangles = newTriangles;
5255
5255
  }
5256
- return {
5256
+ const map = {
5257
5257
  // Data return by this loader implementation
5258
5258
  loaderData: {
5259
5259
  header: {},
@@ -5266,6 +5266,14 @@ class TerrainGenerator {
5266
5266
  indices: { value: Uint32Array.from(triangles), size: 1 },
5267
5267
  attributes,
5268
5268
  };
5269
+ const gridWidth = width === 257 ? 257 : width + 1;
5270
+ const gridHeight = height === 257 ? 257 : height + 1;
5271
+ return {
5272
+ map,
5273
+ raw: terrain,
5274
+ width: gridWidth,
5275
+ height: gridHeight
5276
+ };
5269
5277
  }
5270
5278
  /**
5271
5279
  * Decodes raw raster data into a Float32Array of elevation values.
@@ -5485,7 +5493,16 @@ class BitmapGenerator {
5485
5493
  // Return raw GPU-ready ImageBitmap directly
5486
5494
  // Note: createImageBitmap(imageData) is cleaner, but using the canvas ensures broad compatibility
5487
5495
  c.putImageData(imageData, 0, 0);
5488
- return createImageBitmap(canvas);
5496
+ const map = await createImageBitmap(canvas);
5497
+ return {
5498
+ map,
5499
+ // rasters[0] is the interleaved buffer on the CogTiles path (primary use case).
5500
+ // For planar multi-band GeoTIFFs via GeoImage.getBitmap(), only the first band is exposed here.
5501
+ // Full multi-band raw picking support is tracked in https://github.com/Gisat/deck.gl-geotiff/issues/98
5502
+ raw: rasters[0],
5503
+ width,
5504
+ height
5505
+ };
5489
5506
  }
5490
5507
  static getMinMax(array, options, samplesPerPixel = 1) {
5491
5508
  let maxValue = -Infinity;
@@ -6221,6 +6238,9 @@ class CogBitmapLayer extends CompositeLayer {
6221
6238
  // TODO - pass signal to getTile
6222
6239
  // abort request if signal is aborted
6223
6240
  const tileData = await this.state.bitmapCogTiles.getTile(tile.index.x, tile.index.y, tile.index.z);
6241
+ if (tileData && !this.props.pickable) {
6242
+ tileData.raw = null;
6243
+ }
6224
6244
  return tileData;
6225
6245
  }
6226
6246
  renderSubLayers(props) {
@@ -6234,9 +6254,10 @@ class CogBitmapLayer extends CompositeLayer {
6234
6254
  }
6235
6255
  const { bbox: { west, south, east, north, }, } = props.tile;
6236
6256
  return new SubLayerClass({ ...props, tileSize: this.state.bitmapCogTiles.tileSize }, {
6237
- data: null,
6238
- image: data,
6257
+ data: [1],
6258
+ image: data.map,
6239
6259
  _instanced: false,
6260
+ pickable: props.pickable,
6240
6261
  bounds: [west, south, east, north],
6241
6262
  textureParameters: {
6242
6263
  minFilter: blurredTexture ? 'linear' : 'nearest',
@@ -6258,6 +6279,8 @@ class CogBitmapLayer extends CompositeLayer {
6258
6279
  }), {
6259
6280
  getTileData: this.getTiledBitmapData.bind(this),
6260
6281
  renderSubLayers: this.renderSubLayers.bind(this),
6282
+ pickable: this.props.pickable,
6283
+ onClick: this.props.onClick,
6261
6284
  updateTriggers: {
6262
6285
  getTileData: [
6263
6286
  // rasterData: urlTemplateToUpdateTrigger(rasterData),
@@ -6421,13 +6444,7 @@ class CogTerrainLayer extends CompositeLayer {
6421
6444
  });
6422
6445
  }
6423
6446
  async getTiledTerrainData(tile) {
6424
- // const {
6425
- // elevationData, fetch, texture, elevationDecoder, meshMaxError,
6426
- // } = this.props;
6427
6447
  const { viewport } = this.context;
6428
- // const dataUrl = getURLFromTemplate(elevationData, tile);
6429
- // const textureUrl = texture && getURLFromTemplate(texture, tile);
6430
- // const { signal } = tile;
6431
6448
  let bottomLeft = [0, 0];
6432
6449
  let topRight = [0, 0];
6433
6450
  if (viewport.isGeospatial) {
@@ -6444,6 +6461,9 @@ class CogTerrainLayer extends CompositeLayer {
6444
6461
  // TODO - pass signal to getTile
6445
6462
  // abort request if signal is aborted
6446
6463
  const terrain = await this.state.terrainCogTiles.getTile(tile.index.x, tile.index.y, tile.index.z, bounds, this.props.meshMaxError);
6464
+ if (terrain && !this.props.pickable) {
6465
+ terrain.raw = null;
6466
+ }
6447
6467
  return Promise.all([terrain, null]);
6448
6468
  }
6449
6469
  renderSubLayers(props) {
@@ -6454,12 +6474,13 @@ class CogTerrainLayer extends CompositeLayer {
6454
6474
  return null;
6455
6475
  }
6456
6476
  // const [mesh, texture] = data;
6457
- const [mesh] = data;
6477
+ const [meshResult] = data;
6458
6478
  return new SubLayerClass({ ...props, tileSize: 256 }, {
6459
6479
  data: DUMMY_DATA,
6460
- mesh,
6480
+ mesh: meshResult?.map,
6461
6481
  // texture,
6462
6482
  _instanced: false,
6483
+ pickable: props.pickable,
6463
6484
  coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
6464
6485
  // getPosition: (d) => [0, 0, 0],
6465
6486
  getColor: color,
@@ -6477,8 +6498,7 @@ class CogTerrainLayer extends CompositeLayer {
6477
6498
  .map((tile) => tile.content)
6478
6499
  .filter((x) => x && x[0])
6479
6500
  .map((arr) => {
6480
- // @ts-expect-error: Tile content structure is not fully typed in the source layer
6481
- const bounds = arr[0]?.header?.boundingBox;
6501
+ const bounds = arr[0]?.map?.header?.boundingBox;
6482
6502
  return bounds?.map((bound) => bound[2]);
6483
6503
  });
6484
6504
  if (ranges.length === 0) {
@@ -6504,6 +6524,8 @@ class CogTerrainLayer extends CompositeLayer {
6504
6524
  }), {
6505
6525
  getTileData: this.getTiledTerrainData.bind(this),
6506
6526
  renderSubLayers: this.renderSubLayers.bind(this),
6527
+ pickable: this.props.pickable,
6528
+ onClick: this.props.onClick,
6507
6529
  updateTriggers: {
6508
6530
  getTileData: {
6509
6531
  elevationData: urlTemplateToUpdateTrigger(elevationData),