@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.
- package/dist/dist.dev.js +777 -688
- package/dist/dist.min.js +1 -1
- package/dist/index.cjs +746 -659
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/lib/parse-tilejson.js +1 -1
- package/dist/lib/utils/geometry-utils.js +1 -1
- package/dist/lib/vector-tiler/{clip.d.ts → features/clip-features.d.ts} +4 -4
- package/dist/lib/vector-tiler/features/clip-features.d.ts.map +1 -0
- package/dist/lib/vector-tiler/{clip.js → features/clip-features.js} +4 -4
- package/dist/lib/vector-tiler/{convert.d.ts → features/convert-feature.d.ts} +7 -7
- package/dist/lib/vector-tiler/features/convert-feature.d.ts.map +1 -0
- package/dist/lib/vector-tiler/features/convert-feature.js +140 -0
- package/dist/lib/vector-tiler/features/proto-feature.d.ts +30 -0
- package/dist/lib/vector-tiler/features/proto-feature.d.ts.map +1 -0
- package/dist/lib/vector-tiler/features/proto-feature.js +52 -0
- package/dist/lib/vector-tiler/{simplify.d.ts → features/simplify-path.d.ts} +2 -2
- package/dist/lib/vector-tiler/features/simplify-path.d.ts.map +1 -0
- package/dist/lib/vector-tiler/{simplify.js → features/simplify-path.js} +3 -3
- package/dist/lib/vector-tiler/{wrap.d.ts → features/wrap-features.d.ts} +5 -5
- package/dist/lib/vector-tiler/features/wrap-features.d.ts.map +1 -0
- package/dist/lib/vector-tiler/{wrap.js → features/wrap-features.js} +33 -26
- package/dist/lib/vector-tiler/proto-tile.d.ts +40 -0
- package/dist/lib/vector-tiler/proto-tile.d.ts.map +1 -0
- package/dist/lib/vector-tiler/proto-tile.js +138 -0
- package/dist/lib/vector-tiler/tile-to-geojson.d.ts +12 -0
- package/dist/lib/vector-tiler/tile-to-geojson.d.ts.map +1 -0
- package/dist/lib/vector-tiler/tile-to-geojson.js +81 -0
- package/dist/lib/vector-tiler/transform-tile.d.ts +7 -0
- package/dist/lib/vector-tiler/transform-tile.d.ts.map +1 -0
- package/dist/lib/vector-tiler/transform-tile.js +41 -0
- package/dist/mvt-loader.js +1 -1
- package/dist/mvt-source.d.ts +31 -14
- package/dist/mvt-source.d.ts.map +1 -1
- package/dist/mvt-source.js +26 -6
- package/dist/mvt-worker.js +4 -4
- package/dist/table-tile-source.d.ts +66 -36
- package/dist/table-tile-source.d.ts.map +1 -1
- package/dist/table-tile-source.js +167 -117
- package/dist/tilejson-loader.js +1 -1
- package/package.json +6 -6
- package/src/index.ts +13 -6
- package/src/lib/parse-tilejson.ts +1 -1
- package/src/lib/utils/geometry-utils.ts +1 -1
- package/src/lib/vector-tiler/{clip.ts → features/clip-features.ts} +8 -8
- package/src/lib/vector-tiler/{convert.ts → features/convert-feature.ts} +91 -70
- package/src/lib/vector-tiler/features/proto-feature.ts +104 -0
- package/src/lib/vector-tiler/{simplify.ts → features/simplify-path.ts} +8 -3
- package/src/lib/vector-tiler/{wrap.ts → features/wrap-features.ts} +44 -29
- package/src/lib/vector-tiler/proto-tile.ts +217 -0
- package/src/lib/vector-tiler/tile-to-geojson.ts +105 -0
- package/src/lib/vector-tiler/transform-tile.ts +57 -0
- package/src/mvt-source.ts +42 -18
- package/src/table-tile-source.ts +130 -85
- package/src/tilejson-loader.ts +2 -2
- package/dist/lib/vector-tiler/clip.d.ts.map +0 -1
- package/dist/lib/vector-tiler/convert.d.ts.map +0 -1
- package/dist/lib/vector-tiler/convert.js +0 -139
- package/dist/lib/vector-tiler/feature.d.ts +0 -3
- package/dist/lib/vector-tiler/feature.d.ts.map +0 -1
- package/dist/lib/vector-tiler/feature.js +0 -44
- package/dist/lib/vector-tiler/simplify.d.ts.map +0 -1
- package/dist/lib/vector-tiler/tile.d.ts +0 -38
- package/dist/lib/vector-tiler/tile.d.ts.map +0 -1
- package/dist/lib/vector-tiler/tile.js +0 -123
- package/dist/lib/vector-tiler/transform.d.ts +0 -7
- package/dist/lib/vector-tiler/transform.d.ts.map +0 -1
- package/dist/lib/vector-tiler/transform.js +0 -41
- package/dist/lib/vector-tiler/wrap.d.ts.map +0 -1
- package/src/lib/vector-tiler/feature.ts +0 -47
- package/src/lib/vector-tiler/tile.ts +0 -187
- 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
|
-
}
|