@developmentseed/deck.gl-raster 0.5.0-beta.1 → 0.5.0

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 (64) hide show
  1. package/dist/gpu-modules/composite-bands.d.ts +85 -0
  2. package/dist/gpu-modules/composite-bands.d.ts.map +1 -0
  3. package/dist/gpu-modules/composite-bands.js +141 -0
  4. package/dist/gpu-modules/composite-bands.js.map +1 -0
  5. package/dist/gpu-modules/cutline-bbox.d.ts +70 -0
  6. package/dist/gpu-modules/cutline-bbox.d.ts.map +1 -0
  7. package/dist/gpu-modules/cutline-bbox.js +100 -0
  8. package/dist/gpu-modules/cutline-bbox.js.map +1 -0
  9. package/dist/gpu-modules/index.d.ts +6 -0
  10. package/dist/gpu-modules/index.d.ts.map +1 -1
  11. package/dist/gpu-modules/index.js +3 -0
  12. package/dist/gpu-modules/index.js.map +1 -1
  13. package/dist/gpu-modules/linear-rescale.d.ts +39 -0
  14. package/dist/gpu-modules/linear-rescale.d.ts.map +1 -0
  15. package/dist/gpu-modules/linear-rescale.js +40 -0
  16. package/dist/gpu-modules/linear-rescale.js.map +1 -0
  17. package/dist/gpu-modules/types.d.ts +10 -1
  18. package/dist/gpu-modules/types.d.ts.map +1 -1
  19. package/dist/index.d.ts +5 -9
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +4 -3
  22. package/dist/index.js.map +1 -1
  23. package/dist/layer-utils.d.ts +28 -0
  24. package/dist/layer-utils.d.ts.map +1 -0
  25. package/dist/layer-utils.js +56 -0
  26. package/dist/layer-utils.js.map +1 -0
  27. package/dist/mesh-layer/mesh-layer.d.ts.map +1 -1
  28. package/dist/mesh-layer/mesh-layer.js +10 -1
  29. package/dist/mesh-layer/mesh-layer.js.map +1 -1
  30. package/dist/multi-raster-tileset/index.d.ts +5 -0
  31. package/dist/multi-raster-tileset/index.d.ts.map +1 -0
  32. package/dist/multi-raster-tileset/index.js +3 -0
  33. package/dist/multi-raster-tileset/index.js.map +1 -0
  34. package/dist/multi-raster-tileset/multi-tileset-descriptor.d.ts +75 -0
  35. package/dist/multi-raster-tileset/multi-tileset-descriptor.d.ts.map +1 -0
  36. package/dist/multi-raster-tileset/multi-tileset-descriptor.js +97 -0
  37. package/dist/multi-raster-tileset/multi-tileset-descriptor.js.map +1 -0
  38. package/dist/multi-raster-tileset/secondary-tile-resolver.d.ts +129 -0
  39. package/dist/multi-raster-tileset/secondary-tile-resolver.d.ts.map +1 -0
  40. package/dist/multi-raster-tileset/secondary-tile-resolver.js +88 -0
  41. package/dist/multi-raster-tileset/secondary-tile-resolver.js.map +1 -0
  42. package/dist/raster-tileset/index.d.ts +4 -1
  43. package/dist/raster-tileset/index.d.ts.map +1 -1
  44. package/dist/raster-tileset/index.js +2 -1
  45. package/dist/raster-tileset/index.js.map +1 -1
  46. package/dist/raster-tileset/raster-tile-traversal.d.ts +29 -51
  47. package/dist/raster-tileset/raster-tile-traversal.d.ts.map +1 -1
  48. package/dist/raster-tileset/raster-tile-traversal.js +113 -171
  49. package/dist/raster-tileset/raster-tile-traversal.js.map +1 -1
  50. package/dist/raster-tileset/raster-tileset-2d.d.ts +8 -22
  51. package/dist/raster-tileset/raster-tileset-2d.d.ts.map +1 -1
  52. package/dist/raster-tileset/raster-tileset-2d.js +18 -81
  53. package/dist/raster-tileset/raster-tileset-2d.js.map +1 -1
  54. package/dist/raster-tileset/tile-matrix-set.d.ts +20 -0
  55. package/dist/raster-tileset/tile-matrix-set.d.ts.map +1 -0
  56. package/dist/raster-tileset/tile-matrix-set.js +121 -0
  57. package/dist/raster-tileset/tile-matrix-set.js.map +1 -0
  58. package/dist/raster-tileset/tileset-interface.d.ts +78 -0
  59. package/dist/raster-tileset/tileset-interface.d.ts.map +1 -0
  60. package/dist/raster-tileset/tileset-interface.js +2 -0
  61. package/dist/raster-tileset/tileset-interface.js.map +1 -0
  62. package/dist/raster-tileset/types.d.ts +10 -18
  63. package/dist/raster-tileset/types.d.ts.map +1 -1
  64. package/package.json +14 -14
@@ -0,0 +1,85 @@
1
+ import type { Texture } from "@luma.gl/core";
2
+ import type { UvTransform } from "../multi-raster-tileset/index.js";
3
+ /**
4
+ * Maximum number of band texture slots supported by {@link CompositeBands}.
5
+ */
6
+ export declare const MAX_BAND_SLOTS = 4;
7
+ /**
8
+ * Props for the {@link CompositeBands} shader module.
9
+ *
10
+ * Textures (`band0`–`band3`) are bound via `getUniforms`. Scalar uniforms
11
+ * (`uvTransform0`–`uvTransform3`, `channelMap`) go through a uniform block.
12
+ */
13
+ export type CompositeBandsProps = {
14
+ band0: Texture;
15
+ band1: Texture;
16
+ band2: Texture;
17
+ band3: Texture;
18
+ uvTransform0: UvTransform;
19
+ uvTransform1: UvTransform;
20
+ uvTransform2: UvTransform;
21
+ uvTransform3: UvTransform;
22
+ channelMap: [number, number, number, number];
23
+ };
24
+ /**
25
+ * A shader module that samples up to 4 band textures with per-band UV
26
+ * transforms and composites them into a `vec4` color.
27
+ *
28
+ * Uses fixed uniform slots (`band0`–`band3`) for textures (bound via
29
+ * `getUniforms`) and a uniform block for scalar values (`uvTransform0`–
30
+ * `uvTransform3`, `channelMap`).
31
+ *
32
+ * @see {@link CompositeBandsProps}
33
+ * @see {@link buildCompositeBandsProps} for a helper that maps named bands
34
+ * to slot indices.
35
+ */
36
+ export declare const CompositeBands: {
37
+ readonly name: "compositeBands";
38
+ readonly inject: {
39
+ readonly "fs:#decl": "\nuniform sampler2D band0;\nuniform sampler2D band1;\nuniform sampler2D band2;\nuniform sampler2D band3;\n\nvec2 compositeBands_applyUv(vec2 uv, vec4 transform) {\n return uv * transform.zw + transform.xy;\n}\n\nfloat compositeBands_sampleSlot(int slot, vec2 uv) {\n if (slot == 0) return texture(band0, compositeBands_applyUv(uv, compositeBands.uvTransform0)).r;\n if (slot == 1) return texture(band1, compositeBands_applyUv(uv, compositeBands.uvTransform1)).r;\n if (slot == 2) return texture(band2, compositeBands_applyUv(uv, compositeBands.uvTransform2)).r;\n if (slot == 3) return texture(band3, compositeBands_applyUv(uv, compositeBands.uvTransform3)).r;\n return 0.0;\n}\n";
40
+ readonly "fs:DECKGL_FILTER_COLOR": "\n float r = compositeBands.channelMap.r >= 0 ? compositeBands_sampleSlot(compositeBands.channelMap.r, geometry.uv) : 0.0;\n float g = compositeBands.channelMap.g >= 0 ? compositeBands_sampleSlot(compositeBands.channelMap.g, geometry.uv) : 0.0;\n float b = compositeBands.channelMap.b >= 0 ? compositeBands_sampleSlot(compositeBands.channelMap.b, geometry.uv) : 0.0;\n float a = compositeBands.channelMap.a >= 0 ? compositeBands_sampleSlot(compositeBands.channelMap.a, geometry.uv) : 1.0;\n color = vec4(r, g, b, a);\n";
41
+ };
42
+ readonly fs: "uniform compositeBandsUniforms {\n vec4 uvTransform0;\n vec4 uvTransform1;\n vec4 uvTransform2;\n vec4 uvTransform3;\n ivec4 channelMap;\n} compositeBands;\n";
43
+ readonly uniformTypes: {
44
+ readonly uvTransform0: "vec4<f32>";
45
+ readonly uvTransform1: "vec4<f32>";
46
+ readonly uvTransform2: "vec4<f32>";
47
+ readonly uvTransform3: "vec4<f32>";
48
+ readonly channelMap: "vec4<i32>";
49
+ };
50
+ readonly getUniforms: (props: Partial<CompositeBandsProps>) => {
51
+ band0: Texture | undefined;
52
+ band1: Texture | undefined;
53
+ band2: Texture | undefined;
54
+ band3: Texture | undefined;
55
+ uvTransform0: UvTransform;
56
+ uvTransform1: UvTransform;
57
+ uvTransform2: UvTransform;
58
+ uvTransform3: UvTransform;
59
+ channelMap: [number, number, number, number];
60
+ };
61
+ };
62
+ /**
63
+ * Maps named bands and their UV transforms to {@link CompositeBandsProps}
64
+ * slot indices.
65
+ *
66
+ * Assigns each unique band name to a fixed slot (0–3), builds the
67
+ * `channelMap` that maps RGBA output channels to slots, and fills unused
68
+ * slots with a placeholder texture to satisfy WebGL binding requirements.
69
+ *
70
+ * @param mapping - Which named band goes to which RGBA channel.
71
+ * @param bands - Map of band name to texture + UV transform.
72
+ * @returns Props ready to pass to `{ module: CompositeBands, props: ... }`.
73
+ *
74
+ * @see {@link CompositeBands}
75
+ */
76
+ export declare function buildCompositeBandsProps(mapping: {
77
+ r: string;
78
+ g?: string;
79
+ b?: string;
80
+ a?: string;
81
+ }, bands: Map<string, {
82
+ texture: Texture;
83
+ uvTransform: UvTransform;
84
+ }>): Partial<CompositeBandsProps>;
85
+ //# sourceMappingURL=composite-bands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composite-bands.d.ts","sourceRoot":"","sources":["../../src/gpu-modules/composite-bands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,YAAY,EAAE,WAAW,CAAC;IAC1B,YAAY,EAAE,WAAW,CAAC;IAC1B,YAAY,EAAE,WAAW,CAAC;IAC1B,YAAY,EAAE,WAAW,CAAC;IAC1B,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9C,CAAC;AAIF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;kCA+CJ,OAAO,CAAC,mBAAmB,CAAC;;;;;;;;;;;CAeG,CAAC;AAEvD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAC1D,KAAK,EAAE,GAAG,CACR,MAAM,EACN;IACE,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,WAAW,CAAC;CAC1B,CACF,GACA,OAAO,CAAC,mBAAmB,CAAC,CAsD9B"}
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Maximum number of band texture slots supported by {@link CompositeBands}.
3
+ */
4
+ export const MAX_BAND_SLOTS = 4;
5
+ const MODULE_NAME = "compositeBands";
6
+ /**
7
+ * A shader module that samples up to 4 band textures with per-band UV
8
+ * transforms and composites them into a `vec4` color.
9
+ *
10
+ * Uses fixed uniform slots (`band0`–`band3`) for textures (bound via
11
+ * `getUniforms`) and a uniform block for scalar values (`uvTransform0`–
12
+ * `uvTransform3`, `channelMap`).
13
+ *
14
+ * @see {@link CompositeBandsProps}
15
+ * @see {@link buildCompositeBandsProps} for a helper that maps named bands
16
+ * to slot indices.
17
+ */
18
+ export const CompositeBands = {
19
+ name: MODULE_NAME,
20
+ // Texture samplers — declared via inject, bound via getUniforms
21
+ inject: {
22
+ "fs:#decl": /* glsl */ `
23
+ uniform sampler2D band0;
24
+ uniform sampler2D band1;
25
+ uniform sampler2D band2;
26
+ uniform sampler2D band3;
27
+
28
+ vec2 compositeBands_applyUv(vec2 uv, vec4 transform) {
29
+ return uv * transform.zw + transform.xy;
30
+ }
31
+
32
+ float compositeBands_sampleSlot(int slot, vec2 uv) {
33
+ if (slot == 0) return texture(band0, compositeBands_applyUv(uv, ${MODULE_NAME}.uvTransform0)).r;
34
+ if (slot == 1) return texture(band1, compositeBands_applyUv(uv, ${MODULE_NAME}.uvTransform1)).r;
35
+ if (slot == 2) return texture(band2, compositeBands_applyUv(uv, ${MODULE_NAME}.uvTransform2)).r;
36
+ if (slot == 3) return texture(band3, compositeBands_applyUv(uv, ${MODULE_NAME}.uvTransform3)).r;
37
+ return 0.0;
38
+ }
39
+ `,
40
+ "fs:DECKGL_FILTER_COLOR": /* glsl */ `
41
+ float r = ${MODULE_NAME}.channelMap.r >= 0 ? compositeBands_sampleSlot(${MODULE_NAME}.channelMap.r, geometry.uv) : 0.0;
42
+ float g = ${MODULE_NAME}.channelMap.g >= 0 ? compositeBands_sampleSlot(${MODULE_NAME}.channelMap.g, geometry.uv) : 0.0;
43
+ float b = ${MODULE_NAME}.channelMap.b >= 0 ? compositeBands_sampleSlot(${MODULE_NAME}.channelMap.b, geometry.uv) : 0.0;
44
+ float a = ${MODULE_NAME}.channelMap.a >= 0 ? compositeBands_sampleSlot(${MODULE_NAME}.channelMap.a, geometry.uv) : 1.0;
45
+ color = vec4(r, g, b, a);
46
+ `,
47
+ },
48
+ // Scalar uniforms — declared via fs uniform block + uniformTypes
49
+ fs: `\
50
+ uniform ${MODULE_NAME}Uniforms {
51
+ vec4 uvTransform0;
52
+ vec4 uvTransform1;
53
+ vec4 uvTransform2;
54
+ vec4 uvTransform3;
55
+ ivec4 channelMap;
56
+ } ${MODULE_NAME};
57
+ `,
58
+ uniformTypes: {
59
+ uvTransform0: "vec4<f32>",
60
+ uvTransform1: "vec4<f32>",
61
+ uvTransform2: "vec4<f32>",
62
+ uvTransform3: "vec4<f32>",
63
+ channelMap: "vec4<i32>",
64
+ },
65
+ getUniforms: (props) => {
66
+ return {
67
+ // Texture bindings
68
+ band0: props.band0,
69
+ band1: props.band1,
70
+ band2: props.band2,
71
+ band3: props.band3,
72
+ // Scalar uniforms (uniform block)
73
+ uvTransform0: props.uvTransform0 ?? [0, 0, 1, 1],
74
+ uvTransform1: props.uvTransform1 ?? [0, 0, 1, 1],
75
+ uvTransform2: props.uvTransform2 ?? [0, 0, 1, 1],
76
+ uvTransform3: props.uvTransform3 ?? [0, 0, 1, 1],
77
+ channelMap: props.channelMap ?? [0, 1, 2, -1],
78
+ };
79
+ },
80
+ };
81
+ /**
82
+ * Maps named bands and their UV transforms to {@link CompositeBandsProps}
83
+ * slot indices.
84
+ *
85
+ * Assigns each unique band name to a fixed slot (0–3), builds the
86
+ * `channelMap` that maps RGBA output channels to slots, and fills unused
87
+ * slots with a placeholder texture to satisfy WebGL binding requirements.
88
+ *
89
+ * @param mapping - Which named band goes to which RGBA channel.
90
+ * @param bands - Map of band name to texture + UV transform.
91
+ * @returns Props ready to pass to `{ module: CompositeBands, props: ... }`.
92
+ *
93
+ * @see {@link CompositeBands}
94
+ */
95
+ export function buildCompositeBandsProps(mapping, bands) {
96
+ // Collect unique band names in mapping order and assign slot indices
97
+ const slotNames = [];
98
+ const slotIndex = new Map();
99
+ for (const name of [mapping.r, mapping.g, mapping.b, mapping.a]) {
100
+ if (name && !slotIndex.has(name)) {
101
+ if (slotNames.length >= MAX_BAND_SLOTS) {
102
+ throw new Error(`CompositeBands supports at most ${MAX_BAND_SLOTS} band slots`);
103
+ }
104
+ slotIndex.set(name, slotNames.length);
105
+ slotNames.push(name);
106
+ }
107
+ }
108
+ function slotFor(name) {
109
+ return name ? (slotIndex.get(name) ?? -1) : -1;
110
+ }
111
+ const props = {
112
+ channelMap: [
113
+ slotFor(mapping.r),
114
+ slotFor(mapping.g),
115
+ slotFor(mapping.b),
116
+ slotFor(mapping.a),
117
+ ],
118
+ };
119
+ // Get the first texture to use as a placeholder for unused slots.
120
+ // WebGL requires all declared samplers to have a valid texture bound,
121
+ // even if the channelMap never references them.
122
+ const firstBandName = slotNames[0];
123
+ if (!firstBandName) {
124
+ throw new Error("At least one band is required");
125
+ }
126
+ const firstTexture = bands.get(firstBandName).texture;
127
+ for (const [name, slot] of slotIndex) {
128
+ const band = bands.get(name);
129
+ if (!band) {
130
+ throw new Error(`Band "${name}" not found in fetched bands`);
131
+ }
132
+ props[`band${slot}`] = band.texture;
133
+ props[`uvTransform${slot}`] = band.uvTransform;
134
+ }
135
+ // Fill unused slots with the first texture as a placeholder
136
+ for (let i = slotNames.length; i < MAX_BAND_SLOTS; i++) {
137
+ props[`band${i}`] = firstTexture;
138
+ }
139
+ return props;
140
+ }
141
+ //# sourceMappingURL=composite-bands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composite-bands.js","sourceRoot":"","sources":["../../src/gpu-modules/composite-bands.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,70 @@
1
+ export type CutlineBboxProps = {
2
+ /**
3
+ * Axis-aligned bbox in **EPSG:3857 meters**, packed as
4
+ * `[minX, minY, maxX, maxY]`. This must be in the same coordinate space
5
+ * as the layer's mesh `positions` attribute — for `COGLayer` /
6
+ * `RasterLayer`'s Web Mercator rendering path, that is raw 3857 meters.
7
+ *
8
+ * Use {@link lngLatBboxToMercator} to project a WGS84 lng/lat bbox once
9
+ * at bbox definition time.
10
+ */
11
+ bbox: [number, number, number, number];
12
+ };
13
+ /**
14
+ * A shader module that discards fragments whose position falls outside a
15
+ * Web Mercator (EPSG:3857) axis-aligned bbox.
16
+ *
17
+ * Intended for rendering rasters with a "map collar" (e.g. USGS historical
18
+ * topographic maps) where the valid data area is described as a bbox but
19
+ * the raw pixels include surrounding metadata.
20
+ *
21
+ * Only supports rendering in a `WebMercatorViewport`. The caller is
22
+ * responsible for enforcing this in application code; the module itself
23
+ * does not have viewport access.
24
+ *
25
+ * This module assumes the layer's mesh `positions` attribute is in EPSG:3857
26
+ * meters — the convention used by `COGLayer` / `RasterLayer` in Web Mercator
27
+ * rendering mode. It injects a vertex shader varying that passes each
28
+ * vertex's 3857 meters through to the fragment shader, and compares against
29
+ * a uniform bbox also in 3857 meters. This avoids deck.gl's common space and
30
+ * its viewport-anchored precision translation, which would otherwise cause
31
+ * the test to drift at higher zoom levels.
32
+ */
33
+ export declare const CutlineBbox: {
34
+ readonly name: "cutlineBbox";
35
+ readonly fs: "uniform cutlineBboxUniforms {\n vec4 bbox;\n} cutlineBbox;\n";
36
+ readonly inject: {
37
+ readonly "vs:#decl": "out vec2 v_cutlineBboxMercator;";
38
+ readonly "vs:#main-start": "\n v_cutlineBboxMercator = positions.xy;\n ";
39
+ readonly "fs:#decl": "in vec2 v_cutlineBboxMercator;";
40
+ readonly "fs:#main-start": "\n {\n if (v_cutlineBboxMercator.x < cutlineBbox.bbox.x ||\n v_cutlineBboxMercator.x > cutlineBbox.bbox.z ||\n v_cutlineBboxMercator.y < cutlineBbox.bbox.y ||\n v_cutlineBboxMercator.y > cutlineBbox.bbox.w) {\n discard;\n }\n }\n ";
41
+ };
42
+ readonly uniformTypes: {
43
+ readonly bbox: "vec4<f32>";
44
+ };
45
+ readonly getUniforms: (props: Partial<CutlineBboxProps>) => {
46
+ bbox: [number, number, number, number];
47
+ } | {
48
+ bbox?: undefined;
49
+ };
50
+ };
51
+ /**
52
+ * Project a single WGS84 lng/lat point (degrees) to EPSG:3857 meters.
53
+ *
54
+ * Throws if the latitude falls outside the Web Mercator projection's valid
55
+ * range (±85.051129°).
56
+ *
57
+ * This is intended to be used with the {@link CutlineBbox} module, which
58
+ * expects a bbox in 3857 meters. The conversion from WGS84 to 3857 is a
59
+ * one-time cost that can be done at bbox definition time, rather than per frame
60
+ * in the shader.
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * const [west, south] = lngLatToMercator(-120.75, 39.25);
65
+ * const [east, north] = lngLatToMercator(-120.5, 39.5);
66
+ * const bbox = [west, south, east, north];
67
+ * ```
68
+ */
69
+ export declare function lngLatToMercator(lng: number, lat: number): [number, number];
70
+ //# sourceMappingURL=cutline-bbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cutline-bbox.d.ts","sourceRoot":"","sources":["../../src/gpu-modules/cutline-bbox.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;;;;;OAQG;IACH,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC,CAAC;AAUF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;kCAyCD,OAAO,CAAC,gBAAgB,CAAC;;;;;CAEG,CAAC;AAEpD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAU3E"}
@@ -0,0 +1,100 @@
1
+ /** Earth equatorial radius used by Web Mercator (WGS84 / EPSG:3857). */
2
+ const EARTH_RADIUS = 6378137.0;
3
+ /** Web Mercator latitude limit in degrees. */
4
+ const MERCATOR_LAT_LIMIT = 85.051129;
5
+ const MODULE_NAME = "cutlineBbox";
6
+ const uniformBlock = `\
7
+ uniform ${MODULE_NAME}Uniforms {
8
+ vec4 bbox;
9
+ } ${MODULE_NAME};
10
+ `;
11
+ /**
12
+ * A shader module that discards fragments whose position falls outside a
13
+ * Web Mercator (EPSG:3857) axis-aligned bbox.
14
+ *
15
+ * Intended for rendering rasters with a "map collar" (e.g. USGS historical
16
+ * topographic maps) where the valid data area is described as a bbox but
17
+ * the raw pixels include surrounding metadata.
18
+ *
19
+ * Only supports rendering in a `WebMercatorViewport`. The caller is
20
+ * responsible for enforcing this in application code; the module itself
21
+ * does not have viewport access.
22
+ *
23
+ * This module assumes the layer's mesh `positions` attribute is in EPSG:3857
24
+ * meters — the convention used by `COGLayer` / `RasterLayer` in Web Mercator
25
+ * rendering mode. It injects a vertex shader varying that passes each
26
+ * vertex's 3857 meters through to the fragment shader, and compares against
27
+ * a uniform bbox also in 3857 meters. This avoids deck.gl's common space and
28
+ * its viewport-anchored precision translation, which would otherwise cause
29
+ * the test to drift at higher zoom levels.
30
+ */
31
+ export const CutlineBbox = {
32
+ name: MODULE_NAME,
33
+ fs: uniformBlock,
34
+ inject: {
35
+ // Declare the mercator-meters varying on both sides of the pipeline.
36
+ "vs:#decl": `out vec2 v_cutlineBboxMercator;`,
37
+ // `positions` is the per-vertex attribute the SimpleMeshLayer vertex
38
+ // shader reads (see @deck.gl/mesh-layers simple-mesh-layer-vertex.glsl).
39
+ // In COGLayer's CARTESIAN + web-mercator path this attribute is already
40
+ // in EPSG:3857 meters. We capture it before any projection is applied.
41
+ "vs:#main-start": /* glsl */ `
42
+ v_cutlineBboxMercator = positions.xy;
43
+ `,
44
+ "fs:#decl": `in vec2 v_cutlineBboxMercator;`,
45
+ // Injects at fs:#main-start (not fs:DECKGL_FILTER_COLOR). The
46
+ // DECKGL_FILTER_COLOR hook is a generated function whose body is assembled
47
+ // before the main FS source; top-level FS varyings declared in the main
48
+ // source are out of scope there. Injecting at #main-start puts this test
49
+ // inside main() where the varying is visible and discard still works.
50
+ //
51
+ // Globe support: when rendering in a GlobeView, the mesh positions are in
52
+ // 4326 lng/lat rather than 3857 meters, so this exact varying is no
53
+ // longer meaningful. A future globe code path would need a different
54
+ // varying (e.g. lng/lat pair) and matching uniform layout.
55
+ "fs:#main-start": /* glsl */ `
56
+ {
57
+ if (v_cutlineBboxMercator.x < ${MODULE_NAME}.bbox.x ||
58
+ v_cutlineBboxMercator.x > ${MODULE_NAME}.bbox.z ||
59
+ v_cutlineBboxMercator.y < ${MODULE_NAME}.bbox.y ||
60
+ v_cutlineBboxMercator.y > ${MODULE_NAME}.bbox.w) {
61
+ discard;
62
+ }
63
+ }
64
+ `,
65
+ },
66
+ uniformTypes: {
67
+ bbox: "vec4<f32>",
68
+ },
69
+ // Pass-through: the bbox is expected to already be in 3857 meters. The
70
+ // conversion from WGS84 is done by `lngLatBboxToMercator` at bbox
71
+ // definition time so it does not run in the per-frame render loop.
72
+ getUniforms: (props) => props.bbox ? { bbox: props.bbox } : {},
73
+ };
74
+ /**
75
+ * Project a single WGS84 lng/lat point (degrees) to EPSG:3857 meters.
76
+ *
77
+ * Throws if the latitude falls outside the Web Mercator projection's valid
78
+ * range (±85.051129°).
79
+ *
80
+ * This is intended to be used with the {@link CutlineBbox} module, which
81
+ * expects a bbox in 3857 meters. The conversion from WGS84 to 3857 is a
82
+ * one-time cost that can be done at bbox definition time, rather than per frame
83
+ * in the shader.
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * const [west, south] = lngLatToMercator(-120.75, 39.25);
88
+ * const [east, north] = lngLatToMercator(-120.5, 39.5);
89
+ * const bbox = [west, south, east, north];
90
+ * ```
91
+ */
92
+ export function lngLatToMercator(lng, lat) {
93
+ if (lat < -MERCATOR_LAT_LIMIT || lat > MERCATOR_LAT_LIMIT) {
94
+ throw new Error(`lngLatToMercator: latitude must be within Web Mercator limits (±${MERCATOR_LAT_LIMIT}°); got lat=${lat}`);
95
+ }
96
+ const x = (EARTH_RADIUS * lng * Math.PI) / 180;
97
+ const y = EARTH_RADIUS * Math.log(Math.tan(Math.PI / 4 + (lat * Math.PI) / 360));
98
+ return [x, y];
99
+ }
100
+ //# sourceMappingURL=cutline-bbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cutline-bbox.js","sourceRoot":"","sources":["../../src/gpu-modules/cutline-bbox.ts"],"names":[],"mappings":"AAEA,wEAAwE;AACxE,MAAM,YAAY,GAAG,SAAS,CAAC;AAE/B,8CAA8C;AAC9C,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAerC,MAAM,WAAW,GAAG,aAAa,CAAC;AAElC,MAAM,YAAY,GAAG;UACX,WAAW;;IAEjB,WAAW;CACd,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,WAAW;IACjB,EAAE,EAAE,YAAY;IAChB,MAAM,EAAE;QACN,qEAAqE;QACrE,UAAU,EAAE,iCAAiC;QAC7C,qEAAqE;QACrE,yEAAyE;QACzE,wEAAwE;QACxE,uEAAuE;QACvE,gBAAgB,EAAE,UAAU,CAAC;;KAE5B;QACD,UAAU,EAAE,gCAAgC;QAC5C,8DAA8D;QAC9D,2EAA2E;QAC3E,wEAAwE;QACxE,yEAAyE;QACzE,sEAAsE;QACtE,EAAE;QACF,0EAA0E;QAC1E,oEAAoE;QACpE,qEAAqE;QACrE,2DAA2D;QAC3D,gBAAgB,EAAE,UAAU,CAAC;;wCAEO,WAAW;wCACX,WAAW;wCACX,WAAW;wCACX,WAAW;;;;KAI9C;KACF;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,WAAW;KAClB;IACD,uEAAuE;IACvE,kEAAkE;IAClE,mEAAmE;IACnE,WAAW,EAAE,CAAC,KAAgC,EAAE,EAAE,CAChD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE;CACS,CAAC;AAEpD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAW,EAAE,GAAW;IACvD,IAAI,GAAG,GAAG,CAAC,kBAAkB,IAAI,GAAG,GAAG,kBAAkB,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CACb,mEAAmE,kBAAkB,eAAe,GAAG,EAAE,CAC1G,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,GAAG,CAAC,YAAY,GAAG,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;IAC/C,MAAM,CAAC,GACL,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACzE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAChB,CAAC"}
@@ -1,7 +1,13 @@
1
1
  export { BlackIsZero, CMYKToRGB, cieLabToRGB, WhiteIsZero, YCbCrToRGB, } from "./color";
2
2
  export { Colormap } from "./colormap";
3
+ export type { CompositeBandsProps } from "./composite-bands.js";
4
+ export { buildCompositeBandsProps, CompositeBands, } from "./composite-bands.js";
3
5
  export { CreateTexture } from "./create-texture";
6
+ export type { CutlineBboxProps } from "./cutline-bbox.js";
7
+ export { CutlineBbox, lngLatToMercator } from "./cutline-bbox.js";
4
8
  export { FilterNoDataVal } from "./filter-nodata";
9
+ export type { LinearRescaleProps } from "./linear-rescale.js";
10
+ export { LinearRescale } from "./linear-rescale.js";
5
11
  export { MaskTexture } from "./mask-texture";
6
12
  export type { RasterModule } from "./types";
7
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gpu-modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,WAAW,EACX,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gpu-modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,WAAW,EACX,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EACL,wBAAwB,EACxB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
@@ -1,6 +1,9 @@
1
1
  export { BlackIsZero, CMYKToRGB, cieLabToRGB, WhiteIsZero, YCbCrToRGB, } from "./color";
2
2
  export { Colormap } from "./colormap";
3
+ export { buildCompositeBandsProps, CompositeBands, } from "./composite-bands.js";
3
4
  export { CreateTexture } from "./create-texture";
5
+ export { CutlineBbox, lngLatToMercator } from "./cutline-bbox.js";
4
6
  export { FilterNoDataVal } from "./filter-nodata";
7
+ export { LinearRescale } from "./linear-rescale.js";
5
8
  export { MaskTexture } from "./mask-texture";
6
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/gpu-modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,WAAW,EACX,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/gpu-modules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,WAAW,EACX,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EACL,wBAAwB,EACxB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Props for the {@link LinearRescale} shader module.
3
+ */
4
+ export type LinearRescaleProps = {
5
+ /** Minimum input value (maps to 0.0 in output). */
6
+ rescaleMin: number;
7
+ /** Maximum input value (maps to 1.0 in output). */
8
+ rescaleMax: number;
9
+ };
10
+ /**
11
+ * A shader module that linearly rescales RGB color values from
12
+ * `[min, max]` to `[0, 1]`, clamping values outside the range.
13
+ *
14
+ * Useful for normalizing data like Sentinel-2 reflectance (0-10000 stored
15
+ * as uint16) into a visible range after `r16unorm` normalization maps
16
+ * them to approximately 0.0-0.15.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * // Sentinel-2 L2A: reflectance 0-10000 → r16unorm 0.0-0.153
21
+ * { module: LinearRescale, props: { rescaleMin: 0, rescaleMax: 0.15 } }
22
+ * ```
23
+ */
24
+ export declare const LinearRescale: {
25
+ readonly name: "linearRescale";
26
+ readonly fs: "uniform linearRescaleUniforms {\n float rescaleMin;\n float rescaleMax;\n} linearRescale;\n";
27
+ readonly inject: {
28
+ readonly "fs:DECKGL_FILTER_COLOR": "\n color.rgb = clamp((color.rgb - linearRescale.rescaleMin) / (linearRescale.rescaleMax - linearRescale.rescaleMin), 0.0, 1.0);\n";
29
+ };
30
+ readonly uniformTypes: {
31
+ readonly rescaleMin: "f32";
32
+ readonly rescaleMax: "f32";
33
+ };
34
+ readonly getUniforms: (props: Partial<LinearRescaleProps>) => {
35
+ rescaleMin: number;
36
+ rescaleMax: number;
37
+ };
38
+ };
39
+ //# sourceMappingURL=linear-rescale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linear-rescale.d.ts","sourceRoot":"","sources":["../../src/gpu-modules/linear-rescale.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAIF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;kCAiBH,OAAO,CAAC,kBAAkB,CAAC;;;;CAMG,CAAC"}
@@ -0,0 +1,40 @@
1
+ const MODULE_NAME = "linearRescale";
2
+ /**
3
+ * A shader module that linearly rescales RGB color values from
4
+ * `[min, max]` to `[0, 1]`, clamping values outside the range.
5
+ *
6
+ * Useful for normalizing data like Sentinel-2 reflectance (0-10000 stored
7
+ * as uint16) into a visible range after `r16unorm` normalization maps
8
+ * them to approximately 0.0-0.15.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * // Sentinel-2 L2A: reflectance 0-10000 → r16unorm 0.0-0.153
13
+ * { module: LinearRescale, props: { rescaleMin: 0, rescaleMax: 0.15 } }
14
+ * ```
15
+ */
16
+ export const LinearRescale = {
17
+ name: MODULE_NAME,
18
+ fs: `\
19
+ uniform ${MODULE_NAME}Uniforms {
20
+ float rescaleMin;
21
+ float rescaleMax;
22
+ } ${MODULE_NAME};
23
+ `,
24
+ inject: {
25
+ "fs:DECKGL_FILTER_COLOR": /* glsl */ `
26
+ color.rgb = clamp((color.rgb - ${MODULE_NAME}.rescaleMin) / (${MODULE_NAME}.rescaleMax - ${MODULE_NAME}.rescaleMin), 0.0, 1.0);
27
+ `,
28
+ },
29
+ uniformTypes: {
30
+ rescaleMin: "f32",
31
+ rescaleMax: "f32",
32
+ },
33
+ getUniforms: (props) => {
34
+ return {
35
+ rescaleMin: props.rescaleMin ?? 0.0,
36
+ rescaleMax: props.rescaleMax ?? 1.0,
37
+ };
38
+ },
39
+ };
40
+ //# sourceMappingURL=linear-rescale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linear-rescale.js","sourceRoot":"","sources":["../../src/gpu-modules/linear-rescale.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,GAAG,eAAe,CAAC;AAEpC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,WAAW;IACjB,EAAE,EAAE;UACI,WAAW;;;IAGjB,WAAW;CACd;IACC,MAAM,EAAE;QACN,wBAAwB,EAAE,UAAU,CAAC;mCACN,WAAW,mBAAmB,WAAW,iBAAiB,WAAW;CACvG;KACE;IACD,YAAY,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,UAAU,EAAE,KAAK;KAClB;IACD,WAAW,EAAE,CAAC,KAAkC,EAAE,EAAE;QAClD,OAAO;YACL,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,GAAG;YACnC,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,GAAG;SACpC,CAAC;IACJ,CAAC;CACkD,CAAC"}
@@ -1,7 +1,16 @@
1
1
  import type { Texture } from "@luma.gl/core";
2
2
  import type { ShaderModule } from "@luma.gl/shadertools";
3
- export type RasterModule<PropsT extends Record<string, number | Texture> = Record<string, number | Texture>> = {
3
+ /**
4
+ * Allowed prop value types for shader modules: scalars, typed tuples
5
+ * (matching luma.gl's internal `UniformValue`), or texture bindings.
6
+ */
7
+ type RasterModulePropValue = number | boolean | readonly number[] | Texture;
8
+ /**
9
+ * A shader module paired with its props, forming one step in a render pipeline.
10
+ */
11
+ export type RasterModule<PropsT extends Record<string, RasterModulePropValue> = Record<string, RasterModulePropValue>> = {
4
12
  module: ShaderModule<PropsT>;
5
13
  props?: Partial<PropsT>;
6
14
  };
15
+ export {};
7
16
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/gpu-modules/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,MAAM,YAAY,CACtB,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,MAAM,CACtD,MAAM,EACN,MAAM,GAAG,OAAO,CACjB,IACC;IACF,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;CACzB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/gpu-modules/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;;GAGG;AACH,KAAK,qBAAqB,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC;AAE5E;;GAEG;AACH,MAAM,MAAM,YAAY,CACtB,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,GAAG,MAAM,CAC3D,MAAM,EACN,qBAAqB,CACtB,IACC;IACF,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;CACzB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,13 +1,9 @@
1
1
  export type { RasterModule } from "./gpu-modules/types.js";
2
+ export { renderDebugTileOutline as _renderDebugTileOutline } from "./layer-utils.js";
3
+ export type { MultiTilesetDescriptor, SecondaryTileIndex, SecondaryTileResolution, UvTransform, } from "./multi-raster-tileset/index.js";
4
+ export { createMultiTilesetDescriptor, resolveSecondaryTiles, selectSecondaryLevel, tilesetLevelsEqual, } from "./multi-raster-tileset/index.js";
2
5
  export type { RasterLayerProps, RenderTileResult } from "./raster-layer.js";
3
6
  export { RasterLayer } from "./raster-layer.js";
4
- export type { TileMetadata } from "./raster-tileset/index.js";
5
- export { TileMatrixSetTileset } from "./raster-tileset/index.js";
6
- export declare const __TEST_EXPORTS: {
7
- computeProjectedTileBounds: (tileMatrix: import("@developmentseed/morecantile").TileMatrix, { x, y, }: {
8
- x: number;
9
- y: number;
10
- }) => [number, number, number, number];
11
- RasterTileNode: typeof import("./raster-tileset/raster-tile-traversal.js").RasterTileNode;
12
- };
7
+ export type { Bounds, CornerBounds, Corners, ProjectionFunction, TileMetadata, TilesetDescriptor, TilesetLevel, } from "./raster-tileset/index.js";
8
+ export { RasterTileset2D, TileMatrixSetAdaptor, } from "./raster-tileset/index.js";
13
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAIjE,eAAO,MAAM,cAAc;;;;;;CAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,sBAAsB,IAAI,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AACrF,YAAY,EACV,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,WAAW,GACZ,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,4BAA4B,EAC5B,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,iCAAiC,CAAC;AACzC,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EACV,MAAM,EACN,YAAY,EACZ,OAAO,EACP,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,YAAY,GACb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,eAAe,EACf,oBAAoB,GACrB,MAAM,2BAA2B,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
+ // Not a public API; exported for use in COGLayer and ZarrLayer
2
+ export { renderDebugTileOutline as _renderDebugTileOutline } from "./layer-utils.js";
3
+ export { createMultiTilesetDescriptor, resolveSecondaryTiles, selectSecondaryLevel, tilesetLevelsEqual, } from "./multi-raster-tileset/index.js";
1
4
  export { RasterLayer } from "./raster-layer.js";
2
- export { TileMatrixSetTileset } from "./raster-tileset/index.js";
3
- import { __TEST_EXPORTS as traversalTestExports } from "./raster-tileset/raster-tile-traversal.js";
4
- export const __TEST_EXPORTS = { ...traversalTestExports };
5
+ export { RasterTileset2D, TileMatrixSetAdaptor, } from "./raster-tileset/index.js";
5
6
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EAAE,cAAc,IAAI,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEnG,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,GAAG,oBAAoB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,+DAA+D;AAC/D,OAAO,EAAE,sBAAsB,IAAI,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAOrF,OAAO,EACL,4BAA4B,EAC5B,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAUhD,OAAO,EACL,eAAe,EACf,oBAAoB,GACrB,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { _Tile2DHeader as Tile2DHeader } from "@deck.gl/geo-layers";
2
+ import { PathLayer, TextLayer } from "@deck.gl/layers";
3
+ import type { ReprojectionFns } from "@developmentseed/raster-reproject";
4
+ import type { TileMetadata } from "./raster-tileset";
5
+ export declare function renderDebugTileOutline(id: string, tile: Tile2DHeader & TileMetadata, forwardTo4326: ReprojectionFns["forwardReproject"]): (TextLayer<any, {
6
+ id: `${string}-label`;
7
+ data: {
8
+ position: number[];
9
+ text: string;
10
+ }[];
11
+ getColor: [number, number, number, number];
12
+ getSize: 24;
13
+ sizeUnits: "pixels";
14
+ outlineWidth: 3;
15
+ outlineColor: [number, number, number, number];
16
+ fontSettings: {
17
+ sdf: true;
18
+ };
19
+ }> | PathLayer<any, {
20
+ id: string;
21
+ data: [number, number][][];
22
+ getPath: (d: any) => any;
23
+ getColor: [number, number, number, number];
24
+ getWidth: 2;
25
+ widthUnits: "pixels";
26
+ pickable: false;
27
+ }>)[];
28
+ //# sourceMappingURL=layer-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layer-utils.d.ts","sourceRoot":"","sources":["../src/layer-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,YAAY,GAAG,YAAY,EACjC,aAAa,EAAE,eAAe,CAAC,kBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;MA2DnD"}