@loaders.gl/mvt 4.0.0-beta.3 → 4.0.0-beta.4

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 CHANGED
@@ -1522,10 +1522,7 @@ var __exports__ = (() => {
1522
1522
  const nextIndices = geometry.indices[l + 1];
1523
1523
  for (let i2 = 0, il = indices.length; i2 < il; ++i2) {
1524
1524
  const start = indices[i2];
1525
- const end = i2 === il - 1 ? (
1526
- // last line, so either read to:
1527
- nextIndices === void 0 ? geometry.data.length : nextIndices[0]
1528
- ) : indices[i2 + 1];
1525
+ const end = i2 === il - 1 ? nextIndices === void 0 ? geometry.data.length : nextIndices[0] : indices[i2 + 1];
1529
1526
  polygons.primitivePolygonIndices[indexMap.polygonRing++] = indexMap.polygonPosition;
1530
1527
  indexMap.polygonPosition += (end - start) / coordLength;
1531
1528
  }
@@ -1627,7 +1624,6 @@ var __exports__ = (() => {
1627
1624
  },
1628
1625
  numericProps: wrapProps(polygons.numericProps, 1)
1629
1626
  }
1630
- // triangles not expected
1631
1627
  };
1632
1628
  if (binaryFeatures.polygons && polygons.triangles) {
1633
1629
  binaryFeatures.polygons.triangles = {
@@ -1735,7 +1731,6 @@ var __exports__ = (() => {
1735
1731
  this._values = values;
1736
1732
  pbf.readFields(readFeature, this, end);
1737
1733
  }
1738
- // eslint-disable-next-line complexity, max-statements
1739
1734
  loadGeometry() {
1740
1735
  const pbf = this._pbf;
1741
1736
  pbf.pos = this._geometry;
@@ -1775,7 +1770,6 @@ var __exports__ = (() => {
1775
1770
  lines.push(line);
1776
1771
  return lines;
1777
1772
  }
1778
- // eslint-disable-next-line max-statements
1779
1773
  bbox() {
1780
1774
  const pbf = this._pbf;
1781
1775
  pbf.pos = this._geometry;
@@ -1896,11 +1890,6 @@ var __exports__ = (() => {
1896
1890
  pbf.readFields(readLayer, this, end);
1897
1891
  this.length = this._features.length;
1898
1892
  }
1899
- /**
1900
- * return feature `i` from this layer as a `VectorTileFeature`
1901
- * @param index
1902
- * @returns feature
1903
- */
1904
1893
  feature(i2) {
1905
1894
  if (i2 < 0 || i2 >= this._features.length) {
1906
1895
  throw new Error("feature index out of bounds");
@@ -2045,7 +2034,6 @@ var __exports__ = (() => {
2045
2034
  var y;
2046
2035
  var i;
2047
2036
  var VectorTileFeature2 = class {
2048
- // eslint-disable-next-line max-params
2049
2037
  constructor(pbf, end, extent, keys, values, geometryInfo) {
2050
2038
  this.properties = {};
2051
2039
  this.extent = extent;
@@ -2058,7 +2046,6 @@ var __exports__ = (() => {
2058
2046
  this._geometryInfo = geometryInfo;
2059
2047
  pbf.readFields(readFeature2, this, end);
2060
2048
  }
2061
- // eslint-disable-next-line complexity, max-statements
2062
2049
  loadGeometry() {
2063
2050
  const pbf = this._pbf;
2064
2051
  pbf.pos = this._geometry;
@@ -2100,11 +2087,6 @@ var __exports__ = (() => {
2100
2087
  indices
2101
2088
  };
2102
2089
  }
2103
- /**
2104
- *
2105
- * @param transform
2106
- * @returns result
2107
- */
2108
2090
  _toBinaryCoordinates(transform) {
2109
2091
  const geom = this.loadGeometry();
2110
2092
  let geometry;
@@ -2180,13 +2162,6 @@ var __exports__ = (() => {
2180
2162
  pbf.readFields(readLayer2, this, end);
2181
2163
  this.length = this._features.length;
2182
2164
  }
2183
- /**
2184
- * return feature `i` from this layer as a `VectorTileFeature`
2185
- *
2186
- * @param index
2187
- * @param geometryInfo
2188
- * @returns {VectorTileFeature}
2189
- */
2190
2165
  feature(i2, geometryInfo) {
2191
2166
  if (i2 < 0 || i2 >= this._features.length) {
2192
2167
  throw new Error("feature index out of bounds");
@@ -2340,20 +2315,14 @@ var __exports__ = (() => {
2340
2315
  return options.mvt;
2341
2316
  }
2342
2317
  function getDecodedFeature(feature, options, layerName) {
2343
- const decodedFeature = feature.toGeoJSON(
2344
- // @ts-expect-error What is going on here?
2345
- options.coordinates === "wgs84" ? options.tileIndex : transformToLocalCoordinates
2346
- );
2318
+ const decodedFeature = feature.toGeoJSON(options.coordinates === "wgs84" ? options.tileIndex : transformToLocalCoordinates);
2347
2319
  if (options.layerProperty) {
2348
2320
  decodedFeature.properties[options.layerProperty] = layerName;
2349
2321
  }
2350
2322
  return decodedFeature;
2351
2323
  }
2352
2324
  function getDecodedFeatureBinary(feature, options, layerName) {
2353
- const decodedFeature = feature.toBinaryCoordinates(
2354
- // @ts-expect-error What is going on here?
2355
- options.coordinates === "wgs84" ? options.tileIndex : transformToLocalCoordinatesBinary
2356
- );
2325
+ const decodedFeature = feature.toBinaryCoordinates(options.coordinates === "wgs84" ? options.tileIndex : transformToLocalCoordinatesBinary);
2357
2326
  if (options.layerProperty && decodedFeature.properties) {
2358
2327
  decodedFeature.properties[options.layerProperty] = layerName;
2359
2328
  }
@@ -2385,14 +2354,8 @@ var __exports__ = (() => {
2385
2354
  id: "mvt",
2386
2355
  module: "mvt",
2387
2356
  version: VERSION,
2388
- // Note: ArcGIS uses '.pbf' extension and 'application/octet-stream'
2389
2357
  extensions: ["mvt", "pbf"],
2390
- mimeTypes: [
2391
- // https://www.iana.org/assignments/media-types/application/vnd.mapbox-vector-tile
2392
- "application/vnd.mapbox-vector-tile",
2393
- "application/x-protobuf"
2394
- // 'application/octet-stream'
2395
- ],
2358
+ mimeTypes: ["application/vnd.mapbox-vector-tile", "application/x-protobuf"],
2396
2359
  worker: true,
2397
2360
  category: "geometry",
2398
2361
  options: {
@@ -2556,8 +2519,6 @@ var __exports__ = (() => {
2556
2519
  const fieldTypes = attributeTypeToFieldType(attribute.type);
2557
2520
  return {
2558
2521
  name: attribute.attribute,
2559
- // what happens if attribute type is string...
2560
- // filterProps: getFilterProps(fieldTypes.type, attribute),
2561
2522
  ...fieldTypes
2562
2523
  };
2563
2524
  }
@@ -2613,10 +2574,7 @@ var __exports__ = (() => {
2613
2574
  var window_ = globals.window || globals.self || globals.global || {};
2614
2575
  var global_ = globals.global || globals.self || globals.window || {};
2615
2576
  var document_ = globals.document || {};
2616
- var isBrowser = (
2617
- // @ts-ignore process does not exist on browser
2618
- Boolean(typeof process !== "object" || String(process) !== "[object process]" || process.browser)
2619
- );
2577
+ var isBrowser = Boolean(typeof process !== "object" || String(process) !== "[object process]" || process.browser);
2620
2578
  var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
2621
2579
  var nodeVersion = matches && parseFloat(matches[1]) || 0;
2622
2580
 
@@ -2638,8 +2596,6 @@ var __exports__ = (() => {
2638
2596
 
2639
2597
  // ../loader-utils/src/lib/sources/data-source.ts
2640
2598
  var DataSource = class {
2641
- /** A resolved fetch function extracted from loadOptions prop */
2642
- /** The actual load options, if calling a loaders.gl loader */
2643
2599
  _needsRefresh = true;
2644
2600
  constructor(props) {
2645
2601
  this.props = {
@@ -2654,14 +2610,9 @@ var __exports__ = (() => {
2654
2610
  this.props = Object.assign(this.props, props);
2655
2611
  this.setNeedsRefresh();
2656
2612
  }
2657
- /** Mark this data source as needing a refresh (redraw) */
2658
2613
  setNeedsRefresh() {
2659
2614
  this._needsRefresh = true;
2660
2615
  }
2661
- /**
2662
- * Does this data source need refreshing?
2663
- * @note The specifics of the refresh mechanism depends on type of data source
2664
- */
2665
2616
  getNeedsRefresh(clear = true) {
2666
2617
  const needsRefresh = this._needsRefresh;
2667
2618
  if (clear) {
@@ -2686,12 +2637,10 @@ var __exports__ = (() => {
2686
2637
  var VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
2687
2638
 
2688
2639
  // ../images/src/lib/category-api/image-type.ts
2689
- var {
2690
- _parseImageNode
2691
- } = globalThis;
2640
+ var parseImageNode = globalThis.loaders?.parseImageNode;
2692
2641
  var IMAGE_SUPPORTED = typeof Image !== "undefined";
2693
2642
  var IMAGE_BITMAP_SUPPORTED = typeof ImageBitmap !== "undefined";
2694
- var NODE_IMAGE_SUPPORTED = Boolean(_parseImageNode);
2643
+ var NODE_IMAGE_SUPPORTED = Boolean(parseImageNode);
2695
2644
  var DATA_SUPPORTED = isBrowser ? true : NODE_IMAGE_SUPPORTED;
2696
2645
  function isImageTypeSupported(type) {
2697
2646
  switch (type) {
@@ -2908,7 +2857,6 @@ var __exports__ = (() => {
2908
2857
  }
2909
2858
  return {
2910
2859
  mimeType: mediaType.mimeType,
2911
- // TODO - decode width and height
2912
2860
  width: 0,
2913
2861
  height: 0
2914
2862
  };
@@ -2966,9 +2914,7 @@ var __exports__ = (() => {
2966
2914
  return {
2967
2915
  mimeType: "image/jpeg",
2968
2916
  height: dataView.getUint16(i2 + 5, BIG_ENDIAN),
2969
- // Number of lines
2970
2917
  width: dataView.getUint16(i2 + 7, BIG_ENDIAN)
2971
- // Number of pixels per line
2972
2918
  };
2973
2919
  }
2974
2920
  if (!tableMarkers.has(marker)) {
@@ -3008,9 +2954,9 @@ var __exports__ = (() => {
3008
2954
  const {
3009
2955
  mimeType
3010
2956
  } = getBinaryImageMetadata(arrayBuffer) || {};
3011
- const _parseImageNode2 = globalThis._parseImageNode;
3012
- assert(_parseImageNode2);
3013
- return await _parseImageNode2(arrayBuffer, mimeType);
2957
+ const parseImageNode2 = globalThis.loaders?.parseImageNode;
2958
+ assert(parseImageNode2);
2959
+ return await parseImageNode2(arrayBuffer, mimeType);
3014
2960
  }
3015
2961
 
3016
2962
  // ../images/src/lib/parsers/parse-image.ts
@@ -3059,9 +3005,7 @@ var __exports__ = (() => {
3059
3005
  image: {
3060
3006
  type: "auto",
3061
3007
  decode: true
3062
- // if format is HTML
3063
3008
  }
3064
- // imagebitmap: {} - passes (platform dependent) parameters to ImageBitmap constructor
3065
3009
  };
3066
3010
  var ImageLoader = {
3067
3011
  id: "image",
@@ -3071,7 +3015,6 @@ var __exports__ = (() => {
3071
3015
  mimeTypes: MIME_TYPES,
3072
3016
  extensions: EXTENSIONS,
3073
3017
  parse: parseImage,
3074
- // TODO: byteOffset, byteLength;
3075
3018
  tests: [(arrayBuffer) => Boolean(getBinaryImageMetadata(new DataView(arrayBuffer)))],
3076
3019
  options: DEFAULT_IMAGE_LOADER_OPTIONS
3077
3020
  };
@@ -3086,7 +3029,6 @@ var __exports__ = (() => {
3086
3029
  this.getTileData = this.getTileData.bind(this);
3087
3030
  this.metadata = this.getMetadata();
3088
3031
  }
3089
- // @ts-ignore - Metadata type misalignment
3090
3032
  async getMetadata() {
3091
3033
  const metadataUrl = this.getMetadataUrl();
3092
3034
  const response = await this.fetch(metadataUrl);
@@ -3111,8 +3053,6 @@ var __exports__ = (() => {
3111
3053
  const arrayBuffer = await response.arrayBuffer();
3112
3054
  return arrayBuffer;
3113
3055
  }
3114
- // Tile Source interface implementation: deck.gl compatible API
3115
- // TODO - currently only handles image tiles, not vector tiles
3116
3056
  async getTileData(tileParams) {
3117
3057
  const {
3118
3058
  x: x2,
@@ -3137,12 +3077,10 @@ var __exports__ = (() => {
3137
3077
  });
3138
3078
  }
3139
3079
  }
3140
- // ImageTileSource interface implementation
3141
3080
  async getImageTile(tileParams) {
3142
3081
  const arrayBuffer = await this.getTile(tileParams);
3143
3082
  return arrayBuffer ? await ImageLoader.parse(arrayBuffer, this.loadOptions) : null;
3144
3083
  }
3145
- // VectorTileSource interface implementation
3146
3084
  async getVectorTile(tileParams) {
3147
3085
  const arrayBuffer = await this.getTile(tileParams);
3148
3086
  const loadOptions = {
@@ -3226,7 +3164,6 @@ var __exports__ = (() => {
3226
3164
  // src/lib/geojson-tiler/feature.ts
3227
3165
  function createFeature(id, type, geom, tags) {
3228
3166
  const feature = {
3229
- // eslint-disable-next-line
3230
3167
  id: id == null ? null : id,
3231
3168
  type,
3232
3169
  geometry: geom,
@@ -3739,29 +3676,17 @@ var __exports__ = (() => {
3739
3676
  // src/lib/geojson-tiler/geojson-tiler.ts
3740
3677
  var DEFAULT_OPTIONS = {
3741
3678
  maxZoom: 14,
3742
- // max zoom to preserve detail on
3743
3679
  indexMaxZoom: 5,
3744
- // max zoom in the tile index
3745
3680
  indexMaxPoints: 1e5,
3746
- // max number of points per tile in the tile index
3747
3681
  tolerance: 3,
3748
- // simplification tolerance (higher means simpler)
3749
3682
  extent: 4096,
3750
- // tile extent
3751
3683
  buffer: 64,
3752
- // tile buffer on each side
3753
3684
  lineMetrics: false,
3754
- // whether to calculate line metrics
3755
- // @ts-expect-error Ensures all these required params have defaults
3756
3685
  promoteId: void 0,
3757
- // name of a feature property to be promoted to feature.id
3758
3686
  generateId: false,
3759
- // whether to generate feature ids. Cannot be used with promoteId
3760
3687
  debug: 0
3761
- // logging level (0, 1 or 2)
3762
3688
  };
3763
3689
  var GeoJSONTiler = class {
3764
- // tiles and tileCoords are part of the public API
3765
3690
  tiles = {};
3766
3691
  tileCoords = [];
3767
3692
  stats = {};
@@ -3799,14 +3724,6 @@ var __exports__ = (() => {
3799
3724
  console.log("tiles generated:", this.total, JSON.stringify(this.stats));
3800
3725
  }
3801
3726
  }
3802
- /**
3803
- * Get a tile at the specified index
3804
- * @param z
3805
- * @param x
3806
- * @param y
3807
- * @returns
3808
- */
3809
- // eslint-disable-next-line complexity, max-statements
3810
3727
  getTile(z, x2, y2) {
3811
3728
  const {
3812
3729
  extent,
@@ -3846,15 +3763,6 @@ var __exports__ = (() => {
3846
3763
  }
3847
3764
  return this.tiles[id] ? transformTile(this.tiles[id], extent) : null;
3848
3765
  }
3849
- /**
3850
- * splits features from a parent tile to sub-tiles.
3851
- * @param z, x, and y are the coordinates of the parent tile
3852
- * @param cz, cx, and cy are the coordinates of the target tile
3853
- *
3854
- * If no target tile is specified, splitting stops when we reach the maximum
3855
- * zoom or the number of points is low as specified in the options.
3856
- */
3857
- // eslint-disable-next-line max-params, max-statements, complexity
3858
3766
  splitTile(features, z, x2, y2, cz, cx, cy) {
3859
3767
  const stack = [features, z, x2, y2];
3860
3768
  const options = this.options;
@@ -2302,7 +2302,7 @@
2302
2302
  }
2303
2303
 
2304
2304
  // src/mvt-loader.ts
2305
- var VERSION = true ? "4.0.0-beta.3" : "latest";
2305
+ var VERSION = true ? "4.0.0-beta.4" : "latest";
2306
2306
  var MVTWorkerLoader = {
2307
2307
  name: "Mapbox Vector Tile",
2308
2308
  id: "mvt",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@loaders.gl/mvt",
3
3
  "description": "Loader for Mapbox Vector Tiles",
4
- "version": "4.0.0-beta.3",
4
+ "version": "4.0.0-beta.4",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "publishConfig": {
@@ -40,15 +40,15 @@
40
40
  "build-worker": "esbuild src/workers/mvt-worker.ts --bundle --outfile=dist/mvt-worker.js --define:__VERSION__=\\\"$npm_package_version\\\""
41
41
  },
42
42
  "dependencies": {
43
- "@loaders.gl/gis": "4.0.0-beta.3",
44
- "@loaders.gl/images": "4.0.0-beta.3",
45
- "@loaders.gl/loader-utils": "4.0.0-beta.3",
46
- "@loaders.gl/schema": "4.0.0-beta.3",
43
+ "@loaders.gl/gis": "4.0.0-beta.4",
44
+ "@loaders.gl/images": "4.0.0-beta.4",
45
+ "@loaders.gl/loader-utils": "4.0.0-beta.4",
46
+ "@loaders.gl/schema": "4.0.0-beta.4",
47
47
  "@math.gl/polygon": "^4.0.0",
48
48
  "pbf": "^3.2.1"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/pbf": "^3.0.2"
52
52
  },
53
- "gitHead": "7ba9621cc51c7a26c407086ac86171f35b8712af"
53
+ "gitHead": "848c20b474532d301f2c3f8d4e1fb9bf262b86d4"
54
54
  }