@loaders.gl/mvt 4.3.0-alpha.2 → 4.3.0-alpha.3

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 (74) hide show
  1. package/dist/dist.dev.js +777 -688
  2. package/dist/dist.min.js +1 -1
  3. package/dist/index.cjs +746 -659
  4. package/dist/index.cjs.map +4 -4
  5. package/dist/index.d.ts +6 -5
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +5 -1
  8. package/dist/lib/parse-tilejson.js +1 -1
  9. package/dist/lib/utils/geometry-utils.js +1 -1
  10. package/dist/lib/vector-tiler/{clip.d.ts → features/clip-features.d.ts} +4 -4
  11. package/dist/lib/vector-tiler/features/clip-features.d.ts.map +1 -0
  12. package/dist/lib/vector-tiler/{clip.js → features/clip-features.js} +4 -4
  13. package/dist/lib/vector-tiler/{convert.d.ts → features/convert-feature.d.ts} +7 -7
  14. package/dist/lib/vector-tiler/features/convert-feature.d.ts.map +1 -0
  15. package/dist/lib/vector-tiler/features/convert-feature.js +140 -0
  16. package/dist/lib/vector-tiler/features/proto-feature.d.ts +30 -0
  17. package/dist/lib/vector-tiler/features/proto-feature.d.ts.map +1 -0
  18. package/dist/lib/vector-tiler/features/proto-feature.js +52 -0
  19. package/dist/lib/vector-tiler/{simplify.d.ts → features/simplify-path.d.ts} +2 -2
  20. package/dist/lib/vector-tiler/features/simplify-path.d.ts.map +1 -0
  21. package/dist/lib/vector-tiler/{simplify.js → features/simplify-path.js} +3 -3
  22. package/dist/lib/vector-tiler/{wrap.d.ts → features/wrap-features.d.ts} +5 -5
  23. package/dist/lib/vector-tiler/features/wrap-features.d.ts.map +1 -0
  24. package/dist/lib/vector-tiler/{wrap.js → features/wrap-features.js} +33 -26
  25. package/dist/lib/vector-tiler/proto-tile.d.ts +40 -0
  26. package/dist/lib/vector-tiler/proto-tile.d.ts.map +1 -0
  27. package/dist/lib/vector-tiler/proto-tile.js +138 -0
  28. package/dist/lib/vector-tiler/tile-to-geojson.d.ts +12 -0
  29. package/dist/lib/vector-tiler/tile-to-geojson.d.ts.map +1 -0
  30. package/dist/lib/vector-tiler/tile-to-geojson.js +81 -0
  31. package/dist/lib/vector-tiler/transform-tile.d.ts +7 -0
  32. package/dist/lib/vector-tiler/transform-tile.d.ts.map +1 -0
  33. package/dist/lib/vector-tiler/transform-tile.js +41 -0
  34. package/dist/mvt-loader.js +1 -1
  35. package/dist/mvt-source.d.ts +31 -14
  36. package/dist/mvt-source.d.ts.map +1 -1
  37. package/dist/mvt-source.js +26 -6
  38. package/dist/mvt-worker.js +4 -4
  39. package/dist/table-tile-source.d.ts +66 -36
  40. package/dist/table-tile-source.d.ts.map +1 -1
  41. package/dist/table-tile-source.js +167 -117
  42. package/dist/tilejson-loader.js +1 -1
  43. package/package.json +6 -6
  44. package/src/index.ts +13 -6
  45. package/src/lib/parse-tilejson.ts +1 -1
  46. package/src/lib/utils/geometry-utils.ts +1 -1
  47. package/src/lib/vector-tiler/{clip.ts → features/clip-features.ts} +8 -8
  48. package/src/lib/vector-tiler/{convert.ts → features/convert-feature.ts} +91 -70
  49. package/src/lib/vector-tiler/features/proto-feature.ts +104 -0
  50. package/src/lib/vector-tiler/{simplify.ts → features/simplify-path.ts} +8 -3
  51. package/src/lib/vector-tiler/{wrap.ts → features/wrap-features.ts} +44 -29
  52. package/src/lib/vector-tiler/proto-tile.ts +217 -0
  53. package/src/lib/vector-tiler/tile-to-geojson.ts +105 -0
  54. package/src/lib/vector-tiler/transform-tile.ts +57 -0
  55. package/src/mvt-source.ts +42 -18
  56. package/src/table-tile-source.ts +130 -85
  57. package/src/tilejson-loader.ts +2 -2
  58. package/dist/lib/vector-tiler/clip.d.ts.map +0 -1
  59. package/dist/lib/vector-tiler/convert.d.ts.map +0 -1
  60. package/dist/lib/vector-tiler/convert.js +0 -139
  61. package/dist/lib/vector-tiler/feature.d.ts +0 -3
  62. package/dist/lib/vector-tiler/feature.d.ts.map +0 -1
  63. package/dist/lib/vector-tiler/feature.js +0 -44
  64. package/dist/lib/vector-tiler/simplify.d.ts.map +0 -1
  65. package/dist/lib/vector-tiler/tile.d.ts +0 -38
  66. package/dist/lib/vector-tiler/tile.d.ts.map +0 -1
  67. package/dist/lib/vector-tiler/tile.js +0 -123
  68. package/dist/lib/vector-tiler/transform.d.ts +0 -7
  69. package/dist/lib/vector-tiler/transform.d.ts.map +0 -1
  70. package/dist/lib/vector-tiler/transform.js +0 -41
  71. package/dist/lib/vector-tiler/wrap.d.ts.map +0 -1
  72. package/src/lib/vector-tiler/feature.ts +0 -47
  73. package/src/lib/vector-tiler/tile.ts +0 -187
  74. package/src/lib/vector-tiler/transform.ts +0 -57
@@ -1,57 +0,0 @@
1
- // loaders.gl
2
- // SPDX-License-Identifier: MIT
3
- // Copyright (c) vis.gl contributors
4
- // Forked from https://github.com/mapbox/geojson-vt under compatible ISC license
5
-
6
- import type {TableTile} from './tile';
7
-
8
- /**
9
- * Transforms the coordinates of each feature in the given tile from
10
- * mercator-projected space into (extent x extent) tile space.
11
- */
12
- export function transformTile(tile: TableTile, extent: number): TableTile {
13
- if (tile.transformed) {
14
- return tile;
15
- }
16
-
17
- const z2 = 1 << tile.z;
18
- const tx = tile.x;
19
- const ty = tile.y;
20
-
21
- for (const feature of tile.features) {
22
- const geom = feature.geometry;
23
- const type = feature.type;
24
-
25
- feature.geometry = [];
26
-
27
- if (type === 1) {
28
- for (let j = 0; j < geom.length; j += 2) {
29
- feature.geometry.push(transformPoint(geom[j], geom[j + 1], extent, z2, tx, ty));
30
- }
31
- } else {
32
- for (let j = 0; j < geom.length; j++) {
33
- const ring: number[][] = [];
34
- for (let k = 0; k < geom[j].length; k += 2) {
35
- ring.push(transformPoint(geom[j][k], geom[j][k + 1], extent, z2, tx, ty));
36
- }
37
- feature.geometry.push(ring);
38
- }
39
- }
40
- }
41
-
42
- tile.transformed = true;
43
-
44
- return tile;
45
- }
46
-
47
- // eslint-disable-next-line max-params
48
- function transformPoint(
49
- x: number,
50
- y: number,
51
- extent: number,
52
- z2: number,
53
- tx: number,
54
- ty: number
55
- ): number[] {
56
- return [Math.round(extent * (x * z2 - tx)), Math.round(extent * (y * z2 - ty))];
57
- }