@loaders.gl/mvt 4.3.0-alpha.2 → 4.3.0-alpha.4
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 +821 -680
- package/dist/dist.min.js +1 -1
- package/dist/index.cjs +795 -656
- 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/get-schemas-from-tilejson.d.ts +4 -0
- package/dist/lib/get-schemas-from-tilejson.d.ts.map +1 -0
- package/dist/lib/get-schemas-from-tilejson.js +55 -0
- package/dist/lib/parse-tilejson.d.ts +9 -4
- package/dist/lib/parse-tilejson.d.ts.map +1 -1
- package/dist/lib/parse-tilejson.js +6 -6
- package/dist/lib/types.d.ts +39 -1
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/types.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.d.ts +2 -0
- package/dist/mvt-loader.d.ts.map +1 -1
- 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 +9 -6
- package/src/index.ts +13 -6
- package/src/lib/get-schemas-from-tilejson.ts +64 -0
- package/src/lib/parse-tilejson.ts +19 -12
- package/src/lib/types.ts +40 -2
- 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-loader.ts +2 -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
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { createProtoFeature } from "./proto-feature.js";
|
|
6
|
+
import { clipFeatures } from "./clip-features.js";
|
|
7
7
|
/**
|
|
8
8
|
* Wrap across antemeridian, by clipping into two tiles, shifting the overflowing x coordinates
|
|
9
|
-
* @param
|
|
9
|
+
* @param list of features to be wrapped
|
|
10
10
|
* @param options buffer and extent
|
|
11
11
|
* @returns
|
|
12
12
|
*/
|
|
13
|
-
export function
|
|
13
|
+
export function wrapFeatures(features, options) {
|
|
14
14
|
const buffer = options.buffer / options.extent;
|
|
15
15
|
let merged = features;
|
|
16
|
-
const left =
|
|
17
|
-
const right =
|
|
16
|
+
const left = clipFeatures(features, 1, -1 - buffer, buffer, 0, -1, 2, options); // left world copy
|
|
17
|
+
const right = clipFeatures(features, 1, 1 - buffer, 2 + buffer, 0, -1, 2, options); // right world copy
|
|
18
18
|
if (left || right) {
|
|
19
|
-
merged =
|
|
19
|
+
merged = clipFeatures(features, 1, -buffer, 1 + buffer, 0, -1, 2, options) || []; // center world copy
|
|
20
20
|
if (left) {
|
|
21
21
|
merged = shiftFeatureCoords(left, 1).concat(merged); // merge left into center
|
|
22
22
|
}
|
|
@@ -38,27 +38,34 @@ function shiftFeatureCoords(features, offset) {
|
|
|
38
38
|
const feature = features[i];
|
|
39
39
|
const type = feature.type;
|
|
40
40
|
let newGeometry;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
41
|
+
switch (type) {
|
|
42
|
+
case 'Point':
|
|
43
|
+
case 'MultiPoint':
|
|
44
|
+
case 'LineString':
|
|
45
|
+
newGeometry = shiftCoords(feature.geometry, offset);
|
|
46
|
+
break;
|
|
47
|
+
case 'MultiLineString':
|
|
48
|
+
case 'Polygon':
|
|
49
|
+
newGeometry = [];
|
|
50
|
+
for (const line of feature.geometry) {
|
|
51
|
+
newGeometry.push(shiftCoords(line, offset));
|
|
52
|
+
}
|
|
53
|
+
break;
|
|
54
|
+
case 'MultiPolygon':
|
|
55
|
+
newGeometry = [];
|
|
56
|
+
for (const polygon of feature.geometry) {
|
|
57
|
+
const newPolygon = [];
|
|
58
|
+
for (const line of polygon) {
|
|
59
|
+
// @ts-expect-error TODO
|
|
60
|
+
newPolygon.push(shiftCoords(line, offset));
|
|
61
|
+
}
|
|
62
|
+
newGeometry.push(newPolygon);
|
|
57
63
|
}
|
|
58
|
-
|
|
59
|
-
|
|
64
|
+
break;
|
|
65
|
+
default:
|
|
66
|
+
throw new Error(String(type));
|
|
60
67
|
}
|
|
61
|
-
newFeatures.push(
|
|
68
|
+
newFeatures.push(createProtoFeature(feature.id, type, newGeometry, feature.tags));
|
|
62
69
|
}
|
|
63
70
|
return newFeatures;
|
|
64
71
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ProtoFeature } from "./features/proto-feature.js";
|
|
2
|
+
export type ProtoTile = {
|
|
3
|
+
/** Processed features */
|
|
4
|
+
protoFeatures: ProtoFeature[];
|
|
5
|
+
/** if we slice further down, no need to keep source geometry */
|
|
6
|
+
sourceFeatures: ProtoFeature[] | null;
|
|
7
|
+
/** Properties */
|
|
8
|
+
tags?: Record<string, string>;
|
|
9
|
+
/** tile x coordinate */
|
|
10
|
+
x: number;
|
|
11
|
+
/** tile y coordinate */
|
|
12
|
+
y: number;
|
|
13
|
+
/** tile z coordinate */
|
|
14
|
+
z: number;
|
|
15
|
+
/** spatial extent */
|
|
16
|
+
minX: number;
|
|
17
|
+
/** spatial extent */
|
|
18
|
+
maxX: number;
|
|
19
|
+
/** spatial extent */
|
|
20
|
+
minY: number;
|
|
21
|
+
/** spatial extent */
|
|
22
|
+
maxY: number;
|
|
23
|
+
/** Whether this tile has been transformed */
|
|
24
|
+
transformed: boolean;
|
|
25
|
+
numPoints: number;
|
|
26
|
+
numSimplified: number;
|
|
27
|
+
/** Number of features in this tile */
|
|
28
|
+
numFeatures: number;
|
|
29
|
+
};
|
|
30
|
+
export type CreateTileOptions = {
|
|
31
|
+
maxZoom?: number;
|
|
32
|
+
tolerance: number;
|
|
33
|
+
extent: number;
|
|
34
|
+
lineMetrics: boolean;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Create a tile from features and tile index
|
|
38
|
+
*/
|
|
39
|
+
export declare function createProtoTile(features: ProtoFeature[], z: any, tx: any, ty: any, options: CreateTileOptions): ProtoTile;
|
|
40
|
+
//# sourceMappingURL=proto-tile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proto-tile.d.ts","sourceRoot":"","sources":["../../../src/lib/vector-tiler/proto-tile.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,YAAY,EAAC,oCAAiC;AAE3D,MAAM,MAAM,SAAS,GAAG;IACtB,yBAAyB;IACzB,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,gEAAgE;IAChE,cAAc,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IAEtC,iBAAiB;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE9B,wBAAwB;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,wBAAwB;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,wBAAwB;IACxB,CAAC,EAAE,MAAM,CAAC;IAEV,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IAEb,6CAA6C;IAC7C,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,sCAAsC;IACtC,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,YAAY,EAAE,EACxB,CAAC,KAAA,EACD,EAAE,KAAA,EACF,EAAE,KAAA,EACF,OAAO,EAAE,iBAAiB,GACzB,SAAS,CAqBX"}
|
|
@@ -0,0 +1,138 @@
|
|
|
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
|
+
* Create a tile from features and tile index
|
|
7
|
+
*/
|
|
8
|
+
export function createProtoTile(features, z, tx, ty, options) {
|
|
9
|
+
const tolerance = z === options.maxZoom ? 0 : options.tolerance / ((1 << z) * options.extent);
|
|
10
|
+
const tile = {
|
|
11
|
+
protoFeatures: [],
|
|
12
|
+
sourceFeatures: null,
|
|
13
|
+
numPoints: 0,
|
|
14
|
+
numSimplified: 0,
|
|
15
|
+
numFeatures: features.length,
|
|
16
|
+
x: tx,
|
|
17
|
+
y: ty,
|
|
18
|
+
z,
|
|
19
|
+
transformed: false,
|
|
20
|
+
minX: 2,
|
|
21
|
+
minY: 1,
|
|
22
|
+
maxX: -1,
|
|
23
|
+
maxY: 0
|
|
24
|
+
};
|
|
25
|
+
for (const feature of features) {
|
|
26
|
+
addProtoFeature(tile, feature, tolerance, options);
|
|
27
|
+
}
|
|
28
|
+
return tile;
|
|
29
|
+
}
|
|
30
|
+
// eslint-disable-next-line complexity, max-statements
|
|
31
|
+
function addProtoFeature(tile, feature, tolerance, options) {
|
|
32
|
+
const geometry = feature.geometry;
|
|
33
|
+
const type = feature.type;
|
|
34
|
+
const simplifiedGeometry = [];
|
|
35
|
+
tile.minX = Math.min(tile.minX, feature.minX);
|
|
36
|
+
tile.minY = Math.min(tile.minY, feature.minY);
|
|
37
|
+
tile.maxX = Math.max(tile.maxX, feature.maxX);
|
|
38
|
+
tile.maxY = Math.max(tile.maxY, feature.maxY);
|
|
39
|
+
let simplifiedType;
|
|
40
|
+
switch (type) {
|
|
41
|
+
case 'Point':
|
|
42
|
+
case 'MultiPoint':
|
|
43
|
+
simplifiedType = 1;
|
|
44
|
+
for (let i = 0; i < geometry.length; i += 3) {
|
|
45
|
+
simplifiedGeometry.push(geometry[i], geometry[i + 1]);
|
|
46
|
+
tile.numPoints++;
|
|
47
|
+
tile.numSimplified++;
|
|
48
|
+
}
|
|
49
|
+
break;
|
|
50
|
+
case 'LineString':
|
|
51
|
+
simplifiedType = 2;
|
|
52
|
+
addProtoLine(simplifiedGeometry, geometry, tile, tolerance, false, false);
|
|
53
|
+
break;
|
|
54
|
+
case 'MultiLineString':
|
|
55
|
+
simplifiedType = 2;
|
|
56
|
+
for (let i = 0; i < geometry.length; i++) {
|
|
57
|
+
addProtoLine(simplifiedGeometry, geometry[i], tile, tolerance, false, i === 0);
|
|
58
|
+
}
|
|
59
|
+
break;
|
|
60
|
+
case 'Polygon':
|
|
61
|
+
simplifiedType = 3;
|
|
62
|
+
for (let i = 0; i < geometry.length; i++) {
|
|
63
|
+
addProtoLine(simplifiedGeometry, geometry[i], tile, tolerance, true, i === 0);
|
|
64
|
+
}
|
|
65
|
+
break;
|
|
66
|
+
case 'MultiPolygon':
|
|
67
|
+
simplifiedType = 3;
|
|
68
|
+
for (let k = 0; k < geometry.length; k++) {
|
|
69
|
+
const polygon = geometry[k];
|
|
70
|
+
for (let i = 0; i < polygon.length; i++) {
|
|
71
|
+
addProtoLine(simplifiedGeometry, polygon[i], tile, tolerance, true, i === 0);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
break;
|
|
75
|
+
default:
|
|
76
|
+
throw new Error(`Unknown geometry type: ${type}`);
|
|
77
|
+
}
|
|
78
|
+
if (simplifiedGeometry.length) {
|
|
79
|
+
let tags = feature.tags || null;
|
|
80
|
+
if (type === 'LineString' && options.lineMetrics) {
|
|
81
|
+
tags = {};
|
|
82
|
+
for (const key in feature.tags) {
|
|
83
|
+
tags[key] = feature.tags[key];
|
|
84
|
+
}
|
|
85
|
+
// @ts-expect-error adding fields to arrays
|
|
86
|
+
// eslint-disable-next-line camelcase
|
|
87
|
+
tags.mapbox_clip_start = geometry.start / geometry.size;
|
|
88
|
+
// @ts-expect-error adding fields to arrays
|
|
89
|
+
// eslint-disable-next-line camelcase
|
|
90
|
+
tags.mapbox_clip_end = geometry.end / geometry.size;
|
|
91
|
+
}
|
|
92
|
+
const tileFeature = {
|
|
93
|
+
geometry: simplifiedGeometry,
|
|
94
|
+
simplifiedType,
|
|
95
|
+
// @ts-expect-error
|
|
96
|
+
tags
|
|
97
|
+
};
|
|
98
|
+
if (feature.id !== null) {
|
|
99
|
+
tileFeature.id = feature.id;
|
|
100
|
+
}
|
|
101
|
+
tile.protoFeatures.push(tileFeature);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// eslint-disable-next-line max-params, max-statements
|
|
105
|
+
function addProtoLine(result, geometry, tile, tolerance, isPolygon, isOuter) {
|
|
106
|
+
const sqTolerance = tolerance * tolerance;
|
|
107
|
+
if (tolerance > 0 && geometry.size < (isPolygon ? sqTolerance : tolerance)) {
|
|
108
|
+
tile.numPoints += geometry.length / 3;
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const ring = [];
|
|
112
|
+
for (let i = 0; i < geometry.length; i += 3) {
|
|
113
|
+
if (tolerance === 0 || geometry[i + 2] > sqTolerance) {
|
|
114
|
+
tile.numSimplified++;
|
|
115
|
+
ring.push(geometry[i], geometry[i + 1]);
|
|
116
|
+
}
|
|
117
|
+
tile.numPoints++;
|
|
118
|
+
}
|
|
119
|
+
if (isPolygon)
|
|
120
|
+
rewind(ring, isOuter);
|
|
121
|
+
result.push(ring);
|
|
122
|
+
}
|
|
123
|
+
function rewind(ring, clockwise) {
|
|
124
|
+
let area = 0;
|
|
125
|
+
for (let i = 0, j = ring.length - 2; i < ring.length; j = i, i += 2) {
|
|
126
|
+
area += (ring[i] - ring[j]) * (ring[i + 1] + ring[j + 1]);
|
|
127
|
+
}
|
|
128
|
+
if (area > 0 === clockwise) {
|
|
129
|
+
for (let i = 0, len = ring.length; i < len / 2; i += 2) {
|
|
130
|
+
const x = ring[i];
|
|
131
|
+
const y = ring[i + 1];
|
|
132
|
+
ring[i] = ring[len - 2 - i];
|
|
133
|
+
ring[i + 1] = ring[len - 1 - i];
|
|
134
|
+
ring[len - 2 - i] = x;
|
|
135
|
+
ring[len - 1 - i] = y;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ProtoTile } from "./proto-tile.js";
|
|
2
|
+
import { GeoJSONTable } from '@loaders.gl/schema';
|
|
3
|
+
export declare function convertTileToGeoJSON(protoTile: ProtoTile, props: {
|
|
4
|
+
coordinates: 'EPSG:4326' | 'wgs84' | 'local';
|
|
5
|
+
tileIndex: {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
z: number;
|
|
9
|
+
};
|
|
10
|
+
extent: number;
|
|
11
|
+
}): GeoJSONTable | null;
|
|
12
|
+
//# sourceMappingURL=tile-to-geojson.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tile-to-geojson.d.ts","sourceRoot":"","sources":["../../../src/lib/vector-tiler/tile-to-geojson.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,SAAS,EAAC,wBAAqB;AACvC,OAAO,EAAU,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAMzD,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE;IACL,WAAW,EAAE,WAAW,GAAG,OAAO,GAAG,OAAO,CAAC;IAC7C,SAAS,EAAE;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;IAC7C,MAAM,EAAE,MAAM,CAAC;CAChB,GACA,YAAY,GAAG,IAAI,CAqFrB"}
|
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
import { projectToLngLat } from "../utils/geometry-utils.js";
|
|
6
|
+
import { convertToLocalCoordinates } from "../utils/geometry-utils.js";
|
|
7
|
+
// eslint-disable-next-line max-statements, complexity
|
|
8
|
+
export function convertTileToGeoJSON(protoTile, props) {
|
|
9
|
+
const features = [];
|
|
10
|
+
for (const rawFeature of protoTile.protoFeatures) {
|
|
11
|
+
if (!rawFeature || !rawFeature.geometry) {
|
|
12
|
+
// eslint-disable-next-line no-continue
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
let type;
|
|
16
|
+
let coordinates;
|
|
17
|
+
// raw geometry
|
|
18
|
+
switch (rawFeature.simplifiedType) {
|
|
19
|
+
case 1:
|
|
20
|
+
if (rawFeature.geometry.length === 1) {
|
|
21
|
+
type = 'Point';
|
|
22
|
+
coordinates = rawFeature.geometry[0];
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
type = 'MultiPoint';
|
|
26
|
+
coordinates = rawFeature.geometry;
|
|
27
|
+
}
|
|
28
|
+
break;
|
|
29
|
+
case 2:
|
|
30
|
+
if (rawFeature.geometry.length === 1) {
|
|
31
|
+
type = 'LineString';
|
|
32
|
+
coordinates = rawFeature.geometry[0];
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
type = 'MultiLineString';
|
|
36
|
+
coordinates = rawFeature.geometry;
|
|
37
|
+
}
|
|
38
|
+
break;
|
|
39
|
+
case 3:
|
|
40
|
+
if (rawFeature.geometry.length > 1) {
|
|
41
|
+
type = 'MultiPolygon';
|
|
42
|
+
coordinates = [rawFeature.geometry];
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
type = 'Polygon';
|
|
46
|
+
coordinates = rawFeature.geometry;
|
|
47
|
+
}
|
|
48
|
+
break;
|
|
49
|
+
default:
|
|
50
|
+
throw new Error(`${rawFeature.simplifiedType}is not a valid simplified type`);
|
|
51
|
+
}
|
|
52
|
+
switch (props.coordinates) {
|
|
53
|
+
case 'EPSG:4326':
|
|
54
|
+
case 'wgs84':
|
|
55
|
+
projectToLngLat(coordinates, props.tileIndex, props.extent);
|
|
56
|
+
break;
|
|
57
|
+
default:
|
|
58
|
+
convertToLocalCoordinates(coordinates, props.extent);
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
const feature = {
|
|
62
|
+
type: 'Feature',
|
|
63
|
+
geometry: {
|
|
64
|
+
type,
|
|
65
|
+
coordinates
|
|
66
|
+
},
|
|
67
|
+
properties: rawFeature.tags || {},
|
|
68
|
+
id: rawFeature.id
|
|
69
|
+
};
|
|
70
|
+
features.push(feature);
|
|
71
|
+
}
|
|
72
|
+
if (features.length === 0) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
const table = {
|
|
76
|
+
shape: 'geojson-table',
|
|
77
|
+
type: 'FeatureCollection',
|
|
78
|
+
features
|
|
79
|
+
};
|
|
80
|
+
return table;
|
|
81
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ProtoTile } from "./proto-tile.js";
|
|
2
|
+
/**
|
|
3
|
+
* Transforms the coordinates of each protoFeature in the given protoTile from
|
|
4
|
+
* mercator-projected space into (extent x extent) protoTile space.
|
|
5
|
+
*/
|
|
6
|
+
export declare function transformTile(protoTile: ProtoTile, extent: number): ProtoTile;
|
|
7
|
+
//# sourceMappingURL=transform-tile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform-tile.d.ts","sourceRoot":"","sources":["../../../src/lib/vector-tiler/transform-tile.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,SAAS,EAAC,wBAAqB;AAE5C;;;GAGG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAiC7E"}
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
* Transforms the coordinates of each protoFeature in the given protoTile from
|
|
7
|
+
* mercator-projected space into (extent x extent) protoTile space.
|
|
8
|
+
*/
|
|
9
|
+
export function transformTile(protoTile, extent) {
|
|
10
|
+
if (protoTile.transformed) {
|
|
11
|
+
return protoTile;
|
|
12
|
+
}
|
|
13
|
+
const z2 = 1 << protoTile.z;
|
|
14
|
+
const tx = protoTile.x;
|
|
15
|
+
const ty = protoTile.y;
|
|
16
|
+
for (const protoFeature of protoTile.protoFeatures) {
|
|
17
|
+
const geom = protoFeature.geometry;
|
|
18
|
+
const simplifiedType = protoFeature.simplifiedType;
|
|
19
|
+
protoFeature.geometry = [];
|
|
20
|
+
if (simplifiedType === 1) {
|
|
21
|
+
for (let j = 0; j < geom.length; j += 2) {
|
|
22
|
+
protoFeature.geometry.push(transformPoint(geom[j], geom[j + 1], extent, z2, tx, ty));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
for (let j = 0; j < geom.length; j++) {
|
|
27
|
+
const ring = [];
|
|
28
|
+
for (let k = 0; k < geom[j].length; k += 2) {
|
|
29
|
+
ring.push(transformPoint(geom[j][k], geom[j][k + 1], extent, z2, tx, ty));
|
|
30
|
+
}
|
|
31
|
+
protoFeature.geometry.push(ring);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
protoTile.transformed = true;
|
|
36
|
+
return protoTile;
|
|
37
|
+
}
|
|
38
|
+
// eslint-disable-next-line max-params
|
|
39
|
+
function transformPoint(x, y, extent, z2, tx, ty) {
|
|
40
|
+
return [Math.round(extent * (x * z2 - tx)), Math.round(extent * (y * z2 - ty))];
|
|
41
|
+
}
|
package/dist/mvt-loader.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ export type MVTLoaderOptions = LoaderOptions & {
|
|
|
20
20
|
workerUrl?: string;
|
|
21
21
|
};
|
|
22
22
|
gis?: {
|
|
23
|
+
/** @deprecated Use options.mvt.shape === 'binary-geometry' */
|
|
24
|
+
binary?: boolean;
|
|
23
25
|
/** @deprecated. Use options.mvt.shape */
|
|
24
26
|
format?: 'geojson-table' | 'columnar-table' | 'geojson' | 'binary' | 'binary-geometry';
|
|
25
27
|
};
|
package/dist/mvt-loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mvt-loader.d.ts","sourceRoot":"","sources":["../src/mvt-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAA2B,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAEtF,OAAO,EAAC,QAAQ,EAAC,2BAAwB;AAMzC,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE;QACJ,6BAA6B;QAC7B,KAAK,CAAC,EAAE,eAAe,GAAG,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,iBAAiB,CAAC;QACtF,sHAAsH;QACtH,WAAW,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;QAChC,uJAAuJ;QACvJ,SAAS,CAAC,EAAE;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAA;SAAC,CAAC;QAC9C,0GAA0G;QAC1G,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QAChC,gJAAgJ;QAChJ,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAClB,8EAA8E;QAC9E,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,yCAAyC;QACzC,MAAM,CAAC,EAAE,eAAe,GAAG,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,iBAAiB,CAAC;KACxF,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;CA+B3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS;yDAEiB,gBAAgB;;;;;;;;;;;;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./lib/parse-mvt.js";
|
|
6
6
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
7
7
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
8
|
-
const VERSION = typeof "4.3.0-alpha.
|
|
8
|
+
const VERSION = typeof "4.3.0-alpha.3" !== 'undefined' ? "4.3.0-alpha.3" : 'latest';
|
|
9
9
|
/**
|
|
10
10
|
* Worker loader for the Mapbox Vector Tile format
|
|
11
11
|
*/
|
package/dist/mvt-source.d.ts
CHANGED
|
@@ -4,18 +4,35 @@ import type { GetTileParameters, GetTileDataParameters } from '@loaders.gl/loade
|
|
|
4
4
|
import { DataSource } from '@loaders.gl/loader-utils';
|
|
5
5
|
import { ImageLoaderOptions } from '@loaders.gl/images';
|
|
6
6
|
import { MVTLoaderOptions, TileJSON, TileJSONLoaderOptions } from '@loaders.gl/mvt';
|
|
7
|
+
/** Creates an MVTTileSource */
|
|
8
|
+
export declare const MVTSource: {
|
|
9
|
+
readonly name: "MVT";
|
|
10
|
+
readonly id: "mvt";
|
|
11
|
+
readonly module: "mvt";
|
|
12
|
+
readonly version: "0.0.0";
|
|
13
|
+
readonly extensions: ["mvt"];
|
|
14
|
+
readonly mimeTypes: ["application/octet-stream"];
|
|
15
|
+
readonly options: {
|
|
16
|
+
readonly mvt: {};
|
|
17
|
+
};
|
|
18
|
+
readonly type: "mvt";
|
|
19
|
+
readonly fromUrl: true;
|
|
20
|
+
readonly fromBlob: false;
|
|
21
|
+
readonly testURL: (url: string) => boolean;
|
|
22
|
+
readonly createDataSource: (url: string, props: MVTTileSourceProps) => MVTTileSource;
|
|
23
|
+
};
|
|
7
24
|
/** Properties for a Mapbox Vector Tile Source */
|
|
8
|
-
export type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
export type MVTTileSourceProps = DataSourceProps & {
|
|
26
|
+
mvt?: {
|
|
27
|
+
/** if not supplied, loads tilejson.json, If null does not load metadata */
|
|
28
|
+
metadataUrl?: string | null;
|
|
29
|
+
/** Override extension (necessary if no metadata) */
|
|
30
|
+
extension?: string;
|
|
31
|
+
/** Additional attribution, adds to any attribution loaded from tileset metadata */
|
|
32
|
+
attributions?: string[];
|
|
33
|
+
/** Specify load options for all sub loaders */
|
|
34
|
+
loadOptions?: TileJSONLoaderOptions & MVTLoaderOptions & ImageLoaderOptions;
|
|
35
|
+
};
|
|
19
36
|
};
|
|
20
37
|
/**
|
|
21
38
|
* MVT data source for Mapbox Vector Tiles v1.
|
|
@@ -24,8 +41,8 @@ export type MVTSourceProps = DataSourceProps & {
|
|
|
24
41
|
* A PMTiles data source
|
|
25
42
|
* @note Can be either a raster or vector tile source depending on the contents of the PMTiles file.
|
|
26
43
|
*/
|
|
27
|
-
export declare class
|
|
28
|
-
readonly props:
|
|
44
|
+
export declare class MVTTileSource extends DataSource implements ImageTileSource, VectorTileSource {
|
|
45
|
+
readonly props: MVTTileSourceProps;
|
|
29
46
|
readonly url: string;
|
|
30
47
|
readonly metadataUrl: string | null;
|
|
31
48
|
data: string;
|
|
@@ -33,7 +50,7 @@ export declare class MVTSource extends DataSource implements ImageTileSource, Ve
|
|
|
33
50
|
metadata: Promise<TileJSON | null>;
|
|
34
51
|
extension: string;
|
|
35
52
|
mimeType: string | null;
|
|
36
|
-
constructor(props:
|
|
53
|
+
constructor(url: string, props: MVTTileSourceProps);
|
|
37
54
|
getMetadata(): Promise<TileJSON | null>;
|
|
38
55
|
getTileMIMEType(): string | null;
|
|
39
56
|
getTile(parameters: GetTileParameters): Promise<ArrayBuffer | null>;
|
package/dist/mvt-source.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mvt-source.d.ts","sourceRoot":"","sources":["../src/mvt-source.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mvt-source.d.ts","sourceRoot":"","sources":["../src/mvt-source.ts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ED
|
@@ -4,6 +4,27 @@
|
|
|
4
4
|
import { DataSource, resolvePath } from '@loaders.gl/loader-utils';
|
|
5
5
|
import { ImageLoader, getBinaryImageMetadata } from '@loaders.gl/images';
|
|
6
6
|
import { MVTLoader, TileJSONLoader } from '@loaders.gl/mvt';
|
|
7
|
+
/** Creates an MVTTileSource */
|
|
8
|
+
export const MVTSource = {
|
|
9
|
+
name: 'MVT',
|
|
10
|
+
id: 'mvt',
|
|
11
|
+
module: 'mvt',
|
|
12
|
+
version: '0.0.0',
|
|
13
|
+
extensions: ['mvt'],
|
|
14
|
+
mimeTypes: ['application/octet-stream'],
|
|
15
|
+
options: {
|
|
16
|
+
mvt: {
|
|
17
|
+
// TODO - add options here
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
type: 'mvt',
|
|
21
|
+
fromUrl: true,
|
|
22
|
+
fromBlob: false,
|
|
23
|
+
testURL: (url) => true,
|
|
24
|
+
createDataSource(url, props) {
|
|
25
|
+
return new MVTTileSource(url, props);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
7
28
|
/**
|
|
8
29
|
* MVT data source for Mapbox Vector Tiles v1.
|
|
9
30
|
*/
|
|
@@ -11,7 +32,7 @@ import { MVTLoader, TileJSONLoader } from '@loaders.gl/mvt';
|
|
|
11
32
|
* A PMTiles data source
|
|
12
33
|
* @note Can be either a raster or vector tile source depending on the contents of the PMTiles file.
|
|
13
34
|
*/
|
|
14
|
-
export class
|
|
35
|
+
export class MVTTileSource extends DataSource {
|
|
15
36
|
props;
|
|
16
37
|
url;
|
|
17
38
|
metadataUrl = null;
|
|
@@ -20,13 +41,12 @@ export class MVTSource extends DataSource {
|
|
|
20
41
|
metadata;
|
|
21
42
|
extension;
|
|
22
43
|
mimeType = null;
|
|
23
|
-
constructor(props) {
|
|
44
|
+
constructor(url, props) {
|
|
24
45
|
super(props);
|
|
25
46
|
this.props = props;
|
|
26
|
-
this.url = resolvePath(
|
|
27
|
-
this.metadataUrl =
|
|
28
|
-
|
|
29
|
-
this.extension = props.extension || '.png';
|
|
47
|
+
this.url = resolvePath(url);
|
|
48
|
+
this.metadataUrl = props.mvt?.metadataUrl || `${this.url}/tilejson.json`;
|
|
49
|
+
this.extension = props.mvt?.extension || '.png';
|
|
30
50
|
this.data = this.url;
|
|
31
51
|
this.getTileData = this.getTileData.bind(this);
|
|
32
52
|
this.metadata = this.getMetadata();
|
package/dist/mvt-worker.js
CHANGED
|
@@ -1649,7 +1649,7 @@
|
|
|
1649
1649
|
var navigator_ = globalThis.navigator || {};
|
|
1650
1650
|
|
|
1651
1651
|
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/utils/globals.js
|
|
1652
|
-
var VERSION = true ? "4.3.0-alpha.
|
|
1652
|
+
var VERSION = true ? "4.3.0-alpha.3" : "untranspiled source";
|
|
1653
1653
|
var isBrowser2 = isBrowser();
|
|
1654
1654
|
|
|
1655
1655
|
// ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
|
|
@@ -2147,7 +2147,7 @@
|
|
|
2147
2147
|
});
|
|
2148
2148
|
|
|
2149
2149
|
// ../loader-utils/src/lib/log-utils/log.ts
|
|
2150
|
-
var VERSION2 = true ? "4.3.0-alpha.
|
|
2150
|
+
var VERSION2 = true ? "4.3.0-alpha.3" : "latest";
|
|
2151
2151
|
var version = VERSION2[0] >= "0" && VERSION2[0] <= "9" ? `v${VERSION2}` : "";
|
|
2152
2152
|
function createLog() {
|
|
2153
2153
|
const log2 = new Log({ id: "loaders.gl" });
|
|
@@ -2384,7 +2384,7 @@
|
|
|
2384
2384
|
p[1] /= extent;
|
|
2385
2385
|
}
|
|
2386
2386
|
function convertToLocalCoordinatesFlat(data, extent) {
|
|
2387
|
-
for (let i = 0
|
|
2387
|
+
for (let i = 0; i < data.length; ++i) {
|
|
2388
2388
|
data[i] /= extent;
|
|
2389
2389
|
}
|
|
2390
2390
|
}
|
|
@@ -3019,7 +3019,7 @@
|
|
|
3019
3019
|
}
|
|
3020
3020
|
|
|
3021
3021
|
// src/mvt-loader.ts
|
|
3022
|
-
var VERSION3 = true ? "4.3.0-alpha.
|
|
3022
|
+
var VERSION3 = true ? "4.3.0-alpha.3" : "latest";
|
|
3023
3023
|
var MVTWorkerLoader = {
|
|
3024
3024
|
dataType: null,
|
|
3025
3025
|
batchType: null,
|