@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.
Files changed (120) hide show
  1. package/dist/dist.dev.js +1784 -847
  2. package/dist/dist.min.js +1 -1
  3. package/dist/index.cjs +713 -640
  4. package/dist/index.cjs.map +4 -4
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +1 -1
  8. package/dist/lib/parse-mvt.d.ts +2 -1
  9. package/dist/lib/parse-mvt.d.ts.map +1 -1
  10. package/dist/lib/parse-mvt.js +15 -45
  11. package/dist/lib/parse-tilejson.d.ts +4 -4
  12. package/dist/lib/parse-tilejson.d.ts.map +1 -1
  13. package/dist/lib/types.d.ts +1 -39
  14. package/dist/lib/types.d.ts.map +1 -1
  15. package/dist/lib/utils/geometry-utils.d.ts +83 -0
  16. package/dist/lib/utils/geometry-utils.d.ts.map +1 -0
  17. package/dist/lib/utils/geometry-utils.js +206 -0
  18. package/dist/lib/vector-tile/vector-tile-feature.d.ts +72 -0
  19. package/dist/lib/vector-tile/vector-tile-feature.d.ts.map +1 -0
  20. package/dist/lib/vector-tile/vector-tile-feature.js +342 -0
  21. package/dist/lib/{mapbox-vector-tile → vector-tile}/vector-tile-layer.d.ts +10 -1
  22. package/dist/lib/vector-tile/vector-tile-layer.d.ts.map +1 -0
  23. package/dist/lib/{mapbox-vector-tile → vector-tile}/vector-tile-layer.js +16 -1
  24. package/dist/lib/vector-tile/vector-tile.d.ts.map +1 -0
  25. package/dist/lib/{geojson-tiler → vector-tiler}/clip.d.ts +3 -3
  26. package/dist/lib/vector-tiler/clip.d.ts.map +1 -0
  27. package/dist/lib/vector-tiler/convert.d.ts +18 -0
  28. package/dist/lib/vector-tiler/convert.d.ts.map +1 -0
  29. package/dist/lib/{geojson-tiler → vector-tiler}/convert.js +8 -1
  30. package/dist/lib/vector-tiler/feature.d.ts +3 -0
  31. package/dist/lib/vector-tiler/feature.d.ts.map +1 -0
  32. package/dist/lib/vector-tiler/simplify.d.ts.map +1 -0
  33. package/dist/lib/{geojson-tiler → vector-tiler}/tile.d.ts +4 -4
  34. package/dist/lib/vector-tiler/tile.d.ts.map +1 -0
  35. package/dist/lib/vector-tiler/transform.d.ts +7 -0
  36. package/dist/lib/vector-tiler/transform.d.ts.map +1 -0
  37. package/dist/lib/{geojson-tiler → vector-tiler}/wrap.d.ts +2 -2
  38. package/dist/lib/vector-tiler/wrap.d.ts.map +1 -0
  39. package/dist/mvt-loader.d.ts +19 -8
  40. package/dist/mvt-loader.d.ts.map +1 -1
  41. package/dist/mvt-loader.js +3 -2
  42. package/dist/mvt-source.d.ts +4 -4
  43. package/dist/mvt-source.d.ts.map +1 -1
  44. package/dist/mvt-source.js +7 -7
  45. package/dist/mvt-worker.js +1244 -762
  46. package/dist/table-tile-source.d.ts +118 -0
  47. package/dist/table-tile-source.d.ts.map +1 -0
  48. package/dist/table-tile-source.js +370 -0
  49. package/dist/tilejson-loader.js +1 -1
  50. package/package.json +7 -6
  51. package/src/index.ts +3 -3
  52. package/src/lib/parse-mvt.ts +28 -66
  53. package/src/lib/parse-tilejson.ts +5 -5
  54. package/src/lib/types.ts +1 -39
  55. package/src/lib/utils/geometry-utils.ts +234 -0
  56. package/src/lib/vector-tile/vector-tile-feature.ts +416 -0
  57. package/src/lib/{mapbox-vector-tile → vector-tile}/vector-tile-layer.ts +28 -2
  58. package/src/lib/{geojson-tiler → vector-tiler}/clip.ts +4 -4
  59. package/src/lib/{geojson-tiler → vector-tiler}/convert.ts +19 -9
  60. package/src/lib/{geojson-tiler → vector-tiler}/feature.ts +3 -3
  61. package/src/lib/{geojson-tiler → vector-tiler}/tile.ts +10 -10
  62. package/src/lib/{geojson-tiler → vector-tiler}/transform.ts +2 -2
  63. package/src/lib/{geojson-tiler → vector-tiler}/wrap.ts +5 -5
  64. package/src/mvt-loader.ts +14 -6
  65. package/src/mvt-source.ts +9 -10
  66. package/src/table-tile-source.ts +508 -0
  67. package/dist/helpers/binary-util-functions.d.ts +0 -35
  68. package/dist/helpers/binary-util-functions.d.ts.map +0 -1
  69. package/dist/helpers/binary-util-functions.js +0 -114
  70. package/dist/helpers/mapbox-util-functions.d.ts +0 -29
  71. package/dist/helpers/mapbox-util-functions.d.ts.map +0 -1
  72. package/dist/helpers/mapbox-util-functions.js +0 -78
  73. package/dist/lib/binary-vector-tile/vector-tile-feature.d.ts +0 -41
  74. package/dist/lib/binary-vector-tile/vector-tile-feature.d.ts.map +0 -1
  75. package/dist/lib/binary-vector-tile/vector-tile-feature.js +0 -163
  76. package/dist/lib/binary-vector-tile/vector-tile-layer.d.ts +0 -23
  77. package/dist/lib/binary-vector-tile/vector-tile-layer.d.ts.map +0 -1
  78. package/dist/lib/binary-vector-tile/vector-tile-layer.js +0 -96
  79. package/dist/lib/binary-vector-tile/vector-tile.d.ts +0 -9
  80. package/dist/lib/binary-vector-tile/vector-tile.d.ts.map +0 -1
  81. package/dist/lib/binary-vector-tile/vector-tile.js +0 -27
  82. package/dist/lib/geojson-tiler/clip.d.ts.map +0 -1
  83. package/dist/lib/geojson-tiler/convert.d.ts +0 -10
  84. package/dist/lib/geojson-tiler/convert.d.ts.map +0 -1
  85. package/dist/lib/geojson-tiler/feature.d.ts +0 -3
  86. package/dist/lib/geojson-tiler/feature.d.ts.map +0 -1
  87. package/dist/lib/geojson-tiler/geojson-tiler.d.ts +0 -44
  88. package/dist/lib/geojson-tiler/geojson-tiler.d.ts.map +0 -1
  89. package/dist/lib/geojson-tiler/geojson-tiler.js +0 -209
  90. package/dist/lib/geojson-tiler/simplify.d.ts.map +0 -1
  91. package/dist/lib/geojson-tiler/tile.d.ts.map +0 -1
  92. package/dist/lib/geojson-tiler/transform.d.ts +0 -7
  93. package/dist/lib/geojson-tiler/transform.d.ts.map +0 -1
  94. package/dist/lib/geojson-tiler/wrap.d.ts.map +0 -1
  95. package/dist/lib/mapbox-vector-tile/vector-tile-feature.d.ts +0 -27
  96. package/dist/lib/mapbox-vector-tile/vector-tile-feature.d.ts.map +0 -1
  97. package/dist/lib/mapbox-vector-tile/vector-tile-feature.js +0 -178
  98. package/dist/lib/mapbox-vector-tile/vector-tile-layer.d.ts.map +0 -1
  99. package/dist/lib/mapbox-vector-tile/vector-tile.d.ts.map +0 -1
  100. package/src/helpers/binary-util-functions.ts +0 -125
  101. package/src/helpers/mapbox-util-functions.ts +0 -82
  102. package/src/lib/binary-vector-tile/vector-tile-feature.ts +0 -203
  103. package/src/lib/binary-vector-tile/vector-tile-layer.ts +0 -113
  104. package/src/lib/binary-vector-tile/vector-tile.ts +0 -36
  105. package/src/lib/geojson-tiler/geojson-tiler.ts +0 -283
  106. package/src/lib/mapbox-vector-tile/LICENSE.txt +0 -31
  107. package/src/lib/mapbox-vector-tile/vector-tile-feature.ts +0 -207
  108. /package/dist/lib/{mapbox-vector-tile → vector-tile}/vector-tile.d.ts +0 -0
  109. /package/dist/lib/{mapbox-vector-tile → vector-tile}/vector-tile.js +0 -0
  110. /package/dist/lib/{geojson-tiler → vector-tiler}/clip.js +0 -0
  111. /package/dist/lib/{geojson-tiler → vector-tiler}/feature.js +0 -0
  112. /package/dist/lib/{geojson-tiler → vector-tiler}/simplify.d.ts +0 -0
  113. /package/dist/lib/{geojson-tiler → vector-tiler}/simplify.js +0 -0
  114. /package/dist/lib/{geojson-tiler → vector-tiler}/tile.js +0 -0
  115. /package/dist/lib/{geojson-tiler → vector-tiler}/transform.js +0 -0
  116. /package/dist/lib/{geojson-tiler → vector-tiler}/wrap.js +0 -0
  117. /package/src/lib/{binary-vector-tile → vector-tile}/LICENSE.txt +0 -0
  118. /package/src/lib/{mapbox-vector-tile → vector-tile}/vector-tile.ts +0 -0
  119. /package/src/lib/{geojson-tiler → vector-tiler}/LICENSE +0 -0
  120. /package/src/lib/{geojson-tiler → 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 { GeoJSONTilerOptions } from "./lib/geojson-tiler/geojson-tiler.js";
8
- export { GeoJSONTiler } from "./lib/geojson-tiler/geojson-tiler.js";
7
+ export type { TableTileSourceProps } from "./table-tile-source.js";
8
+ export { TableTileSource } from "./table-tile-source.js";
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -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,mBAAmB,EAAC,6CAA0C;AAC3E,OAAO,EAAC,YAAY,EAAC,6CAA0C"}
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 { GeoJSONTiler } from "./lib/geojson-tiler/geojson-tiler.js";
7
+ export { TableTileSource } from "./table-tile-source.js";
@@ -1,4 +1,5 @@
1
- import type { Feature, BinaryFeatureCollection, GeoJSONTable } from '@loaders.gl/schema';
1
+ import type { Feature } from '@loaders.gl/schema';
2
+ import type { GeoJSONTable, BinaryFeatureCollection } from '@loaders.gl/schema';
2
3
  import type { MVTLoaderOptions } from "../mvt-loader.js";
3
4
  /**
4
5
  * Parse MVT arrayBuffer and return GeoJSON.
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"parse-mvt.d.ts","sourceRoot":"","sources":["../../src/lib/parse-mvt.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAc,OAAO,EAAsB,MAAM,oBAAoB,CAAC;AAClF,OAAO,KAAK,EAAC,YAAY,EAAE,uBAAuB,EAAC,MAAM,oBAAoB,CAAC;AAQ9E,OAAO,KAAK,EAAC,gBAAgB,EAAC,yBAAsB;AAGpD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,gBAAgB;;;EAyB5E"}
@@ -2,9 +2,9 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright vis.gl contributors
4
4
  import { flatGeojsonToBinary } from '@loaders.gl/gis';
5
+ import { log } from '@loaders.gl/loader-utils';
5
6
  import Protobuf from 'pbf';
6
- import { VectorTile } from "./mapbox-vector-tile/vector-tile.js";
7
- import { BinaryVectorTile } from "./binary-vector-tile/vector-tile.js";
7
+ import { VectorTile } from "./vector-tile/vector-tile.js";
8
8
  /**
9
9
  * Parse MVT arrayBuffer and return GeoJSON.
10
10
  *
@@ -13,7 +13,7 @@ import { BinaryVectorTile } from "./binary-vector-tile/vector-tile.js";
13
13
  * @returns A GeoJSON geometry object or a binary representation
14
14
  */
15
15
  export function parseMVT(arrayBuffer, options) {
16
- const mvtOptions = normalizeOptions(options);
16
+ const mvtOptions = checkOptions(options);
17
17
  const shape = options?.gis?.format || options?.mvt?.shape || options?.shape;
18
18
  switch (shape) {
19
19
  case 'columnar-table': // binary + some JS arrays
@@ -62,7 +62,7 @@ function parseToFlatGeoJson(arrayBuffer, options) {
62
62
  if (arrayBuffer.byteLength <= 0) {
63
63
  return [features, geometryInfo];
64
64
  }
65
- const tile = new BinaryVectorTile(new Protobuf(arrayBuffer));
65
+ const tile = new VectorTile(new Protobuf(arrayBuffer));
66
66
  const selectedLayers = options && Array.isArray(options.layers) ? options.layers : Object.keys(tile.layers);
67
67
  selectedLayers.forEach((layerName) => {
68
68
  const vectorTileLayer = tile.layers[layerName];
@@ -70,7 +70,7 @@ function parseToFlatGeoJson(arrayBuffer, options) {
70
70
  return;
71
71
  }
72
72
  for (let i = 0; i < vectorTileLayer.length; i++) {
73
- const vectorTileFeature = vectorTileLayer.feature(i, geometryInfo);
73
+ const vectorTileFeature = vectorTileLayer.getBinaryFeature(i, geometryInfo);
74
74
  const decodedFeature = getDecodedFeatureBinary(vectorTileFeature, options, layerName);
75
75
  features.push(decodedFeature);
76
76
  }
@@ -90,27 +90,24 @@ function parseToGeojsonFeatures(arrayBuffer, options) {
90
90
  return;
91
91
  }
92
92
  for (let i = 0; i < vectorTileLayer.length; i++) {
93
- const vectorTileFeature = vectorTileLayer.feature(i);
93
+ const vectorTileFeature = vectorTileLayer.getGeoJSONFeature(i);
94
94
  const decodedFeature = getDecodedFeature(vectorTileFeature, options, layerName);
95
95
  features.push(decodedFeature);
96
96
  }
97
97
  });
98
98
  return features;
99
99
  }
100
- function normalizeOptions(options) {
100
+ /** Check that options are good */
101
+ function checkOptions(options) {
101
102
  if (!options?.mvt) {
102
103
  throw new Error('mvt options required');
103
104
  }
104
- // Validate
105
- const wgs84Coordinates = options.mvt?.coordinates === 'wgs84';
106
- const { tileIndex } = options.mvt;
107
- const hasTileIndex = tileIndex &&
108
- Number.isFinite(tileIndex.x) &&
109
- Number.isFinite(tileIndex.y) &&
110
- Number.isFinite(tileIndex.z);
111
- if (wgs84Coordinates && !hasTileIndex) {
105
+ if (options.mvt?.coordinates === 'wgs84' && !options.mvt.tileIndex) {
112
106
  throw new Error('MVT Loader: WGS84 coordinates need tileIndex property');
113
107
  }
108
+ if (options.gis) {
109
+ log.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')();
110
+ }
114
111
  return options.mvt;
115
112
  }
116
113
  /**
@@ -119,11 +116,10 @@ function normalizeOptions(options) {
119
116
  * @returns decoded feature
120
117
  */
121
118
  function getDecodedFeature(feature, options, layerName) {
122
- const decodedFeature = feature.toGeoJSON(
123
- // @ts-expect-error What is going on here?
124
- options.coordinates === 'wgs84' ? options.tileIndex : transformToLocalCoordinates);
119
+ const decodedFeature = feature.toGeoJSONFeature(options.coordinates || 'local', options.tileIndex);
125
120
  // Add layer name to GeoJSON properties
126
121
  if (options.layerProperty) {
122
+ decodedFeature.properties ||= {};
127
123
  decodedFeature.properties[options.layerProperty] = layerName;
128
124
  }
129
125
  return decodedFeature;
@@ -134,36 +130,10 @@ function getDecodedFeature(feature, options, layerName) {
134
130
  * @returns decoded binary feature
135
131
  */
136
132
  function getDecodedFeatureBinary(feature, options, layerName) {
137
- const decodedFeature = feature.toBinaryCoordinates(
138
- // @ts-expect-error
139
- options.coordinates === 'wgs84' ? options.tileIndex : transformToLocalCoordinatesBinary);
133
+ const decodedFeature = feature.toBinaryFeature(options.coordinates || 'local', options.tileIndex);
140
134
  // Add layer name to GeoJSON properties
141
135
  if (options.layerProperty && decodedFeature.properties) {
142
136
  decodedFeature.properties[options.layerProperty] = layerName;
143
137
  }
144
138
  return decodedFeature;
145
139
  }
146
- /**
147
- * @param line
148
- * @param feature
149
- */
150
- function transformToLocalCoordinates(line, feature) {
151
- // This function transforms local coordinates in a
152
- // [0 - bufferSize, this.extent + bufferSize] range to a
153
- // [0 - (bufferSize / this.extent), 1 + (bufferSize / this.extent)] range.
154
- // The resulting extent would be 1.
155
- const { extent } = feature;
156
- for (let i = 0; i < line.length; i++) {
157
- const p = line[i];
158
- p[0] /= extent;
159
- p[1] /= extent;
160
- }
161
- }
162
- function transformToLocalCoordinatesBinary(data, feature) {
163
- // For the binary code path, the feature data is just
164
- // one big flat array, so we just divide each value
165
- const { extent } = feature;
166
- for (let i = 0, il = data.length; i < il; ++i) {
167
- data[i] /= extent;
168
- }
169
- }
@@ -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,yEA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,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"}
@@ -1,41 +1,4 @@
1
- /** For local coordinates, the tileIndex is not required */
2
- type MVTLocalCoordinatesOptions = {
3
- /**
4
- * When set to `local`, the parser will return a flat array of GeoJSON objects with local coordinates decoded from tile origin.
5
- */
6
- coordinates: 'local';
7
- tileIndex: null;
8
- };
9
- /** In WGS84 coordinates, the tileIndex is required */
10
- type MVTWgs84CoordinatesOptions = {
11
- /**
12
- * When set to `wgs84`, the parser will return a flat array of GeoJSON objects with coordinates in longitude, latitude decoded from the provided tile index.
13
- */
14
- coordinates?: 'wgs84';
15
- /**
16
- * Mandatory with `wgs84` coordinates option. An object containing tile index values (`x`, `y`,
17
- * `z`) to reproject features' coordinates into WGS84.
18
- */
19
- tileIndex?: {
20
- x: number;
21
- y: number;
22
- z: number;
23
- };
24
- };
25
- export type MVTOptions = (MVTLocalCoordinatesOptions | MVTWgs84CoordinatesOptions) & {
26
- shape?: 'geojson-table' | 'columnar-table' | 'geojson' | 'binary' | 'binary-geometry';
27
- /**
28
- * When non-`null`, the layer name of each feature is added to
29
- * `feature.properties[layerProperty]`. (A `feature.properties` object is created if the feature
30
- * has no existing properties). If set to `null`, a layer name property will not be added.
31
- */
32
- layerProperty?: string | number;
33
- /**
34
- * Optional list of layer names. If not `null`, only features belonging to the named layers will
35
- * be included in the output. If `null`, features from all layers are returned.
36
- */
37
- layers?: string[];
38
- };
1
+ /** TODO where is this used? */
39
2
  export type MVTMapboxGeometry = {
40
3
  type?: string;
41
4
  id?: number;
@@ -53,5 +16,4 @@ export type MVTMapboxCoordinates = {
53
16
  };
54
17
  id?: number;
55
18
  };
56
- export {};
57
19
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAIA,+BAA+B;AAC/B,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"}
@@ -0,0 +1,83 @@
1
+ import { FlatIndexedGeometry, FlatPolygon } from '@loaders.gl/schema';
2
+ /**
3
+ *
4
+ * @param ring
5
+ * @returns sum
6
+ */
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;
24
+ /**
25
+ * Projects local tile coordinates to lngLat in place.
26
+ * @param points
27
+ * @param tileIndex
28
+ */
29
+ export declare function projectToLngLat(line: number[] | number[][] | number[][][], tileIndex: {
30
+ x: number;
31
+ y: number;
32
+ z: number;
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
+ */
55
+ /**
56
+ *
57
+ * @param data
58
+ * @param x0
59
+ * @param y0
60
+ * @param size
61
+ */
62
+ export declare function projectToLngLatFlat(data: number[], tileIndex: {
63
+ x: number;
64
+ y: number;
65
+ z: number;
66
+ }, extent: number): void;
67
+ /**
68
+ * Classifies an array of rings into polygons with outer rings and holes
69
+ * @param rings
70
+ * @returns polygons
71
+ */
72
+ export declare function classifyRings(rings: number[][][]): number[][][][];
73
+ /**
74
+ * Classifies an array of rings into polygons with outer rings and holes
75
+ * The function also detects holes which have zero area and
76
+ * removes them. In doing so it modifies the input
77
+ * `geom.data` array to remove the unneeded data
78
+ *
79
+ * @param geometry
80
+ * @returns object
81
+ */
82
+ export declare function classifyRingsFlat(geom: FlatIndexedGeometry): FlatPolygon;
83
+ //# sourceMappingURL=geometry-utils.d.ts.map
@@ -0,0 +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,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8
+ * @returns sum
9
+ */
10
+ export function signedArea(ring) {
11
+ let sum = 0;
12
+ for (let i = 0, j = ring.length - 1, p1, p2; i < ring.length; j = i++) {
13
+ p1 = ring[i];
14
+ p2 = ring[j];
15
+ sum += (p2[0] - p1[0]) * (p1[1] + p2[1]);
16
+ }
17
+ return sum;
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
+ }
50
+ /**
51
+ * Projects local tile coordinates to lngLat in place.
52
+ * @param points
53
+ * @param tileIndex
54
+ */
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];
68
+ p[0] = ((p[0] + x0) * 360) / size - 180;
69
+ const y2 = 180 - ((p[1] + y0) * 360) / size;
70
+ p[1] = (360 / Math.PI) * Math.atan(Math.exp((y2 * Math.PI) / 180)) - 90;
71
+ }
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
+ */
94
+ /**
95
+ *
96
+ * @param data
97
+ * @param x0
98
+ * @param y0
99
+ * @param size
100
+ */
101
+ export function projectToLngLatFlat(data, tileIndex, extent) {
102
+ const { x, y, z } = tileIndex;
103
+ const size = extent * Math.pow(2, z);
104
+ const x0 = extent * x;
105
+ const y0 = extent * y;
106
+ for (let j = 0, jl = data.length; j < jl; j += 2) {
107
+ data[j] = ((data[j] + x0) * 360) / size - 180;
108
+ const y2 = 180 - ((data[j + 1] + y0) * 360) / size;
109
+ data[j + 1] = (360 / Math.PI) * Math.atan(Math.exp((y2 * Math.PI) / 180)) - 90;
110
+ }
111
+ }
112
+ /**
113
+ * Classifies an array of rings into polygons with outer rings and holes
114
+ * @param rings
115
+ * @returns polygons
116
+ */
117
+ export function classifyRings(rings) {
118
+ const len = rings.length;
119
+ if (len <= 1)
120
+ return [rings];
121
+ const polygons = [];
122
+ let polygon;
123
+ let ccw;
124
+ for (let i = 0; i < len; i++) {
125
+ const area = signedArea(rings[i]);
126
+ if (area === 0)
127
+ continue; // eslint-disable-line no-continue
128
+ if (ccw === undefined)
129
+ ccw = area < 0;
130
+ if (ccw === area < 0) {
131
+ if (polygon)
132
+ polygons.push(polygon);
133
+ polygon = [rings[i]];
134
+ }
135
+ else if (polygon)
136
+ polygon.push(rings[i]);
137
+ }
138
+ if (polygon)
139
+ polygons.push(polygon);
140
+ return polygons;
141
+ }
142
+ /**
143
+ * Classifies an array of rings into polygons with outer rings and holes
144
+ * The function also detects holes which have zero area and
145
+ * removes them. In doing so it modifies the input
146
+ * `geom.data` array to remove the unneeded data
147
+ *
148
+ * @param geometry
149
+ * @returns object
150
+ */
151
+ // eslint-disable-next-line max-statements
152
+ export function classifyRingsFlat(geom) {
153
+ const len = geom.indices.length;
154
+ const type = 'Polygon';
155
+ if (len <= 1) {
156
+ return {
157
+ type,
158
+ data: geom.data,
159
+ areas: [[getPolygonSignedArea(geom.data)]],
160
+ indices: [geom.indices]
161
+ };
162
+ }
163
+ const areas = [];
164
+ const polygons = [];
165
+ let ringAreas = [];
166
+ let polygon = [];
167
+ let ccw;
168
+ let offset = 0;
169
+ for (let endIndex, i = 0, startIndex; i < len; i++) {
170
+ startIndex = geom.indices[i] - offset;
171
+ endIndex = geom.indices[i + 1] - offset || geom.data.length;
172
+ const shape = geom.data.slice(startIndex, endIndex);
173
+ const area = getPolygonSignedArea(shape);
174
+ if (area === 0) {
175
+ // This polygon has no area, so remove it from the shape
176
+ // Remove the section from the data array
177
+ const before = geom.data.slice(0, startIndex);
178
+ const after = geom.data.slice(endIndex);
179
+ geom.data = before.concat(after);
180
+ // Need to offset any remaining indices as we have
181
+ // modified the data buffer
182
+ offset += endIndex - startIndex;
183
+ // Do not add this index to the output and process next shape
184
+ continue; // eslint-disable-line no-continue
185
+ }
186
+ if (ccw === undefined)
187
+ ccw = area < 0;
188
+ if (ccw === area < 0) {
189
+ if (polygon.length) {
190
+ areas.push(ringAreas);
191
+ polygons.push(polygon);
192
+ }
193
+ polygon = [startIndex];
194
+ ringAreas = [area];
195
+ }
196
+ else {
197
+ ringAreas.push(area);
198
+ polygon.push(startIndex);
199
+ }
200
+ }
201
+ if (ringAreas)
202
+ areas.push(ringAreas);
203
+ if (polygon.length)
204
+ polygons.push(polygon);
205
+ return { type, areas, indices: polygons, data: geom.data };
206
+ }
@@ -0,0 +1,72 @@
1
+ import { Feature } from '@loaders.gl/schema';
2
+ import { FlatFeature, FlatIndexedGeometry, GeojsonGeometryInfo } from '@loaders.gl/schema';
3
+ import Protobuf from 'pbf';
4
+ export declare class VectorTileFeature {
5
+ properties: {
6
+ [x: string]: string | number | boolean | null;
7
+ };
8
+ extent: any;
9
+ type: number;
10
+ id: number | null;
11
+ _pbf: Protobuf;
12
+ _geometry: number;
13
+ _keys: string[];
14
+ _values: (string | number | boolean | null)[];
15
+ _geometryInfo: GeojsonGeometryInfo;
16
+ static types: Readonly<string[]>;
17
+ constructor(pbf: Protobuf, end: number, extent: any, keys: string[], values: (string | number | boolean | null)[], geometryInfo?: GeojsonGeometryInfo);
18
+ toGeoJSONFeature(coordinates: 'wgs84' | 'local', tileIndex?: {
19
+ x: number;
20
+ y: number;
21
+ z: number;
22
+ }): Feature;
23
+ /**
24
+ *
25
+ * @param options
26
+ * @returns
27
+ */
28
+ toBinaryFeature(coordinates: 'wgs84' | 'local', tileIndex?: {
29
+ x: number;
30
+ y: number;
31
+ z: number;
32
+ }): FlatFeature;
33
+ /** Read a bounding box from the feature */
34
+ bbox(): number[];
35
+ /**
36
+ *
37
+ * @param transform
38
+ * @returns result
39
+ */
40
+ _toBinaryCoordinates(geom: FlatIndexedGeometry, transform: (data: number[], extent: number) => void): {
41
+ type: "Feature";
42
+ geometry: import("@loaders.gl/schema").FlatGeometry;
43
+ id?: string | number | undefined;
44
+ properties: import("geojson").GeoJsonProperties;
45
+ bbox?: import("geojson").BBox | undefined;
46
+ };
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
+ */
70
+ loadFlatGeometry(): FlatIndexedGeometry;
71
+ }
72
+ //# sourceMappingURL=vector-tile-feature.d.ts.map
@@ -0,0 +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;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,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;IAEnC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAiD;gBAI/E,GAAG,EAAE,QAAQ,EACb,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,GAAG,EACX,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE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