@developmentseed/deck.gl-raster 0.1.0-beta.5 → 0.1.0-beta.6
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/package.json +2 -2
- package/dist/index.cjs +0 -4
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -2
- package/dist/layer.d.ts +0 -72
- package/dist/layer.d.ts.map +0 -1
- package/dist/layer.js +0 -88
- package/dist/layer.js.map +0 -1
- package/dist/mesh.d.ts +0 -1
- package/dist/mesh.d.ts.map +0 -1
- package/dist/mesh.js +0 -2
- package/dist/mesh.js.map +0 -1
- package/dist/raster-debug-layer.d.ts +0 -51
- package/dist/raster-debug-layer.d.ts.map +0 -1
- package/dist/raster-debug-layer.js +0 -102
- package/dist/raster-debug-layer.js.map +0 -1
- package/dist/raster-tileset-bak/index.d.ts +0 -1
- package/dist/raster-tileset-bak/index.d.ts.map +0 -1
- package/dist/raster-tileset-bak/index.js +0 -2
- package/dist/raster-tileset-bak/index.js.map +0 -1
- package/dist/raster-tileset-bak/raster-tile-traversal.d.ts +0 -104
- package/dist/raster-tileset-bak/raster-tile-traversal.d.ts.map +0 -1
- package/dist/raster-tileset-bak/raster-tile-traversal.js +0 -390
- package/dist/raster-tileset-bak/raster-tile-traversal.js.map +0 -1
- package/dist/raster-tileset-bak/raster-tileset-2d.d.ts +0 -43
- package/dist/raster-tileset-bak/raster-tileset-2d.d.ts.map +0 -1
- package/dist/raster-tileset-bak/raster-tileset-2d.js +0 -288
- package/dist/raster-tileset-bak/raster-tileset-2d.js.map +0 -1
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -2
- package/dist/src/index.js.map +0 -1
- package/dist/src/layer.d.ts +0 -1
- package/dist/src/layer.d.ts.map +0 -1
- package/dist/src/layer.js +0 -3
- package/dist/src/layer.js.map +0 -1
- package/dist/src/mesh.d.ts +0 -1
- package/dist/src/mesh.d.ts.map +0 -1
- package/dist/src/mesh.js +0 -2
- package/dist/src/mesh.js.map +0 -1
- package/dist/tests/placeholder.test.d.ts +0 -2
- package/dist/tests/placeholder.test.d.ts.map +0 -1
- package/dist/tests/placeholder.test.js +0 -7
- package/dist/tests/placeholder.test.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,390 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file implements tile traversal for generic 2D tilesets defined by COG
|
|
3
|
-
* tile layouts.
|
|
4
|
-
*
|
|
5
|
-
* The main algorithm works as follows:
|
|
6
|
-
* 1. Start at the root tile(s) (z=0, covers the entire image, but not
|
|
7
|
-
* necessarily the whole world)
|
|
8
|
-
* 2. Test if each tile is visible using viewport frustum culling
|
|
9
|
-
* 3. For visible tiles, compute distance-based LOD (Level of Detail)
|
|
10
|
-
* 4. If LOD is insufficient, recursively subdivide into 4 child tiles
|
|
11
|
-
* 5. Select tiles at appropriate zoom levels based on distance from camera
|
|
12
|
-
*
|
|
13
|
-
* The result is a set of tiles at varying zoom levels that efficiently
|
|
14
|
-
* cover the visible area with appropriate detail.
|
|
15
|
-
*/
|
|
16
|
-
import { _GlobeViewport, assert, WebMercatorViewport, } from "@deck.gl/core";
|
|
17
|
-
import { CullingVolume, Plane, makeOrientedBoundingBoxFromPoints, } from "@math.gl/culling";
|
|
18
|
-
/**
|
|
19
|
-
* The size of the entire world in deck.gl's common coordinate space.
|
|
20
|
-
*
|
|
21
|
-
* The world always spans [0, 512] in both X and Y in Web Mercator common space.
|
|
22
|
-
*
|
|
23
|
-
* The origin (0,0) is at the top-left corner, and (512,512) is at the
|
|
24
|
-
* bottom-right.
|
|
25
|
-
*/
|
|
26
|
-
const WORLD_SIZE = 512;
|
|
27
|
-
// Reference points used to sample tile boundaries for bounding volume
|
|
28
|
-
// calculation.
|
|
29
|
-
//
|
|
30
|
-
// In upstream deck.gl code, such reference points are only used in non-Web
|
|
31
|
-
// Mercator projections because the OSM tiling scheme is designed for Web
|
|
32
|
-
// Mercator and the OSM tile extents are already in Web Mercator projection. So
|
|
33
|
-
// using Axis-Aligned bounding boxes based on tile extents is sufficient for
|
|
34
|
-
// frustum culling in Web Mercator viewports.
|
|
35
|
-
//
|
|
36
|
-
// In upstream code these reference points are used for Globe View where the OSM
|
|
37
|
-
// tile indices _projected into longitude-latitude bounds in Globe View space_
|
|
38
|
-
// are no longer axis-aligned, and oriented bounding boxes must be used instead.
|
|
39
|
-
//
|
|
40
|
-
// In the context of generic tiling grids which are often not in Web Mercator
|
|
41
|
-
// projection, we must use the reference points approach because the grid tiles
|
|
42
|
-
// will never be exact axis aligned boxes in Web Mercator space.
|
|
43
|
-
// For most tiles: sample 4 corners and center (5 points total)
|
|
44
|
-
const REF_POINTS_5 = [
|
|
45
|
-
[0.5, 0.5], // center
|
|
46
|
-
[0, 0], // top-left
|
|
47
|
-
[0, 1], // bottom-left
|
|
48
|
-
[1, 0], // top-right
|
|
49
|
-
[1, 1], // bottom-right
|
|
50
|
-
];
|
|
51
|
-
// For higher detail: add 4 edge midpoints (9 points total)
|
|
52
|
-
const REF_POINTS_9 = REF_POINTS_5.concat([
|
|
53
|
-
[0, 0.5], // left edge
|
|
54
|
-
[0.5, 0], // top edge
|
|
55
|
-
[1, 0.5], // right edge
|
|
56
|
-
[0.5, 1], // bottom edge
|
|
57
|
-
]);
|
|
58
|
-
/**
|
|
59
|
-
* Raster Tile Node - similar to OSMNode but for a generic raster tileset's
|
|
60
|
-
* tile structure.
|
|
61
|
-
*
|
|
62
|
-
* Represents a single tile in the COG internal tiling pyramid.
|
|
63
|
-
*
|
|
64
|
-
* COG tile nodes use the following coordinate system:
|
|
65
|
-
*
|
|
66
|
-
* - x: tile column (0 to TileMatrix.tilesX, left to right)
|
|
67
|
-
* - y: tile row (0 to TileMatrix.tilesY, top to bottom)
|
|
68
|
-
* - z: overview level. This uses TileMatrixSet ordering where: 0 = coarsest, higher = finer
|
|
69
|
-
*/
|
|
70
|
-
export class RasterTileNode {
|
|
71
|
-
/** Index across a row */
|
|
72
|
-
x;
|
|
73
|
-
/** Index down a column */
|
|
74
|
-
y;
|
|
75
|
-
/** TileMatrixSet-style zoom index (higher = finer detail) */
|
|
76
|
-
z;
|
|
77
|
-
metadata;
|
|
78
|
-
/**
|
|
79
|
-
* Flag indicating whether any descendant of this tile is visible.
|
|
80
|
-
*
|
|
81
|
-
* Used to prevent loading parent tiles when children are visible (avoids
|
|
82
|
-
* overdraw).
|
|
83
|
-
*/
|
|
84
|
-
childVisible;
|
|
85
|
-
/**
|
|
86
|
-
* Flag indicating this tile should be rendered
|
|
87
|
-
*
|
|
88
|
-
* Set to `true` when this is the appropriate LOD for its distance from camera.
|
|
89
|
-
*/
|
|
90
|
-
selected;
|
|
91
|
-
/** A cache of the children of this node. */
|
|
92
|
-
_children;
|
|
93
|
-
constructor(x, y, z, metadata) {
|
|
94
|
-
this.x = x;
|
|
95
|
-
this.y = y;
|
|
96
|
-
this.z = z;
|
|
97
|
-
this.metadata = metadata;
|
|
98
|
-
}
|
|
99
|
-
/** Get overview info for this tile's z level */
|
|
100
|
-
get overview() {
|
|
101
|
-
return this.metadata.tileMatrices[this.z];
|
|
102
|
-
}
|
|
103
|
-
/** Get the children of this node. */
|
|
104
|
-
get children() {
|
|
105
|
-
if (!this._children) {
|
|
106
|
-
const maxZ = this.metadata.tileMatrices.length - 1;
|
|
107
|
-
if (this.z >= maxZ) {
|
|
108
|
-
// Already at finest resolution, no children
|
|
109
|
-
return [];
|
|
110
|
-
}
|
|
111
|
-
// In TileMatrixSet ordering: refine to z + 1 (finer detail)
|
|
112
|
-
const childZ = this.z + 1;
|
|
113
|
-
const parentOverview = this.overview;
|
|
114
|
-
const childOverview = this.metadata.tileMatrices[childZ];
|
|
115
|
-
// Calculate scale factor between levels
|
|
116
|
-
const scaleFactor = parentOverview.cellSize / childOverview.cellSize;
|
|
117
|
-
// Generate child tiles
|
|
118
|
-
this._children = [];
|
|
119
|
-
for (let dy = 0; dy < scaleFactor; dy++) {
|
|
120
|
-
for (let dx = 0; dx < scaleFactor; dx++) {
|
|
121
|
-
const childX = this.x * scaleFactor + dx;
|
|
122
|
-
const childY = this.y * scaleFactor + dy;
|
|
123
|
-
// Only create child if it's within bounds
|
|
124
|
-
// Some tiles on the edges might not need to be created at higher
|
|
125
|
-
// resolutions (higher map zoom level)
|
|
126
|
-
if (childX < childOverview.tileWidth &&
|
|
127
|
-
childY < childOverview.tileHeight) {
|
|
128
|
-
this._children.push(new RasterTileNode(childX, childY, childZ, this.metadata));
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return this._children;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Update tile visibility using frustum culling
|
|
137
|
-
* This follows the pattern from OSMNode
|
|
138
|
-
*/
|
|
139
|
-
update(params) {
|
|
140
|
-
const { viewport, cullingVolume, elevationBounds, minZ, maxZ = this.metadata.tileMatrices.length - 1, project, } = params;
|
|
141
|
-
// Get bounding volume for this tile
|
|
142
|
-
const boundingVolume = this.getBoundingVolume(elevationBounds, project);
|
|
143
|
-
// Note: this is a part of the upstream code because they have _generic_
|
|
144
|
-
// tiling systems, where the client doesn't know whether a given xyz tile
|
|
145
|
-
// actually exists. So the idea of `bounds` is to avoid even trying to fetch
|
|
146
|
-
// tiles that the user doesn't care about (think oceans)
|
|
147
|
-
//
|
|
148
|
-
// But in our case, we have known bounds from the COG metadata. So the tiles
|
|
149
|
-
// are explicitly constructed to match only tiles that exist.
|
|
150
|
-
// Check if tile is within user-specified bounds
|
|
151
|
-
// if (bounds && !this.insideBounds(bounds)) {
|
|
152
|
-
// return false;
|
|
153
|
-
// }
|
|
154
|
-
console.log("=== FRUSTUM CULLING DEBUG ===");
|
|
155
|
-
console.log(`Tile: ${this.x}, ${this.y}, ${this.z}`);
|
|
156
|
-
console.log("Bounding volume center:", boundingVolume.center);
|
|
157
|
-
console.log("Bounding volume halfSize:", boundingVolume.halfSize);
|
|
158
|
-
console.log("Viewport cameraPosition:", viewport.cameraPosition);
|
|
159
|
-
console.log("Viewport pitch:", viewport instanceof WebMercatorViewport ? viewport.pitch : "N/A");
|
|
160
|
-
for (let i = 0; i < cullingVolume.planes.length; i++) {
|
|
161
|
-
const plane = cullingVolume.planes[i];
|
|
162
|
-
const result = boundingVolume.intersectPlane(plane);
|
|
163
|
-
const planeNames = ["left", "right", "bottom", "top", "near", "far"];
|
|
164
|
-
// Calculate signed distance from OBB center to plane
|
|
165
|
-
const centerDist = plane.normal.x * boundingVolume.center.x +
|
|
166
|
-
plane.normal.y * boundingVolume.center.y +
|
|
167
|
-
plane.normal.z * boundingVolume.center.z +
|
|
168
|
-
plane.distance;
|
|
169
|
-
console.log(`Plane ${i} (${planeNames[i]}): normal=[${plane.normal.x.toFixed(3)}, ${plane.normal.y.toFixed(3)}, ${plane.normal.z.toFixed(3)}], ` +
|
|
170
|
-
`distance=${plane.distance.toFixed(3)}, centerDist=${centerDist.toFixed(3)}, result=${result} (${result === 1 ? "INSIDE" : result === 0 ? "INTERSECT" : "OUTSIDE"})`);
|
|
171
|
-
}
|
|
172
|
-
console.log("=== END FRUSTUM DEBUG ===");
|
|
173
|
-
// Frustum culling
|
|
174
|
-
// Test if tile's bounding volume intersects the camera frustum
|
|
175
|
-
// Returns: <0 if outside, 0 if intersecting, >0 if fully inside
|
|
176
|
-
const isInside = cullingVolume.computeVisibility(boundingVolume);
|
|
177
|
-
console.log(`Tile ${this.x},${this.y},${this.z} frustum check: ${isInside} (${isInside < 0 ? "CULLED" : "VISIBLE"})`);
|
|
178
|
-
if (isInside < 0) {
|
|
179
|
-
return false;
|
|
180
|
-
}
|
|
181
|
-
// LOD (Level of Detail) selection
|
|
182
|
-
// Only select this tile if no child is visible (prevents overlapping tiles)
|
|
183
|
-
if (!this.childVisible) {
|
|
184
|
-
let { z } = this;
|
|
185
|
-
if (z < maxZ && z >= minZ) {
|
|
186
|
-
// Compute distance-based LOD adjustment
|
|
187
|
-
// Tiles farther from camera can use lower zoom levels (larger tiles)
|
|
188
|
-
// Distance is normalized by viewport height to be resolution-independent
|
|
189
|
-
const distance = (boundingVolume.distanceTo(viewport.cameraPosition) *
|
|
190
|
-
viewport.scale) /
|
|
191
|
-
viewport.height;
|
|
192
|
-
// Increase effective zoom level based on log2(distance)
|
|
193
|
-
// e.g., if distance=4, accept tiles 2 levels lower than maxZ
|
|
194
|
-
z += Math.floor(Math.log2(distance));
|
|
195
|
-
}
|
|
196
|
-
if (z >= maxZ) {
|
|
197
|
-
// This tile's LOD is sufficient for its distance - select it for rendering
|
|
198
|
-
this.selected = true;
|
|
199
|
-
return true;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
// LOD is not enough, recursively test child tiles
|
|
203
|
-
this.selected = false;
|
|
204
|
-
this.childVisible = true;
|
|
205
|
-
for (const child of this.children) {
|
|
206
|
-
child.update(params);
|
|
207
|
-
}
|
|
208
|
-
// // NOTE: this deviates from upstream; we could move to the upstream code if
|
|
209
|
-
// // we pass in maxZ correctly I think
|
|
210
|
-
// if (children.length === 0) {
|
|
211
|
-
// // No children available (at finest resolution), select this tile
|
|
212
|
-
// this.selected = true;
|
|
213
|
-
// return true;
|
|
214
|
-
// }
|
|
215
|
-
// for (const child of children) {
|
|
216
|
-
// child.update(params);
|
|
217
|
-
// }
|
|
218
|
-
return true;
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Collect all tiles marked as selected in the tree.
|
|
222
|
-
* Recursively traverses the entire tree and gathers tiles where selected=true.
|
|
223
|
-
*
|
|
224
|
-
* @param result - Accumulator array for selected tiles
|
|
225
|
-
* @returns Array of selected OSMNode tiles
|
|
226
|
-
*/
|
|
227
|
-
getSelected(result = []) {
|
|
228
|
-
if (this.selected) {
|
|
229
|
-
result.push(this);
|
|
230
|
-
}
|
|
231
|
-
if (this._children) {
|
|
232
|
-
for (const node of this._children) {
|
|
233
|
-
node.getSelected(result);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
return result;
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Calculate the 3D bounding volume for this tile in deck.gl's common
|
|
240
|
-
* coordinate space for frustum culling.
|
|
241
|
-
*
|
|
242
|
-
*/
|
|
243
|
-
getBoundingVolume(zRange, project) {
|
|
244
|
-
const overview = this.overview;
|
|
245
|
-
const { tileMatrices } = this.metadata;
|
|
246
|
-
const { tileWidth, tileHeight } = tileMatrices[tileMatrices.length - 1];
|
|
247
|
-
// Use geotransform to calculate tile bounds
|
|
248
|
-
// geotransform: [a, b, c, d, e, f] where:
|
|
249
|
-
// x_geo = a * col + b * row + c
|
|
250
|
-
// y_geo = d * col + e * row + f
|
|
251
|
-
const [a, b, c, d, e, f] = overview.geotransform;
|
|
252
|
-
// Calculate pixel coordinates for this tile's extent
|
|
253
|
-
const pixelMinCol = this.x * tileWidth;
|
|
254
|
-
const pixelMinRow = this.y * tileHeight;
|
|
255
|
-
const pixelMaxCol = (this.x + 1) * tileWidth;
|
|
256
|
-
const pixelMaxRow = (this.y + 1) * tileHeight;
|
|
257
|
-
// Sample reference points across the tile surface
|
|
258
|
-
const refPoints = REF_POINTS_9;
|
|
259
|
-
console.log("refPoints", refPoints);
|
|
260
|
-
/** Reference points positions in image CRS */
|
|
261
|
-
const refPointPositionsImage = [];
|
|
262
|
-
for (const [pX, pY] of refPoints) {
|
|
263
|
-
// pX, pY are in [0, 1] range
|
|
264
|
-
// Interpolate pixel coordinates within the tile
|
|
265
|
-
const col = pixelMinCol + pX * (pixelMaxCol - pixelMinCol);
|
|
266
|
-
const row = pixelMinRow + pY * (pixelMaxRow - pixelMinRow);
|
|
267
|
-
// Convert pixel coordinates to geographic coordinates using geotransform
|
|
268
|
-
const geoX = a * col + b * row + c;
|
|
269
|
-
const geoY = d * col + e * row + f;
|
|
270
|
-
refPointPositionsImage.push([geoX, geoY]);
|
|
271
|
-
}
|
|
272
|
-
console.log("refPointPositionsImage (image CRS):", refPointPositionsImage);
|
|
273
|
-
console.log("Geotransform [a,b,c,d,e,f]:", [a, b, c, d, e, f]);
|
|
274
|
-
if (project) {
|
|
275
|
-
assert(false, "TODO: implement bounding volume implementation in Globe view");
|
|
276
|
-
// Reproject positions to wgs84 instead, then pass them into `project`
|
|
277
|
-
// return makeOrientedBoundingBoxFromPoints(refPointPositions);
|
|
278
|
-
}
|
|
279
|
-
/** Reference points positions in EPSG 3857 */
|
|
280
|
-
const refPointPositionsProjected = [];
|
|
281
|
-
for (const [pX, pY] of refPointPositionsImage) {
|
|
282
|
-
// Reproject to Web Mercator (EPSG 3857)
|
|
283
|
-
const projected = this.metadata.projectTo3857([pX, pY]);
|
|
284
|
-
refPointPositionsProjected.push(projected);
|
|
285
|
-
// Also log WGS84 for comparison
|
|
286
|
-
const wgs84 = this.metadata.projectToWgs84([pX, pY]);
|
|
287
|
-
console.log(`Image [${pX.toFixed(2)}, ${pY.toFixed(2)}] -> WGS84 [${wgs84[0].toFixed(6)}, ${wgs84[1].toFixed(6)}] -> WebMerc [${projected[0].toFixed(2)}, ${projected[1].toFixed(2)}]`);
|
|
288
|
-
}
|
|
289
|
-
console.log("refPointPositionsProjected (EPSG:3857):", refPointPositionsProjected);
|
|
290
|
-
// Convert from Web Mercator meters to deck.gl's common space (world units)
|
|
291
|
-
// Web Mercator range: [-20037508.34, 20037508.34] meters
|
|
292
|
-
// deck.gl world space: [0, 512]
|
|
293
|
-
const WEB_MERCATOR_MAX = 20037508.342789244; // Half Earth circumference
|
|
294
|
-
/** Reference points positions in deck.gl world space */
|
|
295
|
-
const refPointPositionsWorld = [];
|
|
296
|
-
for (const [mercX, mercY] of refPointPositionsProjected) {
|
|
297
|
-
// X: offset from [-20M, 20M] to [0, 40M], then normalize to [0, 512]
|
|
298
|
-
const worldX = ((mercX + WEB_MERCATOR_MAX) / (2 * WEB_MERCATOR_MAX)) * WORLD_SIZE;
|
|
299
|
-
// Y: same transformation WITHOUT flip
|
|
300
|
-
// Testing hypothesis: Y-flip might be incorrect since geotransform already handles orientation
|
|
301
|
-
const worldY = ((mercY + WEB_MERCATOR_MAX) / (2 * WEB_MERCATOR_MAX)) * WORLD_SIZE;
|
|
302
|
-
console.log(`WebMerc [${mercX.toFixed(2)}, ${mercY.toFixed(2)}] -> World [${worldX.toFixed(4)}, ${worldY.toFixed(4)}]`);
|
|
303
|
-
// Add z-range minimum
|
|
304
|
-
refPointPositionsWorld.push([worldX, worldY, zRange[0]]);
|
|
305
|
-
}
|
|
306
|
-
// Add top z-range if elevation varies
|
|
307
|
-
if (zRange[0] !== zRange[1]) {
|
|
308
|
-
for (const [mercX, mercY] of refPointPositionsProjected) {
|
|
309
|
-
const worldX = ((mercX + WEB_MERCATOR_MAX) / (2 * WEB_MERCATOR_MAX)) * WORLD_SIZE;
|
|
310
|
-
const worldY = WORLD_SIZE -
|
|
311
|
-
((mercY + WEB_MERCATOR_MAX) / (2 * WEB_MERCATOR_MAX)) * WORLD_SIZE;
|
|
312
|
-
refPointPositionsWorld.push([worldX, worldY, zRange[1]]);
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
console.log("refPointPositionsWorld", refPointPositionsWorld);
|
|
316
|
-
console.log("zRange used:", zRange);
|
|
317
|
-
const obb = makeOrientedBoundingBoxFromPoints(refPointPositionsWorld);
|
|
318
|
-
console.log("Created OBB center:", obb.center);
|
|
319
|
-
console.log("Created OBB halfAxes:", obb.halfAxes);
|
|
320
|
-
return obb;
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* Convert COG coordinates to lng/lat
|
|
324
|
-
* This is a placeholder - needs proper projection library (proj4js)
|
|
325
|
-
*/
|
|
326
|
-
cogCoordsToLngLat([x, y]) {
|
|
327
|
-
const [lng, lat] = this.metadata.projectToWgs84([x, y]);
|
|
328
|
-
return [lng, lat, 0];
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
/**
|
|
332
|
-
* Get tile indices visible in viewport
|
|
333
|
-
* Uses frustum culling similar to OSM implementation
|
|
334
|
-
*
|
|
335
|
-
* Overviews follow TileMatrixSet ordering: index 0 = coarsest, higher = finer
|
|
336
|
-
*/
|
|
337
|
-
export function getTileIndices(metadata, opts) {
|
|
338
|
-
const { viewport, maxZ, zRange } = opts;
|
|
339
|
-
// console.log("=== getTileIndices called ===");
|
|
340
|
-
// console.log("Viewport:", viewport);
|
|
341
|
-
// console.log("maxZ:", maxZ);
|
|
342
|
-
// console.log("COG metadata tileMatrices count:", metadata.tileMatrices.length);
|
|
343
|
-
// console.log("COG bbox:", metadata.bbox);
|
|
344
|
-
const project = viewport instanceof _GlobeViewport && viewport.resolution
|
|
345
|
-
? viewport.projectPosition
|
|
346
|
-
: null;
|
|
347
|
-
// Get the culling volume of the current camera
|
|
348
|
-
const planes = Object.values(viewport.getFrustumPlanes()).map(({ normal, distance }) => new Plane(normal.clone().negate(), distance));
|
|
349
|
-
const cullingVolume = new CullingVolume(planes);
|
|
350
|
-
// Project zRange from meters to common space
|
|
351
|
-
const unitsPerMeter = viewport.distanceScales.unitsPerMeter[2];
|
|
352
|
-
const elevationMin = (zRange && zRange[0] * unitsPerMeter) || 0;
|
|
353
|
-
const elevationMax = (zRange && zRange[1] * unitsPerMeter) || 0;
|
|
354
|
-
// Optimization: For low-pitch views, only consider tiles at maxZ level
|
|
355
|
-
// At low pitch (top-down view), all tiles are roughly the same distance,
|
|
356
|
-
// so we don't need the LOD pyramid - just use the finest level
|
|
357
|
-
const minZ = viewport instanceof WebMercatorViewport && viewport.pitch <= 60 ? maxZ : 0;
|
|
358
|
-
// Start from coarsest overview
|
|
359
|
-
const coarsestOverview = metadata.tileMatrices[0];
|
|
360
|
-
// Create root tiles at coarsest level
|
|
361
|
-
// In contrary to OSM tiling, we might have more than one tile at the
|
|
362
|
-
// coarsest level (z=0)
|
|
363
|
-
const roots = [];
|
|
364
|
-
for (let y = 0; y < coarsestOverview.tileHeight; y++) {
|
|
365
|
-
for (let x = 0; x < coarsestOverview.tileWidth; x++) {
|
|
366
|
-
roots.push(new RasterTileNode(x, y, 0, metadata));
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
// Traverse and update visibility
|
|
370
|
-
const traversalParams = {
|
|
371
|
-
viewport,
|
|
372
|
-
project,
|
|
373
|
-
cullingVolume,
|
|
374
|
-
elevationBounds: [elevationMin, elevationMax],
|
|
375
|
-
minZ,
|
|
376
|
-
maxZ,
|
|
377
|
-
};
|
|
378
|
-
console.log("Traversal params:", traversalParams);
|
|
379
|
-
for (const root of roots) {
|
|
380
|
-
root.update(traversalParams);
|
|
381
|
-
}
|
|
382
|
-
console.log("roots", roots);
|
|
383
|
-
// Collect selected tiles
|
|
384
|
-
const selectedNodes = [];
|
|
385
|
-
for (const root of roots) {
|
|
386
|
-
root.getSelected(selectedNodes);
|
|
387
|
-
}
|
|
388
|
-
return selectedNodes;
|
|
389
|
-
}
|
|
390
|
-
//# sourceMappingURL=raster-tile-traversal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"raster-tile-traversal.js","sourceRoot":"","sources":["../../src/raster-tileset-bak/raster-tile-traversal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,cAAc,EACd,MAAM,EAEN,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,aAAa,EACb,KAAK,EACL,iCAAiC,GAClC,MAAM,kBAAkB,CAAC;AAS1B;;;;;;;GAOG;AACH,MAAM,UAAU,GAAG,GAAG,CAAC;AAEvB,sEAAsE;AACtE,eAAe;AACf,EAAE;AACF,2EAA2E;AAC3E,yEAAyE;AACzE,+EAA+E;AAC/E,4EAA4E;AAC5E,6CAA6C;AAC7C,EAAE;AACF,gFAAgF;AAChF,8EAA8E;AAC9E,gFAAgF;AAChF,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,gEAAgE;AAEhE,+DAA+D;AAC/D,MAAM,YAAY,GAAuB;IACvC,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,SAAS;IACrB,CAAC,CAAC,EAAE,C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|
-
*
|
|
4
|
-
* This version properly implements frustum culling and bounding volume calculations
|
|
5
|
-
* following the pattern from deck.gl's OSM tile indexing.
|
|
6
|
-
*/
|
|
7
|
-
import { Viewport } from "@deck.gl/core";
|
|
8
|
-
import { _Tileset2D as Tileset2D } from "@deck.gl/geo-layers";
|
|
9
|
-
import type { Tileset2DProps } from "@deck.gl/geo-layers/dist/tileset-2d";
|
|
10
|
-
import type { ZRange } from "@deck.gl/geo-layers/dist/tileset-2d/types";
|
|
11
|
-
import { Matrix4 } from "@math.gl/core";
|
|
12
|
-
import { GeoTIFF } from "geotiff";
|
|
13
|
-
import type { COGMetadata, COGTileIndex } from "../raster-tileset/types";
|
|
14
|
-
/**
|
|
15
|
-
* Extract COG metadata
|
|
16
|
-
*/
|
|
17
|
-
export declare function extractCOGMetadata(tiff: GeoTIFF): Promise<COGMetadata>;
|
|
18
|
-
/**
|
|
19
|
-
* COGTileset2D with proper frustum culling
|
|
20
|
-
*/
|
|
21
|
-
export declare class COGTileset2D extends Tileset2D {
|
|
22
|
-
private cogMetadata;
|
|
23
|
-
constructor(cogMetadata: COGMetadata, opts: Tileset2DProps);
|
|
24
|
-
/**
|
|
25
|
-
* Get tile indices visible in viewport
|
|
26
|
-
* Uses frustum culling similar to OSM implementation
|
|
27
|
-
*
|
|
28
|
-
* Overviews follow TileMatrixSet ordering: index 0 = coarsest, higher = finer
|
|
29
|
-
*/
|
|
30
|
-
getTileIndices(opts: {
|
|
31
|
-
viewport: Viewport;
|
|
32
|
-
maxZoom?: number;
|
|
33
|
-
minZoom?: number;
|
|
34
|
-
zRange: ZRange | null;
|
|
35
|
-
modelMatrix?: Matrix4;
|
|
36
|
-
modelMatrixInverse?: Matrix4;
|
|
37
|
-
}): COGTileIndex[];
|
|
38
|
-
getTileId(index: COGTileIndex): string;
|
|
39
|
-
getParentIndex(index: COGTileIndex): COGTileIndex;
|
|
40
|
-
getTileZoom(index: COGTileIndex): number;
|
|
41
|
-
getTileMetadata(index: COGTileIndex): Record<string, unknown>;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=raster-tileset-2d.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"raster-tileset-2d.d.ts","sourceRoot":"","sources":["../../src/raster-tileset-bak/raster-tileset-2d.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAuB,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,OAAO,EAAgB,MAAM,SAAS,CAAC;AAIhD,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EAGb,MAAM,yBAAyB,CAAC;AA0EjC;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAsG5E;AAoBD;;GAEG;AACH,qBAAa,YAAa,SAAQ,SAAS;IACzC,OAAO,CAAC,WAAW,CAAc;gBAErB,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,cAAc;IAK1D;;;;;OAKG;IACH,cAAc,CAAC,IAAI,EAAE;QACnB,QAAQ,EAAE,QAAQ,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;KAC9B,GAAG,YAAY,EAAE;IAiBlB,SAAS,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM;IAItC,cAAc,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY;I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