@developmentseed/deck.gl-raster 0.5.0-beta.1 → 0.6.0-alpha.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/gpu-modules/colormap-names.d.ts +128 -0
- package/dist/gpu-modules/colormap-names.d.ts.map +1 -0
- package/dist/gpu-modules/colormap-names.js +127 -0
- package/dist/gpu-modules/colormap-names.js.map +1 -0
- package/dist/gpu-modules/colormap.d.ts +28 -4
- package/dist/gpu-modules/colormap.d.ts.map +1 -1
- package/dist/gpu-modules/colormap.js +22 -5
- package/dist/gpu-modules/colormap.js.map +1 -1
- package/dist/gpu-modules/colormaps.png +0 -0
- package/dist/gpu-modules/composite-bands.d.ts +85 -0
- package/dist/gpu-modules/composite-bands.d.ts.map +1 -0
- package/dist/gpu-modules/composite-bands.js +141 -0
- package/dist/gpu-modules/composite-bands.js.map +1 -0
- package/dist/gpu-modules/create-colormap-texture.d.ts +16 -0
- package/dist/gpu-modules/create-colormap-texture.d.ts.map +1 -0
- package/dist/gpu-modules/create-colormap-texture.js +41 -0
- package/dist/gpu-modules/create-colormap-texture.js.map +1 -0
- package/dist/gpu-modules/cutline-bbox.d.ts +70 -0
- package/dist/gpu-modules/cutline-bbox.d.ts.map +1 -0
- package/dist/gpu-modules/cutline-bbox.js +100 -0
- package/dist/gpu-modules/cutline-bbox.js.map +1 -0
- package/dist/gpu-modules/decode-colormap-sprite.d.ts +25 -0
- package/dist/gpu-modules/decode-colormap-sprite.d.ts.map +1 -0
- package/dist/gpu-modules/decode-colormap-sprite.js +51 -0
- package/dist/gpu-modules/decode-colormap-sprite.js.map +1 -0
- package/dist/gpu-modules/index.d.ts +12 -1
- package/dist/gpu-modules/index.d.ts.map +1 -1
- package/dist/gpu-modules/index.js +7 -1
- package/dist/gpu-modules/index.js.map +1 -1
- package/dist/gpu-modules/linear-rescale.d.ts +39 -0
- package/dist/gpu-modules/linear-rescale.d.ts.map +1 -0
- package/dist/gpu-modules/linear-rescale.js +40 -0
- package/dist/gpu-modules/linear-rescale.js.map +1 -0
- package/dist/gpu-modules/types.d.ts +10 -1
- package/dist/gpu-modules/types.d.ts.map +1 -1
- package/dist/index.d.ts +5 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/layer-utils.d.ts +28 -0
- package/dist/layer-utils.d.ts.map +1 -0
- package/dist/layer-utils.js +56 -0
- package/dist/layer-utils.js.map +1 -0
- package/dist/mesh-layer/mesh-layer.d.ts.map +1 -1
- package/dist/mesh-layer/mesh-layer.js +10 -1
- package/dist/mesh-layer/mesh-layer.js.map +1 -1
- package/dist/multi-raster-tileset/index.d.ts +5 -0
- package/dist/multi-raster-tileset/index.d.ts.map +1 -0
- package/dist/multi-raster-tileset/index.js +3 -0
- package/dist/multi-raster-tileset/index.js.map +1 -0
- package/dist/multi-raster-tileset/multi-tileset-descriptor.d.ts +75 -0
- package/dist/multi-raster-tileset/multi-tileset-descriptor.d.ts.map +1 -0
- package/dist/multi-raster-tileset/multi-tileset-descriptor.js +97 -0
- package/dist/multi-raster-tileset/multi-tileset-descriptor.js.map +1 -0
- package/dist/multi-raster-tileset/secondary-tile-resolver.d.ts +129 -0
- package/dist/multi-raster-tileset/secondary-tile-resolver.d.ts.map +1 -0
- package/dist/multi-raster-tileset/secondary-tile-resolver.js +88 -0
- package/dist/multi-raster-tileset/secondary-tile-resolver.js.map +1 -0
- package/dist/raster-tileset/index.d.ts +4 -1
- package/dist/raster-tileset/index.d.ts.map +1 -1
- package/dist/raster-tileset/index.js +2 -1
- package/dist/raster-tileset/index.js.map +1 -1
- package/dist/raster-tileset/raster-tile-traversal.d.ts +29 -51
- package/dist/raster-tileset/raster-tile-traversal.d.ts.map +1 -1
- package/dist/raster-tileset/raster-tile-traversal.js +113 -171
- package/dist/raster-tileset/raster-tile-traversal.js.map +1 -1
- package/dist/raster-tileset/raster-tileset-2d.d.ts +8 -22
- package/dist/raster-tileset/raster-tileset-2d.d.ts.map +1 -1
- package/dist/raster-tileset/raster-tileset-2d.js +30 -81
- package/dist/raster-tileset/raster-tileset-2d.js.map +1 -1
- package/dist/raster-tileset/tile-matrix-set.d.ts +20 -0
- package/dist/raster-tileset/tile-matrix-set.d.ts.map +1 -0
- package/dist/raster-tileset/tile-matrix-set.js +121 -0
- package/dist/raster-tileset/tile-matrix-set.js.map +1 -0
- package/dist/raster-tileset/tileset-interface.d.ts +78 -0
- package/dist/raster-tileset/tileset-interface.d.ts.map +1 -0
- package/dist/raster-tileset/tileset-interface.js +2 -0
- package/dist/raster-tileset/tileset-interface.js.map +1 -0
- package/dist/raster-tileset/types.d.ts +10 -18
- package/dist/raster-tileset/types.d.ts.map +1 -1
- package/package.json +17 -16
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* RasterTileset2D - Generic tile traversal over a tile pyramid with Frustum
|
|
3
|
+
* Culling
|
|
3
4
|
*
|
|
4
5
|
* This version properly implements frustum culling and bounding volume calculations
|
|
5
6
|
* following the pattern from deck.gl's OSM tile indexing.
|
|
6
7
|
*/
|
|
7
8
|
import { _Tileset2D as Tileset2D } from "@deck.gl/geo-layers";
|
|
8
|
-
import * as affine from "@developmentseed/affine";
|
|
9
|
-
import { tileTransform } from "@developmentseed/morecantile";
|
|
10
9
|
import { transformBounds } from "@developmentseed/proj";
|
|
11
10
|
import { getTileIndices } from "./raster-tile-traversal";
|
|
12
11
|
/**
|
|
@@ -16,22 +15,27 @@ import { getTileIndices } from "./raster-tile-traversal";
|
|
|
16
15
|
*
|
|
17
16
|
* Handles tile lifecycle, caching, and viewport-based loading.
|
|
18
17
|
*/
|
|
19
|
-
export class
|
|
20
|
-
|
|
18
|
+
export class RasterTileset2D extends Tileset2D {
|
|
19
|
+
descriptor;
|
|
21
20
|
wgs84Bounds;
|
|
22
|
-
projectTo3857;
|
|
23
21
|
projectTo4326;
|
|
24
|
-
constructor(opts,
|
|
22
|
+
constructor(opts, descriptor, { projectTo4326, }) {
|
|
25
23
|
super(opts);
|
|
26
|
-
this.
|
|
27
|
-
this.projectTo3857 = projectTo3857;
|
|
24
|
+
this.descriptor = descriptor;
|
|
28
25
|
this.projectTo4326 = projectTo4326;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
const rawBounds = transformBounds(projectTo4326, ...this.descriptor.projectedBounds);
|
|
27
|
+
// Web Mercator cannot represent latitudes outside ~±85.051°, and the
|
|
28
|
+
// downstream tile traversal calls `lngLatToWorld` on these bounds which
|
|
29
|
+
// asserts against that range. Global data at ±90° (e.g. reanalysis grids)
|
|
30
|
+
// would otherwise crash tile selection. Clamp here; any polar rows beyond
|
|
31
|
+
// ±MAX_LAT are unreachable on a Mercator map anyway.
|
|
32
|
+
const MAX_LAT = 85.0511287798066;
|
|
33
|
+
this.wgs84Bounds = [
|
|
34
|
+
rawBounds[0],
|
|
35
|
+
Math.max(rawBounds[1], -MAX_LAT),
|
|
36
|
+
rawBounds[2],
|
|
37
|
+
Math.min(rawBounds[3], MAX_LAT),
|
|
38
|
+
];
|
|
35
39
|
}
|
|
36
40
|
/**
|
|
37
41
|
* Get tile indices visible in viewport
|
|
@@ -40,17 +44,15 @@ export class TileMatrixSetTileset extends Tileset2D {
|
|
|
40
44
|
* Overviews follow TileMatrixSet ordering: index 0 = coarsest, higher = finer
|
|
41
45
|
*/
|
|
42
46
|
getTileIndices(opts) {
|
|
43
|
-
const maxAvailableZ = this.
|
|
47
|
+
const maxAvailableZ = this.descriptor.levels.length - 1;
|
|
44
48
|
const maxZ = typeof opts.maxZoom === "number"
|
|
45
49
|
? Math.min(opts.maxZoom, maxAvailableZ)
|
|
46
50
|
: maxAvailableZ;
|
|
47
|
-
const tileIndices = getTileIndices(this.
|
|
51
|
+
const tileIndices = getTileIndices(this.descriptor, {
|
|
48
52
|
viewport: opts.viewport,
|
|
49
53
|
maxZ,
|
|
50
54
|
zRange: opts.zRange ?? null,
|
|
51
55
|
wgs84Bounds: this.wgs84Bounds,
|
|
52
|
-
projectTo3857: this.projectTo3857,
|
|
53
|
-
projectTo4326: this.projectTo4326,
|
|
54
56
|
});
|
|
55
57
|
return tileIndices;
|
|
56
58
|
}
|
|
@@ -62,17 +64,17 @@ export class TileMatrixSetTileset extends Tileset2D {
|
|
|
62
64
|
// Already at coarsest level
|
|
63
65
|
return index;
|
|
64
66
|
}
|
|
65
|
-
const currentOverview = this.
|
|
66
|
-
const parentOverview = this.
|
|
67
|
+
const currentOverview = this.descriptor.levels[index.z];
|
|
68
|
+
const parentOverview = this.descriptor.levels[index.z - 1];
|
|
67
69
|
// Decimation is the number of child tiles that fit across one parent tile.
|
|
68
70
|
// Must use tile footprint (cellSize × tileWidth/Height), not cellSize alone,
|
|
69
71
|
// because tileWidth can change between levels (e.g. the last Sentinel-2
|
|
70
72
|
// overview doubles tileWidth while halving cellSize, giving a 1:1 spatial
|
|
71
73
|
// mapping where decimation = 1).
|
|
72
|
-
const parentFootprintX = parentOverview.
|
|
73
|
-
const parentFootprintY = parentOverview.
|
|
74
|
-
const currentFootprintX = currentOverview.
|
|
75
|
-
const currentFootprintY = currentOverview.
|
|
74
|
+
const parentFootprintX = parentOverview.metersPerPixel * parentOverview.tileWidth;
|
|
75
|
+
const parentFootprintY = parentOverview.metersPerPixel * parentOverview.tileHeight;
|
|
76
|
+
const currentFootprintX = currentOverview.metersPerPixel * currentOverview.tileWidth;
|
|
77
|
+
const currentFootprintY = currentOverview.metersPerPixel * currentOverview.tileHeight;
|
|
76
78
|
const decimationX = parentFootprintX / currentFootprintX;
|
|
77
79
|
const decimationY = parentFootprintY / currentFootprintY;
|
|
78
80
|
return {
|
|
@@ -86,16 +88,9 @@ export class TileMatrixSetTileset extends Tileset2D {
|
|
|
86
88
|
}
|
|
87
89
|
getTileMetadata(index) {
|
|
88
90
|
const { x, y, z } = index;
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
const {
|
|
92
|
-
const tileAffine = tileTransform(tileMatrix, { col: x, row: y });
|
|
93
|
-
// tileAffine maps pixel (0,0) → top-left corner of this tile, so use
|
|
94
|
-
// local pixel coordinates (0..tileWidth, 0..tileHeight).
|
|
95
|
-
const topLeft = affine.apply(tileAffine, 0, 0);
|
|
96
|
-
const topRight = affine.apply(tileAffine, tileWidth, 0);
|
|
97
|
-
const bottomLeft = affine.apply(tileAffine, 0, tileHeight);
|
|
98
|
-
const bottomRight = affine.apply(tileAffine, tileWidth, tileHeight);
|
|
91
|
+
const levelDescriptor = this.descriptor.levels[z];
|
|
92
|
+
const { tileHeight, tileWidth } = levelDescriptor;
|
|
93
|
+
const { topLeft, topRight, bottomLeft, bottomRight } = levelDescriptor.projectedTileCorners(x, y);
|
|
99
94
|
// Return the projected bounds as four corners
|
|
100
95
|
// This preserves rotation/skew information
|
|
101
96
|
const projectedCorners = {
|
|
@@ -132,53 +127,7 @@ export class TileMatrixSetTileset extends Tileset2D {
|
|
|
132
127
|
projectedCorners,
|
|
133
128
|
tileWidth,
|
|
134
129
|
tileHeight,
|
|
135
|
-
tileMatrix,
|
|
136
130
|
};
|
|
137
131
|
}
|
|
138
132
|
}
|
|
139
|
-
function projectBoundsToWgs84(bounds, projectTo4326, { densifyPts }) {
|
|
140
|
-
const { lowerLeft, upperRight } = bounds;
|
|
141
|
-
// Four corners of the bounding box
|
|
142
|
-
const corners = [
|
|
143
|
-
lowerLeft,
|
|
144
|
-
[upperRight[0], lowerLeft[1]],
|
|
145
|
-
upperRight,
|
|
146
|
-
[lowerLeft[0], upperRight[1]],
|
|
147
|
-
];
|
|
148
|
-
// Densify edges: interpolate densifyPts points along each edge
|
|
149
|
-
const points = [];
|
|
150
|
-
for (let i = 0; i < corners.length; i++) {
|
|
151
|
-
const from = corners[i];
|
|
152
|
-
const to = corners[(i + 1) % corners.length];
|
|
153
|
-
// Include the start corner and all intermediate points (end corner
|
|
154
|
-
// will be included as the start of the next edge)
|
|
155
|
-
for (let j = 0; j <= densifyPts; j++) {
|
|
156
|
-
const t = j / (densifyPts + 1);
|
|
157
|
-
points.push([
|
|
158
|
-
from[0] + (to[0] - from[0]) * t,
|
|
159
|
-
from[1] + (to[1] - from[1]) * t,
|
|
160
|
-
]);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
// Reproject all points to WGS84 and compute the bounding box
|
|
164
|
-
let wgsMinX = Infinity;
|
|
165
|
-
let wgsMinY = Infinity;
|
|
166
|
-
let wgsMaxX = -Infinity;
|
|
167
|
-
let wgsMaxY = -Infinity;
|
|
168
|
-
for (const [x, y] of points) {
|
|
169
|
-
const [lon, lat] = projectTo4326(x, y);
|
|
170
|
-
if (lon < wgsMinX)
|
|
171
|
-
wgsMinX = lon;
|
|
172
|
-
if (lat < wgsMinY)
|
|
173
|
-
wgsMinY = lat;
|
|
174
|
-
if (lon > wgsMaxX)
|
|
175
|
-
wgsMaxX = lon;
|
|
176
|
-
if (lat > wgsMaxY)
|
|
177
|
-
wgsMaxY = lat;
|
|
178
|
-
}
|
|
179
|
-
return {
|
|
180
|
-
lowerLeft: [wgsMinX, wgsMinY],
|
|
181
|
-
upperRight: [wgsMaxX, wgsMaxY],
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
133
|
//# sourceMappingURL=raster-tileset-2d.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"raster-tileset-2d.js","sourceRoot":"","sources":["../../src/raster-tileset/raster-tileset-2d.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"raster-tileset-2d.js","sourceRoot":"","sources":["../../src/raster-tileset/raster-tileset-2d.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AA2CzD;;;;;;GAMG;AACH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uEAAuE;QACvE,qEAAqE;QACrE,qEAAqE;QACrE,0DAA0D;QAC1D,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,GAAG,eAAe,CAChD,IAAI,CAAC,aAAa,EAClB,GAAG,eAAe,CACnB,CAAC;QAEF,OAAO;YACL,IAAI,EAAE;gBACJ,IAAI;gBACJ,KAAK;gBACL,IAAI;gBACJ,KAAK;aACN;YACD,aAAa,EAAE;gBACb,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC;gBACxB,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;gBAC1B,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC;gBACzB,GAAG,EAAE,eAAe,CAAC,CAAC,CAAC;aACxB;YACD,gBAAgB;YAChB,SAAS;YACT,UAAU;SACX,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TileMatrixSet } from "@developmentseed/morecantile";
|
|
2
|
+
import type { TilesetDescriptor, TilesetLevel } from "./tileset-interface";
|
|
3
|
+
import type { Bounds, ProjectionFunction } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* An adapter interface to use a TileMatrixSet as a TilesetDescriptor for raster
|
|
6
|
+
* tile traversal.
|
|
7
|
+
*/
|
|
8
|
+
export declare class TileMatrixSetAdaptor implements TilesetDescriptor {
|
|
9
|
+
tms: TileMatrixSet;
|
|
10
|
+
private _levels;
|
|
11
|
+
projectTo3857: ProjectionFunction;
|
|
12
|
+
projectTo4326: ProjectionFunction;
|
|
13
|
+
constructor(tms: TileMatrixSet, { projectTo3857, projectTo4326, }: {
|
|
14
|
+
projectTo3857: ProjectionFunction;
|
|
15
|
+
projectTo4326: ProjectionFunction;
|
|
16
|
+
});
|
|
17
|
+
get levels(): TilesetLevel[];
|
|
18
|
+
get projectedBounds(): Bounds;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=tile-matrix-set.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tile-matrix-set.d.ts","sourceRoot":"","sources":["../../src/raster-tileset/tile-matrix-set.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,KAAK,EAAE,MAAM,EAAW,kBAAkB,EAAE,MAAM,SAAS,CAAC;AA0HnE;;;GAGG;AACH,qBAAa,oBAAqB,YAAW,iBAAiB;IAC5D,GAAG,EAAE,aAAa,CAAC;IACnB,OAAO,CAAC,OAAO,CAAsB;IACrC,aAAa,EAAE,kBAAkB,CAAC;IAClC,aAAa,EAAE,kBAAkB,CAAC;gBAGhC,GAAG,EAAE,aAAa,EAClB,EACE,aAAa,EACb,aAAa,GACd,EAAE;QAAE,aAAa,EAAE,kBAAkB,CAAC;QAAC,aAAa,EAAE,kBAAkB,CAAA;KAAE;IAQ7E,IAAI,MAAM,IAAI,YAAY,EAAE,CAE3B;IAED,IAAI,eAAe,IAAI,MAAM,CAU5B;CACF"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { xy_bounds } from "@developmentseed/morecantile";
|
|
2
|
+
// 0.28 mm per pixel — OGC TMS 2.0 standard screen pixel size
|
|
3
|
+
// https://docs.ogc.org/is/17-083r4/17-083r4.html#toc15
|
|
4
|
+
const SCREEN_PIXEL_SIZE = 0.00028;
|
|
5
|
+
class TileMatrixAdaptor {
|
|
6
|
+
inner;
|
|
7
|
+
constructor(tileMatrix) {
|
|
8
|
+
this.inner = tileMatrix;
|
|
9
|
+
}
|
|
10
|
+
get matrixWidth() {
|
|
11
|
+
return this.inner.matrixWidth;
|
|
12
|
+
}
|
|
13
|
+
get matrixHeight() {
|
|
14
|
+
return this.inner.matrixHeight;
|
|
15
|
+
}
|
|
16
|
+
get tileWidth() {
|
|
17
|
+
return this.inner.tileWidth;
|
|
18
|
+
}
|
|
19
|
+
get tileHeight() {
|
|
20
|
+
return this.inner.tileHeight;
|
|
21
|
+
}
|
|
22
|
+
get metersPerPixel() {
|
|
23
|
+
return this.inner.scaleDenominator * SCREEN_PIXEL_SIZE;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Compute the projected tile bounds in the tile matrix's CRS.
|
|
27
|
+
*
|
|
28
|
+
* Because it's a linear transformation from the tile index to projected bounds,
|
|
29
|
+
* we don't need to sample this for each of the reference points. We only need
|
|
30
|
+
* the corners.
|
|
31
|
+
*
|
|
32
|
+
* @return The bounding box as [minX, minY, maxX, maxY] in projected CRS.
|
|
33
|
+
*/
|
|
34
|
+
projectedTileCorners(col, row) {
|
|
35
|
+
const bounds = xy_bounds(this.inner, { x: col, y: row });
|
|
36
|
+
return {
|
|
37
|
+
topLeft: [bounds.lowerLeft[0], bounds.upperRight[1]],
|
|
38
|
+
topRight: bounds.upperRight,
|
|
39
|
+
bottomLeft: bounds.lowerLeft,
|
|
40
|
+
bottomRight: [bounds.upperRight[0], bounds.lowerLeft[1]],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Compute the range of tile indices in a child TileMatrix that spatially
|
|
45
|
+
* overlap a parent tile
|
|
46
|
+
*
|
|
47
|
+
* TileMatrixSets are not guaranteed to form a strict quadtree: successive
|
|
48
|
+
* TileMatrix levels may differ by non-integer refinement ratios and may not
|
|
49
|
+
* align perfectly in tile space. As a result, parent/child relationships
|
|
50
|
+
* cannot be inferred from zoom level or resolution alone.
|
|
51
|
+
*
|
|
52
|
+
* This function determines parent→child relationships by:
|
|
53
|
+
* 1. Treating each TileMatrix as an independent, axis-aligned grid in CRS space
|
|
54
|
+
* 2. Mapping the parent tile's CRS bounding box into the child grid
|
|
55
|
+
* 3. Returning the inclusive range of child tile indices whose spatial extent
|
|
56
|
+
* intersects the parent tile
|
|
57
|
+
*
|
|
58
|
+
* The returned indices are clamped to the valid extents of the child matrix
|
|
59
|
+
* (`[0, matrixWidth)` and `[0, matrixHeight)`).
|
|
60
|
+
*
|
|
61
|
+
* Assumptions:
|
|
62
|
+
* - The TileMatrix grid is axis-aligned in CRS space
|
|
63
|
+
* - `cornerOfOrigin` is `"topLeft"`
|
|
64
|
+
* - Tiles are rectangular and uniformly sized within a TileMatrix
|
|
65
|
+
*
|
|
66
|
+
* @param parentBounds Bounding box of the parent tile in CRS coordinates
|
|
67
|
+
* as `[minX, minY, maxX, maxY]`
|
|
68
|
+
* @param childMatrix The TileMatrix definition for the child zoom level
|
|
69
|
+
*
|
|
70
|
+
* @returns An object containing inclusive index ranges:
|
|
71
|
+
* `{ minCol, maxCol, minRow, maxRow }`, identifying all child tiles
|
|
72
|
+
* that spatially overlap the parent tile
|
|
73
|
+
*/
|
|
74
|
+
crsBoundsToTileRange(projectedMinX, projectedMinY, projectedMaxX, projectedMaxY) {
|
|
75
|
+
const { tileWidth, tileHeight, cellSize, matrixWidth, matrixHeight, pointOfOrigin, } = this.inner;
|
|
76
|
+
const childTileWidthCRS = tileWidth * cellSize;
|
|
77
|
+
const childTileHeightCRS = tileHeight * cellSize;
|
|
78
|
+
// Note: we assume top left origin
|
|
79
|
+
const originX = pointOfOrigin[0];
|
|
80
|
+
const originY = pointOfOrigin[1];
|
|
81
|
+
// Convert CRS bounds → tile indices
|
|
82
|
+
let minCol = Math.floor((projectedMinX - originX) / childTileWidthCRS);
|
|
83
|
+
let maxCol = Math.floor((projectedMaxX - originX) / childTileWidthCRS);
|
|
84
|
+
let minRow = Math.floor((originY - projectedMaxY) / childTileHeightCRS);
|
|
85
|
+
let maxRow = Math.floor((originY - projectedMinY) / childTileHeightCRS);
|
|
86
|
+
// Clamp to matrix bounds
|
|
87
|
+
minCol = Math.max(0, Math.min(matrixWidth - 1, minCol));
|
|
88
|
+
maxCol = Math.max(0, Math.min(matrixWidth - 1, maxCol));
|
|
89
|
+
minRow = Math.max(0, Math.min(matrixHeight - 1, minRow));
|
|
90
|
+
maxRow = Math.max(0, Math.min(matrixHeight - 1, maxRow));
|
|
91
|
+
return { minCol, maxCol, minRow, maxRow };
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* An adapter interface to use a TileMatrixSet as a TilesetDescriptor for raster
|
|
96
|
+
* tile traversal.
|
|
97
|
+
*/
|
|
98
|
+
export class TileMatrixSetAdaptor {
|
|
99
|
+
tms;
|
|
100
|
+
_levels;
|
|
101
|
+
projectTo3857;
|
|
102
|
+
projectTo4326;
|
|
103
|
+
constructor(tms, { projectTo3857, projectTo4326, }) {
|
|
104
|
+
this.tms = tms;
|
|
105
|
+
this._levels = tms.tileMatrices.map((tm) => new TileMatrixAdaptor(tm));
|
|
106
|
+
this.projectTo3857 = projectTo3857;
|
|
107
|
+
this.projectTo4326 = projectTo4326;
|
|
108
|
+
}
|
|
109
|
+
get levels() {
|
|
110
|
+
return this._levels;
|
|
111
|
+
}
|
|
112
|
+
get projectedBounds() {
|
|
113
|
+
const { boundingBox } = this.tms;
|
|
114
|
+
if (!boundingBox) {
|
|
115
|
+
throw new Error("Bounding Box inference not yet implemented; should be provided on TileMatrixSet");
|
|
116
|
+
}
|
|
117
|
+
const { lowerLeft, upperRight } = boundingBox;
|
|
118
|
+
return [lowerLeft[0], lowerLeft[1], upperRight[0], upperRight[1]];
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=tile-matrix-set.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tile-matrix-set.js","sourceRoot":"","sources":["../../src/raster-tileset/tile-matrix-set.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAIzD,6DAA6D;AAC7D,uDAAuD;AACvD,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAElC,MAAM,iBAAiB;IACrB,KAAK,CAAa;IAElB,YAAY,UAAsB;QAChC,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC;IAC1B,CAAC;IA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,CAAgB;IACX,OAAO,CAAsB;IACrC,aAAa,CAAqB;IAClC,aAAa,CAAqB;IAElC,YACE,GAAkB,EAClB,EACE,aAAa,EACb,aAAa,GAC4D;QAE3E,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC;QACvE,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,IAAI,eAAe;QACjB,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;QACjC,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CACb,iFAAiF,CAClF,CAAC;QACJ,CAAC;QAED,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,WAAW,CAAC;QAC9C,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IACpE,CAAC;CACF"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { Bounds, Corners, ProjectionFunction } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* A single zoom level in a generic raster tileset.
|
|
4
|
+
*
|
|
5
|
+
* This interface abstracts over both TileMatrixSet levels and Zarr multiscale
|
|
6
|
+
* levels, enabling a single traversal algorithm to work with both.
|
|
7
|
+
*/
|
|
8
|
+
export interface TilesetLevel {
|
|
9
|
+
/** Number of tiles across this level (columns). */
|
|
10
|
+
matrixWidth: number;
|
|
11
|
+
/** Number of tiles down this level (rows). */
|
|
12
|
+
matrixHeight: number;
|
|
13
|
+
/** Width of each tile in pixels. */
|
|
14
|
+
tileWidth: number;
|
|
15
|
+
/** Height of each tile in pixels. */
|
|
16
|
+
tileHeight: number;
|
|
17
|
+
/**
|
|
18
|
+
* Meters per pixel — used for LOD selection.
|
|
19
|
+
*
|
|
20
|
+
* For TileMatrix: `scaleDenominator * SCREEN_PIXEL_SIZE` (0.00028 m).
|
|
21
|
+
* For Zarr: `sqrt(|scaleX * scaleY|) * mpu` (meters per CRS unit).
|
|
22
|
+
*/
|
|
23
|
+
metersPerPixel: number;
|
|
24
|
+
/**
|
|
25
|
+
* Get the projected bounding box of a tile in the source CRS.
|
|
26
|
+
*
|
|
27
|
+
* The tileset is not guaranteed to be axis aligned, so this returns a rotated
|
|
28
|
+
* rectangle as four corners, which preserves rotation/skew information that
|
|
29
|
+
* would be lost in an axis-aligned bbox.
|
|
30
|
+
*
|
|
31
|
+
* For TMS this delegates to `xy_bounds()`; for Zarr it uses affine math
|
|
32
|
+
* directly. Using a function (rather than a stored affine) lets TMS handle
|
|
33
|
+
* variable tile widths (coalesced rows) and bottomLeft origins cleanly.
|
|
34
|
+
*/
|
|
35
|
+
projectedTileCorners: (col: number, row: number) => Corners;
|
|
36
|
+
/**
|
|
37
|
+
* Get the range of tile indices that overlap a given CRS bounding box.
|
|
38
|
+
*
|
|
39
|
+
* The returned range is **inclusive** on both ends: a consumer should
|
|
40
|
+
* iterate `for (let col = minCol; col <= maxCol; col++)`.
|
|
41
|
+
*
|
|
42
|
+
* Used by the traversal algorithm to find child tiles from a parent tile's
|
|
43
|
+
* projected bounds.
|
|
44
|
+
*/
|
|
45
|
+
crsBoundsToTileRange: (projectedMinX: number, projectedMinY: number, projectedMaxX: number, projectedMaxY: number) => {
|
|
46
|
+
minCol: number;
|
|
47
|
+
maxCol: number;
|
|
48
|
+
minRow: number;
|
|
49
|
+
maxRow: number;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A full multi-resolution raster tileset descriptor.
|
|
54
|
+
*
|
|
55
|
+
* Index 0 = coarsest level, higher index = finer detail (same ordering as
|
|
56
|
+
* TileMatrixSet).
|
|
57
|
+
*/
|
|
58
|
+
export interface TilesetDescriptor {
|
|
59
|
+
/** Ordered levels from coarsest (0) to finest. */
|
|
60
|
+
levels: TilesetLevel[];
|
|
61
|
+
/**
|
|
62
|
+
* Projection function from the source CRS → EPSG:3857.
|
|
63
|
+
*
|
|
64
|
+
* Provided by the caller (e.g. COGLayer or ZarrLayer) so that
|
|
65
|
+
* `deck.gl-raster` itself does not need a proj4 dependency.
|
|
66
|
+
*/
|
|
67
|
+
projectTo3857: ProjectionFunction;
|
|
68
|
+
/**
|
|
69
|
+
* Projection function from the source CRS → EPSG:4326.
|
|
70
|
+
*
|
|
71
|
+
* Provided by the caller so that `deck.gl-raster` itself does not need a
|
|
72
|
+
* proj4 dependency.
|
|
73
|
+
*/
|
|
74
|
+
projectTo4326: ProjectionFunction;
|
|
75
|
+
/** Bounding box of the dataset in the source CRS. */
|
|
76
|
+
projectedBounds: Bounds;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=tileset-interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tileset-interface.d.ts","sourceRoot":"","sources":["../../src/raster-tileset/tileset-interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAC;IAEpB,8CAA8C;IAC9C,YAAY,EAAE,MAAM,CAAC;IAErB,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAC;IAElB,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;;;;;;;;OAUG;IACH,oBAAoB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IAE5D;;;;;;;;OAQG;IACH,oBAAoB,EAAE,CACpB,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,KAClB;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CACzE;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,kDAAkD;IAClD,MAAM,EAAE,YAAY,EAAE,CAAC;IAEvB;;;;;OAKG;IACH,aAAa,EAAE,kBAAkB,CAAC;IAElC;;;;;OAKG;IACH,aAAa,EAAE,kBAAkB,CAAC;IAElC,qDAAqD;IACrD,eAAe,EAAE,MAAM,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tileset-interface.js","sourceRoot":"","sources":["../../src/raster-tileset/tileset-interface.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
export type ZRange = [minZ: number, maxZ: number];
|
|
2
|
+
/** An axis-aligned bounding box */
|
|
2
3
|
export type Bounds = [minX: number, minY: number, maxX: number, maxY: number];
|
|
4
|
+
/** Corners which may or may not be axis-aligned. */
|
|
5
|
+
export type Corners = {
|
|
6
|
+
topLeft: Point;
|
|
7
|
+
topRight: Point;
|
|
8
|
+
bottomLeft: Point;
|
|
9
|
+
bottomRight: Point;
|
|
10
|
+
};
|
|
3
11
|
export type GeoBoundingBox = {
|
|
4
12
|
west: number;
|
|
5
13
|
north: number;
|
|
@@ -12,18 +20,9 @@ export type ProjectedBoundingBox = {
|
|
|
12
20
|
right: number;
|
|
13
21
|
bottom: number;
|
|
14
22
|
};
|
|
15
|
-
|
|
16
|
-
export type TileLoadProps = {
|
|
17
|
-
index: TileIndex;
|
|
18
|
-
id: string;
|
|
19
|
-
bbox: TileBoundingBox;
|
|
20
|
-
url?: string | null;
|
|
21
|
-
signal?: AbortSignal;
|
|
22
|
-
userData?: Record<string, any>;
|
|
23
|
-
zoom?: number;
|
|
24
|
-
};
|
|
23
|
+
/** A 2D point represented as [x, y] */
|
|
25
24
|
export type Point = [number, number];
|
|
26
|
-
|
|
25
|
+
/** A function that projects coordinates from one CRS to another */
|
|
27
26
|
export type ProjectionFunction = (x: number, y: number) => Point;
|
|
28
27
|
/**
|
|
29
28
|
* Bounding box defined by two named corners
|
|
@@ -32,12 +31,6 @@ export type CornerBounds = {
|
|
|
32
31
|
lowerLeft: Point;
|
|
33
32
|
upperRight: Point;
|
|
34
33
|
};
|
|
35
|
-
/**
|
|
36
|
-
* Minimum bounding rectangle surrounding a 2D resource in the CRS indicated elsewhere
|
|
37
|
-
*/
|
|
38
|
-
export type TileMatrixSetBoundingBox = CornerBounds & {
|
|
39
|
-
crs?: CRS;
|
|
40
|
-
};
|
|
41
34
|
/**
|
|
42
35
|
* Raster Tile Index
|
|
43
36
|
*
|
|
@@ -54,5 +47,4 @@ export type TileIndex = {
|
|
|
54
47
|
*/
|
|
55
48
|
z: number;
|
|
56
49
|
};
|
|
57
|
-
export {};
|
|
58
50
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/raster-tileset/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAElD,MAAM,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAE9E,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/raster-tileset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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@developmentseed/deck.gl-raster",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0-alpha.1",
|
|
4
4
|
"description": "Georeferenced image data visualization in deck.gl",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"./gpu-modules": {
|
|
14
14
|
"types": "./dist/gpu-modules/index.d.ts",
|
|
15
15
|
"default": "./dist/gpu-modules/index.js"
|
|
16
|
-
}
|
|
16
|
+
},
|
|
17
|
+
"./gpu-modules/colormaps.png": "./dist/gpu-modules/colormaps.png"
|
|
17
18
|
},
|
|
18
19
|
"sideEffects": false,
|
|
19
20
|
"files": [
|
|
@@ -37,35 +38,35 @@
|
|
|
37
38
|
"url": "git+https://github.com/developmentseed/deck.gl-raster.git"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
|
-
"@luma.gl/core": "9.2
|
|
41
|
-
"@luma.gl/shadertools": "9.2
|
|
41
|
+
"@luma.gl/core": "9.3.2",
|
|
42
|
+
"@luma.gl/shadertools": "9.3.2",
|
|
42
43
|
"@types/node": "^25.3.3",
|
|
43
44
|
"jsdom": "^28.1.0",
|
|
44
|
-
"typescript": "^
|
|
45
|
+
"typescript": "^6.0.2",
|
|
45
46
|
"vitest": "^4.0.18"
|
|
46
47
|
},
|
|
47
48
|
"peerDependencies": {
|
|
48
|
-
"@deck.gl/core": "^9.
|
|
49
|
-
"@deck.gl/geo-layers": "^9.
|
|
50
|
-
"@deck.gl/layers": "^9.
|
|
51
|
-
"@deck.gl/mesh-layers": "^9.
|
|
52
|
-
"@luma.gl/core": "^9.2
|
|
53
|
-
"@luma.gl/shadertools": "^9.2
|
|
49
|
+
"@deck.gl/core": "^9.3.0",
|
|
50
|
+
"@deck.gl/geo-layers": "^9.3.0",
|
|
51
|
+
"@deck.gl/layers": "^9.3.0",
|
|
52
|
+
"@deck.gl/mesh-layers": "^9.3.0",
|
|
53
|
+
"@luma.gl/core": "^9.3.2",
|
|
54
|
+
"@luma.gl/shadertools": "^9.3.2",
|
|
55
|
+
"@developmentseed/morecantile": "^0.6.0-alpha.1"
|
|
54
56
|
},
|
|
55
57
|
"dependencies": {
|
|
56
58
|
"@math.gl/core": "^4.1.0",
|
|
57
59
|
"@math.gl/culling": "^4.1.0",
|
|
58
60
|
"@math.gl/web-mercator": "^4.1.0",
|
|
59
|
-
"@developmentseed/affine": "^0.
|
|
60
|
-
"@developmentseed/
|
|
61
|
-
"@developmentseed/
|
|
62
|
-
"@developmentseed/raster-reproject": "^0.5.0-beta.1"
|
|
61
|
+
"@developmentseed/affine": "^0.6.0-alpha.1",
|
|
62
|
+
"@developmentseed/proj": "^0.6.0-alpha.1",
|
|
63
|
+
"@developmentseed/raster-reproject": "^0.6.0-alpha.1"
|
|
63
64
|
},
|
|
64
65
|
"volta": {
|
|
65
66
|
"extends": "../../package.json"
|
|
66
67
|
},
|
|
67
68
|
"scripts": {
|
|
68
|
-
"build": "tsc --build tsconfig.build.json",
|
|
69
|
+
"build": "tsc --build tsconfig.build.json && cp src/gpu-modules/colormaps.png dist/gpu-modules/colormaps.png",
|
|
69
70
|
"test": "vitest run",
|
|
70
71
|
"test:watch": "vitest",
|
|
71
72
|
"typecheck": "tsc --noEmit"
|