@loaders.gl/mvt 3.2.12 → 3.3.0-alpha.10

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 (130) hide show
  1. package/dist/dist.min.js +782 -10
  2. package/dist/es5/bundle.js +0 -1
  3. package/dist/es5/bundle.js.map +1 -1
  4. package/dist/es5/helpers/binary-util-functions.js +2 -12
  5. package/dist/es5/helpers/binary-util-functions.js.map +1 -1
  6. package/dist/es5/helpers/mapbox-util-functions.js +2 -10
  7. package/dist/es5/helpers/mapbox-util-functions.js.map +1 -1
  8. package/dist/es5/index.js +7 -1
  9. package/dist/es5/index.js.map +1 -1
  10. package/dist/es5/lib/binary-vector-tile/vector-tile-feature.js +14 -35
  11. package/dist/es5/lib/binary-vector-tile/vector-tile-feature.js.map +1 -1
  12. package/dist/es5/lib/binary-vector-tile/vector-tile-layer.js +3 -14
  13. package/dist/es5/lib/binary-vector-tile/vector-tile-layer.js.map +1 -1
  14. package/dist/es5/lib/binary-vector-tile/vector-tile.js +3 -10
  15. package/dist/es5/lib/binary-vector-tile/vector-tile.js.map +1 -1
  16. package/dist/es5/lib/geojson-tiler/LICENSE +19 -0
  17. package/dist/es5/lib/geojson-tiler/clip.js +247 -0
  18. package/dist/es5/lib/geojson-tiler/clip.js.map +1 -0
  19. package/dist/es5/lib/geojson-tiler/convert.js +163 -0
  20. package/dist/es5/lib/geojson-tiler/convert.js.map +1 -0
  21. package/dist/es5/lib/geojson-tiler/feature.js +63 -0
  22. package/dist/es5/lib/geojson-tiler/feature.js.map +1 -0
  23. package/dist/es5/lib/geojson-tiler/geojson-tiler.js +203 -0
  24. package/dist/es5/lib/geojson-tiler/geojson-tiler.js.map +1 -0
  25. package/dist/es5/lib/geojson-tiler/simplify.js +54 -0
  26. package/dist/es5/lib/geojson-tiler/simplify.js.map +1 -0
  27. package/dist/es5/lib/geojson-tiler/tile.js +127 -0
  28. package/dist/es5/lib/geojson-tiler/tile.js.map +1 -0
  29. package/dist/es5/lib/geojson-tiler/transform.js +52 -0
  30. package/dist/es5/lib/geojson-tiler/transform.js.map +1 -0
  31. package/dist/es5/lib/geojson-tiler/wrap.js +127 -0
  32. package/dist/es5/lib/geojson-tiler/wrap.js.map +1 -0
  33. package/dist/es5/lib/mapbox-vector-tile/vector-tile-feature.js +8 -35
  34. package/dist/es5/lib/mapbox-vector-tile/vector-tile-feature.js.map +1 -1
  35. package/dist/es5/lib/mapbox-vector-tile/vector-tile-layer.js +4 -14
  36. package/dist/es5/lib/mapbox-vector-tile/vector-tile-layer.js.map +1 -1
  37. package/dist/es5/lib/mapbox-vector-tile/vector-tile.js +3 -10
  38. package/dist/es5/lib/mapbox-vector-tile/vector-tile.js.map +1 -1
  39. package/dist/es5/lib/parse-mvt.js +3 -37
  40. package/dist/es5/lib/parse-mvt.js.map +1 -1
  41. package/dist/es5/lib/types.js.map +1 -1
  42. package/dist/es5/mvt-loader.js +9 -18
  43. package/dist/es5/mvt-loader.js.map +1 -1
  44. package/dist/es5/workers/mvt-worker.js +0 -2
  45. package/dist/es5/workers/mvt-worker.js.map +1 -1
  46. package/dist/esm/bundle.js +1 -1
  47. package/dist/esm/bundle.js.map +1 -1
  48. package/dist/esm/helpers/binary-util-functions.js +5 -10
  49. package/dist/esm/helpers/binary-util-functions.js.map +1 -1
  50. package/dist/esm/helpers/mapbox-util-functions.js +5 -8
  51. package/dist/esm/helpers/mapbox-util-functions.js.map +1 -1
  52. package/dist/esm/index.js +4 -0
  53. package/dist/esm/index.js.map +1 -1
  54. package/dist/esm/lib/binary-vector-tile/vector-tile-feature.js +6 -25
  55. package/dist/esm/lib/binary-vector-tile/vector-tile-feature.js.map +1 -1
  56. package/dist/esm/lib/binary-vector-tile/vector-tile-layer.js +2 -14
  57. package/dist/esm/lib/binary-vector-tile/vector-tile-layer.js.map +1 -1
  58. package/dist/esm/lib/binary-vector-tile/vector-tile.js +1 -3
  59. package/dist/esm/lib/binary-vector-tile/vector-tile.js.map +1 -1
  60. package/dist/esm/lib/geojson-tiler/LICENSE +19 -0
  61. package/dist/esm/lib/geojson-tiler/clip.js +184 -0
  62. package/dist/esm/lib/geojson-tiler/clip.js.map +1 -0
  63. package/dist/esm/lib/geojson-tiler/convert.js +120 -0
  64. package/dist/esm/lib/geojson-tiler/convert.js.map +1 -0
  65. package/dist/esm/lib/geojson-tiler/feature.js +37 -0
  66. package/dist/esm/lib/geojson-tiler/feature.js.map +1 -0
  67. package/dist/esm/lib/geojson-tiler/geojson-tiler.js +189 -0
  68. package/dist/esm/lib/geojson-tiler/geojson-tiler.js.map +1 -0
  69. package/dist/esm/lib/geojson-tiler/simplify.js +49 -0
  70. package/dist/esm/lib/geojson-tiler/simplify.js.map +1 -0
  71. package/dist/esm/lib/geojson-tiler/tile.js +108 -0
  72. package/dist/esm/lib/geojson-tiler/tile.js.map +1 -0
  73. package/dist/esm/lib/geojson-tiler/transform.js +35 -0
  74. package/dist/esm/lib/geojson-tiler/transform.js.map +1 -0
  75. package/dist/esm/lib/geojson-tiler/wrap.js +75 -0
  76. package/dist/esm/lib/geojson-tiler/wrap.js.map +1 -0
  77. package/dist/esm/lib/mapbox-vector-tile/vector-tile-feature.js +2 -36
  78. package/dist/esm/lib/mapbox-vector-tile/vector-tile-feature.js.map +1 -1
  79. package/dist/esm/lib/mapbox-vector-tile/vector-tile-layer.js +2 -14
  80. package/dist/esm/lib/mapbox-vector-tile/vector-tile-layer.js.map +1 -1
  81. package/dist/esm/lib/mapbox-vector-tile/vector-tile.js +1 -3
  82. package/dist/esm/lib/mapbox-vector-tile/vector-tile.js.map +1 -1
  83. package/dist/esm/lib/parse-mvt.js +0 -26
  84. package/dist/esm/lib/parse-mvt.js.map +1 -1
  85. package/dist/esm/lib/types.js.map +1 -1
  86. package/dist/esm/mvt-loader.js +9 -3
  87. package/dist/esm/mvt-loader.js.map +1 -1
  88. package/dist/esm/workers/mvt-worker.js.map +1 -1
  89. package/dist/index.d.ts +2 -0
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/index.js +4 -1
  92. package/dist/lib/geojson-tiler/clip.d.ts +16 -0
  93. package/dist/lib/geojson-tiler/clip.d.ts.map +1 -0
  94. package/dist/lib/geojson-tiler/clip.js +209 -0
  95. package/dist/lib/geojson-tiler/convert.d.ts +10 -0
  96. package/dist/lib/geojson-tiler/convert.d.ts.map +1 -0
  97. package/dist/lib/geojson-tiler/convert.js +134 -0
  98. package/dist/lib/geojson-tiler/feature.d.ts +3 -0
  99. package/dist/lib/geojson-tiler/feature.d.ts.map +1 -0
  100. package/dist/lib/geojson-tiler/feature.js +46 -0
  101. package/dist/lib/geojson-tiler/geojson-tiler.d.ts +44 -0
  102. package/dist/lib/geojson-tiler/geojson-tiler.d.ts.map +1 -0
  103. package/dist/lib/geojson-tiler/geojson-tiler.js +210 -0
  104. package/dist/lib/geojson-tiler/simplify.d.ts +10 -0
  105. package/dist/lib/geojson-tiler/simplify.d.ts.map +1 -0
  106. package/dist/lib/geojson-tiler/simplify.js +68 -0
  107. package/dist/lib/geojson-tiler/tile.d.ts +38 -0
  108. package/dist/lib/geojson-tiler/tile.d.ts.map +1 -0
  109. package/dist/lib/geojson-tiler/tile.js +125 -0
  110. package/dist/lib/geojson-tiler/transform.d.ts +7 -0
  111. package/dist/lib/geojson-tiler/transform.d.ts.map +1 -0
  112. package/dist/lib/geojson-tiler/transform.js +43 -0
  113. package/dist/lib/geojson-tiler/wrap.d.ts +17 -0
  114. package/dist/lib/geojson-tiler/wrap.d.ts.map +1 -0
  115. package/dist/lib/geojson-tiler/wrap.js +86 -0
  116. package/dist/lib/mapbox-vector-tile/vector-tile-feature.js +3 -3
  117. package/dist/lib/types.d.ts +6 -6
  118. package/dist/lib/types.d.ts.map +1 -1
  119. package/dist/mvt-worker.js +10 -11
  120. package/package.json +5 -5
  121. package/src/index.ts +7 -0
  122. package/src/lib/geojson-tiler/LICENSE +19 -0
  123. package/src/lib/geojson-tiler/clip.ts +248 -0
  124. package/src/lib/geojson-tiler/convert.ts +158 -0
  125. package/src/lib/geojson-tiler/feature.ts +45 -0
  126. package/src/lib/geojson-tiler/geojson-tiler.ts +281 -0
  127. package/src/lib/geojson-tiler/simplify.ts +77 -0
  128. package/src/lib/geojson-tiler/tile.ts +185 -0
  129. package/src/lib/geojson-tiler/transform.ts +55 -0
  130. package/src/lib/geojson-tiler/wrap.ts +108 -0
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ // loaders.gl, MIT license
3
+ // Forked from https://github.com/mapbox/geojson-vt under compatible ISC license
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.createTile = void 0;
6
+ /**
7
+ * Create a tile from features and tile index
8
+ */
9
+ function createTile(features, z, tx, ty, options) {
10
+ const tolerance = z === options.maxZoom ? 0 : options.tolerance / ((1 << z) * options.extent);
11
+ const tile = {
12
+ features: [],
13
+ numPoints: 0,
14
+ numSimplified: 0,
15
+ numFeatures: features.length,
16
+ source: null,
17
+ x: tx,
18
+ y: ty,
19
+ z,
20
+ transformed: false,
21
+ minX: 2,
22
+ minY: 1,
23
+ maxX: -1,
24
+ maxY: 0
25
+ };
26
+ for (const feature of features) {
27
+ addFeature(tile, feature, tolerance, options);
28
+ }
29
+ return tile;
30
+ }
31
+ exports.createTile = createTile;
32
+ // eslint-disable-next-line complexity, max-statements
33
+ function addFeature(tile, feature, tolerance, options) {
34
+ const geom = feature.geometry;
35
+ const type = feature.type;
36
+ const simplified = [];
37
+ tile.minX = Math.min(tile.minX, feature.minX);
38
+ tile.minY = Math.min(tile.minY, feature.minY);
39
+ tile.maxX = Math.max(tile.maxX, feature.maxX);
40
+ tile.maxY = Math.max(tile.maxY, feature.maxY);
41
+ if (type === 'Point' || type === 'MultiPoint') {
42
+ for (let i = 0; i < geom.length; i += 3) {
43
+ simplified.push(geom[i], geom[i + 1]);
44
+ tile.numPoints++;
45
+ tile.numSimplified++;
46
+ }
47
+ }
48
+ else if (type === 'LineString') {
49
+ addLine(simplified, geom, tile, tolerance, false, false);
50
+ }
51
+ else if (type === 'MultiLineString' || type === 'Polygon') {
52
+ for (let i = 0; i < geom.length; i++) {
53
+ addLine(simplified, geom[i], tile, tolerance, type === 'Polygon', i === 0);
54
+ }
55
+ }
56
+ else if (type === 'MultiPolygon') {
57
+ for (let k = 0; k < geom.length; k++) {
58
+ const polygon = geom[k];
59
+ for (let i = 0; i < polygon.length; i++) {
60
+ addLine(simplified, polygon[i], tile, tolerance, true, i === 0);
61
+ }
62
+ }
63
+ }
64
+ if (simplified.length) {
65
+ let tags = feature.tags || null;
66
+ if (type === 'LineString' && options.lineMetrics) {
67
+ tags = {};
68
+ for (const key in feature.tags)
69
+ tags[key] = feature.tags[key];
70
+ // eslint-disable-next-line camelcase
71
+ tags.mapbox_clip_start = geom.start / geom.size;
72
+ // eslint-disable-next-line camelcase
73
+ tags.mapbox_clip_end = geom.end / geom.size;
74
+ }
75
+ // @ts-expect-error TODO - create sub type?
76
+ const tileFeature = {
77
+ geometry: simplified,
78
+ type: type === 'Polygon' || type === 'MultiPolygon'
79
+ ? 3
80
+ : type === 'LineString' || type === 'MultiLineString'
81
+ ? 2
82
+ : 1,
83
+ tags
84
+ };
85
+ if (feature.id !== null) {
86
+ tileFeature.id = feature.id;
87
+ }
88
+ tile.features.push(tileFeature);
89
+ }
90
+ }
91
+ // eslint-disable-next-line max-params, max-statements
92
+ function addLine(result, geom, tile, tolerance, isPolygon, isOuter) {
93
+ const sqTolerance = tolerance * tolerance;
94
+ if (tolerance > 0 && geom.size < (isPolygon ? sqTolerance : tolerance)) {
95
+ tile.numPoints += geom.length / 3;
96
+ return;
97
+ }
98
+ const ring = [];
99
+ for (let i = 0; i < geom.length; i += 3) {
100
+ if (tolerance === 0 || geom[i + 2] > sqTolerance) {
101
+ tile.numSimplified++;
102
+ ring.push(geom[i], geom[i + 1]);
103
+ }
104
+ tile.numPoints++;
105
+ }
106
+ if (isPolygon)
107
+ rewind(ring, isOuter);
108
+ result.push(ring);
109
+ }
110
+ function rewind(ring, clockwise) {
111
+ let area = 0;
112
+ for (let i = 0, j = ring.length - 2; i < ring.length; j = i, i += 2) {
113
+ area += (ring[i] - ring[j]) * (ring[i + 1] + ring[j + 1]);
114
+ }
115
+ if (area > 0 === clockwise) {
116
+ for (let i = 0, len = ring.length; i < len / 2; i += 2) {
117
+ const x = ring[i];
118
+ const y = ring[i + 1];
119
+ ring[i] = ring[len - 2 - i];
120
+ ring[i + 1] = ring[len - 1 - i];
121
+ ring[len - 2 - i] = x;
122
+ ring[len - 1 - i] = y;
123
+ }
124
+ }
125
+ }
@@ -0,0 +1,7 @@
1
+ import type { GeoJSONTile } from './tile';
2
+ /**
3
+ * Transforms the coordinates of each feature in the given tile from
4
+ * mercator-projected space into (extent x extent) tile space.
5
+ */
6
+ export declare function transformTile(tile: GeoJSONTile, extent: number): GeoJSONTile;
7
+ //# sourceMappingURL=transform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/lib/geojson-tiler/transform.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,QAAQ,CAAC;AAExC;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAiC5E"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ // loaders.gl, MIT license
3
+ // Forked from https://github.com/mapbox/geojson-vt under compatible ISC license
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.transformTile = void 0;
6
+ /**
7
+ * Transforms the coordinates of each feature in the given tile from
8
+ * mercator-projected space into (extent x extent) tile space.
9
+ */
10
+ function transformTile(tile, extent) {
11
+ if (tile.transformed) {
12
+ return tile;
13
+ }
14
+ const z2 = 1 << tile.z;
15
+ const tx = tile.x;
16
+ const ty = tile.y;
17
+ for (const feature of tile.features) {
18
+ const geom = feature.geometry;
19
+ const type = feature.type;
20
+ feature.geometry = [];
21
+ if (type === 1) {
22
+ for (let j = 0; j < geom.length; j += 2) {
23
+ feature.geometry.push(transformPoint(geom[j], geom[j + 1], extent, z2, tx, ty));
24
+ }
25
+ }
26
+ else {
27
+ for (let j = 0; j < geom.length; j++) {
28
+ const ring = [];
29
+ for (let k = 0; k < geom[j].length; k += 2) {
30
+ ring.push(transformPoint(geom[j][k], geom[j][k + 1], extent, z2, tx, ty));
31
+ }
32
+ feature.geometry.push(ring);
33
+ }
34
+ }
35
+ }
36
+ tile.transformed = true;
37
+ return tile;
38
+ }
39
+ exports.transformTile = transformTile;
40
+ // eslint-disable-next-line max-params
41
+ function transformPoint(x, y, extent, z2, tx, ty) {
42
+ return [Math.round(extent * (x * z2 - tx)), Math.round(extent * (y * z2 - ty))];
43
+ }
@@ -0,0 +1,17 @@
1
+ import type { GeoJSONTileFeature } from './tile';
2
+ /**
3
+ * Options for wrap()
4
+ */
5
+ export type WrapOptions = {
6
+ buffer: number /** number of pixels of buffer for the tile */;
7
+ extent: number /** extent of each tile */;
8
+ lineMetrics: boolean;
9
+ };
10
+ /**
11
+ * Wrap across antemeridian, by clipping into two tiles, shifting the overflowing x coordinates
12
+ * @param features list of features to be wrapped
13
+ * @param options buffer and extent
14
+ * @returns
15
+ */
16
+ export declare function wrap(features: GeoJSONTileFeature[], options: WrapOptions): GeoJSONTileFeature[];
17
+ //# sourceMappingURL=wrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrap.d.ts","sourceRoot":"","sources":["../../../src/lib/geojson-tiler/wrap.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,QAAQ,CAAC;AAI/C;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC,8CAA8C,CAAC;IAC9D,MAAM,EAAE,MAAM,CAAC,0BAA0B,CAAC;IAC1C,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,QAAQ,EAAE,kBAAkB,EAAE,EAAE,OAAO,EAAE,WAAW,wBAkBxE"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ // loaders.gl, MIT license
3
+ // Forked from https://github.com/mapbox/geojson-vt under compatible ISC license
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.wrap = void 0;
6
+ const clip_1 = require("./clip");
7
+ const feature_1 = require("./feature");
8
+ /**
9
+ * Wrap across antemeridian, by clipping into two tiles, shifting the overflowing x coordinates
10
+ * @param features list of features to be wrapped
11
+ * @param options buffer and extent
12
+ * @returns
13
+ */
14
+ function wrap(features, options) {
15
+ const buffer = options.buffer / options.extent;
16
+ let merged = features;
17
+ const left = (0, clip_1.clip)(features, 1, -1 - buffer, buffer, 0, -1, 2, options); // left world copy
18
+ const right = (0, clip_1.clip)(features, 1, 1 - buffer, 2 + buffer, 0, -1, 2, options); // right world copy
19
+ if (left || right) {
20
+ merged = (0, clip_1.clip)(features, 1, -buffer, 1 + buffer, 0, -1, 2, options) || []; // center world copy
21
+ if (left) {
22
+ merged = shiftFeatureCoords(left, 1).concat(merged); // merge left into center
23
+ }
24
+ if (right) {
25
+ merged = merged.concat(shiftFeatureCoords(right, -1)); // merge right into center
26
+ }
27
+ }
28
+ return merged;
29
+ }
30
+ exports.wrap = wrap;
31
+ /**
32
+ * Shift the x coordinates of a list of features
33
+ * @param features list of features to shift x coordinates for
34
+ * @param offset
35
+ * @returns
36
+ */
37
+ function shiftFeatureCoords(features, offset) {
38
+ const newFeatures = [];
39
+ for (let i = 0; i < features.length; i++) {
40
+ const feature = features[i];
41
+ const type = feature.type;
42
+ let newGeometry;
43
+ if (type === 'Point' || type === 'MultiPoint' || type === 'LineString') {
44
+ newGeometry = shiftCoords(feature.geometry, offset);
45
+ }
46
+ else if (type === 'MultiLineString' || type === 'Polygon') {
47
+ newGeometry = [];
48
+ for (const line of feature.geometry) {
49
+ newGeometry.push(shiftCoords(line, offset));
50
+ }
51
+ }
52
+ else if (type === 'MultiPolygon') {
53
+ newGeometry = [];
54
+ for (const polygon of feature.geometry) {
55
+ const newPolygon = [];
56
+ for (const line of polygon) {
57
+ // @ts-expect-error TODO
58
+ newPolygon.push(shiftCoords(line, offset));
59
+ }
60
+ newGeometry.push(newPolygon);
61
+ }
62
+ }
63
+ newFeatures.push((0, feature_1.createFeature)(feature.id, type, newGeometry, feature.tags));
64
+ }
65
+ return newFeatures;
66
+ }
67
+ class Points extends Array {
68
+ }
69
+ /**
70
+ * Shift the x coordinate of every point
71
+ * @param points
72
+ * @param offset
73
+ * @returns
74
+ */
75
+ function shiftCoords(points, offset) {
76
+ const newPoints = [];
77
+ newPoints.size = points.size;
78
+ if (points.start !== undefined) {
79
+ newPoints.start = points.start;
80
+ newPoints.end = points.end;
81
+ }
82
+ for (let i = 0; i < points.length; i += 3) {
83
+ newPoints.push(points[i] + offset, points[i + 1], points[i + 2]);
84
+ }
85
+ return newPoints;
86
+ }
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const mapbox_util_functions_1 = require("../../helpers/mapbox-util-functions");
4
4
  class VectorTileFeature {
5
+ static get types() {
6
+ return ['Unknown', 'Point', 'LineString', 'Polygon'];
7
+ }
5
8
  constructor(pbf, end, extent, keys, values) {
6
9
  // Public
7
10
  this.properties = {};
@@ -15,9 +18,6 @@ class VectorTileFeature {
15
18
  this._values = values;
16
19
  pbf.readFields(mapbox_util_functions_1.readFeature, this, end);
17
20
  }
18
- static get types() {
19
- return ['Unknown', 'Point', 'LineString', 'Polygon'];
20
- }
21
21
  // eslint-disable-next-line complexity, max-statements
22
22
  loadGeometry() {
23
23
  const pbf = this._pbf;
@@ -1,6 +1,6 @@
1
1
  import type { LoaderOptions } from '@loaders.gl/loader-utils';
2
2
  /** For local coordinates, the tileIndex is not required */
3
- declare type MVTLocalCoordinatesOptions = {
3
+ type MVTLocalCoordinatesOptions = {
4
4
  /**
5
5
  * When set to `local`, the parser will return a flat array of GeoJSON objects with local coordinates decoded from tile origin.
6
6
  */
@@ -8,7 +8,7 @@ declare type MVTLocalCoordinatesOptions = {
8
8
  tileIndex: null;
9
9
  };
10
10
  /** In WGS84 coordinates, the tileIndex is required */
11
- declare type MVTWgs84CoordinatesOptions = {
11
+ type MVTWgs84CoordinatesOptions = {
12
12
  /**
13
13
  * When set to `wgs84`, the parser will return a flat array of GeoJSON objects with coordinates in longitude, latitude decoded from the provided tile index.
14
14
  */
@@ -23,7 +23,7 @@ declare type MVTWgs84CoordinatesOptions = {
23
23
  z: number;
24
24
  };
25
25
  };
26
- export declare type MVTOptions = (MVTLocalCoordinatesOptions | MVTWgs84CoordinatesOptions) & {
26
+ export type MVTOptions = (MVTLocalCoordinatesOptions | MVTWgs84CoordinatesOptions) & {
27
27
  /**
28
28
  * When non-`null`, the layer name of each feature is added to
29
29
  * `feature.properties[layerProperty]`. (A `feature.properties` object is created if the feature
@@ -37,13 +37,13 @@ export declare type MVTOptions = (MVTLocalCoordinatesOptions | MVTWgs84Coordinat
37
37
  layers?: string[];
38
38
  shape?: 'geojson-row-table' | 'columnar-table' | 'geojson' | 'binary' | 'binary-geometry';
39
39
  };
40
- export declare type MVTMapboxGeometry = {
40
+ export type MVTMapboxGeometry = {
41
41
  type?: string;
42
42
  id?: number;
43
43
  length: number;
44
44
  coordinates?: any[];
45
45
  };
46
- export declare type MVTMapboxCoordinates = {
46
+ export type MVTMapboxCoordinates = {
47
47
  type: string;
48
48
  geometry: {
49
49
  type: string;
@@ -54,7 +54,7 @@ export declare type MVTMapboxCoordinates = {
54
54
  };
55
55
  id?: number;
56
56
  };
57
- export declare type MVTLoaderOptions = LoaderOptions & {
57
+ export type MVTLoaderOptions = LoaderOptions & {
58
58
  mvt?: MVTOptions;
59
59
  gis?: {
60
60
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAE5D,2DAA2D;AAC3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AE,MAAM,CAAC;QACb,WAAW,EAAE,iBAAiB,CAAC;KAChC,CAAC;IACF,UAAU,EAAE;QAAC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;KAAC,CAAC;IAC5D,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,GAAG,CAAC,EAAE;QACJ;;WAEG;QACH,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,yCAAyC;QACzC,MAAM,CAAC,EAAE,mBAAmB,GAAG,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,iBAAiB,CAAC;KAC5F,CAAC;CACH,CAAC"}
@@ -773,11 +773,10 @@
773
773
  }
774
774
 
775
775
  // ../../node_modules/@math.gl/polygon/dist/esm/earcut.js
776
- function earcut(data, holeIndices, dim, areas) {
777
- dim = dim || 2;
776
+ function earcut(positions, holeIndices, dim = 2, areas) {
778
777
  const hasHoles = holeIndices && holeIndices.length;
779
- const outerLen = hasHoles ? holeIndices[0] * dim : data.length;
780
- let outerNode = linkedList(data, 0, outerLen, dim, true, areas && areas[0]);
778
+ const outerLen = hasHoles ? holeIndices[0] * dim : positions.length;
779
+ let outerNode = linkedList(positions, 0, outerLen, dim, true, areas && areas[0]);
781
780
  const triangles = [];
782
781
  if (!outerNode || outerNode.next === outerNode.prev)
783
782
  return triangles;
@@ -789,13 +788,13 @@
789
788
  let x2;
790
789
  let y2;
791
790
  if (hasHoles)
792
- outerNode = eliminateHoles(data, holeIndices, outerNode, dim, areas);
793
- if (data.length > 80 * dim) {
794
- minX = maxX = data[0];
795
- minY = maxY = data[1];
791
+ outerNode = eliminateHoles(positions, holeIndices, outerNode, dim, areas);
792
+ if (positions.length > 80 * dim) {
793
+ minX = maxX = positions[0];
794
+ minY = maxY = positions[1];
796
795
  for (let i2 = dim; i2 < outerLen; i2 += dim) {
797
- x2 = data[i2];
798
- y2 = data[i2 + 1];
796
+ x2 = positions[i2];
797
+ y2 = positions[i2 + 1];
799
798
  if (x2 < minX)
800
799
  minX = x2;
801
800
  if (y2 < minY)
@@ -2146,7 +2145,7 @@
2146
2145
  }
2147
2146
 
2148
2147
  // src/mvt-loader.ts
2149
- var VERSION = true ? "3.2.12" : "latest";
2148
+ var VERSION = true ? "3.3.0-alpha.10" : "latest";
2150
2149
  var DEFAULT_MVT_LOADER_OPTIONS = {
2151
2150
  mvt: {
2152
2151
  shape: "geojson",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@loaders.gl/mvt",
3
3
  "description": "Loader for Mapbox Vector Tiles",
4
- "version": "3.2.12",
4
+ "version": "3.3.0-alpha.10",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -32,14 +32,14 @@
32
32
  "build-worker": "esbuild src/workers/mvt-worker.ts --bundle --outfile=dist/mvt-worker.js --define:__VERSION__=\\\"$npm_package_version\\\""
33
33
  },
34
34
  "dependencies": {
35
- "@loaders.gl/gis": "3.2.12",
36
- "@loaders.gl/loader-utils": "3.2.12",
37
- "@loaders.gl/schema": "3.2.12",
35
+ "@loaders.gl/gis": "3.3.0-alpha.10",
36
+ "@loaders.gl/loader-utils": "3.3.0-alpha.10",
37
+ "@loaders.gl/schema": "3.3.0-alpha.10",
38
38
  "@math.gl/polygon": "^3.5.1",
39
39
  "pbf": "^3.2.1"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/pbf": "^3.0.2"
43
43
  },
44
- "gitHead": "7d46e4ff10047e479374e9b3411f5142a79df15f"
44
+ "gitHead": "53bc8d3f18fbc3445a00f8509038479119895c78"
45
45
  }
package/src/index.ts CHANGED
@@ -1 +1,8 @@
1
+ // loaders.gl, MIT license
2
+
1
3
  export {MVTLoader, MVTWorkerLoader} from './mvt-loader';
4
+
5
+ // GeoJSONTiler
6
+
7
+ export type {GeoJSONTilerOptions} from './lib/geojson-tiler/geojson-tiler';
8
+ export {GeoJSONTiler} from './lib/geojson-tiler/geojson-tiler';
@@ -0,0 +1,19 @@
1
+ This directory is forked from Mapbox's https://github.com/mapbox/geojson-vt under ISC License.
2
+
3
+ ```
4
+ ISC License
5
+
6
+ Copyright (c) 2015, Mapbox
7
+
8
+ Permission to use, copy, modify, and/or distribute this software for any purpose
9
+ with or without fee is hereby granted, provided that the above copyright notice
10
+ and this permission notice appear in all copies.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
13
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
14
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
15
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
16
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
17
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
18
+ THIS SOFTWARE.
19
+ ```