@loaders.gl/mvt 4.2.0-alpha.5 → 4.2.0-beta.1
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 +70 -18
- package/dist/dist.min.js +1 -1
- package/dist/helpers/binary-util-functions.d.ts +3 -3
- package/dist/helpers/binary-util-functions.d.ts.map +1 -1
- package/dist/helpers/binary-util-functions.js +3 -0
- package/dist/helpers/mapbox-util-functions.d.ts +1 -1
- package/dist/helpers/mapbox-util-functions.d.ts.map +1 -1
- package/dist/helpers/mapbox-util-functions.js +3 -0
- package/dist/index.cjs +64 -18
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/binary-vector-tile/vector-tile-feature.d.ts +1 -1
- package/dist/lib/binary-vector-tile/vector-tile-feature.d.ts.map +1 -1
- package/dist/lib/binary-vector-tile/vector-tile-feature.js +13 -2
- package/dist/lib/binary-vector-tile/vector-tile-layer.d.ts +5 -5
- package/dist/lib/binary-vector-tile/vector-tile-layer.d.ts.map +1 -1
- package/dist/lib/binary-vector-tile/vector-tile-layer.js +16 -5
- package/dist/lib/binary-vector-tile/vector-tile.d.ts +3 -3
- package/dist/lib/binary-vector-tile/vector-tile.d.ts.map +1 -1
- package/dist/lib/binary-vector-tile/vector-tile.js +7 -3
- package/dist/lib/geojson-tiler/clip.js +3 -0
- package/dist/lib/geojson-tiler/geojson-tiler.js +6 -5
- package/dist/lib/geojson-tiler/wrap.js +3 -0
- package/dist/lib/mapbox-vector-tile/vector-tile-feature.d.ts +1 -1
- package/dist/lib/mapbox-vector-tile/vector-tile-feature.d.ts.map +1 -1
- package/dist/lib/mapbox-vector-tile/vector-tile-feature.js +12 -1
- package/dist/lib/mapbox-vector-tile/vector-tile-layer.d.ts +2 -2
- package/dist/lib/mapbox-vector-tile/vector-tile-layer.d.ts.map +1 -1
- package/dist/lib/mapbox-vector-tile/vector-tile-layer.js +13 -4
- package/dist/lib/mapbox-vector-tile/vector-tile.d.ts +2 -2
- package/dist/lib/mapbox-vector-tile/vector-tile.d.ts.map +1 -1
- package/dist/lib/mapbox-vector-tile/vector-tile.js +6 -2
- package/dist/lib/parse-mvt.d.ts +2 -2
- package/dist/lib/parse-mvt.d.ts.map +1 -1
- package/dist/lib/parse-mvt.js +7 -4
- package/dist/lib/types.d.ts +0 -10
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/types.js +3 -0
- package/dist/mvt-loader.d.ts +63 -6
- package/dist/mvt-loader.d.ts.map +1 -1
- package/dist/mvt-loader.js +7 -9
- package/dist/mvt-source.js +8 -3
- package/dist/mvt-worker.js +50 -11
- package/dist/tilejson-loader.d.ts +2 -3
- package/dist/tilejson-loader.d.ts.map +1 -1
- package/dist/tilejson-loader.js +3 -1
- package/dist/workers/mvt-worker.js +3 -0
- package/package.json +6 -6
- package/src/helpers/binary-util-functions.ts +7 -3
- package/src/helpers/mapbox-util-functions.ts +5 -1
- package/src/index.ts +1 -1
- package/src/lib/binary-vector-tile/vector-tile-feature.ts +5 -1
- package/src/lib/binary-vector-tile/vector-tile-layer.ts +11 -7
- package/src/lib/binary-vector-tile/vector-tile.ts +13 -5
- package/src/lib/mapbox-vector-tile/vector-tile-feature.ts +5 -1
- package/src/lib/mapbox-vector-tile/vector-tile-layer.ts +6 -2
- package/src/lib/mapbox-vector-tile/vector-tile.ts +6 -2
- package/src/lib/parse-mvt.ts +13 -8
- package/src/lib/types.ts +3 -11
- package/src/mvt-loader.ts +35 -22
- package/src/tilejson-loader.ts +5 -2
- package/src/workers/mvt-worker.ts +4 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { MVTLoaderOptions } from "./
|
|
1
|
+
export type { MVTLoaderOptions } from "./mvt-loader.js";
|
|
2
2
|
export { MVTLoader, MVTWorkerLoader } from "./mvt-loader.js";
|
|
3
3
|
export type { TileJSON } from "./lib/parse-tilejson.js";
|
|
4
4
|
export type { TileJSONLoaderOptions } from "./tilejson-loader.js";
|
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,
|
|
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,mBAAmB,EAAC,6CAA0C;AAC3E,OAAO,EAAC,YAAY,EAAC,6CAA0C"}
|
|
@@ -4,7 +4,7 @@ import { classifyRings } from "../../helpers/binary-util-functions.js";
|
|
|
4
4
|
export declare const TEST_EXPORTS: {
|
|
5
5
|
classifyRings: typeof classifyRings;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export declare class BinaryVectorTileFeature {
|
|
8
8
|
properties: {
|
|
9
9
|
[x: string]: string | number | boolean | null;
|
|
10
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-tile-feature.d.ts","sourceRoot":"","sources":["../../../src/lib/binary-vector-tile/vector-tile-feature.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vector-tile-feature.d.ts","sourceRoot":"","sources":["../../../src/lib/binary-vector-tile/vector-tile-feature.ts"],"names":[],"mappings":"AAMA,OAAO,QAAQ,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAC,WAAW,EAAE,mBAAmB,EAAE,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AACzF,OAAO,EAAC,aAAa,EAAuB,+CAA4C;AAWxF,eAAO,MAAM,YAAY;;CAExB,CAAC;AAEF,qBAAa,uBAAuB;IAClC,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,CAAC;IAClB,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC;IAC9C,aAAa,EAAE,mBAAmB,CAAC;gBAIjC,GAAG,EAAE,QAAQ,EACb,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,GAAG,EACX,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,EAAE,EAC5C,YAAY,EAAE,mBAAmB;IAmBnC,YAAY,IAAI,mBAAmB;IAqDnC;;;;OAIG;IACH,oBAAoB,CAAC,SAAS,KAAA;;;;;;;IAuE9B,mBAAmB,CACjB,OAAO,EAAE;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE;QAAC,MAAM,EAAE,GAAG,CAAA;KAAC,KAAK,IAAI,CAAC,GAC9F,WAAW;CAWf"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright vis.gl contributors
|
|
2
4
|
import { classifyRings, project, readFeature } from "../../helpers/binary-util-functions.js";
|
|
3
5
|
// Reduce GC by reusing variables
|
|
4
6
|
let endPos;
|
|
@@ -11,7 +13,16 @@ let i;
|
|
|
11
13
|
export const TEST_EXPORTS = {
|
|
12
14
|
classifyRings
|
|
13
15
|
};
|
|
14
|
-
export
|
|
16
|
+
export class BinaryVectorTileFeature {
|
|
17
|
+
properties;
|
|
18
|
+
extent;
|
|
19
|
+
type;
|
|
20
|
+
id;
|
|
21
|
+
_pbf;
|
|
22
|
+
_geometry;
|
|
23
|
+
_keys;
|
|
24
|
+
_values;
|
|
25
|
+
_geometryInfo;
|
|
15
26
|
// eslint-disable-next-line max-params
|
|
16
27
|
constructor(pbf, end, extent, keys, values, geometryInfo) {
|
|
17
28
|
// Public
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BinaryVectorTileFeature } from "./vector-tile-feature.js";
|
|
2
2
|
import Protobuf from 'pbf';
|
|
3
3
|
import { GeojsonGeometryInfo } from '@loaders.gl/schema';
|
|
4
|
-
export
|
|
4
|
+
export declare class BinaryVectorTileLayer {
|
|
5
5
|
version: number;
|
|
6
6
|
name: string;
|
|
7
7
|
extent: number;
|
|
@@ -12,12 +12,12 @@ export default class VectorTileLayer {
|
|
|
12
12
|
_features: number[];
|
|
13
13
|
constructor(pbf: Protobuf, end: number);
|
|
14
14
|
/**
|
|
15
|
-
* return feature `i` from this layer as a `
|
|
15
|
+
* return feature `i` from this layer as a `BinaryVectorTileFeature`
|
|
16
16
|
*
|
|
17
17
|
* @param index
|
|
18
18
|
* @param geometryInfo
|
|
19
|
-
* @returns {
|
|
19
|
+
* @returns {BinaryVectorTileFeature}
|
|
20
20
|
*/
|
|
21
|
-
feature(i: number, geometryInfo: GeojsonGeometryInfo):
|
|
21
|
+
feature(i: number, geometryInfo: GeojsonGeometryInfo): BinaryVectorTileFeature;
|
|
22
22
|
}
|
|
23
23
|
//# sourceMappingURL=vector-tile-layer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-tile-layer.d.ts","sourceRoot":"","sources":["../../../src/lib/binary-vector-tile/vector-tile-layer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vector-tile-layer.d.ts","sourceRoot":"","sources":["../../../src/lib/binary-vector-tile/vector-tile-layer.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,uBAAuB,EAAC,iCAA8B;AAC9D,OAAO,QAAQ,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAC,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AAEvD,qBAAa,qBAAqB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC;IAC9C,SAAS,EAAE,MAAM,EAAE,CAAC;gBACR,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM;IAkBtC;;;;;;OAMG;IACH,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,mBAAmB,GAAG,uBAAuB;CAiB/E"}
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright vis.gl contributors
|
|
1
4
|
/* eslint-disable indent */
|
|
2
5
|
// This code is forked from https://github.com/mapbox/vector-tile-js under BSD 3-clause license.
|
|
3
|
-
import
|
|
4
|
-
export
|
|
6
|
+
import { BinaryVectorTileFeature } from "./vector-tile-feature.js";
|
|
7
|
+
export class BinaryVectorTileLayer {
|
|
8
|
+
version;
|
|
9
|
+
name;
|
|
10
|
+
extent;
|
|
11
|
+
length;
|
|
12
|
+
_pbf;
|
|
13
|
+
_keys;
|
|
14
|
+
_values;
|
|
15
|
+
_features;
|
|
5
16
|
constructor(pbf, end) {
|
|
6
17
|
// Public
|
|
7
18
|
this.version = 1;
|
|
@@ -17,11 +28,11 @@ export default class VectorTileLayer {
|
|
|
17
28
|
this.length = this._features.length;
|
|
18
29
|
}
|
|
19
30
|
/**
|
|
20
|
-
* return feature `i` from this layer as a `
|
|
31
|
+
* return feature `i` from this layer as a `BinaryVectorTileFeature`
|
|
21
32
|
*
|
|
22
33
|
* @param index
|
|
23
34
|
* @param geometryInfo
|
|
24
|
-
* @returns {
|
|
35
|
+
* @returns {BinaryVectorTileFeature}
|
|
25
36
|
*/
|
|
26
37
|
feature(i, geometryInfo) {
|
|
27
38
|
if (i < 0 || i >= this._features.length) {
|
|
@@ -29,7 +40,7 @@ export default class VectorTileLayer {
|
|
|
29
40
|
}
|
|
30
41
|
this._pbf.pos = this._features[i];
|
|
31
42
|
const end = this._pbf.readVarint() + this._pbf.pos;
|
|
32
|
-
return new
|
|
43
|
+
return new BinaryVectorTileFeature(this._pbf, end, this.extent, this._keys, this._values, geometryInfo);
|
|
33
44
|
}
|
|
34
45
|
}
|
|
35
46
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BinaryVectorTileLayer } from "./vector-tile-layer.js";
|
|
2
2
|
import Protobuf from 'pbf';
|
|
3
|
-
export
|
|
3
|
+
export declare class BinaryVectorTile {
|
|
4
4
|
layers: {
|
|
5
|
-
[x: string]:
|
|
5
|
+
[x: string]: BinaryVectorTileLayer;
|
|
6
6
|
};
|
|
7
7
|
constructor(pbf: Protobuf, end?: number);
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-tile.d.ts","sourceRoot":"","sources":["../../../src/lib/binary-vector-tile/vector-tile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vector-tile.d.ts","sourceRoot":"","sources":["../../../src/lib/binary-vector-tile/vector-tile.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,qBAAqB,EAAC,+BAA4B;AAC1D,OAAO,QAAQ,MAAM,KAAK,CAAC;AAE3B,qBAAa,gBAAgB;IAC3B,MAAM,EAAE;QAAC,CAAC,CAAC,EAAE,MAAM,GAAG,qBAAqB,CAAA;KAAC,CAAC;gBACjC,GAAG,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,MAAM;CAGxC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright vis.gl contributors
|
|
1
4
|
// This code is forked from https://github.com/mapbox/vector-tile-js under BSD 3-clause license.
|
|
2
|
-
import
|
|
3
|
-
export
|
|
5
|
+
import { BinaryVectorTileLayer } from "./vector-tile-layer.js";
|
|
6
|
+
export class BinaryVectorTile {
|
|
7
|
+
layers;
|
|
4
8
|
constructor(pbf, end) {
|
|
5
9
|
this.layers = pbf.readFields(readTile, {}, end);
|
|
6
10
|
}
|
|
@@ -14,7 +18,7 @@ export default class VectorTile {
|
|
|
14
18
|
function readTile(tag, layers, pbf) {
|
|
15
19
|
if (tag === 3) {
|
|
16
20
|
if (pbf) {
|
|
17
|
-
const layer = new
|
|
21
|
+
const layer = new BinaryVectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
|
|
18
22
|
if (layer.length && layers) {
|
|
19
23
|
layers[layer.name] = layer;
|
|
20
24
|
}
|
|
@@ -21,12 +21,13 @@ const DEFAULT_OPTIONS = {
|
|
|
21
21
|
debug: 0 // logging level (0, 1 or 2)
|
|
22
22
|
};
|
|
23
23
|
export class GeoJSONTiler {
|
|
24
|
+
options;
|
|
25
|
+
// tiles and tileCoords are part of the public API
|
|
26
|
+
tiles = {};
|
|
27
|
+
tileCoords = [];
|
|
28
|
+
stats = {};
|
|
29
|
+
total = 0;
|
|
24
30
|
constructor(data, options) {
|
|
25
|
-
// tiles and tileCoords are part of the public API
|
|
26
|
-
this.tiles = {};
|
|
27
|
-
this.tileCoords = [];
|
|
28
|
-
this.stats = {};
|
|
29
|
-
this.total = 0;
|
|
30
31
|
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
31
32
|
options = this.options;
|
|
32
33
|
const debug = options.debug;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-tile-feature.d.ts","sourceRoot":"","sources":["../../../src/lib/mapbox-vector-tile/vector-tile-feature.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vector-tile-feature.d.ts","sourceRoot":"","sources":["../../../src/lib/mapbox-vector-tile/vector-tile-feature.ts"],"names":[],"mappings":"AAKA,OAAO,QAAQ,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAC,oBAAoB,EAAE,iBAAiB,EAAC,oBAAiB;AAGjE,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,CAAC;IAClB,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC;IAC9C,MAAM,KAAK,KAAK,aAEf;gBAGC,GAAG,EAAE,QAAQ,EACb,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,GAAG,EACX,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,EAAE;IAkB9C,YAAY,IAAI,iBAAiB;IA+CjC,IAAI;IAsCJ,UAAU,CAAC,SAAS,KAAA;IAuDpB,SAAS,CACP,OAAO,EAAE;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE;QAAC,MAAM,EAAE,GAAG,CAAA;KAAC,KAAK,IAAI,CAAC,GAC9F,oBAAoB;CAmBxB"}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright vis.gl contributors
|
|
1
4
|
import { readFeature, classifyRings } from "../../helpers/mapbox-util-functions.js";
|
|
2
|
-
export
|
|
5
|
+
export class VectorTileFeature {
|
|
6
|
+
properties;
|
|
7
|
+
extent;
|
|
8
|
+
type;
|
|
9
|
+
id;
|
|
10
|
+
_pbf;
|
|
11
|
+
_geometry;
|
|
12
|
+
_keys;
|
|
13
|
+
_values;
|
|
3
14
|
static get types() {
|
|
4
15
|
return ['Unknown', 'Point', 'LineString', 'Polygon'];
|
|
5
16
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Protobuf from 'pbf';
|
|
2
|
-
import VectorTileFeature from "./vector-tile-feature.js";
|
|
3
|
-
export
|
|
2
|
+
import { VectorTileFeature } from "./vector-tile-feature.js";
|
|
3
|
+
export declare class VectorTileLayer {
|
|
4
4
|
version: number;
|
|
5
5
|
name: string;
|
|
6
6
|
extent: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-tile-layer.d.ts","sourceRoot":"","sources":["../../../src/lib/mapbox-vector-tile/vector-tile-layer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vector-tile-layer.d.ts","sourceRoot":"","sources":["../../../src/lib/mapbox-vector-tile/vector-tile-layer.ts"],"names":[],"mappings":"AAOA,OAAO,QAAQ,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAC,iBAAiB,EAAC,iCAA8B;AAExD,qBAAa,eAAe;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC;IAC9C,SAAS,EAAE,MAAM,EAAE,CAAC;gBACR,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM;IAkBtC;;;;OAIG;IAEH,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,iBAAiB;CAUtC"}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
//
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright vis.gl contributors
|
|
4
|
+
import { VectorTileFeature } from "./vector-tile-feature.js";
|
|
5
|
+
export class VectorTileLayer {
|
|
6
|
+
version;
|
|
7
|
+
name;
|
|
8
|
+
extent;
|
|
9
|
+
length;
|
|
10
|
+
_pbf;
|
|
11
|
+
_keys;
|
|
12
|
+
_values;
|
|
13
|
+
_features;
|
|
5
14
|
constructor(pbf, end) {
|
|
6
15
|
// Public
|
|
7
16
|
this.version = 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-tile.d.ts","sourceRoot":"","sources":["../../../src/lib/mapbox-vector-tile/vector-tile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vector-tile.d.ts","sourceRoot":"","sources":["../../../src/lib/mapbox-vector-tile/vector-tile.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,eAAe,EAAC,+BAA4B;AACpD,OAAO,QAAQ,MAAM,KAAK,CAAC;AAE3B,qBAAa,UAAU;IACrB,MAAM,EAAE;QAAC,CAAC,CAAC,EAAE,MAAM,GAAG,eAAe,CAAA;KAAC,CAAC;gBAC3B,GAAG,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,MAAM;CAGxC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright vis.gl contributors
|
|
1
4
|
// This code is forked from https://github.com/mapbox/vector-tile-js under BSD 3-clause license.
|
|
2
|
-
import VectorTileLayer from "./vector-tile-layer.js";
|
|
3
|
-
export
|
|
5
|
+
import { VectorTileLayer } from "./vector-tile-layer.js";
|
|
6
|
+
export class VectorTile {
|
|
7
|
+
layers;
|
|
4
8
|
constructor(pbf, end) {
|
|
5
9
|
this.layers = pbf.readFields(readTile, {}, end);
|
|
6
10
|
}
|
package/dist/lib/parse-mvt.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Feature, BinaryFeatureCollection, GeoJSONTable } from '@loaders.gl/schema';
|
|
2
|
-
import type { MVTLoaderOptions } from "../
|
|
2
|
+
import type { MVTLoaderOptions } from "../mvt-loader.js";
|
|
3
3
|
/**
|
|
4
4
|
* Parse MVT arrayBuffer and return GeoJSON.
|
|
5
5
|
*
|
|
@@ -7,7 +7,7 @@ import type { MVTLoaderOptions } from "../lib/types.js";
|
|
|
7
7
|
* @param options
|
|
8
8
|
* @returns A GeoJSON geometry object or a binary representation
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export declare function parseMVT(arrayBuffer: ArrayBuffer, options?: MVTLoaderOptions): BinaryFeatureCollection | GeoJSONTable | Feature<import("geojson").Geometry, import("geojson").GeoJsonProperties>[] | {
|
|
11
11
|
shape: string;
|
|
12
12
|
data: BinaryFeatureCollection;
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-mvt.d.ts","sourceRoot":"","sources":["../../src/lib/parse-mvt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parse-mvt.d.ts","sourceRoot":"","sources":["../../src/lib/parse-mvt.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,OAAO,EAEP,uBAAuB,EACvB,YAAY,EACb,MAAM,oBAAoB,CAAC;AAI5B,OAAO,KAAK,EAAC,gBAAgB,EAAC,yBAAsB;AAOpD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,gBAAgB;;;EAyB5E"}
|
package/dist/lib/parse-mvt.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright vis.gl contributors
|
|
1
4
|
import { flatGeojsonToBinary } from '@loaders.gl/gis';
|
|
2
5
|
import Protobuf from 'pbf';
|
|
3
|
-
import VectorTile from "./mapbox-vector-tile/vector-tile.js";
|
|
4
|
-
import BinaryVectorTile from "./binary-vector-tile/vector-tile.js";
|
|
6
|
+
import { VectorTile } from "./mapbox-vector-tile/vector-tile.js";
|
|
7
|
+
import { BinaryVectorTile } from "./binary-vector-tile/vector-tile.js";
|
|
5
8
|
/**
|
|
6
9
|
* Parse MVT arrayBuffer and return GeoJSON.
|
|
7
10
|
*
|
|
@@ -9,7 +12,7 @@ import BinaryVectorTile from "./binary-vector-tile/vector-tile.js";
|
|
|
9
12
|
* @param options
|
|
10
13
|
* @returns A GeoJSON geometry object or a binary representation
|
|
11
14
|
*/
|
|
12
|
-
export
|
|
15
|
+
export function parseMVT(arrayBuffer, options) {
|
|
13
16
|
const mvtOptions = normalizeOptions(options);
|
|
14
17
|
const shape = options?.gis?.format || options?.mvt?.shape || options?.shape;
|
|
15
18
|
switch (shape) {
|
|
@@ -132,7 +135,7 @@ function getDecodedFeature(feature, options, layerName) {
|
|
|
132
135
|
*/
|
|
133
136
|
function getDecodedFeatureBinary(feature, options, layerName) {
|
|
134
137
|
const decodedFeature = feature.toBinaryCoordinates(
|
|
135
|
-
// @ts-expect-error
|
|
138
|
+
// @ts-expect-error
|
|
136
139
|
options.coordinates === 'wgs84' ? options.tileIndex : transformToLocalCoordinatesBinary);
|
|
137
140
|
// Add layer name to GeoJSON properties
|
|
138
141
|
if (options.layerProperty && decodedFeature.properties) {
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { LoaderOptions } from '@loaders.gl/loader-utils';
|
|
2
1
|
/** For local coordinates, the tileIndex is not required */
|
|
3
2
|
type MVTLocalCoordinatesOptions = {
|
|
4
3
|
/**
|
|
@@ -54,14 +53,5 @@ export type MVTMapboxCoordinates = {
|
|
|
54
53
|
};
|
|
55
54
|
id?: number;
|
|
56
55
|
};
|
|
57
|
-
export type MVTLoaderOptions = LoaderOptions & {
|
|
58
|
-
mvt?: MVTOptions;
|
|
59
|
-
gis?: {
|
|
60
|
-
/** `true`: parser will output the data in binary format. Equivalent to loading the data as GeoJSON and then applying geojsonToBinary */
|
|
61
|
-
binary?: boolean;
|
|
62
|
-
/** @deprecated. Use options.mvt.shape */
|
|
63
|
-
format?: 'geojson-table' | 'columnar-table' | 'geojson' | 'binary' | 'binary-geometry';
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
56
|
export {};
|
|
67
57
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAIA,2DAA2D;AAC3D,KAAK,0BAA0B,GAAG;IAChC;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,IAAI,CAAC;CACjB,CAAC;AAEF,sDAAsD;AACtD,KAAK,0BAA0B,GAAG;IAChC;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;OAGG;IACH,SAAS,CAAC,EAAE;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,0BAA0B,GAAG,0BAA0B,CAAC,GAAG;IACnF,KAAK,CAAC,EAAE,eAAe,GAAG,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,iBAAiB,CAAC;IACtF;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAEhC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,GAAG,EAAE,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE;QACR,IAAI,EAAE,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"}
|
package/dist/lib/types.js
CHANGED
package/dist/mvt-loader.d.ts
CHANGED
|
@@ -1,13 +1,70 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
1
|
+
import type { LoaderOptions } from '@loaders.gl/loader-utils';
|
|
2
|
+
import { parseMVT } from "./lib/parse-mvt.js";
|
|
3
|
+
import type { MVTOptions } from "./lib/types.js";
|
|
4
|
+
export type MVTLoaderOptions = LoaderOptions & {
|
|
5
|
+
mvt?: MVTOptions & {
|
|
6
|
+
/** Override the URL to the worker bundle (by default loads from unpkg.com) */
|
|
7
|
+
workerUrl?: string;
|
|
8
|
+
};
|
|
9
|
+
gis?: {
|
|
10
|
+
/** `true`: parser will output the data in binary format. Equivalent to loading the data as GeoJSON and then applying geojsonToBinary */
|
|
11
|
+
binary?: boolean;
|
|
12
|
+
/** @deprecated. Use options.mvt.shape */
|
|
13
|
+
format?: 'geojson-table' | 'columnar-table' | 'geojson' | 'binary' | 'binary-geometry';
|
|
14
|
+
};
|
|
15
|
+
};
|
|
3
16
|
/**
|
|
4
17
|
* Worker loader for the Mapbox Vector Tile format
|
|
5
18
|
*/
|
|
6
|
-
export declare const MVTWorkerLoader:
|
|
7
|
-
|
|
19
|
+
export declare const MVTWorkerLoader: {
|
|
20
|
+
readonly dataType: any;
|
|
21
|
+
readonly batchType: never;
|
|
22
|
+
readonly name: "Mapbox Vector Tile";
|
|
23
|
+
readonly id: "mvt";
|
|
24
|
+
readonly module: "mvt";
|
|
25
|
+
readonly version: any;
|
|
26
|
+
readonly extensions: ["mvt", "pbf"];
|
|
27
|
+
readonly mimeTypes: ["application/vnd.mapbox-vector-tile", "application/x-protobuf"];
|
|
28
|
+
readonly worker: true;
|
|
29
|
+
readonly category: "geometry";
|
|
30
|
+
readonly options: {
|
|
31
|
+
readonly mvt: {
|
|
32
|
+
readonly shape: "geojson";
|
|
33
|
+
readonly coordinates: "local";
|
|
34
|
+
readonly layerProperty: "layerName";
|
|
35
|
+
readonly layers: undefined;
|
|
36
|
+
readonly tileIndex: null;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
8
40
|
/**
|
|
9
41
|
* Loader for the Mapbox Vector Tile format
|
|
10
42
|
*/
|
|
11
|
-
export declare const MVTLoader:
|
|
12
|
-
|
|
43
|
+
export declare const MVTLoader: {
|
|
44
|
+
readonly parse: (arrayBuffer: ArrayBuffer, options?: MVTLoaderOptions) => Promise<import("@loaders.gl/schema").BinaryFeatureCollection | import("@loaders.gl/schema").GeoJSONTable | import("geojson").Feature<import("geojson").Geometry, import("geojson").GeoJsonProperties>[] | {
|
|
45
|
+
shape: string;
|
|
46
|
+
data: import("@loaders.gl/schema").BinaryFeatureCollection;
|
|
47
|
+
}>;
|
|
48
|
+
readonly parseSync: typeof parseMVT;
|
|
49
|
+
readonly binary: true;
|
|
50
|
+
readonly dataType: any;
|
|
51
|
+
readonly batchType: never;
|
|
52
|
+
readonly name: "Mapbox Vector Tile";
|
|
53
|
+
readonly id: "mvt";
|
|
54
|
+
readonly module: "mvt";
|
|
55
|
+
readonly version: any;
|
|
56
|
+
readonly extensions: ["mvt", "pbf"];
|
|
57
|
+
readonly mimeTypes: ["application/vnd.mapbox-vector-tile", "application/x-protobuf"];
|
|
58
|
+
readonly worker: true;
|
|
59
|
+
readonly category: "geometry";
|
|
60
|
+
readonly options: {
|
|
61
|
+
readonly mvt: {
|
|
62
|
+
readonly shape: "geojson";
|
|
63
|
+
readonly coordinates: "local";
|
|
64
|
+
readonly layerProperty: "layerName";
|
|
65
|
+
readonly layers: undefined;
|
|
66
|
+
readonly tileIndex: null;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
13
70
|
//# sourceMappingURL=mvt-loader.d.ts.map
|
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":"
|
|
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;AACtF,OAAO,EAAC,QAAQ,EAAC,2BAAwB;AACzC,OAAO,KAAK,EAAC,UAAU,EAAC,uBAAoB;AAM5C,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE,UAAU,GAAG;QACjB,8EAA8E;QAC9E,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,wIAAwI;QACxI,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,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;;;;;;;;;;;;;;;;;;;;;;;;;CAOtD,CAAC"}
|
package/dist/mvt-loader.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
// Geometry,
|
|
6
|
-
// GeoJsonProperties
|
|
7
|
-
// } from '@loaders.gl/schema';
|
|
8
|
-
import parseMVT from "./lib/parse-mvt.js";
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright vis.gl contributors
|
|
4
|
+
import { parseMVT } from "./lib/parse-mvt.js";
|
|
9
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
10
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
11
|
-
const VERSION = typeof "4.2.0-alpha.
|
|
7
|
+
const VERSION = typeof "4.2.0-alpha.6" !== 'undefined' ? "4.2.0-alpha.6" : 'latest';
|
|
12
8
|
/**
|
|
13
9
|
* Worker loader for the Mapbox Vector Tile format
|
|
14
10
|
*/
|
|
15
11
|
export const MVTWorkerLoader = {
|
|
12
|
+
dataType: null,
|
|
13
|
+
batchType: null,
|
|
16
14
|
name: 'Mapbox Vector Tile',
|
|
17
15
|
id: 'mvt',
|
|
18
16
|
module: 'mvt',
|
package/dist/mvt-source.js
CHANGED
|
@@ -12,11 +12,16 @@ import { MVTLoader, TileJSONLoader } from '@loaders.gl/mvt';
|
|
|
12
12
|
* @note Can be either a raster or vector tile source depending on the contents of the PMTiles file.
|
|
13
13
|
*/
|
|
14
14
|
export class MVTSource extends DataSource {
|
|
15
|
+
props;
|
|
16
|
+
url;
|
|
17
|
+
metadataUrl = null;
|
|
18
|
+
data;
|
|
19
|
+
schema = 'tms';
|
|
20
|
+
metadata;
|
|
21
|
+
extension;
|
|
22
|
+
mimeType = null;
|
|
15
23
|
constructor(props) {
|
|
16
24
|
super(props);
|
|
17
|
-
this.metadataUrl = null;
|
|
18
|
-
this.schema = 'tms';
|
|
19
|
-
this.mimeType = null;
|
|
20
25
|
this.props = props;
|
|
21
26
|
this.url = resolvePath(props.url);
|
|
22
27
|
this.metadataUrl =
|