@developmentseed/deck.gl-raster 0.8.0-beta.1 → 0.8.0-beta.2

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.
@@ -18,9 +18,11 @@ export interface CornerLatitudes {
18
18
  * that never converge (see #182 / #351). Seeding the reprojector with the
19
19
  * clamped band avoids meshing those rows entirely.
20
20
  *
21
- * Only **north-up geographic** tiles are handled — where latitude is constant
22
- * across each row, so the valid band is an axis-aligned rectangle. Rotated or
23
- * projected tiles return `undefined` (the caller falls back to the full mesh).
21
+ * Only tiles whose **rows are constant-latitude** are handled — where latitude
22
+ * is constant across each row, so the valid band is an axis-aligned rectangle.
23
+ *
24
+ * This covers both north-up grids and south-up grids. Rotated or projected
25
+ * tiles return `undefined` (the caller falls back to the full mesh).
24
26
  *
25
27
  * @param cornerLats WGS84 latitudes of the tile's four corners.
26
28
  * @param maxLat Web Mercator latitude limit. Defaults to ±85.051°.
@@ -1 +1 @@
1
- {"version":3,"file":"web-mercator-clamp.d.ts","sourceRoot":"","sources":["../../src/raster-tileset/web-mercator-clamp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAS9E;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qCAAqC,CACnD,UAAU,EAAE,eAAe,EAC3B,MAAM,GAAE,MAA6B,GACpC,oBAAoB,GAAG,SAAS,CAqClC"}
1
+ {"version":3,"file":"web-mercator-clamp.d.ts","sourceRoot":"","sources":["../../src/raster-tileset/web-mercator-clamp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAS9E;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qCAAqC,CACnD,UAAU,EAAE,eAAe,EAC3B,MAAM,GAAE,MAA6B,GACpC,oBAAoB,GAAG,SAAS,CAqDlC"}
@@ -1,7 +1,7 @@
1
1
  import { triangulateRectangle } from "@developmentseed/raster-reproject";
2
2
  /** Maximum latitude representable in Web Mercator (EPSG:3857), in degrees. */
3
3
  const MAX_WEB_MERCATOR_LAT = 85.05112877980659;
4
- /** Tolerance for the north-up check and degenerate-band guard, in degrees. */
4
+ /** Tolerance for the constant-latitude check and degenerate-band guard, in degrees. */
5
5
  const LAT_EPSILON = 1e-6;
6
6
  /**
7
7
  * Compute a {@link InitialTriangulation} that clamps a tile's reprojection mesh
@@ -13,36 +13,51 @@ const LAT_EPSILON = 1e-6;
13
13
  * that never converge (see #182 / #351). Seeding the reprojector with the
14
14
  * clamped band avoids meshing those rows entirely.
15
15
  *
16
- * Only **north-up geographic** tiles are handled — where latitude is constant
17
- * across each row, so the valid band is an axis-aligned rectangle. Rotated or
18
- * projected tiles return `undefined` (the caller falls back to the full mesh).
16
+ * Only tiles whose **rows are constant-latitude** are handled — where latitude
17
+ * is constant across each row, so the valid band is an axis-aligned rectangle.
18
+ *
19
+ * This covers both north-up grids and south-up grids. Rotated or projected
20
+ * tiles return `undefined` (the caller falls back to the full mesh).
19
21
  *
20
22
  * @param cornerLats WGS84 latitudes of the tile's four corners.
21
23
  * @param maxLat Web Mercator latitude limit. Defaults to ±85.051°.
22
24
  */
23
25
  export function createInitialWebMercatorTriangulation(cornerLats, maxLat = MAX_WEB_MERCATOR_LAT) {
24
26
  const { topLeft, topRight, bottomLeft, bottomRight } = cornerLats;
25
- // North-up means latitude is constant across each row, so the clamp band is
26
- // an axis-aligned rectangle. Otherwise fall back to the full mesh.
27
- const northUp = Math.abs(topLeft - topRight) < LAT_EPSILON &&
27
+ // Each row must be constant-latitude for the clamp band to be an axis-aligned
28
+ // rectangle in UV space. Otherwise fall back to the full mesh.
29
+ const rowsIsoLatitude = Math.abs(topLeft - topRight) < LAT_EPSILON &&
28
30
  Math.abs(bottomLeft - bottomRight) < LAT_EPSILON;
29
- if (!northUp) {
31
+ if (!rowsIsoLatitude) {
30
32
  return undefined;
31
33
  }
32
- const north = topLeft;
33
- const south = bottomLeft;
34
- // Degenerate or south-up tile: leave it to the default full mesh.
35
- if (north - south <= LAT_EPSILON) {
34
+ // v runs 0 (top row) → 1 (bottom row); latitude varies linearly along it:
35
+ // lat(v) = top + v * (bottom - top)
36
+ // Do NOT assume top is the northern edge: a positive-`e` (south-up) affine
37
+ // puts the south pole at row 0, so `top` is the southern edge. Deriving the
38
+ // band from the actual top/bottom keeps this orientation-agnostic.
39
+ const top = topLeft;
40
+ const bottom = bottomLeft;
41
+ // Degenerate tile (zero latitude span): leave it to the default full mesh.
42
+ if (Math.abs(bottom - top) <= LAT_EPSILON) {
36
43
  return undefined;
37
44
  }
38
- // Nothing to clamp if the whole tile is already within bounds.
39
- if (north <= maxLat && south >= -maxLat) {
45
+ // Nothing to clamp if the whole tile is already within bounds (linear interp
46
+ // between two in-band corners stays in band).
47
+ if (top <= maxLat &&
48
+ top >= -maxLat &&
49
+ bottom <= maxLat &&
50
+ bottom >= -maxLat) {
40
51
  return undefined;
41
52
  }
42
- // v runs 0 (north) 1 (south); lat(v) = north - v * (north - south).
53
+ // Intersect the tile's latitude segment with the band [-maxLat, maxLat]:
54
+ // solve lat(v) = ±maxLat for v, then take the overlapping v-interval. min/max
55
+ // makes this independent of whether latitude increases or decreases with v.
43
56
  const clamp01 = (t) => Math.max(0, Math.min(1, t));
44
- const vTop = clamp01((north - maxLat) / (north - south));
45
- const vBottom = clamp01((north - -maxLat) / (north - south));
57
+ const vAtMaxLat = (maxLat - top) / (bottom - top);
58
+ const vAtMinLat = (-maxLat - top) / (bottom - top);
59
+ const vTop = clamp01(Math.min(vAtMaxLat, vAtMinLat));
60
+ const vBottom = clamp01(Math.max(vAtMaxLat, vAtMinLat));
46
61
  // Fully-polar tile (entirely outside ±maxLat): empty band, nothing to render.
47
62
  // Such tiles are normally excluded by the dataset-bounds clamp; guard anyway
48
63
  // so we never emit a degenerate seed.
@@ -1 +1 @@
1
- {"version":3,"file":"web-mercator-clamp.js","sourceRoot":"","sources":["../../src/raster-tileset/web-mercator-clamp.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE,8EAA8E;AAC9E,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AAE/C,8EAA8E;AAC9E,MAAM,WAAW,GAAG,IAAI,CAAC;AAYzB;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,qCAAqC,CACnD,UAA2B,EAC3B,SAAiB,oBAAoB;IAErC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC;IAElE,4EAA4E;IAC5E,mEAAmE;IACnE,MAAM,OAAO,GACX,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,QAAQ,CAAC,GAAG,WAAW;QAC1C,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG,WAAW,CAAC,GAAG,WAAW,CAAC;IACnD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,CAAC;IACtB,MAAM,KAAK,GAAG,UAAU,CAAC;IACzB,kEAAkE;IAClE,IAAI,KAAK,GAAG,KAAK,IAAI,WAAW,EAAE,CAAC;QACjC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,+DAA+D;IAC/D,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;QACxC,OAA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IAAI,OAAO,GAAG,IAAI,GAAG,WAAW,EAAE,CAAC;QACjC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,oBAAoB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@developmentseed/deck.gl-raster",
3
- "version": "0.8.0-beta.1",
3
+ "version": "0.8.0-beta.2",
4
4
  "description": "Georeferenced image data visualization in deck.gl",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -52,15 +52,15 @@
52
52
  "@deck.gl/mesh-layers": "^9.3.0",
53
53
  "@luma.gl/core": "^9.3.2",
54
54
  "@luma.gl/shadertools": "^9.3.2",
55
- "@developmentseed/morecantile": "^0.8.0-beta.1"
55
+ "@developmentseed/morecantile": "^0.8.0-beta.2"
56
56
  },
57
57
  "dependencies": {
58
58
  "@math.gl/core": "^4.1.0",
59
59
  "@math.gl/culling": "^4.1.0",
60
60
  "@math.gl/web-mercator": "^4.1.0",
61
- "@developmentseed/affine": "^0.8.0-beta.1",
62
- "@developmentseed/proj": "^0.8.0-beta.1",
63
- "@developmentseed/raster-reproject": "^0.8.0-beta.1"
61
+ "@developmentseed/proj": "^0.8.0-beta.2",
62
+ "@developmentseed/raster-reproject": "^0.8.0-beta.2",
63
+ "@developmentseed/affine": "^0.8.0-beta.2"
64
64
  },
65
65
  "volta": {
66
66
  "extends": "../../package.json"