@loaders.gl/mvt 4.3.0-alpha.1 → 4.3.0-alpha.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.
- package/dist/dist.dev.js +568 -175
- package/dist/dist.min.js +1 -1
- package/dist/index.cjs +226 -163
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/parse-mvt.d.ts +1 -1
- package/dist/lib/parse-mvt.js +2 -30
- package/dist/lib/parse-tilejson.d.ts +4 -4
- package/dist/lib/parse-tilejson.d.ts.map +1 -1
- package/dist/lib/utils/geometry-utils.d.ts +38 -1
- package/dist/lib/utils/geometry-utils.d.ts.map +1 -1
- package/dist/lib/utils/geometry-utils.js +65 -6
- package/dist/lib/vector-tile/vector-tile-feature.d.ts +28 -9
- package/dist/lib/vector-tile/vector-tile-feature.d.ts.map +1 -1
- package/dist/lib/vector-tile/vector-tile-feature.js +47 -50
- package/dist/lib/{geojsonvt → vector-tiler}/clip.d.ts +3 -3
- package/dist/lib/vector-tiler/clip.d.ts.map +1 -0
- package/dist/lib/vector-tiler/convert.d.ts +18 -0
- package/dist/lib/vector-tiler/convert.d.ts.map +1 -0
- package/dist/lib/{geojsonvt → vector-tiler}/convert.js +8 -1
- package/dist/lib/vector-tiler/feature.d.ts +3 -0
- package/dist/lib/vector-tiler/feature.d.ts.map +1 -0
- package/dist/lib/vector-tiler/simplify.d.ts.map +1 -0
- package/dist/lib/{geojsonvt → vector-tiler}/tile.d.ts +4 -4
- package/dist/lib/vector-tiler/tile.d.ts.map +1 -0
- package/dist/lib/vector-tiler/transform.d.ts +7 -0
- package/dist/lib/vector-tiler/transform.d.ts.map +1 -0
- package/dist/lib/{geojsonvt → vector-tiler}/wrap.d.ts +2 -2
- package/dist/lib/vector-tiler/wrap.d.ts.map +1 -0
- package/dist/mvt-loader.d.ts +1 -1
- package/dist/mvt-loader.js +1 -1
- package/dist/mvt-source.d.ts +4 -4
- package/dist/mvt-source.d.ts.map +1 -1
- package/dist/mvt-source.js +4 -4
- package/dist/mvt-worker.js +101 -56
- package/dist/table-tile-source.d.ts +118 -0
- package/dist/table-tile-source.d.ts.map +1 -0
- package/dist/{geojson-tile-source.js → table-tile-source.js} +154 -103
- package/dist/tilejson-loader.js +1 -1
- package/package.json +7 -6
- package/src/index.ts +3 -3
- package/src/lib/parse-mvt.ts +4 -33
- package/src/lib/parse-tilejson.ts +5 -5
- package/src/lib/utils/geometry-utils.ts +66 -1
- package/src/lib/vector-tile/vector-tile-feature.ts +65 -56
- package/src/lib/{geojsonvt → vector-tiler}/clip.ts +4 -4
- package/src/lib/{geojsonvt → vector-tiler}/convert.ts +18 -8
- package/src/lib/{geojsonvt → vector-tiler}/feature.ts +3 -3
- package/src/lib/{geojsonvt → vector-tiler}/tile.ts +8 -8
- package/src/lib/{geojsonvt → vector-tiler}/transform.ts +2 -2
- package/src/lib/{geojsonvt → vector-tiler}/wrap.ts +5 -5
- package/src/mvt-source.ts +6 -7
- package/src/table-tile-source.ts +508 -0
- package/dist/geojson-tile-source.d.ts +0 -79
- package/dist/geojson-tile-source.d.ts.map +0 -1
- package/dist/lib/geojsonvt/clip.d.ts.map +0 -1
- package/dist/lib/geojsonvt/convert.d.ts +0 -10
- package/dist/lib/geojsonvt/convert.d.ts.map +0 -1
- package/dist/lib/geojsonvt/feature.d.ts +0 -3
- package/dist/lib/geojsonvt/feature.d.ts.map +0 -1
- package/dist/lib/geojsonvt/simplify.d.ts.map +0 -1
- package/dist/lib/geojsonvt/tile.d.ts.map +0 -1
- package/dist/lib/geojsonvt/transform.d.ts +0 -7
- package/dist/lib/geojsonvt/transform.d.ts.map +0 -1
- package/dist/lib/geojsonvt/wrap.d.ts.map +0 -1
- package/src/geojson-tile-source.ts +0 -422
- /package/dist/lib/{geojsonvt → vector-tiler}/clip.js +0 -0
- /package/dist/lib/{geojsonvt → vector-tiler}/feature.js +0 -0
- /package/dist/lib/{geojsonvt → vector-tiler}/simplify.d.ts +0 -0
- /package/dist/lib/{geojsonvt → vector-tiler}/simplify.js +0 -0
- /package/dist/lib/{geojsonvt → vector-tiler}/tile.js +0 -0
- /package/dist/lib/{geojsonvt → vector-tiler}/transform.js +0 -0
- /package/dist/lib/{geojsonvt → vector-tiler}/wrap.js +0 -0
- /package/src/lib/{geojsonvt → vector-tiler}/LICENSE +0 -0
- /package/src/lib/{geojsonvt → vector-tiler}/simplify.ts +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ export type { TileJSON } from "./lib/parse-tilejson.js";
|
|
|
4
4
|
export type { TileJSONLoaderOptions } from "./tilejson-loader.js";
|
|
5
5
|
export { TileJSONLoader } from "./tilejson-loader.js";
|
|
6
6
|
export { MVTSource } from "./mvt-source.js";
|
|
7
|
-
export type {
|
|
8
|
-
export {
|
|
7
|
+
export type { TableTileSourceProps } from "./table-tile-source.js";
|
|
8
|
+
export { TableTileSource } from "./table-tile-source.js";
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAAC,gBAAgB,EAAC,wBAAqB;AACnD,OAAO,EAAC,SAAS,EAAE,eAAe,EAAC,wBAAqB;AAExD,YAAY,EAAC,QAAQ,EAAC,gCAA6B;AACnD,YAAY,EAAC,qBAAqB,EAAC,6BAA0B;AAC7D,OAAO,EAAC,cAAc,EAAC,6BAA0B;AAEjD,OAAO,EAAC,SAAS,EAAC,wBAAqB;AAIvC,YAAY,EAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAAC,gBAAgB,EAAC,wBAAqB;AACnD,OAAO,EAAC,SAAS,EAAE,eAAe,EAAC,wBAAqB;AAExD,YAAY,EAAC,QAAQ,EAAC,gCAA6B;AACnD,YAAY,EAAC,qBAAqB,EAAC,6BAA0B;AAC7D,OAAO,EAAC,cAAc,EAAC,6BAA0B;AAEjD,OAAO,EAAC,SAAS,EAAC,wBAAqB;AAIvC,YAAY,EAAC,oBAAoB,EAAC,+BAA4B;AAC9D,OAAO,EAAC,eAAe,EAAC,+BAA4B"}
|
package/dist/index.js
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
export { MVTLoader, MVTWorkerLoader } from "./mvt-loader.js";
|
|
5
5
|
export { TileJSONLoader } from "./tilejson-loader.js";
|
|
6
6
|
export { MVTSource } from "./mvt-source.js";
|
|
7
|
-
export {
|
|
7
|
+
export { TableTileSource } from "./table-tile-source.js";
|
package/dist/lib/parse-mvt.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { MVTLoaderOptions } from "../mvt-loader.js";
|
|
|
8
8
|
* @param options
|
|
9
9
|
* @returns A GeoJSON geometry object or a binary representation
|
|
10
10
|
*/
|
|
11
|
-
export declare function parseMVT(arrayBuffer: ArrayBuffer, options?: MVTLoaderOptions): GeoJSONTable | Feature<import("geojson").Geometry, import("geojson").GeoJsonProperties>[] |
|
|
11
|
+
export declare function parseMVT(arrayBuffer: ArrayBuffer, options?: MVTLoaderOptions): BinaryFeatureCollection | GeoJSONTable | Feature<import("geojson").Geometry, import("geojson").GeoJsonProperties>[] | {
|
|
12
12
|
shape: string;
|
|
13
13
|
data: BinaryFeatureCollection;
|
|
14
14
|
};
|
package/dist/lib/parse-mvt.js
CHANGED
|
@@ -116,9 +116,7 @@ function checkOptions(options) {
|
|
|
116
116
|
* @returns decoded feature
|
|
117
117
|
*/
|
|
118
118
|
function getDecodedFeature(feature, options, layerName) {
|
|
119
|
-
const decodedFeature = feature.
|
|
120
|
-
// @ts-expect-error What is going on here?
|
|
121
|
-
options.coordinates === 'wgs84' ? options.tileIndex : transformToLocalCoordinates);
|
|
119
|
+
const decodedFeature = feature.toGeoJSONFeature(options.coordinates || 'local', options.tileIndex);
|
|
122
120
|
// Add layer name to GeoJSON properties
|
|
123
121
|
if (options.layerProperty) {
|
|
124
122
|
decodedFeature.properties ||= {};
|
|
@@ -132,36 +130,10 @@ function getDecodedFeature(feature, options, layerName) {
|
|
|
132
130
|
* @returns decoded binary feature
|
|
133
131
|
*/
|
|
134
132
|
function getDecodedFeatureBinary(feature, options, layerName) {
|
|
135
|
-
const decodedFeature = feature.
|
|
136
|
-
// @ts-expect-error
|
|
137
|
-
options.coordinates === 'wgs84' ? options.tileIndex : transformToLocalCoordinatesBinary);
|
|
133
|
+
const decodedFeature = feature.toBinaryFeature(options.coordinates || 'local', options.tileIndex);
|
|
138
134
|
// Add layer name to GeoJSON properties
|
|
139
135
|
if (options.layerProperty && decodedFeature.properties) {
|
|
140
136
|
decodedFeature.properties[options.layerProperty] = layerName;
|
|
141
137
|
}
|
|
142
138
|
return decodedFeature;
|
|
143
139
|
}
|
|
144
|
-
/**
|
|
145
|
-
* @param line
|
|
146
|
-
* @param feature
|
|
147
|
-
*/
|
|
148
|
-
function transformToLocalCoordinates(line, feature) {
|
|
149
|
-
// This function transforms local coordinates in a
|
|
150
|
-
// [0 - bufferSize, this.extent + bufferSize] range to a
|
|
151
|
-
// [0 - (bufferSize / this.extent), 1 + (bufferSize / this.extent)] range.
|
|
152
|
-
// The resulting extent would be 1.
|
|
153
|
-
const { extent } = feature;
|
|
154
|
-
for (let i = 0; i < line.length; i++) {
|
|
155
|
-
const p = line[i];
|
|
156
|
-
p[0] /= extent;
|
|
157
|
-
p[1] /= extent;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
function transformToLocalCoordinatesBinary(data, feature) {
|
|
161
|
-
// For the binary code path, the feature data is just
|
|
162
|
-
// one big flat array, so we just divide each value
|
|
163
|
-
const { extent } = feature;
|
|
164
|
-
for (let i = 0, il = data.length; i < il; ++i) {
|
|
165
|
-
data[i] /= extent;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
@@ -9,10 +9,6 @@ export type TileJSON = {
|
|
|
9
9
|
version?: string;
|
|
10
10
|
tileFormat?: string;
|
|
11
11
|
tilesetType?: string;
|
|
12
|
-
/** Generating application. Tippecanoe adds this. */
|
|
13
|
-
generator?: string;
|
|
14
|
-
/** Generating application options. Tippecanoe adds this. */
|
|
15
|
-
generatorOptions?: string;
|
|
16
12
|
/** Tile indexing scheme */
|
|
17
13
|
scheme?: 'xyz' | 'tms';
|
|
18
14
|
/** Sharded URLs */
|
|
@@ -27,6 +23,10 @@ export type TileJSON = {
|
|
|
27
23
|
htmlAttribution?: string;
|
|
28
24
|
htmlLegend?: string;
|
|
29
25
|
layers?: TileJSONLayer[];
|
|
26
|
+
/** Generating application. Tippecanoe adds this. */
|
|
27
|
+
generator?: string;
|
|
28
|
+
/** Generating application options. Tippecanoe adds this. */
|
|
29
|
+
generatorOptions?: string;
|
|
30
30
|
/** Any nested JSON metadata */
|
|
31
31
|
metaJson?: any | null;
|
|
32
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-tilejson.d.ts","sourceRoot":"","sources":["../../src/lib/parse-tilejson.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,eAAe,GAAG;IAC5B,wFAAwF;IACxF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,yEAAyE;AACzE,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,
|
|
1
|
+
{"version":3,"file":"parse-tilejson.d.ts","sourceRoot":"","sources":["../../src/lib/parse-tilejson.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,eAAe,GAAG;IAC5B,wFAAwF;IACxF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,yE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,MAAM,CAAC;IAC1B,uEAAuE;IAEvE,OAAO;IACP,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,aAAa,EAAE,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IAIrB,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,2DAA2D;IAC3D,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC;CACpB,CAAC;AA+CF;;;;;GAKG;AAEH,wBAAgB,aAAa,CAAC,YAAY,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,GAAG,QAAQ,GAAG,IAAI,CAiE1F"}
|
|
@@ -5,16 +5,53 @@ import { FlatIndexedGeometry, FlatPolygon } from '@loaders.gl/schema';
|
|
|
5
5
|
* @returns sum
|
|
6
6
|
*/
|
|
7
7
|
export declare function signedArea(ring: number[][]): number;
|
|
8
|
+
/**
|
|
9
|
+
* This function projects local coordinates in a
|
|
10
|
+
* [0 - bufferSize, this.extent + bufferSize] range to a
|
|
11
|
+
* [0 - (bufferSize / this.extent), 1 + (bufferSize / this.extent)] range.
|
|
12
|
+
* The resulting extent would be 1.
|
|
13
|
+
* @param line
|
|
14
|
+
* @param feature
|
|
15
|
+
*/
|
|
16
|
+
export declare function convertToLocalCoordinates(coordinates: number[] | number[][] | number[][][] | number[][][][], extent: number): void;
|
|
17
|
+
/**
|
|
18
|
+
* For the binary code path, the feature data is just
|
|
19
|
+
* one big flat array, so we just divide each value
|
|
20
|
+
* @param data
|
|
21
|
+
* @param feature
|
|
22
|
+
*/
|
|
23
|
+
export declare function convertToLocalCoordinatesFlat(data: number[], extent: number): void;
|
|
8
24
|
/**
|
|
9
25
|
* Projects local tile coordinates to lngLat in place.
|
|
10
26
|
* @param points
|
|
11
27
|
* @param tileIndex
|
|
12
28
|
*/
|
|
13
|
-
export declare function
|
|
29
|
+
export declare function projectToLngLat(line: number[] | number[][] | number[][][], tileIndex: {
|
|
14
30
|
x: number;
|
|
15
31
|
y: number;
|
|
16
32
|
z: number;
|
|
17
33
|
}, extent: number): void;
|
|
34
|
+
/**
|
|
35
|
+
* Projects local tile coordinates to lngLat in place.
|
|
36
|
+
* @param points
|
|
37
|
+
* @param tileIndex
|
|
38
|
+
export function projectTileCoordinatesToLngLat(
|
|
39
|
+
points: number[][],
|
|
40
|
+
tileIndex: {x: number; y: number; z: number},
|
|
41
|
+
extent: number
|
|
42
|
+
): void {
|
|
43
|
+
const {x, y, z} = tileIndex;
|
|
44
|
+
const size = extent * Math.pow(2, z);
|
|
45
|
+
const x0 = extent * x;
|
|
46
|
+
const y0 = extent * y;
|
|
47
|
+
|
|
48
|
+
for (const p of points) {
|
|
49
|
+
p[0] = ((p[0] + x0) * 360) / size - 180;
|
|
50
|
+
const y2 = 180 - ((p[1] + y0) * 360) / size;
|
|
51
|
+
p[1] = (360 / Math.PI) * Math.atan(Math.exp((y2 * Math.PI) / 180)) - 90;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
*/
|
|
18
55
|
/**
|
|
19
56
|
*
|
|
20
57
|
* @param data
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/geometry-utils.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,mBAAmB,EAAE,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAEpE;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,UAQ1C;AAED;;;;GAIG;AACH,wBAAgB,
|
|
1
|
+
{"version":3,"file":"geometry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AI,EAAE,mBAAmB,GAAG,WAAW,CA4DxE"}
|
|
@@ -16,22 +16,81 @@ export function signedArea(ring) {
|
|
|
16
16
|
}
|
|
17
17
|
return sum;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* This function projects local coordinates in a
|
|
21
|
+
* [0 - bufferSize, this.extent + bufferSize] range to a
|
|
22
|
+
* [0 - (bufferSize / this.extent), 1 + (bufferSize / this.extent)] range.
|
|
23
|
+
* The resulting extent would be 1.
|
|
24
|
+
* @param line
|
|
25
|
+
* @param feature
|
|
26
|
+
*/
|
|
27
|
+
export function convertToLocalCoordinates(coordinates, extent) {
|
|
28
|
+
if (Array.isArray(coordinates[0])) {
|
|
29
|
+
for (const subcoords of coordinates) {
|
|
30
|
+
convertToLocalCoordinates(subcoords, extent);
|
|
31
|
+
}
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
// Just a point
|
|
35
|
+
const p = coordinates;
|
|
36
|
+
p[0] /= extent;
|
|
37
|
+
p[1] /= extent;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* For the binary code path, the feature data is just
|
|
41
|
+
* one big flat array, so we just divide each value
|
|
42
|
+
* @param data
|
|
43
|
+
* @param feature
|
|
44
|
+
*/
|
|
45
|
+
export function convertToLocalCoordinatesFlat(data, extent) {
|
|
46
|
+
for (let i = 0, il = data.length; i < il; ++i) {
|
|
47
|
+
data[i] /= extent;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
19
50
|
/**
|
|
20
51
|
* Projects local tile coordinates to lngLat in place.
|
|
21
52
|
* @param points
|
|
22
53
|
* @param tileIndex
|
|
23
54
|
*/
|
|
24
|
-
export function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
55
|
+
export function projectToLngLat(line, tileIndex, extent) {
|
|
56
|
+
if (typeof line[0][0] !== 'number') {
|
|
57
|
+
for (const point of line) {
|
|
58
|
+
// @ts-expect-error
|
|
59
|
+
projectToLngLat(point, tileIndex, extent);
|
|
60
|
+
}
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const size = extent * Math.pow(2, tileIndex.z);
|
|
64
|
+
const x0 = extent * tileIndex.x;
|
|
65
|
+
const y0 = extent * tileIndex.y;
|
|
66
|
+
for (let j = 0; j < line.length; j++) {
|
|
67
|
+
const p = line[j];
|
|
30
68
|
p[0] = ((p[0] + x0) * 360) / size - 180;
|
|
31
69
|
const y2 = 180 - ((p[1] + y0) * 360) / size;
|
|
32
70
|
p[1] = (360 / Math.PI) * Math.atan(Math.exp((y2 * Math.PI) / 180)) - 90;
|
|
33
71
|
}
|
|
34
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Projects local tile coordinates to lngLat in place.
|
|
75
|
+
* @param points
|
|
76
|
+
* @param tileIndex
|
|
77
|
+
export function projectTileCoordinatesToLngLat(
|
|
78
|
+
points: number[][],
|
|
79
|
+
tileIndex: {x: number; y: number; z: number},
|
|
80
|
+
extent: number
|
|
81
|
+
): void {
|
|
82
|
+
const {x, y, z} = tileIndex;
|
|
83
|
+
const size = extent * Math.pow(2, z);
|
|
84
|
+
const x0 = extent * x;
|
|
85
|
+
const y0 = extent * y;
|
|
86
|
+
|
|
87
|
+
for (const p of points) {
|
|
88
|
+
p[0] = ((p[0] + x0) * 360) / size - 180;
|
|
89
|
+
const y2 = 180 - ((p[1] + y0) * 360) / size;
|
|
90
|
+
p[1] = (360 / Math.PI) * Math.atan(Math.exp((y2 * Math.PI) / 180)) - 90;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
*/
|
|
35
94
|
/**
|
|
36
95
|
*
|
|
37
96
|
* @param data
|
|
@@ -15,32 +15,29 @@ export declare class VectorTileFeature {
|
|
|
15
15
|
_geometryInfo: GeojsonGeometryInfo;
|
|
16
16
|
static types: Readonly<string[]>;
|
|
17
17
|
constructor(pbf: Protobuf, end: number, extent: any, keys: string[], values: (string | number | boolean | null)[], geometryInfo?: GeojsonGeometryInfo);
|
|
18
|
-
|
|
18
|
+
toGeoJSONFeature(coordinates: 'wgs84' | 'local', tileIndex?: {
|
|
19
19
|
x: number;
|
|
20
20
|
y: number;
|
|
21
21
|
z: number;
|
|
22
|
-
}
|
|
23
|
-
extent: any;
|
|
24
|
-
}) => void)): Feature;
|
|
22
|
+
}): Feature;
|
|
25
23
|
/**
|
|
26
24
|
*
|
|
27
25
|
* @param options
|
|
28
26
|
* @returns
|
|
29
27
|
*/
|
|
30
|
-
|
|
28
|
+
toBinaryFeature(coordinates: 'wgs84' | 'local', tileIndex?: {
|
|
31
29
|
x: number;
|
|
32
30
|
y: number;
|
|
33
31
|
z: number;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
}) => void)): FlatFeature;
|
|
32
|
+
}): FlatFeature;
|
|
33
|
+
/** Read a bounding box from the feature */
|
|
37
34
|
bbox(): number[];
|
|
38
35
|
/**
|
|
39
36
|
*
|
|
40
37
|
* @param transform
|
|
41
38
|
* @returns result
|
|
42
39
|
*/
|
|
43
|
-
_toBinaryCoordinates(transform:
|
|
40
|
+
_toBinaryCoordinates(geom: FlatIndexedGeometry, transform: (data: number[], extent: number) => void): {
|
|
44
41
|
type: "Feature";
|
|
45
42
|
geometry: import("@loaders.gl/schema").FlatGeometry;
|
|
46
43
|
id?: string | number | undefined;
|
|
@@ -48,6 +45,28 @@ export declare class VectorTileFeature {
|
|
|
48
45
|
bbox?: import("geojson").BBox | undefined;
|
|
49
46
|
};
|
|
50
47
|
loadGeometry(): number[][][];
|
|
48
|
+
/**
|
|
49
|
+
* Expands the protobuf data to an intermediate Flat GeoJSON
|
|
50
|
+
* data format, which maps closely to the binary data buffers.
|
|
51
|
+
* It is similar to GeoJSON, but rather than storing the coordinates
|
|
52
|
+
* in multidimensional arrays, we have a 1D `data` with all the
|
|
53
|
+
* coordinates, and then index into this using the `indices`
|
|
54
|
+
* parameter, e.g.
|
|
55
|
+
*
|
|
56
|
+
* geometry: {
|
|
57
|
+
* type: 'Point', data: [1,2], indices: [0]
|
|
58
|
+
* }
|
|
59
|
+
* geometry: {
|
|
60
|
+
* type: 'LineString', data: [1,2,3,4,...], indices: [0]
|
|
61
|
+
* }
|
|
62
|
+
* geometry: {
|
|
63
|
+
* type: 'Polygon', data: [1,2,3,4,...], indices: [[0, 2]]
|
|
64
|
+
* }
|
|
65
|
+
* Thus the indices member lets us look up the relevant range
|
|
66
|
+
* from the data array.
|
|
67
|
+
* The Multi* versions of the above types share the same data
|
|
68
|
+
* structure, just with multiple elements in the indices array
|
|
69
|
+
*/
|
|
51
70
|
loadFlatGeometry(): FlatIndexedGeometry;
|
|
52
71
|
}
|
|
53
72
|
//# sourceMappingURL=vector-tile-feature.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-tile-feature.d.ts","sourceRoot":"","sources":["../../../src/lib/vector-tile/vector-tile-feature.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAC,WAAW,EAAE,mBAAmB,EAAE,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AACzF,OAAO,QAAQ,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"vector-tile-feature.d.ts","sourceRoot":"","sources":["../../../src/lib/vector-tile/vector-tile-feature.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAC,WAAW,EAAE,mBAAmB,EAAE,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AACzF,OAAO,QAAQ,MAAM,KAAK,CAAC;AAK3B,qBAAa,iBAAiB;IAC5B,UAAU,EAAE;QAAC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;KAAC,CAAC;IAC5D,MAAM,EAAE,GAAG,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,GAAG,IAAI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gl
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright vis.gl contributors
|
|
4
|
-
import { classifyRings, classifyRingsFlat
|
|
4
|
+
import { classifyRings, classifyRingsFlat } from "../utils/geometry-utils.js";
|
|
5
|
+
import { projectToLngLat, projectToLngLatFlat } from "../utils/geometry-utils.js";
|
|
6
|
+
import { convertToLocalCoordinates, convertToLocalCoordinatesFlat } from "../utils/geometry-utils.js";
|
|
5
7
|
export class VectorTileFeature {
|
|
6
8
|
properties;
|
|
7
9
|
extent;
|
|
@@ -29,37 +31,30 @@ export class VectorTileFeature {
|
|
|
29
31
|
this._geometryInfo = geometryInfo;
|
|
30
32
|
pbf.readFields(readFeature, this, end);
|
|
31
33
|
}
|
|
32
|
-
|
|
34
|
+
toGeoJSONFeature(coordinates, tileIndex) {
|
|
33
35
|
const coords = this.loadGeometry();
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const x0 = this.extent * x;
|
|
40
|
-
const y0 = this.extent * y;
|
|
41
|
-
function project(line) {
|
|
42
|
-
for (let j = 0; j < line.length; j++) {
|
|
43
|
-
const p = line[j];
|
|
44
|
-
p[0] = ((p[0] + x0) * 360) / size - 180;
|
|
45
|
-
const y2 = 180 - ((p[1] + y0) * 360) / size;
|
|
46
|
-
p[1] = (360 / Math.PI) * Math.atan(Math.exp((y2 * Math.PI) / 180)) - 90;
|
|
47
|
-
}
|
|
36
|
+
switch (coordinates) {
|
|
37
|
+
case 'wgs84':
|
|
38
|
+
return _toGeoJSONFeature(this, coords, (line) => projectToLngLat(line, tileIndex, this.extent));
|
|
39
|
+
default:
|
|
40
|
+
return _toGeoJSONFeature(this, coords, convertToLocalCoordinates);
|
|
48
41
|
}
|
|
49
|
-
return _toGeoJSON(this, coords, project);
|
|
50
42
|
}
|
|
51
43
|
/**
|
|
52
44
|
*
|
|
53
45
|
* @param options
|
|
54
46
|
* @returns
|
|
55
47
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
toBinaryFeature(coordinates, tileIndex) {
|
|
49
|
+
const geom = this.loadFlatGeometry();
|
|
50
|
+
switch (coordinates) {
|
|
51
|
+
case 'wgs84':
|
|
52
|
+
return this._toBinaryCoordinates(geom, (coords) => projectToLngLatFlat(coords, tileIndex, this.extent));
|
|
53
|
+
default:
|
|
54
|
+
return this._toBinaryCoordinates(geom, convertToLocalCoordinatesFlat);
|
|
59
55
|
}
|
|
60
|
-
const tileIndex = options;
|
|
61
|
-
return this._toBinaryCoordinates((data) => projectToLngLatFlat(data, tileIndex, this.extent));
|
|
62
56
|
}
|
|
57
|
+
/** Read a bounding box from the feature */
|
|
63
58
|
// eslint-disable-next-line max-statements
|
|
64
59
|
bbox() {
|
|
65
60
|
const pbf = this._pbf;
|
|
@@ -104,31 +99,10 @@ export class VectorTileFeature {
|
|
|
104
99
|
* @param transform
|
|
105
100
|
* @returns result
|
|
106
101
|
*/
|
|
107
|
-
_toBinaryCoordinates(transform) {
|
|
108
|
-
// Expands the protobuf data to an intermediate Flat GeoJSON
|
|
109
|
-
// data format, which maps closely to the binary data buffers.
|
|
110
|
-
// It is similar to GeoJSON, but rather than storing the coordinates
|
|
111
|
-
// in multidimensional arrays, we have a 1D `data` with all the
|
|
112
|
-
// coordinates, and then index into this using the `indices`
|
|
113
|
-
// parameter, e.g.
|
|
114
|
-
//
|
|
115
|
-
// geometry: {
|
|
116
|
-
// type: 'Point', data: [1,2], indices: [0]
|
|
117
|
-
// }
|
|
118
|
-
// geometry: {
|
|
119
|
-
// type: 'LineString', data: [1,2,3,4,...], indices: [0]
|
|
120
|
-
// }
|
|
121
|
-
// geometry: {
|
|
122
|
-
// type: 'Polygon', data: [1,2,3,4,...], indices: [[0, 2]]
|
|
123
|
-
// }
|
|
124
|
-
// Thus the indices member lets us look up the relevant range
|
|
125
|
-
// from the data array.
|
|
126
|
-
// The Multi* versions of the above types share the same data
|
|
127
|
-
// structure, just with multiple elements in the indices array
|
|
128
|
-
const geom = this.loadFlatGeometry();
|
|
102
|
+
_toBinaryCoordinates(geom, transform) {
|
|
129
103
|
let geometry;
|
|
130
104
|
// Apply the supplied transformation to data
|
|
131
|
-
transform(geom.data, this);
|
|
105
|
+
transform(geom.data, this.extent);
|
|
132
106
|
const coordLength = 2;
|
|
133
107
|
// eslint-disable-next-line default-case
|
|
134
108
|
switch (this.type) {
|
|
@@ -210,6 +184,28 @@ export class VectorTileFeature {
|
|
|
210
184
|
lines.push(line);
|
|
211
185
|
return lines;
|
|
212
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* Expands the protobuf data to an intermediate Flat GeoJSON
|
|
189
|
+
* data format, which maps closely to the binary data buffers.
|
|
190
|
+
* It is similar to GeoJSON, but rather than storing the coordinates
|
|
191
|
+
* in multidimensional arrays, we have a 1D `data` with all the
|
|
192
|
+
* coordinates, and then index into this using the `indices`
|
|
193
|
+
* parameter, e.g.
|
|
194
|
+
*
|
|
195
|
+
* geometry: {
|
|
196
|
+
* type: 'Point', data: [1,2], indices: [0]
|
|
197
|
+
* }
|
|
198
|
+
* geometry: {
|
|
199
|
+
* type: 'LineString', data: [1,2,3,4,...], indices: [0]
|
|
200
|
+
* }
|
|
201
|
+
* geometry: {
|
|
202
|
+
* type: 'Polygon', data: [1,2,3,4,...], indices: [[0, 2]]
|
|
203
|
+
* }
|
|
204
|
+
* Thus the indices member lets us look up the relevant range
|
|
205
|
+
* from the data array.
|
|
206
|
+
* The Multi* versions of the above types share the same data
|
|
207
|
+
* structure, just with multiple elements in the indices array
|
|
208
|
+
*/
|
|
213
209
|
// eslint-disable-next-line complexity, max-statements
|
|
214
210
|
loadFlatGeometry() {
|
|
215
211
|
const pbf = this._pbf;
|
|
@@ -260,7 +256,7 @@ export class VectorTileFeature {
|
|
|
260
256
|
return { data, indices };
|
|
261
257
|
}
|
|
262
258
|
}
|
|
263
|
-
function
|
|
259
|
+
function _toGeoJSONFeature(vtFeature, coords, transform) {
|
|
264
260
|
let type = VectorTileFeature.types[vtFeature.type];
|
|
265
261
|
let i;
|
|
266
262
|
let j;
|
|
@@ -272,19 +268,19 @@ function _toGeoJSON(vtFeature, coords, transform) {
|
|
|
272
268
|
points[i] = coords[i][0];
|
|
273
269
|
}
|
|
274
270
|
coordinates = points;
|
|
275
|
-
transform(coordinates, vtFeature);
|
|
271
|
+
transform(coordinates, vtFeature.extent);
|
|
276
272
|
break;
|
|
277
273
|
case 2:
|
|
278
274
|
coordinates = coords;
|
|
279
275
|
for (i = 0; i < coordinates.length; i++) {
|
|
280
|
-
transform(coordinates[i], vtFeature);
|
|
276
|
+
transform(coordinates[i], vtFeature.extent);
|
|
281
277
|
}
|
|
282
278
|
break;
|
|
283
279
|
case 3:
|
|
284
280
|
coordinates = classifyRings(coords);
|
|
285
281
|
for (i = 0; i < coordinates.length; i++) {
|
|
286
282
|
for (j = 0; j < coordinates[i].length; j++) {
|
|
287
|
-
transform(coordinates[i][j], vtFeature);
|
|
283
|
+
transform(coordinates[i][j], vtFeature.extent);
|
|
288
284
|
}
|
|
289
285
|
}
|
|
290
286
|
break;
|
|
@@ -307,7 +303,8 @@ function _toGeoJSON(vtFeature, coords, transform) {
|
|
|
307
303
|
properties: vtFeature.properties
|
|
308
304
|
};
|
|
309
305
|
if (vtFeature.id !== null) {
|
|
310
|
-
result.
|
|
306
|
+
result.properties ||= {};
|
|
307
|
+
result.properties.id = vtFeature.id;
|
|
311
308
|
}
|
|
312
309
|
return result;
|
|
313
310
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TableTileFeature } from "./tile.js";
|
|
2
2
|
/**
|
|
3
3
|
* Clip features between two vertical or horizontal axis-parallel lines:
|
|
4
4
|
* | |
|
|
@@ -10,7 +10,7 @@ import type { GeoJSONTileFeature } from "./tile.js";
|
|
|
10
10
|
* @param axis: 0 for x, 1 for y
|
|
11
11
|
* @param minAll and maxAll: minimum and maximum coordinate value for all features
|
|
12
12
|
*/
|
|
13
|
-
export declare function clip(features:
|
|
13
|
+
export declare function clip(features: TableTileFeature[], scale: number, k1: number, k2: number, axis: any, minAll: number, maxAll: number, options: {
|
|
14
14
|
lineMetrics: boolean;
|
|
15
|
-
}):
|
|
15
|
+
}): TableTileFeature[] | null;
|
|
16
16
|
//# sourceMappingURL=clip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clip.d.ts","sourceRoot":"","sources":["../../../src/lib/vector-tiler/clip.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,gBAAgB,EAAC,kBAAe;AAK7C;;;;;;;;;;GAUG;AAEH,wBAAgB,IAAI,CAClB,QAAQ,EAAE,gBAAgB,EAAE,EAC5B,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,IAAI,KAAA,EACJ,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;IAAC,WAAW,EAAE,OAAO,CAAA;CAAC,GAC9B,gBAAgB,EAAE,GAAG,IAAI,CA4E3B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Feature, FeatureCollection } from '@loaders.gl/schema';
|
|
2
|
+
import type { TableTileFeature } from "./tile.js";
|
|
3
|
+
/**
|
|
4
|
+
* converts a GeoJSON feature into an intermediate projected JSON vector format
|
|
5
|
+
* with simplification data
|
|
6
|
+
*/
|
|
7
|
+
export declare function convert(data: Feature | FeatureCollection, options: any): TableTileFeature[];
|
|
8
|
+
export type ConvertFeatureOptions = {
|
|
9
|
+
/** max zoom to preserve detail on */
|
|
10
|
+
maxZoom?: number;
|
|
11
|
+
/** simplification tolerance (higher means simpler) */
|
|
12
|
+
tolerance?: number;
|
|
13
|
+
/** tile extent */
|
|
14
|
+
extent?: number;
|
|
15
|
+
/** whether to calculate line metrics */
|
|
16
|
+
lineMetrics?: boolean;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=convert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../../src/lib/vector-tiler/convert.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAC,OAAO,EAAE,iBAAiB,EAAC,MAAM,oBAAoB,CAAC;AACnE,OAAO,KAAK,EAAC,gBAAgB,EAAC,kBAAe;AAK7C;;;GAGG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,iBAAiB,EAAE,OAAO,KAAA,GAAG,gBAAgB,EAAE,CActF;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC"}
|
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license
|
|
5
5
|
import { simplify } from "./simplify.js";
|
|
6
6
|
import { createFeature } from "./feature.js";
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* converts a GeoJSON feature into an intermediate projected JSON vector format
|
|
9
|
+
* with simplification data
|
|
10
|
+
*/
|
|
8
11
|
export function convert(data, options) {
|
|
9
12
|
const features = [];
|
|
10
13
|
if (data.type === 'FeatureCollection') {
|
|
@@ -21,6 +24,10 @@ export function convert(data, options) {
|
|
|
21
24
|
}
|
|
22
25
|
return features;
|
|
23
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* converts a GeoJSON feature into an intermediate projected JSON vector format
|
|
29
|
+
* with simplification data
|
|
30
|
+
*/
|
|
24
31
|
function convertFeature(features, geojson, options, index) {
|
|
25
32
|
if (!geojson.geometry) {
|
|
26
33
|
return;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../../../src/lib/vector-tiler/feature.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,gBAAgB,EAAC,kBAAe;AAExC,wBAAgB,aAAa,CAAC,EAAE,KAAA,EAAE,IAAI,KAAA,EAAE,IAAI,KAAA,EAAE,IAAI,KAAA,GAAG,gBAAgB,CA8BpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simplify.d.ts","sourceRoot":"","sources":["../../../src/lib/vector-tiler/simplify.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAkCjG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type TableTileFeature = {
|
|
2
2
|
type: any;
|
|
3
3
|
geometry: any;
|
|
4
4
|
id?: string;
|
|
@@ -8,8 +8,8 @@ export type GeoJSONTileFeature = {
|
|
|
8
8
|
minY: number;
|
|
9
9
|
maxY: number;
|
|
10
10
|
};
|
|
11
|
-
export type
|
|
12
|
-
features:
|
|
11
|
+
export type TableTile = {
|
|
12
|
+
features: TableTileFeature[];
|
|
13
13
|
type?: number;
|
|
14
14
|
tags?: Record<string, string>;
|
|
15
15
|
x: number;
|
|
@@ -34,5 +34,5 @@ export type CreateTileOptions = {
|
|
|
34
34
|
/**
|
|
35
35
|
* Create a tile from features and tile index
|
|
36
36
|
*/
|
|
37
|
-
export declare function createTile(features: any[], z: any, tx: any, ty: any, options: CreateTileOptions):
|
|
37
|
+
export declare function createTile(features: any[], z: any, tx: any, ty: any, options: CreateTileOptions): TableTile;
|
|
38
38
|
//# sourceMappingURL=tile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tile.d.ts","sourceRoot":"","sources":["../../../src/lib/vector-tiler/tile.ts"],"names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
1
|
+
import type { TableTile } from "./tile.js";
|
|
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: TableTile, extent: number): TableTile;
|
|
7
|
+
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/lib/vector-tiler/transform.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,SAAS,EAAC,kBAAe;AAEtC;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAiCxE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TableTileFeature } from "./tile.js";
|
|
2
2
|
/**
|
|
3
3
|
* Options for wrap()
|
|
4
4
|
*/
|
|
@@ -13,5 +13,5 @@ export type WrapOptions = {
|
|
|
13
13
|
* @param options buffer and extent
|
|
14
14
|
* @returns
|
|
15
15
|
*/
|
|
16
|
-
export declare function wrap(features:
|
|
16
|
+
export declare function wrap(features: TableTileFeature[], options: WrapOptions): TableTileFeature[];
|
|
17
17
|
//# sourceMappingURL=wrap.d.ts.map
|