@loaders.gl/mvt 4.2.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 +1784 -847
- package/dist/dist.min.js +1 -1
- package/dist/index.cjs +713 -640
- 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 +2 -1
- package/dist/lib/parse-mvt.d.ts.map +1 -1
- package/dist/lib/parse-mvt.js +15 -45
- package/dist/lib/parse-tilejson.d.ts +4 -4
- package/dist/lib/parse-tilejson.d.ts.map +1 -1
- package/dist/lib/types.d.ts +1 -39
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/utils/geometry-utils.d.ts +83 -0
- package/dist/lib/utils/geometry-utils.d.ts.map +1 -0
- package/dist/lib/utils/geometry-utils.js +206 -0
- package/dist/lib/vector-tile/vector-tile-feature.d.ts +72 -0
- package/dist/lib/vector-tile/vector-tile-feature.d.ts.map +1 -0
- package/dist/lib/vector-tile/vector-tile-feature.js +342 -0
- package/dist/lib/{mapbox-vector-tile → vector-tile}/vector-tile-layer.d.ts +10 -1
- package/dist/lib/vector-tile/vector-tile-layer.d.ts.map +1 -0
- package/dist/lib/{mapbox-vector-tile → vector-tile}/vector-tile-layer.js +16 -1
- package/dist/lib/vector-tile/vector-tile.d.ts.map +1 -0
- package/dist/lib/{geojson-tiler → 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/{geojson-tiler → 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/{geojson-tiler → 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/{geojson-tiler → vector-tiler}/wrap.d.ts +2 -2
- package/dist/lib/vector-tiler/wrap.d.ts.map +1 -0
- package/dist/mvt-loader.d.ts +19 -8
- package/dist/mvt-loader.d.ts.map +1 -1
- package/dist/mvt-loader.js +3 -2
- package/dist/mvt-source.d.ts +4 -4
- package/dist/mvt-source.d.ts.map +1 -1
- package/dist/mvt-source.js +7 -7
- package/dist/mvt-worker.js +1244 -762
- package/dist/table-tile-source.d.ts +118 -0
- package/dist/table-tile-source.d.ts.map +1 -0
- package/dist/table-tile-source.js +370 -0
- package/dist/tilejson-loader.js +1 -1
- package/package.json +7 -6
- package/src/index.ts +3 -3
- package/src/lib/parse-mvt.ts +28 -66
- package/src/lib/parse-tilejson.ts +5 -5
- package/src/lib/types.ts +1 -39
- package/src/lib/utils/geometry-utils.ts +234 -0
- package/src/lib/vector-tile/vector-tile-feature.ts +416 -0
- package/src/lib/{mapbox-vector-tile → vector-tile}/vector-tile-layer.ts +28 -2
- package/src/lib/{geojson-tiler → vector-tiler}/clip.ts +4 -4
- package/src/lib/{geojson-tiler → vector-tiler}/convert.ts +19 -9
- package/src/lib/{geojson-tiler → vector-tiler}/feature.ts +3 -3
- package/src/lib/{geojson-tiler → vector-tiler}/tile.ts +10 -10
- package/src/lib/{geojson-tiler → vector-tiler}/transform.ts +2 -2
- package/src/lib/{geojson-tiler → vector-tiler}/wrap.ts +5 -5
- package/src/mvt-loader.ts +14 -6
- package/src/mvt-source.ts +9 -10
- package/src/table-tile-source.ts +508 -0
- package/dist/helpers/binary-util-functions.d.ts +0 -35
- package/dist/helpers/binary-util-functions.d.ts.map +0 -1
- package/dist/helpers/binary-util-functions.js +0 -114
- package/dist/helpers/mapbox-util-functions.d.ts +0 -29
- package/dist/helpers/mapbox-util-functions.d.ts.map +0 -1
- package/dist/helpers/mapbox-util-functions.js +0 -78
- package/dist/lib/binary-vector-tile/vector-tile-feature.d.ts +0 -41
- package/dist/lib/binary-vector-tile/vector-tile-feature.d.ts.map +0 -1
- package/dist/lib/binary-vector-tile/vector-tile-feature.js +0 -163
- package/dist/lib/binary-vector-tile/vector-tile-layer.d.ts +0 -23
- package/dist/lib/binary-vector-tile/vector-tile-layer.d.ts.map +0 -1
- package/dist/lib/binary-vector-tile/vector-tile-layer.js +0 -96
- package/dist/lib/binary-vector-tile/vector-tile.d.ts +0 -9
- package/dist/lib/binary-vector-tile/vector-tile.d.ts.map +0 -1
- package/dist/lib/binary-vector-tile/vector-tile.js +0 -27
- package/dist/lib/geojson-tiler/clip.d.ts.map +0 -1
- package/dist/lib/geojson-tiler/convert.d.ts +0 -10
- package/dist/lib/geojson-tiler/convert.d.ts.map +0 -1
- package/dist/lib/geojson-tiler/feature.d.ts +0 -3
- package/dist/lib/geojson-tiler/feature.d.ts.map +0 -1
- package/dist/lib/geojson-tiler/geojson-tiler.d.ts +0 -44
- package/dist/lib/geojson-tiler/geojson-tiler.d.ts.map +0 -1
- package/dist/lib/geojson-tiler/geojson-tiler.js +0 -209
- package/dist/lib/geojson-tiler/simplify.d.ts.map +0 -1
- package/dist/lib/geojson-tiler/tile.d.ts.map +0 -1
- package/dist/lib/geojson-tiler/transform.d.ts +0 -7
- package/dist/lib/geojson-tiler/transform.d.ts.map +0 -1
- package/dist/lib/geojson-tiler/wrap.d.ts.map +0 -1
- package/dist/lib/mapbox-vector-tile/vector-tile-feature.d.ts +0 -27
- package/dist/lib/mapbox-vector-tile/vector-tile-feature.d.ts.map +0 -1
- package/dist/lib/mapbox-vector-tile/vector-tile-feature.js +0 -178
- package/dist/lib/mapbox-vector-tile/vector-tile-layer.d.ts.map +0 -1
- package/dist/lib/mapbox-vector-tile/vector-tile.d.ts.map +0 -1
- package/src/helpers/binary-util-functions.ts +0 -125
- package/src/helpers/mapbox-util-functions.ts +0 -82
- package/src/lib/binary-vector-tile/vector-tile-feature.ts +0 -203
- package/src/lib/binary-vector-tile/vector-tile-layer.ts +0 -113
- package/src/lib/binary-vector-tile/vector-tile.ts +0 -36
- package/src/lib/geojson-tiler/geojson-tiler.ts +0 -283
- package/src/lib/mapbox-vector-tile/LICENSE.txt +0 -31
- package/src/lib/mapbox-vector-tile/vector-tile-feature.ts +0 -207
- /package/dist/lib/{mapbox-vector-tile → vector-tile}/vector-tile.d.ts +0 -0
- /package/dist/lib/{mapbox-vector-tile → vector-tile}/vector-tile.js +0 -0
- /package/dist/lib/{geojson-tiler → vector-tiler}/clip.js +0 -0
- /package/dist/lib/{geojson-tiler → vector-tiler}/feature.js +0 -0
- /package/dist/lib/{geojson-tiler → vector-tiler}/simplify.d.ts +0 -0
- /package/dist/lib/{geojson-tiler → vector-tiler}/simplify.js +0 -0
- /package/dist/lib/{geojson-tiler → vector-tiler}/tile.js +0 -0
- /package/dist/lib/{geojson-tiler → vector-tiler}/transform.js +0 -0
- /package/dist/lib/{geojson-tiler → vector-tiler}/wrap.js +0 -0
- /package/src/lib/{binary-vector-tile → vector-tile}/LICENSE.txt +0 -0
- /package/src/lib/{mapbox-vector-tile → vector-tile}/vector-tile.ts +0 -0
- /package/src/lib/{geojson-tiler → vector-tiler}/LICENSE +0 -0
- /package/src/lib/{geojson-tiler → vector-tiler}/simplify.ts +0 -0
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
// loaders.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright vis.gl contributors
|
|
4
|
-
import { getPolygonSignedArea } from '@math.gl/polygon';
|
|
5
|
-
/**
|
|
6
|
-
* Classifies an array of rings into polygons with outer rings and holes
|
|
7
|
-
* The function also detects holes which have zero area and
|
|
8
|
-
* removes them. In doing so it modifies the input
|
|
9
|
-
* `geom.data` array to remove the unneeded data
|
|
10
|
-
*
|
|
11
|
-
* @param geometry
|
|
12
|
-
* @returns object
|
|
13
|
-
*/
|
|
14
|
-
// eslint-disable-next-line max-statements
|
|
15
|
-
export function classifyRings(geom) {
|
|
16
|
-
const len = geom.indices.length;
|
|
17
|
-
const type = 'Polygon';
|
|
18
|
-
if (len <= 1) {
|
|
19
|
-
return {
|
|
20
|
-
type,
|
|
21
|
-
data: geom.data,
|
|
22
|
-
areas: [[getPolygonSignedArea(geom.data)]],
|
|
23
|
-
indices: [geom.indices]
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
const areas = [];
|
|
27
|
-
const polygons = [];
|
|
28
|
-
let ringAreas = [];
|
|
29
|
-
let polygon = [];
|
|
30
|
-
let ccw;
|
|
31
|
-
let offset = 0;
|
|
32
|
-
for (let endIndex, i = 0, startIndex; i < len; i++) {
|
|
33
|
-
startIndex = geom.indices[i] - offset;
|
|
34
|
-
endIndex = geom.indices[i + 1] - offset || geom.data.length;
|
|
35
|
-
const shape = geom.data.slice(startIndex, endIndex);
|
|
36
|
-
const area = getPolygonSignedArea(shape);
|
|
37
|
-
if (area === 0) {
|
|
38
|
-
// This polygon has no area, so remove it from the shape
|
|
39
|
-
// Remove the section from the data array
|
|
40
|
-
const before = geom.data.slice(0, startIndex);
|
|
41
|
-
const after = geom.data.slice(endIndex);
|
|
42
|
-
geom.data = before.concat(after);
|
|
43
|
-
// Need to offset any remaining indices as we have
|
|
44
|
-
// modified the data buffer
|
|
45
|
-
offset += endIndex - startIndex;
|
|
46
|
-
// Do not add this index to the output and process next shape
|
|
47
|
-
continue; // eslint-disable-line no-continue
|
|
48
|
-
}
|
|
49
|
-
if (ccw === undefined)
|
|
50
|
-
ccw = area < 0;
|
|
51
|
-
if (ccw === area < 0) {
|
|
52
|
-
if (polygon.length) {
|
|
53
|
-
areas.push(ringAreas);
|
|
54
|
-
polygons.push(polygon);
|
|
55
|
-
}
|
|
56
|
-
polygon = [startIndex];
|
|
57
|
-
ringAreas = [area];
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
ringAreas.push(area);
|
|
61
|
-
polygon.push(startIndex);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (ringAreas)
|
|
65
|
-
areas.push(ringAreas);
|
|
66
|
-
if (polygon.length)
|
|
67
|
-
polygons.push(polygon);
|
|
68
|
-
return { type, areas, indices: polygons, data: geom.data };
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
* @param data
|
|
73
|
-
* @param x0
|
|
74
|
-
* @param y0
|
|
75
|
-
* @param size
|
|
76
|
-
*/
|
|
77
|
-
export function project(data, x0, y0, size) {
|
|
78
|
-
for (let j = 0, jl = data.length; j < jl; j += 2) {
|
|
79
|
-
data[j] = ((data[j] + x0) * 360) / size - 180;
|
|
80
|
-
const y2 = 180 - ((data[j + 1] + y0) * 360) / size;
|
|
81
|
-
data[j + 1] = (360 / Math.PI) * Math.atan(Math.exp((y2 * Math.PI) / 180)) - 90;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* All code below is unchanged from the original Mapbox implemenation
|
|
86
|
-
*
|
|
87
|
-
* @param tag
|
|
88
|
-
* @param feature
|
|
89
|
-
* @param pbf
|
|
90
|
-
*/
|
|
91
|
-
export function readFeature(tag, feature, pbf) {
|
|
92
|
-
if (feature && pbf) {
|
|
93
|
-
if (tag === 1)
|
|
94
|
-
feature.id = pbf.readVarint();
|
|
95
|
-
else if (tag === 2)
|
|
96
|
-
readTag(pbf, feature);
|
|
97
|
-
else if (tag === 3)
|
|
98
|
-
feature.type = pbf.readVarint();
|
|
99
|
-
else if (tag === 4)
|
|
100
|
-
feature._geometry = pbf.pos;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* @param pbf
|
|
105
|
-
* @param feature
|
|
106
|
-
*/
|
|
107
|
-
export function readTag(pbf, feature) {
|
|
108
|
-
const end = pbf.readVarint() + pbf.pos;
|
|
109
|
-
while (pbf.pos < end) {
|
|
110
|
-
const key = feature._keys[pbf.readVarint()];
|
|
111
|
-
const value = feature._values[pbf.readVarint()];
|
|
112
|
-
feature.properties[key] = value;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import Protobuf from 'pbf';
|
|
2
|
-
import { MVTMapboxGeometry } from "../lib/types.js";
|
|
3
|
-
import { VectorTileFeature } from "../lib/mapbox-vector-tile/vector-tile-feature.js";
|
|
4
|
-
/**
|
|
5
|
-
* Classifies an array of rings into polygons with outer rings and holes
|
|
6
|
-
* @param rings
|
|
7
|
-
* @returns polygons
|
|
8
|
-
*/
|
|
9
|
-
export declare function classifyRings(rings: MVTMapboxGeometry): MVTMapboxGeometry[] | number[][][];
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
* @param ring
|
|
13
|
-
* @returns sum
|
|
14
|
-
*/
|
|
15
|
-
export declare function signedArea(ring: number[][]): number;
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
* @param tag
|
|
19
|
-
* @param feature
|
|
20
|
-
* @param pbf
|
|
21
|
-
*/
|
|
22
|
-
export declare function readFeature(tag: number, feature?: VectorTileFeature, pbf?: Protobuf): void;
|
|
23
|
-
/**
|
|
24
|
-
*
|
|
25
|
-
* @param pbf
|
|
26
|
-
* @param feature
|
|
27
|
-
*/
|
|
28
|
-
export declare function readTag(pbf: Protobuf, feature: VectorTileFeature): void;
|
|
29
|
-
//# sourceMappingURL=mapbox-util-functions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mapbox-util-functions.d.ts","sourceRoot":"","sources":["../../src/helpers/mapbox-util-functions.ts"],"names":[],"mappings":"AAIA,OAAO,QAAQ,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAC,iBAAiB,EAAC,wBAAqB;AAC/C,OAAO,EAAC,iBAAiB,EAAC,yDAAsD;AAEhF;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,iBAAiB,sCAuBrD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,UAQ1C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,EAAE,GAAG,CAAC,EAAE,QAAQ,GAAG,IAAI,CAO1F;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAQvE"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
// loaders.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright vis.gl contributors
|
|
4
|
-
/**
|
|
5
|
-
* Classifies an array of rings into polygons with outer rings and holes
|
|
6
|
-
* @param rings
|
|
7
|
-
* @returns polygons
|
|
8
|
-
*/
|
|
9
|
-
export function classifyRings(rings) {
|
|
10
|
-
const len = rings.length;
|
|
11
|
-
if (len <= 1)
|
|
12
|
-
return [rings];
|
|
13
|
-
const polygons = [];
|
|
14
|
-
let polygon;
|
|
15
|
-
let ccw;
|
|
16
|
-
for (let i = 0; i < len; i++) {
|
|
17
|
-
const area = signedArea(rings[i]);
|
|
18
|
-
if (area === 0)
|
|
19
|
-
continue; // eslint-disable-line no-continue
|
|
20
|
-
if (ccw === undefined)
|
|
21
|
-
ccw = area < 0;
|
|
22
|
-
if (ccw === area < 0) {
|
|
23
|
-
if (polygon)
|
|
24
|
-
polygons.push(polygon);
|
|
25
|
-
polygon = [rings[i]];
|
|
26
|
-
}
|
|
27
|
-
else if (polygon)
|
|
28
|
-
polygon.push(rings[i]);
|
|
29
|
-
}
|
|
30
|
-
if (polygon)
|
|
31
|
-
polygons.push(polygon);
|
|
32
|
-
return polygons;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
*
|
|
36
|
-
* @param ring
|
|
37
|
-
* @returns sum
|
|
38
|
-
*/
|
|
39
|
-
export function signedArea(ring) {
|
|
40
|
-
let sum = 0;
|
|
41
|
-
for (let i = 0, j = ring.length - 1, p1, p2; i < ring.length; j = i++) {
|
|
42
|
-
p1 = ring[i];
|
|
43
|
-
p2 = ring[j];
|
|
44
|
-
sum += (p2[0] - p1[0]) * (p1[1] + p2[1]);
|
|
45
|
-
}
|
|
46
|
-
return sum;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
-
* @param tag
|
|
51
|
-
* @param feature
|
|
52
|
-
* @param pbf
|
|
53
|
-
*/
|
|
54
|
-
export function readFeature(tag, feature, pbf) {
|
|
55
|
-
if (feature && pbf) {
|
|
56
|
-
if (tag === 1)
|
|
57
|
-
feature.id = pbf.readVarint();
|
|
58
|
-
else if (tag === 2)
|
|
59
|
-
readTag(pbf, feature);
|
|
60
|
-
else if (tag === 3)
|
|
61
|
-
feature.type = pbf.readVarint();
|
|
62
|
-
else if (tag === 4)
|
|
63
|
-
feature._geometry = pbf.pos;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
*
|
|
68
|
-
* @param pbf
|
|
69
|
-
* @param feature
|
|
70
|
-
*/
|
|
71
|
-
export function readTag(pbf, feature) {
|
|
72
|
-
const end = pbf.readVarint() + pbf.pos;
|
|
73
|
-
while (pbf.pos < end) {
|
|
74
|
-
const key = feature._keys[pbf.readVarint()];
|
|
75
|
-
const value = feature._values[pbf.readVarint()];
|
|
76
|
-
feature.properties[key] = value;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import Protobuf from 'pbf';
|
|
2
|
-
import { FlatFeature, FlatIndexedGeometry, GeojsonGeometryInfo } from '@loaders.gl/schema';
|
|
3
|
-
import { classifyRings } from "../../helpers/binary-util-functions.js";
|
|
4
|
-
export declare const TEST_EXPORTS: {
|
|
5
|
-
classifyRings: typeof classifyRings;
|
|
6
|
-
};
|
|
7
|
-
export declare class BinaryVectorTileFeature {
|
|
8
|
-
properties: {
|
|
9
|
-
[x: string]: string | number | boolean | null;
|
|
10
|
-
};
|
|
11
|
-
extent: any;
|
|
12
|
-
type: number;
|
|
13
|
-
id: number | null;
|
|
14
|
-
_pbf: Protobuf;
|
|
15
|
-
_geometry: number;
|
|
16
|
-
_keys: string[];
|
|
17
|
-
_values: (string | number | boolean | null)[];
|
|
18
|
-
_geometryInfo: GeojsonGeometryInfo;
|
|
19
|
-
constructor(pbf: Protobuf, end: number, extent: any, keys: string[], values: (string | number | boolean | null)[], geometryInfo: GeojsonGeometryInfo);
|
|
20
|
-
loadGeometry(): FlatIndexedGeometry;
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
* @param transform
|
|
24
|
-
* @returns result
|
|
25
|
-
*/
|
|
26
|
-
_toBinaryCoordinates(transform: any): {
|
|
27
|
-
type: "Feature";
|
|
28
|
-
geometry: import("@loaders.gl/schema").FlatGeometry;
|
|
29
|
-
id?: string | number | undefined;
|
|
30
|
-
properties: import("geojson").GeoJsonProperties;
|
|
31
|
-
bbox?: import("geojson").BBox | undefined;
|
|
32
|
-
};
|
|
33
|
-
toBinaryCoordinates(options: {
|
|
34
|
-
x: number;
|
|
35
|
-
y: number;
|
|
36
|
-
z: number;
|
|
37
|
-
} | ((data: number[], feature: {
|
|
38
|
-
extent: any;
|
|
39
|
-
}) => void)): FlatFeature;
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=vector-tile-feature.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,163 +0,0 @@
|
|
|
1
|
-
// loaders.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright vis.gl contributors
|
|
4
|
-
import { classifyRings, project, readFeature } from "../../helpers/binary-util-functions.js";
|
|
5
|
-
// Reduce GC by reusing variables
|
|
6
|
-
let endPos;
|
|
7
|
-
let cmd;
|
|
8
|
-
let cmdLen;
|
|
9
|
-
let length;
|
|
10
|
-
let x;
|
|
11
|
-
let y;
|
|
12
|
-
let i;
|
|
13
|
-
export const TEST_EXPORTS = {
|
|
14
|
-
classifyRings
|
|
15
|
-
};
|
|
16
|
-
export class BinaryVectorTileFeature {
|
|
17
|
-
properties;
|
|
18
|
-
extent;
|
|
19
|
-
type;
|
|
20
|
-
id;
|
|
21
|
-
_pbf;
|
|
22
|
-
_geometry;
|
|
23
|
-
_keys;
|
|
24
|
-
_values;
|
|
25
|
-
_geometryInfo;
|
|
26
|
-
// eslint-disable-next-line max-params
|
|
27
|
-
constructor(pbf, end, extent, keys, values, geometryInfo) {
|
|
28
|
-
// Public
|
|
29
|
-
this.properties = {};
|
|
30
|
-
this.extent = extent;
|
|
31
|
-
this.type = 0;
|
|
32
|
-
this.id = null;
|
|
33
|
-
// Private
|
|
34
|
-
this._pbf = pbf;
|
|
35
|
-
this._geometry = -1;
|
|
36
|
-
this._keys = keys;
|
|
37
|
-
this._values = values;
|
|
38
|
-
this._geometryInfo = geometryInfo;
|
|
39
|
-
pbf.readFields(readFeature, this, end);
|
|
40
|
-
}
|
|
41
|
-
// eslint-disable-next-line complexity, max-statements
|
|
42
|
-
loadGeometry() {
|
|
43
|
-
const pbf = this._pbf;
|
|
44
|
-
pbf.pos = this._geometry;
|
|
45
|
-
endPos = pbf.readVarint() + pbf.pos;
|
|
46
|
-
cmd = 1;
|
|
47
|
-
length = 0;
|
|
48
|
-
x = 0;
|
|
49
|
-
y = 0;
|
|
50
|
-
i = 0;
|
|
51
|
-
// Note: I attempted to replace the `data` array with a
|
|
52
|
-
// Float32Array, but performance was worse, both using
|
|
53
|
-
// `set()` and direct index access. Also, we cannot
|
|
54
|
-
// know how large the buffer should be, so it would
|
|
55
|
-
// increase memory usage
|
|
56
|
-
const indices = []; // Indices where geometries start
|
|
57
|
-
const data = []; // Flat array of coordinate data
|
|
58
|
-
while (pbf.pos < endPos) {
|
|
59
|
-
if (length <= 0) {
|
|
60
|
-
cmdLen = pbf.readVarint();
|
|
61
|
-
cmd = cmdLen & 0x7;
|
|
62
|
-
length = cmdLen >> 3;
|
|
63
|
-
}
|
|
64
|
-
length--;
|
|
65
|
-
if (cmd === 1 || cmd === 2) {
|
|
66
|
-
x += pbf.readSVarint();
|
|
67
|
-
y += pbf.readSVarint();
|
|
68
|
-
if (cmd === 1) {
|
|
69
|
-
// New line
|
|
70
|
-
indices.push(i);
|
|
71
|
-
}
|
|
72
|
-
data.push(x, y);
|
|
73
|
-
i += 2;
|
|
74
|
-
}
|
|
75
|
-
else if (cmd === 7) {
|
|
76
|
-
// Workaround for https://github.com/mapbox/mapnik-vector-tile/issues/90
|
|
77
|
-
if (i > 0) {
|
|
78
|
-
const start = indices[indices.length - 1]; // start index of polygon
|
|
79
|
-
data.push(data[start], data[start + 1]); // closePolygon
|
|
80
|
-
i += 2;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
throw new Error(`unknown command ${cmd}`);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return { data, indices };
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
*
|
|
91
|
-
* @param transform
|
|
92
|
-
* @returns result
|
|
93
|
-
*/
|
|
94
|
-
_toBinaryCoordinates(transform) {
|
|
95
|
-
// Expands the protobuf data to an intermediate Flat GeoJSON
|
|
96
|
-
// data format, which maps closely to the binary data buffers.
|
|
97
|
-
// It is similar to GeoJSON, but rather than storing the coordinates
|
|
98
|
-
// in multidimensional arrays, we have a 1D `data` with all the
|
|
99
|
-
// coordinates, and then index into this using the `indices`
|
|
100
|
-
// parameter, e.g.
|
|
101
|
-
//
|
|
102
|
-
// geometry: {
|
|
103
|
-
// type: 'Point', data: [1,2], indices: [0]
|
|
104
|
-
// }
|
|
105
|
-
// geometry: {
|
|
106
|
-
// type: 'LineString', data: [1,2,3,4,...], indices: [0]
|
|
107
|
-
// }
|
|
108
|
-
// geometry: {
|
|
109
|
-
// type: 'Polygon', data: [1,2,3,4,...], indices: [[0, 2]]
|
|
110
|
-
// }
|
|
111
|
-
// Thus the indices member lets us look up the relevant range
|
|
112
|
-
// from the data array.
|
|
113
|
-
// The Multi* versions of the above types share the same data
|
|
114
|
-
// structure, just with multiple elements in the indices array
|
|
115
|
-
const geom = this.loadGeometry();
|
|
116
|
-
let geometry;
|
|
117
|
-
// Apply the supplied transformation to data
|
|
118
|
-
transform(geom.data, this);
|
|
119
|
-
const coordLength = 2;
|
|
120
|
-
// eslint-disable-next-line default-case
|
|
121
|
-
switch (this.type) {
|
|
122
|
-
case 1: // Point
|
|
123
|
-
this._geometryInfo.pointFeaturesCount++;
|
|
124
|
-
this._geometryInfo.pointPositionsCount += geom.indices.length;
|
|
125
|
-
geometry = { type: 'Point', ...geom };
|
|
126
|
-
break;
|
|
127
|
-
case 2: // LineString
|
|
128
|
-
this._geometryInfo.lineFeaturesCount++;
|
|
129
|
-
this._geometryInfo.linePathsCount += geom.indices.length;
|
|
130
|
-
this._geometryInfo.linePositionsCount += geom.data.length / coordLength;
|
|
131
|
-
geometry = { type: 'LineString', ...geom };
|
|
132
|
-
break;
|
|
133
|
-
case 3: // Polygon
|
|
134
|
-
geometry = classifyRings(geom);
|
|
135
|
-
// Unlike Point & LineString geom.indices is a 2D array, thanks
|
|
136
|
-
// to the classifyRings method
|
|
137
|
-
this._geometryInfo.polygonFeaturesCount++;
|
|
138
|
-
this._geometryInfo.polygonObjectsCount += geometry.indices.length;
|
|
139
|
-
for (const indices of geometry.indices) {
|
|
140
|
-
this._geometryInfo.polygonRingsCount += indices.length;
|
|
141
|
-
}
|
|
142
|
-
this._geometryInfo.polygonPositionsCount += geometry.data.length / coordLength;
|
|
143
|
-
break;
|
|
144
|
-
default:
|
|
145
|
-
throw new Error(`Invalid geometry type: ${this.type}`);
|
|
146
|
-
}
|
|
147
|
-
const result = { type: 'Feature', geometry, properties: this.properties };
|
|
148
|
-
if (this.id !== null) {
|
|
149
|
-
result.id = this.id;
|
|
150
|
-
}
|
|
151
|
-
return result;
|
|
152
|
-
}
|
|
153
|
-
toBinaryCoordinates(options) {
|
|
154
|
-
if (typeof options === 'function') {
|
|
155
|
-
return this._toBinaryCoordinates(options);
|
|
156
|
-
}
|
|
157
|
-
const { x, y, z } = options;
|
|
158
|
-
const size = this.extent * Math.pow(2, z);
|
|
159
|
-
const x0 = this.extent * x;
|
|
160
|
-
const y0 = this.extent * y;
|
|
161
|
-
return this._toBinaryCoordinates((data) => project(data, x0, y0, size));
|
|
162
|
-
}
|
|
163
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { BinaryVectorTileFeature } from "./vector-tile-feature.js";
|
|
2
|
-
import Protobuf from 'pbf';
|
|
3
|
-
import { GeojsonGeometryInfo } from '@loaders.gl/schema';
|
|
4
|
-
export declare class BinaryVectorTileLayer {
|
|
5
|
-
version: number;
|
|
6
|
-
name: string;
|
|
7
|
-
extent: number;
|
|
8
|
-
length: number;
|
|
9
|
-
_pbf: Protobuf;
|
|
10
|
-
_keys: string[];
|
|
11
|
-
_values: (string | number | boolean | null)[];
|
|
12
|
-
_features: number[];
|
|
13
|
-
constructor(pbf: Protobuf, end: number);
|
|
14
|
-
/**
|
|
15
|
-
* return feature `i` from this layer as a `BinaryVectorTileFeature`
|
|
16
|
-
*
|
|
17
|
-
* @param index
|
|
18
|
-
* @param geometryInfo
|
|
19
|
-
* @returns {BinaryVectorTileFeature}
|
|
20
|
-
*/
|
|
21
|
-
feature(i: number, geometryInfo: GeojsonGeometryInfo): BinaryVectorTileFeature;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=vector-tile-layer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,96 +0,0 @@
|
|
|
1
|
-
// loaders.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright vis.gl contributors
|
|
4
|
-
/* eslint-disable indent */
|
|
5
|
-
// This code is forked from https://github.com/mapbox/vector-tile-js under BSD 3-clause license.
|
|
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;
|
|
16
|
-
constructor(pbf, end) {
|
|
17
|
-
// Public
|
|
18
|
-
this.version = 1;
|
|
19
|
-
this.name = '';
|
|
20
|
-
this.extent = 4096;
|
|
21
|
-
this.length = 0;
|
|
22
|
-
// Private
|
|
23
|
-
this._pbf = pbf;
|
|
24
|
-
this._keys = [];
|
|
25
|
-
this._values = [];
|
|
26
|
-
this._features = [];
|
|
27
|
-
pbf.readFields(readLayer, this, end);
|
|
28
|
-
this.length = this._features.length;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* return feature `i` from this layer as a `BinaryVectorTileFeature`
|
|
32
|
-
*
|
|
33
|
-
* @param index
|
|
34
|
-
* @param geometryInfo
|
|
35
|
-
* @returns {BinaryVectorTileFeature}
|
|
36
|
-
*/
|
|
37
|
-
feature(i, geometryInfo) {
|
|
38
|
-
if (i < 0 || i >= this._features.length) {
|
|
39
|
-
throw new Error('feature index out of bounds');
|
|
40
|
-
}
|
|
41
|
-
this._pbf.pos = this._features[i];
|
|
42
|
-
const end = this._pbf.readVarint() + this._pbf.pos;
|
|
43
|
-
return new BinaryVectorTileFeature(this._pbf, end, this.extent, this._keys, this._values, geometryInfo);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
*
|
|
48
|
-
* @param tag
|
|
49
|
-
* @param layer
|
|
50
|
-
* @param pbf
|
|
51
|
-
*/
|
|
52
|
-
function readLayer(tag, layer, pbf) {
|
|
53
|
-
if (layer && pbf) {
|
|
54
|
-
if (tag === 15)
|
|
55
|
-
layer.version = pbf.readVarint();
|
|
56
|
-
else if (tag === 1)
|
|
57
|
-
layer.name = pbf.readString();
|
|
58
|
-
else if (tag === 5)
|
|
59
|
-
layer.extent = pbf.readVarint();
|
|
60
|
-
else if (tag === 2)
|
|
61
|
-
layer._features.push(pbf.pos);
|
|
62
|
-
else if (tag === 3)
|
|
63
|
-
layer._keys.push(pbf.readString());
|
|
64
|
-
else if (tag === 4)
|
|
65
|
-
layer._values.push(readValueMessage(pbf));
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
*
|
|
70
|
-
* @param pbf
|
|
71
|
-
* @returns value
|
|
72
|
-
*/
|
|
73
|
-
function readValueMessage(pbf) {
|
|
74
|
-
let value = null;
|
|
75
|
-
const end = pbf.readVarint() + pbf.pos;
|
|
76
|
-
while (pbf.pos < end) {
|
|
77
|
-
const tag = pbf.readVarint() >> 3;
|
|
78
|
-
value =
|
|
79
|
-
tag === 1
|
|
80
|
-
? pbf.readString()
|
|
81
|
-
: tag === 2
|
|
82
|
-
? pbf.readFloat()
|
|
83
|
-
: tag === 3
|
|
84
|
-
? pbf.readDouble()
|
|
85
|
-
: tag === 4
|
|
86
|
-
? pbf.readVarint64()
|
|
87
|
-
: tag === 5
|
|
88
|
-
? pbf.readVarint()
|
|
89
|
-
: tag === 6
|
|
90
|
-
? pbf.readSVarint()
|
|
91
|
-
: tag === 7
|
|
92
|
-
? pbf.readBoolean()
|
|
93
|
-
: null;
|
|
94
|
-
}
|
|
95
|
-
return value;
|
|
96
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { BinaryVectorTileLayer } from "./vector-tile-layer.js";
|
|
2
|
-
import Protobuf from 'pbf';
|
|
3
|
-
export declare class BinaryVectorTile {
|
|
4
|
-
layers: {
|
|
5
|
-
[x: string]: BinaryVectorTileLayer;
|
|
6
|
-
};
|
|
7
|
-
constructor(pbf: Protobuf, end?: number);
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=vector-tile.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,27 +0,0 @@
|
|
|
1
|
-
// loaders.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright vis.gl contributors
|
|
4
|
-
// This code is forked from https://github.com/mapbox/vector-tile-js under BSD 3-clause license.
|
|
5
|
-
import { BinaryVectorTileLayer } from "./vector-tile-layer.js";
|
|
6
|
-
export class BinaryVectorTile {
|
|
7
|
-
layers;
|
|
8
|
-
constructor(pbf, end) {
|
|
9
|
-
this.layers = pbf.readFields(readTile, {}, end);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @param tag
|
|
15
|
-
* @param layers
|
|
16
|
-
* @param pbf
|
|
17
|
-
*/
|
|
18
|
-
function readTile(tag, layers, pbf) {
|
|
19
|
-
if (tag === 3) {
|
|
20
|
-
if (pbf) {
|
|
21
|
-
const layer = new BinaryVectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
|
|
22
|
-
if (layer.length && layers) {
|
|
23
|
-
layers[layer.name] = layer;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clip.d.ts","sourceRoot":"","sources":["../../../src/lib/geojson-tiler/clip.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,kBAAkB,EAAC,kBAAe;AAK/C;;;;;;;;;;GAUG;AAEH,wBAAgB,IAAI,CAClB,QAAQ,EAAE,kBAAkB,EAAE,EAC9B,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,kBAAkB,EAAE,GAAG,IAAI,CA4E7B"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Feature } from '@loaders.gl/schema';
|
|
2
|
-
import type { GeoJSONTileFeature } from "./tile.js";
|
|
3
|
-
export declare function convert(data: Feature, options: any): GeoJSONTileFeature[];
|
|
4
|
-
export type ConvertFeatureOptions = {
|
|
5
|
-
maxZoom?: number;
|
|
6
|
-
tolerance: number;
|
|
7
|
-
extent: number;
|
|
8
|
-
lineMetrics: boolean;
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=convert.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../../src/lib/geojson-tiler/convert.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAC,kBAAkB,EAAC,kBAAe;AAO/C,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,KAAA,GAAG,kBAAkB,EAAE,CAcpE;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../../../src/lib/geojson-tiler/feature.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,kBAAkB,EAAC,kBAAe;AAE1C,wBAAgB,aAAa,CAAC,EAAE,KAAA,EAAE,IAAI,KAAA,EAAE,IAAI,KAAA,EAAE,IAAI,KAAA,GAAG,kBAAkB,CA8BtE"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { GeoJSONTile, GeoJSONTileFeature } from "./tile.js";
|
|
2
|
-
/** Options to configure tiling */
|
|
3
|
-
export type GeoJSONTilerOptions = {
|
|
4
|
-
maxZoom?: number /** max zoom to preserve detail on */;
|
|
5
|
-
indexMaxZoom?: number /** max zoom in the tile index */;
|
|
6
|
-
indexMaxPoints?: number /** max number of points per tile in the tile index */;
|
|
7
|
-
tolerance?: number /** simplification tolerance (higher means simpler) */;
|
|
8
|
-
extent?: number /** tile extent */;
|
|
9
|
-
buffer?: number /** tile buffer on each side */;
|
|
10
|
-
lineMetrics?: boolean /** whether to calculate line metrics */;
|
|
11
|
-
promoteId?: string /** name of a feature property to be promoted to feature.id */;
|
|
12
|
-
generateId?: boolean /** whether to generate feature ids. Cannot be used with promoteId */;
|
|
13
|
-
debug?: number /** logging level (0, 1 or 2) */;
|
|
14
|
-
};
|
|
15
|
-
export declare class GeoJSONTiler {
|
|
16
|
-
options: Required<GeoJSONTilerOptions>;
|
|
17
|
-
tiles: Record<string, GeoJSONTile>;
|
|
18
|
-
tileCoords: {
|
|
19
|
-
x: number;
|
|
20
|
-
y: number;
|
|
21
|
-
z: number;
|
|
22
|
-
}[];
|
|
23
|
-
stats: Record<string, number>;
|
|
24
|
-
total: number;
|
|
25
|
-
constructor(data: any, options?: GeoJSONTilerOptions);
|
|
26
|
-
/**
|
|
27
|
-
* Get a tile at the specified index
|
|
28
|
-
* @param z
|
|
29
|
-
* @param x
|
|
30
|
-
* @param y
|
|
31
|
-
* @returns
|
|
32
|
-
*/
|
|
33
|
-
getTile(z: number, x: number, y: number): GeoJSONTile | null;
|
|
34
|
-
/**
|
|
35
|
-
* splits features from a parent tile to sub-tiles.
|
|
36
|
-
* @param z, x, and y are the coordinates of the parent tile
|
|
37
|
-
* @param cz, cx, and cy are the coordinates of the target tile
|
|
38
|
-
*
|
|
39
|
-
* If no target tile is specified, splitting stops when we reach the maximum
|
|
40
|
-
* zoom or the number of points is low as specified in the options.
|
|
41
|
-
*/
|
|
42
|
-
splitTile(features: GeoJSONTileFeature[], z: number, x: number, y: number, cz?: number, cx?: number, cy?: number): void;
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=geojson-tiler.d.ts.map
|