@loaders.gl/mvt 3.1.0-alpha.1 → 3.1.0-alpha.5

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.
Files changed (100) hide show
  1. package/dist/bundle.d.ts +1 -0
  2. package/dist/dist.min.js +2 -2
  3. package/dist/dist.min.js.map +1 -1
  4. package/dist/es5/bundle.js +7 -0
  5. package/dist/es5/bundle.js.map +1 -0
  6. package/dist/es5/helpers/binary-util-functions.js +95 -0
  7. package/dist/es5/helpers/binary-util-functions.js.map +1 -0
  8. package/dist/es5/helpers/mapbox-util-functions.js +62 -0
  9. package/dist/es5/helpers/mapbox-util-functions.js.map +1 -0
  10. package/dist/es5/index.js +20 -0
  11. package/dist/es5/index.js.map +1 -0
  12. package/dist/{lib → es5/lib}/binary-vector-tile/LICENSE.txt +0 -0
  13. package/dist/es5/lib/binary-vector-tile/features-to-binary.js +338 -0
  14. package/dist/es5/lib/binary-vector-tile/features-to-binary.js.map +1 -0
  15. package/dist/es5/lib/binary-vector-tile/vector-tile-feature.js +162 -0
  16. package/dist/es5/lib/binary-vector-tile/vector-tile-feature.js.map +1 -0
  17. package/dist/es5/lib/binary-vector-tile/vector-tile-layer.js +69 -0
  18. package/dist/es5/lib/binary-vector-tile/vector-tile-layer.js.map +1 -0
  19. package/dist/es5/lib/binary-vector-tile/vector-tile.js +35 -0
  20. package/dist/es5/lib/binary-vector-tile/vector-tile.js.map +1 -0
  21. package/dist/{lib → es5/lib}/mapbox-vector-tile/LICENSE.txt +0 -0
  22. package/dist/es5/lib/mapbox-vector-tile/vector-tile-feature.js +207 -0
  23. package/dist/es5/lib/mapbox-vector-tile/vector-tile-feature.js.map +1 -0
  24. package/dist/es5/lib/mapbox-vector-tile/vector-tile-layer.js +69 -0
  25. package/dist/es5/lib/mapbox-vector-tile/vector-tile-layer.js.map +1 -0
  26. package/dist/es5/lib/mapbox-vector-tile/vector-tile.js +35 -0
  27. package/dist/es5/lib/mapbox-vector-tile/vector-tile.js.map +1 -0
  28. package/dist/es5/lib/parse-mvt.js +129 -0
  29. package/dist/es5/lib/parse-mvt.js.map +1 -0
  30. package/dist/es5/lib/types.js +2 -0
  31. package/dist/{lib → es5/lib}/types.js.map +0 -0
  32. package/dist/es5/mvt-loader.js +38 -0
  33. package/dist/es5/mvt-loader.js.map +1 -0
  34. package/dist/es5/workers/mvt-worker.js +8 -0
  35. package/dist/es5/workers/mvt-worker.js.map +1 -0
  36. package/dist/esm/bundle.js +5 -0
  37. package/dist/esm/bundle.js.map +1 -0
  38. package/dist/{helpers → esm/helpers}/binary-util-functions.js +0 -0
  39. package/dist/esm/helpers/binary-util-functions.js.map +1 -0
  40. package/dist/{helpers → esm/helpers}/mapbox-util-functions.js +0 -0
  41. package/dist/esm/helpers/mapbox-util-functions.js.map +1 -0
  42. package/dist/{index.js → esm/index.js} +0 -0
  43. package/dist/esm/index.js.map +1 -0
  44. package/dist/esm/lib/binary-vector-tile/LICENSE.txt +31 -0
  45. package/dist/{lib → esm/lib}/binary-vector-tile/features-to-binary.js +0 -0
  46. package/dist/esm/lib/binary-vector-tile/features-to-binary.js.map +1 -0
  47. package/dist/{lib → esm/lib}/binary-vector-tile/vector-tile-feature.js +2 -2
  48. package/dist/esm/lib/binary-vector-tile/vector-tile-feature.js.map +1 -0
  49. package/dist/{lib → esm/lib}/binary-vector-tile/vector-tile-layer.js +0 -0
  50. package/dist/esm/lib/binary-vector-tile/vector-tile-layer.js.map +1 -0
  51. package/dist/{lib → esm/lib}/binary-vector-tile/vector-tile.js +0 -0
  52. package/dist/esm/lib/binary-vector-tile/vector-tile.js.map +1 -0
  53. package/dist/esm/lib/mapbox-vector-tile/LICENSE.txt +31 -0
  54. package/dist/{lib → esm/lib}/mapbox-vector-tile/vector-tile-feature.js +3 -3
  55. package/dist/esm/lib/mapbox-vector-tile/vector-tile-feature.js.map +1 -0
  56. package/dist/{lib → esm/lib}/mapbox-vector-tile/vector-tile-layer.js +0 -0
  57. package/dist/esm/lib/mapbox-vector-tile/vector-tile-layer.js.map +1 -0
  58. package/dist/{lib → esm/lib}/mapbox-vector-tile/vector-tile.js +0 -0
  59. package/dist/esm/lib/mapbox-vector-tile/vector-tile.js.map +1 -0
  60. package/dist/{lib → esm/lib}/parse-mvt.js +0 -0
  61. package/dist/esm/lib/parse-mvt.js.map +1 -0
  62. package/dist/{lib → esm/lib}/types.js +0 -0
  63. package/dist/esm/lib/types.js.map +1 -0
  64. package/dist/{mvt-loader.js → esm/mvt-loader.js} +1 -1
  65. package/dist/esm/mvt-loader.js.map +1 -0
  66. package/dist/{workers → esm/workers}/mvt-worker.js +0 -0
  67. package/dist/esm/workers/mvt-worker.js.map +1 -0
  68. package/dist/helpers/binary-util-functions.d.ts +38 -0
  69. package/dist/helpers/mapbox-util-functions.d.ts +28 -0
  70. package/dist/index.d.ts +1 -0
  71. package/dist/lib/binary-vector-tile/features-to-binary.d.ts +184 -0
  72. package/dist/lib/binary-vector-tile/vector-tile-feature.d.ts +35 -0
  73. package/dist/lib/binary-vector-tile/vector-tile-layer.d.ts +22 -0
  74. package/dist/lib/binary-vector-tile/vector-tile.d.ts +8 -0
  75. package/dist/lib/mapbox-vector-tile/vector-tile-feature.d.ts +26 -0
  76. package/dist/lib/mapbox-vector-tile/vector-tile-layer.d.ts +19 -0
  77. package/dist/lib/mapbox-vector-tile/vector-tile.d.ts +8 -0
  78. package/dist/lib/parse-mvt.d.ts +84 -0
  79. package/dist/lib/types.d.ts +91 -0
  80. package/dist/mvt-loader.d.ts +9 -0
  81. package/dist/mvt-worker.js +1 -1
  82. package/dist/mvt-worker.js.map +1 -1
  83. package/dist/workers/mvt-worker.d.ts +1 -0
  84. package/package.json +8 -7
  85. package/src/bundle.ts +2 -3
  86. package/dist/bundle.js +0 -7
  87. package/dist/bundle.js.map +0 -1
  88. package/dist/helpers/binary-util-functions.js.map +0 -1
  89. package/dist/helpers/mapbox-util-functions.js.map +0 -1
  90. package/dist/index.js.map +0 -1
  91. package/dist/lib/binary-vector-tile/features-to-binary.js.map +0 -1
  92. package/dist/lib/binary-vector-tile/vector-tile-feature.js.map +0 -1
  93. package/dist/lib/binary-vector-tile/vector-tile-layer.js.map +0 -1
  94. package/dist/lib/binary-vector-tile/vector-tile.js.map +0 -1
  95. package/dist/lib/mapbox-vector-tile/vector-tile-feature.js.map +0 -1
  96. package/dist/lib/mapbox-vector-tile/vector-tile-layer.js.map +0 -1
  97. package/dist/lib/mapbox-vector-tile/vector-tile.js.map +0 -1
  98. package/dist/lib/parse-mvt.js.map +0 -1
  99. package/dist/mvt-loader.js.map +0 -1
  100. package/dist/workers/mvt-worker.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import parseMVT from './lib/parse-mvt';
2
- const VERSION = typeof "3.1.0-alpha.1" !== 'undefined' ? "3.1.0-alpha.1" : 'latest';
2
+ const VERSION = typeof "3.1.0-alpha.5" !== 'undefined' ? "3.1.0-alpha.5" : 'latest';
3
3
  export const MVTWorkerLoader = {
4
4
  name: 'Mapbox Vector Tile',
5
5
  id: 'mvt',
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/mvt-loader.ts"],"names":["parseMVT","VERSION","MVTWorkerLoader","name","id","module","version","extensions","mimeTypes","worker","category","options","mvt","coordinates","layerProperty","layers","tileIndex","MVTLoader","parse","arrayBuffer","parseSync","binary"],"mappings":"AACA,OAAOA,QAAP,MAAqB,iBAArB;AAIA,MAAMC,OAAO,GAAG,2BAAuB,WAAvB,qBAAmD,QAAnE;AAKA,OAAO,MAAMC,eAAuB,GAAG;AACrCC,EAAAA,IAAI,EAAE,oBAD+B;AAErCC,EAAAA,EAAE,EAAE,KAFiC;AAGrCC,EAAAA,MAAM,EAAE,KAH6B;AAIrCC,EAAAA,OAAO,EAAEL,OAJ4B;AAMrCM,EAAAA,UAAU,EAAE,CAAC,KAAD,EAAQ,KAAR,CANyB;AAOrCC,EAAAA,SAAS,EAAE,CACT,oCADS,EAET,wBAFS,CAP0B;AAYrCC,EAAAA,MAAM,EAAE,IAZ6B;AAarCC,EAAAA,QAAQ,EAAE,UAb2B;AAcrCC,EAAAA,OAAO,EAAE;AACPC,IAAAA,GAAG,EAAE;AACHC,MAAAA,WAAW,EAAE,OADV;AAEHC,MAAAA,aAAa,EAAE,WAFZ;AAGHC,MAAAA,MAAM,EAAE,IAHL;AAIHC,MAAAA,SAAS,EAAE;AAJR;AADE;AAd4B,CAAhC;AA2BP,OAAO,MAAMC,SAA2B,GAAG,EACzC,GAAGf,eADsC;AAEzCgB,EAAAA,KAAK,EAAE,OAAOC,WAAP,EAAoBR,OAApB,KAAgCX,QAAQ,CAACmB,WAAD,EAAcR,OAAd,CAFN;AAGzCS,EAAAA,SAAS,EAAEpB,QAH8B;AAIzCqB,EAAAA,MAAM,EAAE;AAJiC,CAApC","sourcesContent":["import type {Loader, LoaderWithParser} from '@loaders.gl/loader-utils';\nimport parseMVT from './lib/parse-mvt';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/**\n * Worker loader for the Mapbox Vector Tile format\n */\nexport const MVTWorkerLoader: Loader = {\n name: 'Mapbox Vector Tile',\n id: 'mvt',\n module: 'mvt',\n version: VERSION,\n // Note: ArcGIS uses '.pbf' extension and 'application/octet-stream'\n extensions: ['mvt', 'pbf'],\n mimeTypes: [\n 'application/vnd.mapbox-vector-tile',\n 'application/x-protobuf'\n // 'application/octet-stream'\n ],\n worker: true,\n category: 'geometry',\n options: {\n mvt: {\n coordinates: 'local',\n layerProperty: 'layerName',\n layers: null,\n tileIndex: null\n }\n }\n};\n\n/**\n * Loader for the Mapbox Vector Tile format\n */\nexport const MVTLoader: LoaderWithParser = {\n ...MVTWorkerLoader,\n parse: async (arrayBuffer, options) => parseMVT(arrayBuffer, options),\n parseSync: parseMVT,\n binary: true\n};\n"],"file":"mvt-loader.js"}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/workers/mvt-worker.ts"],"names":["MVTLoader","createLoaderWorker"],"mappings":"AAAA,SAAQA,SAAR,QAAwB,eAAxB;AACA,SAAQC,kBAAR,QAAiC,0BAAjC;AAEAA,kBAAkB,CAACD,SAAD,CAAlB","sourcesContent":["import {MVTLoader} from '../mvt-loader';\nimport {createLoaderWorker} from '@loaders.gl/loader-utils';\n\ncreateLoaderWorker(MVTLoader);\n"],"file":"mvt-worker.js"}
@@ -0,0 +1,38 @@
1
+ import Protobuf from 'pbf';
2
+ import { MvtBinaryGeometry } from '../lib/types';
3
+ import VectorTileFeature from '../lib/binary-vector-tile/vector-tile-feature';
4
+ /**
5
+ * Classifies an array of rings into polygons with outer rings and holes
6
+ * The function also detects holes which have zero area and
7
+ * removes them. In doing so it modifies the input
8
+ * `geom.data` array to remove the unneeded data
9
+ *
10
+ * @param geometry
11
+ * @returns object
12
+ */
13
+ export declare function classifyRings(geom: MvtBinaryGeometry): {
14
+ areas: any[];
15
+ lines: any[];
16
+ data: number[];
17
+ };
18
+ /**
19
+ *
20
+ * @param data
21
+ * @param x0
22
+ * @param y0
23
+ * @param size
24
+ */
25
+ export declare function project(data: number[], x0: number, y0: number, size: number): void;
26
+ /**
27
+ * All code below is unchanged from the original Mapbox implemenation
28
+ *
29
+ * @param tag
30
+ * @param feature
31
+ * @param pbf
32
+ */
33
+ export declare function readFeature(tag: number, feature?: VectorTileFeature, pbf?: Protobuf): void;
34
+ /**
35
+ * @param pbf
36
+ * @param feature
37
+ */
38
+ export declare function readTag(pbf: Protobuf, feature: VectorTileFeature): void;
@@ -0,0 +1,28 @@
1
+ import Protobuf from 'pbf';
2
+ import { MvtMapboxGeometry } from '../lib/types';
3
+ import VectorTileFeature from '../lib/mapbox-vector-tile/vector-tile-feature';
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;
@@ -0,0 +1 @@
1
+ export { MVTLoader, MVTWorkerLoader } from './mvt-loader';
@@ -0,0 +1,184 @@
1
+ import { MvtBinaryCoordinates, MvtBinaryOptions, MvtFirstPassedData } from '../types';
2
+ /**
3
+ * Convert binary features to flat binary arrays. Similar to
4
+ * `geojsonToBinary` helper function, except that it expects
5
+ * a binary representation of the feature data, which enables
6
+ * 2X-3X speed increase in parse speed, compared to using
7
+ * geoJSON. See `binary-vector-tile/VectorTileFeature` for
8
+ * data format detais
9
+ *
10
+ * @param features
11
+ * @param firstPassData
12
+ * @param options
13
+ * @returns filled arrays
14
+ */
15
+ export declare function featuresToBinary(features: MvtBinaryCoordinates[], firstPassData: MvtFirstPassedData, options?: MvtBinaryOptions): {
16
+ points: {
17
+ positions: {
18
+ value: Float32Array;
19
+ size: number;
20
+ };
21
+ globalFeatureIds: {
22
+ value: Uint16Array | Uint32Array;
23
+ size: number;
24
+ };
25
+ featureIds: {
26
+ value: Uint16Array | Uint32Array;
27
+ size: number;
28
+ };
29
+ numericProps: object;
30
+ properties: {}[];
31
+ fields: {
32
+ id?: number | undefined;
33
+ }[];
34
+ };
35
+ lines: {
36
+ pathIndices: {
37
+ value: Uint16Array | Uint32Array;
38
+ size: number;
39
+ };
40
+ positions: {
41
+ value: Float32Array;
42
+ size: number;
43
+ };
44
+ globalFeatureIds: {
45
+ value: Uint16Array | Uint32Array;
46
+ size: number;
47
+ };
48
+ featureIds: {
49
+ value: Uint16Array | Uint32Array;
50
+ size: number;
51
+ };
52
+ numericProps: object;
53
+ properties: {}[];
54
+ fields: {
55
+ id?: number | undefined;
56
+ }[];
57
+ };
58
+ polygons: {
59
+ polygonIndices: {
60
+ value: Uint16Array | Uint32Array;
61
+ size: number;
62
+ };
63
+ primitivePolygonIndices: {
64
+ value: Uint16Array | Uint32Array;
65
+ size: number;
66
+ };
67
+ positions: {
68
+ value: Float32Array;
69
+ size: number;
70
+ };
71
+ triangles: {
72
+ value: Uint32Array;
73
+ size: number;
74
+ };
75
+ globalFeatureIds: {
76
+ value: Uint16Array | Uint32Array;
77
+ size: number;
78
+ };
79
+ featureIds: {
80
+ value: Uint16Array | Uint32Array;
81
+ size: number;
82
+ };
83
+ numericProps: object;
84
+ properties: {}[];
85
+ fields: {
86
+ id?: number | undefined;
87
+ }[];
88
+ };
89
+ };
90
+ export declare const TEST_EXPORTS: {
91
+ extractNumericPropKeys: typeof extractNumericPropKeys;
92
+ fillArrays: typeof fillArrays;
93
+ };
94
+ /**
95
+ * Extracts properties that are always numeric
96
+ *
97
+ * @param features
98
+ * @returns object with numeric keys
99
+ */
100
+ declare function extractNumericPropKeys(features: MvtBinaryCoordinates[]): string[];
101
+ /**
102
+ * Fills coordinates into pre-allocated typed arrays
103
+ *
104
+ * @param features
105
+ * @param firstPassData
106
+ * @param options
107
+ * @returns an accessor object with value and size keys
108
+ */
109
+ declare function fillArrays(features: MvtBinaryCoordinates[], firstPassData: MvtFirstPassedData, options: MvtBinaryOptions): {
110
+ points: {
111
+ positions: {
112
+ value: Float32Array;
113
+ size: number;
114
+ };
115
+ globalFeatureIds: {
116
+ value: Uint16Array | Uint32Array;
117
+ size: number;
118
+ };
119
+ featureIds: {
120
+ value: Uint16Array | Uint32Array;
121
+ size: number;
122
+ };
123
+ numericProps: object;
124
+ properties: {}[];
125
+ fields: {
126
+ id?: number | undefined;
127
+ }[];
128
+ };
129
+ lines: {
130
+ pathIndices: {
131
+ value: Uint16Array | Uint32Array;
132
+ size: number;
133
+ };
134
+ positions: {
135
+ value: Float32Array;
136
+ size: number;
137
+ };
138
+ globalFeatureIds: {
139
+ value: Uint16Array | Uint32Array;
140
+ size: number;
141
+ };
142
+ featureIds: {
143
+ value: Uint16Array | Uint32Array;
144
+ size: number;
145
+ };
146
+ numericProps: object;
147
+ properties: {}[];
148
+ fields: {
149
+ id?: number | undefined;
150
+ }[];
151
+ };
152
+ polygons: {
153
+ polygonIndices: {
154
+ value: Uint16Array | Uint32Array;
155
+ size: number;
156
+ };
157
+ primitivePolygonIndices: {
158
+ value: Uint16Array | Uint32Array;
159
+ size: number;
160
+ };
161
+ positions: {
162
+ value: Float32Array;
163
+ size: number;
164
+ };
165
+ triangles: {
166
+ value: Uint32Array;
167
+ size: number;
168
+ };
169
+ globalFeatureIds: {
170
+ value: Uint16Array | Uint32Array;
171
+ size: number;
172
+ };
173
+ featureIds: {
174
+ value: Uint16Array | Uint32Array;
175
+ size: number;
176
+ };
177
+ numericProps: object;
178
+ properties: {}[];
179
+ fields: {
180
+ id?: number | undefined;
181
+ }[];
182
+ };
183
+ };
184
+ export {};
@@ -0,0 +1,35 @@
1
+ import Protobuf from 'pbf';
2
+ import { MvtBinaryCoordinates, MvtBinaryGeometry, MvtFirstPassedData } from '../types';
3
+ import { classifyRings } from '../../helpers/binary-util-functions';
4
+ export declare const TEST_EXPORTS: {
5
+ classifyRings: typeof classifyRings;
6
+ };
7
+ export default class VectorTileFeature {
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
+ _firstPassData: MvtFirstPassedData;
19
+ static get types(): string[];
20
+ constructor(pbf: Protobuf, end: number, extent: any, keys: string[], values: (string | number | boolean | null)[], firstPassData: MvtFirstPassedData);
21
+ loadGeometry(): MvtBinaryGeometry;
22
+ /**
23
+ *
24
+ * @param transform
25
+ * @returns result
26
+ */
27
+ _toBinaryCoordinates(transform: any): MvtBinaryCoordinates;
28
+ toBinaryCoordinates(options: {
29
+ x: number;
30
+ y: number;
31
+ z: number;
32
+ } | ((data: number[], feature: {
33
+ extent: any;
34
+ }) => void)): MvtBinaryCoordinates;
35
+ }
@@ -0,0 +1,22 @@
1
+ import VectorTileFeature from './vector-tile-feature';
2
+ import Protobuf from 'pbf';
3
+ import { MvtFirstPassedData } from '../types';
4
+ export default class VectorTileLayer {
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 `VectorTileFeature`
16
+ *
17
+ * @param index
18
+ * @param firstPassData
19
+ * @returns {VectorTileFeature}
20
+ */
21
+ feature(i: number, firstPassData: MvtFirstPassedData): VectorTileFeature;
22
+ }
@@ -0,0 +1,8 @@
1
+ import VectorTileLayer from './vector-tile-layer';
2
+ import Protobuf from 'pbf';
3
+ export default class VectorTile {
4
+ layers: {
5
+ [x: string]: VectorTileLayer;
6
+ };
7
+ constructor(pbf: Protobuf, end?: number);
8
+ }
@@ -0,0 +1,26 @@
1
+ import Protobuf from 'pbf';
2
+ import { MvtMapboxCoordinates, MvtMapboxGeometry } from '../types';
3
+ export default class VectorTileFeature {
4
+ properties: {
5
+ [x: string]: string | number | boolean | null;
6
+ };
7
+ extent: any;
8
+ type: number;
9
+ id: number | null;
10
+ _pbf: Protobuf;
11
+ _geometry: number;
12
+ _keys: string[];
13
+ _values: (string | number | boolean | null)[];
14
+ static get types(): string[];
15
+ constructor(pbf: Protobuf, end: number, extent: any, keys: string[], values: (string | number | boolean | null)[]);
16
+ loadGeometry(): MvtMapboxGeometry;
17
+ bbox(): number[];
18
+ _toGeoJSON(transform: any): MvtMapboxCoordinates;
19
+ toGeoJSON(options: {
20
+ x: number;
21
+ y: number;
22
+ z: number;
23
+ } | ((data: number[], feature: {
24
+ extent: any;
25
+ }) => void)): MvtMapboxCoordinates;
26
+ }
@@ -0,0 +1,19 @@
1
+ import Protobuf from 'pbf';
2
+ import VectorTileFeature from './vector-tile-feature';
3
+ export default class VectorTileLayer {
4
+ version: number;
5
+ name: string;
6
+ extent: number;
7
+ length: number;
8
+ _pbf: Protobuf;
9
+ _keys: string[];
10
+ _values: (string | number | boolean | null)[];
11
+ _features: number[];
12
+ constructor(pbf: Protobuf, end: number);
13
+ /**
14
+ * return feature `i` from this layer as a `VectorTileFeature`
15
+ * @param index
16
+ * @returns feature
17
+ */
18
+ feature(i: number): VectorTileFeature;
19
+ }
@@ -0,0 +1,8 @@
1
+ import VectorTileLayer from './vector-tile-layer';
2
+ import Protobuf from 'pbf';
3
+ export default class VectorTile {
4
+ layers: {
5
+ [x: string]: VectorTileLayer;
6
+ };
7
+ constructor(pbf: Protobuf, end?: number);
8
+ }
@@ -0,0 +1,84 @@
1
+ import { MvtBinaryCoordinates, MvtMapboxCoordinates } from '../lib/types';
2
+ import { LoaderOptions } from '@loaders.gl/loader-utils/';
3
+ /**
4
+ * Parse MVT arrayBuffer and return GeoJSON.
5
+ *
6
+ * @param arrayBuffer A MVT arrayBuffer
7
+ * @param options
8
+ * @returns A GeoJSON geometry object or a binary representation
9
+ */
10
+ export default function parseMVT(arrayBuffer: ArrayBuffer, options?: LoaderOptions): {
11
+ points: {
12
+ positions: {
13
+ value: Float32Array;
14
+ size: number;
15
+ };
16
+ globalFeatureIds: {
17
+ value: Uint16Array | Uint32Array;
18
+ size: number;
19
+ };
20
+ featureIds: {
21
+ value: Uint16Array | Uint32Array;
22
+ size: number;
23
+ };
24
+ numericProps: object;
25
+ properties: {}[];
26
+ fields: {
27
+ id?: number | undefined;
28
+ }[];
29
+ };
30
+ lines: {
31
+ pathIndices: {
32
+ value: Uint16Array | Uint32Array;
33
+ size: number;
34
+ };
35
+ positions: {
36
+ value: Float32Array;
37
+ size: number;
38
+ };
39
+ globalFeatureIds: {
40
+ value: Uint16Array | Uint32Array;
41
+ size: number;
42
+ };
43
+ featureIds: {
44
+ value: Uint16Array | Uint32Array;
45
+ size: number;
46
+ };
47
+ numericProps: object;
48
+ properties: {}[];
49
+ fields: {
50
+ id?: number | undefined;
51
+ }[];
52
+ };
53
+ polygons: {
54
+ polygonIndices: {
55
+ value: Uint16Array | Uint32Array;
56
+ size: number;
57
+ };
58
+ primitivePolygonIndices: {
59
+ value: Uint16Array | Uint32Array;
60
+ size: number;
61
+ };
62
+ positions: {
63
+ value: Float32Array;
64
+ size: number;
65
+ };
66
+ triangles: {
67
+ value: Uint32Array;
68
+ size: number;
69
+ };
70
+ globalFeatureIds: {
71
+ value: Uint16Array | Uint32Array;
72
+ size: number;
73
+ };
74
+ featureIds: {
75
+ value: Uint16Array | Uint32Array;
76
+ size: number;
77
+ };
78
+ numericProps: object;
79
+ properties: {}[];
80
+ fields: {
81
+ id?: number | undefined;
82
+ }[];
83
+ };
84
+ } | (MvtBinaryCoordinates | MvtMapboxCoordinates)[];
@@ -0,0 +1,91 @@
1
+ export declare type MvtOptions = {
2
+ coordinates: string | number[];
3
+ tileIndex: {
4
+ x: number;
5
+ y: number;
6
+ z: number;
7
+ };
8
+ layerProperty: string | number;
9
+ layerName: string;
10
+ };
11
+ export declare type MvtBinaryGeometry = {
12
+ data: number[];
13
+ lines: any[];
14
+ areas?: number[];
15
+ type?: string;
16
+ id?: number;
17
+ };
18
+ export declare type MvtMapboxGeometry = {
19
+ type?: string;
20
+ id?: number;
21
+ length: number;
22
+ coordinates?: any[];
23
+ };
24
+ export declare type MvtBinaryCoordinates = {
25
+ type: string;
26
+ geometry: MvtBinaryGeometry;
27
+ properties: {
28
+ [x: string]: string | number | boolean | null;
29
+ };
30
+ id?: number;
31
+ };
32
+ export declare type MvtMapboxCoordinates = {
33
+ type: string;
34
+ geometry: {
35
+ type: string;
36
+ coordinates: MvtMapboxGeometry;
37
+ };
38
+ properties: {
39
+ [x: string]: string | number | boolean | null;
40
+ };
41
+ id?: number;
42
+ };
43
+ export declare type MvtBinaryOptions = {
44
+ numericPropKeys: string[];
45
+ PositionDataType: Float32ArrayConstructor;
46
+ };
47
+ export declare type MvtFirstPassedData = {
48
+ pointPositionsCount: number;
49
+ pointFeaturesCount: number;
50
+ linePositionsCount: number;
51
+ linePathsCount: number;
52
+ lineFeaturesCount: number;
53
+ polygonPositionsCount: number;
54
+ polygonObjectsCount: number;
55
+ polygonRingsCount: number;
56
+ polygonFeaturesCount: number;
57
+ };
58
+ export declare type MvtPoints = {
59
+ positions: Float32Array;
60
+ globalFeatureIds: Uint16Array | Uint32Array;
61
+ featureIds: Uint16Array | Uint32Array;
62
+ numericProps: object;
63
+ properties: {}[];
64
+ fields: {
65
+ id?: number;
66
+ }[];
67
+ };
68
+ export declare type MvtLines = {
69
+ pathIndices: Uint16Array | Uint32Array;
70
+ positions: Float32Array;
71
+ globalFeatureIds: Uint16Array | Uint32Array;
72
+ featureIds: Uint16Array | Uint32Array;
73
+ numericProps: object;
74
+ properties: {}[];
75
+ fields: {
76
+ id?: number;
77
+ }[];
78
+ };
79
+ export declare type MvtPolygons = {
80
+ polygonIndices: Uint16Array | Uint32Array;
81
+ primitivePolygonIndices: Uint16Array | Uint32Array;
82
+ positions: Float32Array;
83
+ triangles: number[];
84
+ globalFeatureIds: Uint16Array | Uint32Array;
85
+ featureIds: Uint16Array | Uint32Array;
86
+ numericProps: object;
87
+ properties: {}[];
88
+ fields: {
89
+ id?: number;
90
+ }[];
91
+ };
@@ -0,0 +1,9 @@
1
+ import type { Loader, LoaderWithParser } from '@loaders.gl/loader-utils';
2
+ /**
3
+ * Worker loader for the Mapbox Vector Tile format
4
+ */
5
+ export declare const MVTWorkerLoader: Loader;
6
+ /**
7
+ * Loader for the Mapbox Vector Tile format
8
+ */
9
+ export declare const MVTLoader: LoaderWithParser;