@loaders.gl/tiles 5.0.0-alpha.12 → 5.0.0-alpha.13
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/LICENSE +1 -1
- package/README.md +18 -72
- package/dist/dist.dev.js +6979 -42928
- package/dist/dist.min.js +3 -22
- package/dist/image-set.d.ts +1 -1
- package/dist/image-set.d.ts.map +1 -1
- package/dist/index.cjs +2847 -8781
- package/dist/index.cjs.map +3 -4
- package/dist/index.d.ts +4 -45
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -27
- package/dist/index.js.map +1 -1
- package/dist/mlt/bundled.d.ts +3 -0
- package/dist/mlt/bundled.d.ts.map +1 -0
- package/dist/mlt/bundled.js +5 -0
- package/dist/mlt/bundled.js.map +1 -0
- package/dist/mlt/index.cjs +3701 -0
- package/dist/mlt/index.cjs.map +6 -0
- package/dist/mlt/index.d.ts +10 -0
- package/dist/mlt/index.d.ts.map +1 -0
- package/dist/mlt/index.js +12 -0
- package/dist/mlt/index.js.map +1 -0
- package/dist/mlt/lib/encode-mlt-geometry.d.ts +6 -0
- package/dist/mlt/lib/encode-mlt-geometry.d.ts.map +1 -0
- package/dist/mlt/lib/encode-mlt-geometry.js +150 -0
- package/dist/mlt/lib/encode-mlt-geometry.js.map +1 -0
- package/dist/mlt/lib/encode-mlt-streams.d.ts +13 -0
- package/dist/mlt/lib/encode-mlt-streams.d.ts.map +1 -0
- package/dist/mlt/lib/encode-mlt-streams.js +57 -0
- package/dist/mlt/lib/encode-mlt-streams.js.map +1 -0
- package/dist/mlt/lib/encode-mlt.d.ts +6 -0
- package/dist/mlt/lib/encode-mlt.d.ts.map +1 -0
- package/dist/mlt/lib/encode-mlt.js +174 -0
- package/dist/mlt/lib/encode-mlt.js.map +1 -0
- package/dist/mlt/lib/parse-mlt.d.ts +11 -0
- package/dist/mlt/lib/parse-mlt.d.ts.map +1 -0
- package/dist/mlt/lib/parse-mlt.js +675 -0
- package/dist/mlt/lib/parse-mlt.js.map +1 -0
- package/dist/mlt/mlt-format.d.ts +14 -0
- package/dist/mlt/mlt-format.d.ts.map +1 -0
- package/dist/mlt/mlt-format.js +17 -0
- package/dist/mlt/mlt-format.js.map +1 -0
- package/dist/mlt/mlt-loader-with-parser.d.ts +91 -0
- package/dist/mlt/mlt-loader-with-parser.d.ts.map +1 -0
- package/dist/mlt/mlt-loader-with-parser.js +29 -0
- package/dist/mlt/mlt-loader-with-parser.js.map +1 -0
- package/dist/mlt/mlt-loader.d.ts +115 -0
- package/dist/mlt/mlt-loader.d.ts.map +1 -0
- package/dist/mlt/mlt-loader.js +38 -0
- package/dist/mlt/mlt-loader.js.map +1 -0
- package/dist/mlt/mlt-source-loader.d.ts +82 -0
- package/dist/mlt/mlt-source-loader.d.ts.map +1 -0
- package/dist/mlt/mlt-source-loader.js +179 -0
- package/dist/mlt/mlt-source-loader.js.map +1 -0
- package/dist/mlt/mlt-writer.d.ts +45 -0
- package/dist/mlt/mlt-writer.d.ts.map +1 -0
- package/dist/mlt/mlt-writer.js +21 -0
- package/dist/mlt/mlt-writer.js.map +1 -0
- package/dist/mlt/unbundled.d.ts +3 -0
- package/dist/mlt/unbundled.d.ts.map +1 -0
- package/dist/mlt/unbundled.js +5 -0
- package/dist/mlt/unbundled.js.map +1 -0
- package/dist/mvt/arrow-table-tile-source-loader-types.d.ts +36 -0
- package/dist/mvt/arrow-table-tile-source-loader-types.d.ts.map +1 -0
- package/dist/mvt/arrow-table-tile-source-loader-types.js +36 -0
- package/dist/mvt/arrow-table-tile-source-loader-types.js.map +1 -0
- package/dist/mvt/arrow-table-tile-source-loader.cjs +6343 -0
- package/dist/mvt/arrow-table-tile-source-loader.cjs.map +6 -0
- package/dist/mvt/arrow-table-tile-source-loader.d.ts +69 -0
- package/dist/mvt/arrow-table-tile-source-loader.d.ts.map +1 -0
- package/dist/mvt/arrow-table-tile-source-loader.js +216 -0
- package/dist/mvt/arrow-table-tile-source-loader.js.map +1 -0
- package/dist/mvt/arrow-table-tile-source-types.d.ts +21 -0
- package/dist/mvt/arrow-table-tile-source-types.d.ts.map +1 -0
- package/dist/mvt/arrow-table-tile-source-types.js +6 -0
- package/dist/mvt/arrow-table-tile-source-types.js.map +1 -0
- package/dist/mvt/bundled.d.ts +6 -0
- package/dist/mvt/bundled.d.ts.map +1 -0
- package/dist/mvt/bundled.js +7 -0
- package/dist/mvt/bundled.js.map +1 -0
- package/dist/mvt/dist.dev.js +46689 -0
- package/dist/mvt/dist.min.js +94 -0
- package/dist/mvt/index.cjs +10095 -0
- package/dist/mvt/index.cjs.map +6 -0
- package/dist/mvt/index.d.ts +28 -0
- package/dist/mvt/index.d.ts.map +1 -0
- package/dist/mvt/index.js +27 -0
- package/dist/mvt/index.js.map +1 -0
- package/dist/mvt/lib/encode-mvt-arrow.d.ts +6 -0
- package/dist/mvt/lib/encode-mvt-arrow.d.ts.map +1 -0
- package/dist/mvt/lib/encode-mvt-arrow.js +225 -0
- package/dist/mvt/lib/encode-mvt-arrow.js.map +1 -0
- package/dist/mvt/lib/encode-mvt.d.ts +30 -0
- package/dist/mvt/lib/encode-mvt.d.ts.map +1 -0
- package/dist/mvt/lib/encode-mvt.js +20 -0
- package/dist/mvt/lib/encode-mvt.js.map +1 -0
- package/dist/mvt/lib/get-schemas-from-tilejson.d.ts +4 -0
- package/dist/mvt/lib/get-schemas-from-tilejson.d.ts.map +1 -0
- package/dist/mvt/lib/get-schemas-from-tilejson.js +56 -0
- package/dist/mvt/lib/get-schemas-from-tilejson.js.map +1 -0
- package/dist/mvt/lib/is-longitude-latitude-crs.d.ts +3 -0
- package/dist/mvt/lib/is-longitude-latitude-crs.d.ts.map +1 -0
- package/dist/mvt/lib/is-longitude-latitude-crs.js +13 -0
- package/dist/mvt/lib/is-longitude-latitude-crs.js.map +1 -0
- package/dist/mvt/lib/mapbox-vt-pbf/geojson-wrapper.d.ts +25 -0
- package/dist/mvt/lib/mapbox-vt-pbf/geojson-wrapper.d.ts.map +1 -0
- package/dist/mvt/lib/mapbox-vt-pbf/geojson-wrapper.js +73 -0
- package/dist/mvt/lib/mapbox-vt-pbf/geojson-wrapper.js.map +1 -0
- package/dist/mvt/lib/mapbox-vt-pbf/to-vector-tile.d.ts +52 -0
- package/dist/mvt/lib/mapbox-vt-pbf/to-vector-tile.d.ts.map +1 -0
- package/dist/mvt/lib/mapbox-vt-pbf/to-vector-tile.js +165 -0
- package/dist/mvt/lib/mapbox-vt-pbf/to-vector-tile.js.map +1 -0
- package/dist/mvt/lib/mvt-pbf/mvt-constants.d.ts +116 -0
- package/dist/mvt/lib/mvt-pbf/mvt-constants.d.ts.map +1 -0
- package/dist/mvt/lib/mvt-pbf/mvt-constants.js +127 -0
- package/dist/mvt/lib/mvt-pbf/mvt-constants.js.map +1 -0
- package/dist/mvt/lib/mvt-pbf/mvt-types.d.ts +17 -0
- package/dist/mvt/lib/mvt-pbf/mvt-types.d.ts.map +1 -0
- package/dist/mvt/lib/mvt-pbf/mvt-types.js +5 -0
- package/dist/mvt/lib/mvt-pbf/mvt-types.js.map +1 -0
- package/dist/mvt/lib/mvt-pbf/parse-geometry-from-pbf.d.ts +77 -0
- package/dist/mvt/lib/mvt-pbf/parse-geometry-from-pbf.d.ts.map +1 -0
- package/dist/mvt/lib/mvt-pbf/parse-geometry-from-pbf.js +235 -0
- package/dist/mvt/lib/mvt-pbf/parse-geometry-from-pbf.js.map +1 -0
- package/dist/mvt/lib/mvt-pbf/parse-mvt-from-pbf.d.ts +25 -0
- package/dist/mvt/lib/mvt-pbf/parse-mvt-from-pbf.d.ts.map +1 -0
- package/dist/mvt/lib/mvt-pbf/parse-mvt-from-pbf.js +263 -0
- package/dist/mvt/lib/mvt-pbf/parse-mvt-from-pbf.js.map +1 -0
- package/dist/mvt/lib/mvt-pbf/write-mvt-to-pbf.d.ts +4 -0
- package/dist/mvt/lib/mvt-pbf/write-mvt-to-pbf.d.ts.map +1 -0
- package/dist/mvt/lib/mvt-pbf/write-mvt-to-pbf.js +134 -0
- package/dist/mvt/lib/mvt-pbf/write-mvt-to-pbf.js.map +1 -0
- package/dist/mvt/lib/mvt-worker-transport.d.ts +15 -0
- package/dist/mvt/lib/mvt-worker-transport.d.ts.map +1 -0
- package/dist/mvt/lib/mvt-worker-transport.js +54 -0
- package/dist/mvt/lib/mvt-worker-transport.js.map +1 -0
- package/dist/mvt/lib/parse-mvt-geojson.d.ts +6 -0
- package/dist/mvt/lib/parse-mvt-geojson.d.ts.map +1 -0
- package/dist/mvt/lib/parse-mvt-geojson.js +48 -0
- package/dist/mvt/lib/parse-mvt-geojson.js.map +1 -0
- package/dist/mvt/lib/parse-mvt.d.ts +14 -0
- package/dist/mvt/lib/parse-mvt.d.ts.map +1 -0
- package/dist/mvt/lib/parse-mvt.js +105 -0
- package/dist/mvt/lib/parse-mvt.js.map +1 -0
- package/dist/mvt/lib/parse-tilejson.d.ts +74 -0
- package/dist/mvt/lib/parse-tilejson.d.ts.map +1 -0
- package/dist/mvt/lib/parse-tilejson.js +267 -0
- package/dist/mvt/lib/parse-tilejson.js.map +1 -0
- package/dist/mvt/lib/resolve-table-tile-parameters.d.ts +4 -0
- package/dist/mvt/lib/resolve-table-tile-parameters.d.ts.map +1 -0
- package/dist/mvt/lib/resolve-table-tile-parameters.js +16 -0
- package/dist/mvt/lib/resolve-table-tile-parameters.js.map +1 -0
- package/dist/mvt/lib/types.d.ts +88 -0
- package/dist/mvt/lib/types.d.ts.map +1 -0
- package/dist/mvt/lib/types.js.map +1 -0
- package/dist/mvt/lib/utils/geometry-utils.d.ts +83 -0
- package/dist/mvt/lib/utils/geometry-utils.d.ts.map +1 -0
- package/dist/mvt/lib/utils/geometry-utils.js +211 -0
- package/dist/mvt/lib/utils/geometry-utils.js.map +1 -0
- package/dist/mvt/lib/vector-tile/vector-tile-feature.d.ts +72 -0
- package/dist/mvt/lib/vector-tile/vector-tile-feature.d.ts.map +1 -0
- package/dist/mvt/lib/vector-tile/vector-tile-feature.js +350 -0
- package/dist/mvt/lib/vector-tile/vector-tile-feature.js.map +1 -0
- package/dist/mvt/lib/vector-tile/vector-tile-layer.d.ts +29 -0
- package/dist/mvt/lib/vector-tile/vector-tile-layer.d.ts.map +1 -0
- package/dist/mvt/lib/vector-tile/vector-tile-layer.js +108 -0
- package/dist/mvt/lib/vector-tile/vector-tile-layer.js.map +1 -0
- package/dist/mvt/lib/vector-tile/vector-tile.d.ts +9 -0
- package/dist/mvt/lib/vector-tile/vector-tile.d.ts.map +1 -0
- package/dist/mvt/lib/vector-tile/vector-tile.js +28 -0
- package/dist/mvt/lib/vector-tile/vector-tile.js.map +1 -0
- package/dist/mvt/lib/vector-tiler/arrow-tile.d.ts +6 -0
- package/dist/mvt/lib/vector-tiler/arrow-tile.d.ts.map +1 -0
- package/dist/mvt/lib/vector-tiler/arrow-tile.js +84 -0
- package/dist/mvt/lib/vector-tiler/arrow-tile.js.map +1 -0
- package/dist/mvt/lib/vector-tiler/features/clip-features.d.ts +16 -0
- package/dist/mvt/lib/vector-tiler/features/clip-features.d.ts.map +1 -0
- package/dist/mvt/lib/vector-tiler/features/clip-features.js +211 -0
- package/dist/mvt/lib/vector-tiler/features/clip-features.js.map +1 -0
- package/dist/mvt/lib/vector-tiler/features/convert-feature.d.ts +18 -0
- package/dist/mvt/lib/vector-tiler/features/convert-feature.d.ts.map +1 -0
- package/dist/mvt/lib/vector-tiler/features/convert-feature.js +161 -0
- package/dist/mvt/lib/vector-tiler/features/convert-feature.js.map +1 -0
- package/dist/mvt/lib/vector-tiler/features/proto-feature.d.ts +30 -0
- package/dist/mvt/lib/vector-tiler/features/proto-feature.d.ts.map +1 -0
- package/dist/mvt/lib/vector-tiler/features/proto-feature.js +53 -0
- package/dist/mvt/lib/vector-tiler/features/proto-feature.js.map +1 -0
- package/dist/mvt/lib/vector-tiler/features/simplify-path.d.ts +10 -0
- package/dist/mvt/lib/vector-tiler/features/simplify-path.d.ts.map +1 -0
- package/dist/mvt/lib/vector-tiler/features/simplify-path.js +67 -0
- package/dist/mvt/lib/vector-tiler/features/simplify-path.js.map +1 -0
- package/dist/mvt/lib/vector-tiler/features/wrap-features.d.ts +17 -0
- package/dist/mvt/lib/vector-tiler/features/wrap-features.d.ts.map +1 -0
- package/dist/mvt/lib/vector-tiler/features/wrap-features.js +95 -0
- package/dist/mvt/lib/vector-tiler/features/wrap-features.js.map +1 -0
- package/dist/mvt/lib/vector-tiler/proto-tile.d.ts +40 -0
- package/dist/mvt/lib/vector-tiler/proto-tile.d.ts.map +1 -0
- package/dist/mvt/lib/vector-tiler/proto-tile.js +139 -0
- package/dist/mvt/lib/vector-tiler/proto-tile.js.map +1 -0
- package/dist/mvt/lib/vector-tiler/tile-to-geojson.d.ts +12 -0
- package/dist/mvt/lib/vector-tiler/tile-to-geojson.d.ts.map +1 -0
- package/dist/mvt/lib/vector-tiler/tile-to-geojson.js +81 -0
- package/dist/mvt/lib/vector-tiler/tile-to-geojson.js.map +1 -0
- package/dist/mvt/lib/vector-tiler/transform-tile.d.ts +7 -0
- package/dist/mvt/lib/vector-tiler/transform-tile.d.ts.map +1 -0
- package/dist/mvt/lib/vector-tiler/transform-tile.js +42 -0
- package/dist/mvt/lib/vector-tiler/transform-tile.js.map +1 -0
- package/dist/mvt/map-style-format.d.ts +13 -0
- package/dist/mvt/map-style-format.d.ts.map +1 -0
- package/dist/mvt/map-style-format.js +16 -0
- package/dist/mvt/map-style-format.js.map +1 -0
- package/dist/mvt/map-style-loader-with-parser.d.ts +26 -0
- package/dist/mvt/map-style-loader-with-parser.d.ts.map +1 -0
- package/dist/mvt/map-style-loader-with-parser.js +38 -0
- package/dist/mvt/map-style-loader-with-parser.js.map +1 -0
- package/dist/mvt/map-style-loader.d.ts +44 -0
- package/dist/mvt/map-style-loader.d.ts.map +1 -0
- package/dist/mvt/map-style-loader.js +25 -0
- package/dist/mvt/map-style-loader.js.map +1 -0
- package/dist/mvt/map-style-schema.d.ts +58 -0
- package/dist/mvt/map-style-schema.d.ts.map +1 -0
- package/dist/mvt/map-style-schema.js +47 -0
- package/dist/mvt/map-style-schema.js.map +1 -0
- package/dist/mvt/map-style.d.ts +110 -0
- package/dist/mvt/map-style.d.ts.map +1 -0
- package/dist/mvt/map-style.js +90 -0
- package/dist/mvt/map-style.js.map +1 -0
- package/dist/mvt/mvt-format.d.ts +14 -0
- package/dist/mvt/mvt-format.d.ts.map +1 -0
- package/dist/mvt/mvt-format.js +23 -0
- package/dist/mvt/mvt-format.js.map +1 -0
- package/dist/mvt/mvt-geojson-loader-types.d.ts +82 -0
- package/dist/mvt/mvt-geojson-loader-types.d.ts.map +1 -0
- package/dist/mvt/mvt-geojson-loader-types.js +34 -0
- package/dist/mvt/mvt-geojson-loader-types.js.map +1 -0
- package/dist/mvt/mvt-geojson-loader.cjs +1366 -0
- package/dist/mvt/mvt-geojson-loader.cjs.map +6 -0
- package/dist/mvt/mvt-geojson-loader.d.ts +32 -0
- package/dist/mvt/mvt-geojson-loader.d.ts.map +1 -0
- package/dist/mvt/mvt-geojson-loader.js +13 -0
- package/dist/mvt/mvt-geojson-loader.js.map +1 -0
- package/dist/mvt/mvt-loader-with-parser.d.ts +105 -0
- package/dist/mvt/mvt-loader-with-parser.d.ts.map +1 -0
- package/dist/mvt/mvt-loader-with-parser.js +21 -0
- package/dist/mvt/mvt-loader-with-parser.js.map +1 -0
- package/dist/mvt/mvt-loader.d.ts +129 -0
- package/dist/mvt/mvt-loader.d.ts.map +1 -0
- package/dist/mvt/mvt-loader.js +40 -0
- package/dist/mvt/mvt-loader.js.map +1 -0
- package/dist/mvt/mvt-source-loader.d.ts +102 -0
- package/dist/mvt/mvt-source-loader.d.ts.map +1 -0
- package/dist/mvt/mvt-source-loader.js +275 -0
- package/dist/mvt/mvt-source-loader.js.map +1 -0
- package/dist/mvt/mvt-writer.d.ts +28 -0
- package/dist/mvt/mvt-writer.d.ts.map +1 -0
- package/dist/mvt/mvt-writer.js +32 -0
- package/dist/mvt/mvt-writer.js.map +1 -0
- package/dist/mvt/table-tile-source-loader.d.ts +169 -0
- package/dist/mvt/table-tile-source-loader.d.ts.map +1 -0
- package/dist/mvt/table-tile-source-loader.js +478 -0
- package/dist/mvt/table-tile-source-loader.js.map +1 -0
- package/dist/mvt/tilejson-format.d.ts +13 -0
- package/dist/mvt/tilejson-format.d.ts.map +1 -0
- package/dist/mvt/tilejson-format.js +16 -0
- package/dist/mvt/tilejson-format.js.map +1 -0
- package/dist/mvt/tilejson-loader-with-parser.d.ts +13 -0
- package/dist/mvt/tilejson-loader-with-parser.d.ts.map +1 -0
- package/dist/mvt/tilejson-loader-with-parser.js +25 -0
- package/dist/mvt/tilejson-loader-with-parser.js.map +1 -0
- package/dist/mvt/tilejson-loader.d.ts +56 -0
- package/dist/mvt/tilejson-loader.d.ts.map +1 -0
- package/dist/mvt/tilejson-loader.js +28 -0
- package/dist/mvt/tilejson-loader.js.map +1 -0
- package/dist/mvt/tilejson-zod-schema.cjs +79 -0
- package/dist/mvt/tilejson-zod-schema.cjs.map +6 -0
- package/dist/mvt/tilejson-zod-schema.d.ts +218 -0
- package/dist/mvt/tilejson-zod-schema.d.ts.map +1 -0
- package/dist/mvt/tilejson-zod-schema.js +68 -0
- package/dist/mvt/tilejson-zod-schema.js.map +1 -0
- package/dist/mvt/tilejson.schema.json +197 -0
- package/dist/mvt/unbundled.d.ts +8 -0
- package/dist/mvt/unbundled.d.ts.map +1 -0
- package/dist/mvt/unbundled.js +8 -0
- package/dist/mvt/unbundled.js.map +1 -0
- package/dist/mvt/workers/mvt-worker-node.d.ts +2 -0
- package/dist/mvt/workers/mvt-worker-node.d.ts.map +1 -0
- package/dist/mvt/workers/mvt-worker-node.js +8 -0
- package/dist/mvt/workers/mvt-worker-node.js.map +1 -0
- package/dist/mvt/workers/mvt-worker.d.ts +2 -0
- package/dist/mvt/workers/mvt-worker.d.ts.map +1 -0
- package/dist/mvt/workers/mvt-worker.js +7 -0
- package/dist/mvt/workers/mvt-worker.js.map +1 -0
- package/dist/mvt-worker-node.js +72460 -0
- package/dist/mvt-worker-node.js.map +7 -0
- package/dist/mvt-worker.js +21239 -0
- package/dist/pmtiles/bundled.d.ts +3 -0
- package/dist/pmtiles/bundled.d.ts.map +1 -0
- package/dist/pmtiles/bundled.js +5 -0
- package/dist/pmtiles/bundled.js.map +1 -0
- package/dist/pmtiles/dist.dev.js +50530 -0
- package/dist/pmtiles/dist.min.js +94 -0
- package/dist/pmtiles/geoarrow.cjs +6718 -0
- package/dist/pmtiles/geoarrow.cjs.map +6 -0
- package/dist/pmtiles/geoarrow.d.ts +30 -0
- package/dist/pmtiles/geoarrow.d.ts.map +1 -0
- package/dist/pmtiles/geoarrow.js +143 -0
- package/dist/pmtiles/geoarrow.js.map +1 -0
- package/dist/pmtiles/index.cjs +8011 -0
- package/dist/pmtiles/index.cjs.map +6 -0
- package/dist/pmtiles/index.d.ts +14 -0
- package/dist/pmtiles/index.d.ts.map +1 -0
- package/dist/pmtiles/index.js +10 -0
- package/dist/pmtiles/index.js.map +1 -0
- package/dist/pmtiles/lib/blob-source.d.ts +14 -0
- package/dist/pmtiles/lib/blob-source.d.ts.map +1 -0
- package/dist/pmtiles/lib/blob-source.js +32 -0
- package/dist/pmtiles/lib/blob-source.js.map +1 -0
- package/dist/pmtiles/lib/encode-pmtiles.d.ts +8 -0
- package/dist/pmtiles/lib/encode-pmtiles.d.ts.map +1 -0
- package/dist/pmtiles/lib/encode-pmtiles.js +268 -0
- package/dist/pmtiles/lib/encode-pmtiles.js.map +1 -0
- package/dist/pmtiles/lib/parse-pmtiles.d.ts +52 -0
- package/dist/pmtiles/lib/parse-pmtiles.d.ts.map +1 -0
- package/dist/pmtiles/lib/parse-pmtiles.js +95 -0
- package/dist/pmtiles/lib/parse-pmtiles.js.map +1 -0
- package/dist/pmtiles/lib/range-request-source.d.ts +24 -0
- package/dist/pmtiles/lib/range-request-source.d.ts.map +1 -0
- package/dist/pmtiles/lib/range-request-source.js +45 -0
- package/dist/pmtiles/lib/range-request-source.js.map +1 -0
- package/dist/pmtiles/lib/version.d.ts +2 -0
- package/dist/pmtiles/lib/version.d.ts.map +1 -0
- package/dist/pmtiles/lib/version.js +8 -0
- package/dist/pmtiles/lib/version.js.map +1 -0
- package/dist/pmtiles/pmtiles-format.d.ts +14 -0
- package/dist/pmtiles/pmtiles-format.d.ts.map +1 -0
- package/dist/pmtiles/pmtiles-format.js +17 -0
- package/dist/pmtiles/pmtiles-format.js.map +1 -0
- package/dist/pmtiles/pmtiles-loader-with-parser.d.ts +30 -0
- package/dist/pmtiles/pmtiles-loader-with-parser.d.ts.map +1 -0
- package/dist/pmtiles/pmtiles-loader-with-parser.js +41 -0
- package/dist/pmtiles/pmtiles-loader-with-parser.js.map +1 -0
- package/dist/pmtiles/pmtiles-loader.d.ts +41 -0
- package/dist/pmtiles/pmtiles-loader.d.ts.map +1 -0
- package/dist/pmtiles/pmtiles-loader.js +20 -0
- package/dist/pmtiles/pmtiles-loader.js.map +1 -0
- package/dist/pmtiles/pmtiles-source-loader.d.ts +85 -0
- package/dist/pmtiles/pmtiles-source-loader.d.ts.map +1 -0
- package/dist/pmtiles/pmtiles-source-loader.js +239 -0
- package/dist/pmtiles/pmtiles-source-loader.js.map +1 -0
- package/dist/pmtiles/pmtiles-writer-types.d.ts +39 -0
- package/dist/pmtiles/pmtiles-writer-types.d.ts.map +1 -0
- package/dist/{point-cloud-tile-source-types.js → pmtiles/pmtiles-writer-types.js} +1 -1
- package/dist/pmtiles/pmtiles-writer-types.js.map +1 -0
- package/dist/pmtiles/pmtiles-writer.d.ts +22 -0
- package/dist/pmtiles/pmtiles-writer.d.ts.map +1 -0
- package/dist/pmtiles/pmtiles-writer.js +15 -0
- package/dist/pmtiles/pmtiles-writer.js.map +1 -0
- package/dist/pmtiles/raster.cjs +1183 -0
- package/dist/pmtiles/raster.cjs.map +6 -0
- package/dist/pmtiles/raster.d.ts +30 -0
- package/dist/pmtiles/raster.d.ts.map +1 -0
- package/dist/pmtiles/raster.js +212 -0
- package/dist/pmtiles/raster.js.map +1 -0
- package/dist/pmtiles/source-info.d.ts +25 -0
- package/dist/pmtiles/source-info.d.ts.map +1 -0
- package/dist/{types.js → pmtiles/source-info.js} +1 -1
- package/dist/pmtiles/source-info.js.map +1 -0
- package/dist/pmtiles/unbundled.d.ts +3 -0
- package/dist/pmtiles/unbundled.d.ts.map +1 -0
- package/dist/pmtiles/unbundled.js +5 -0
- package/dist/pmtiles/unbundled.js.map +1 -0
- package/dist/raster-set.d.ts +1 -1
- package/dist/raster-set.d.ts.map +1 -1
- package/dist/raster-set.js +1 -1
- package/dist/raster-set.js.map +1 -1
- package/dist/tile-matrix.cjs +81 -0
- package/dist/tile-matrix.cjs.map +6 -0
- package/dist/tile-matrix.d.ts +52 -0
- package/dist/tile-matrix.d.ts.map +1 -0
- package/dist/tile-matrix.js +75 -0
- package/dist/tile-matrix.js.map +1 -0
- package/dist/tileset-2d/tile-2d-header.d.ts +2 -2
- package/dist/tileset-2d/tile-2d-header.d.ts.map +1 -1
- package/dist/tileset-2d/tile-2d-header.js +11 -11
- package/dist/tileset-2d/tile-2d-header.js.map +1 -1
- package/dist/tileset-2d/tileset-2d.d.ts +19 -10
- package/dist/tileset-2d/tileset-2d.d.ts.map +1 -1
- package/dist/tileset-2d/tileset-2d.js +69 -15
- package/dist/tileset-2d/tileset-2d.js.map +1 -1
- package/package.json +101 -25
- package/src/image-set.ts +1 -1
- package/src/index.ts +8 -128
- package/src/mlt/bundled.ts +9 -0
- package/src/mlt/index.ts +18 -0
- package/src/mlt/lib/encode-mlt-geometry.ts +162 -0
- package/src/mlt/lib/encode-mlt-streams.ts +66 -0
- package/src/mlt/lib/encode-mlt.ts +215 -0
- package/src/mlt/lib/parse-mlt.ts +906 -0
- package/src/mlt/libs/mlt-decoder.cjs +4552 -0
- package/src/mlt/mlt-format.ts +19 -0
- package/src/mlt/mlt-loader-with-parser.ts +57 -0
- package/src/mlt/mlt-loader.ts +64 -0
- package/src/mlt/mlt-source-loader.ts +266 -0
- package/src/mlt/mlt-writer.ts +47 -0
- package/src/mlt/unbundled.ts +6 -0
- package/src/mvt/arrow-table-tile-source-loader-types.ts +55 -0
- package/src/mvt/arrow-table-tile-source-loader.ts +307 -0
- package/src/mvt/arrow-table-tile-source-types.ts +32 -0
- package/src/mvt/bundled.ts +14 -0
- package/src/mvt/index.ts +67 -0
- package/src/mvt/lib/encode-mvt-arrow.ts +273 -0
- package/src/mvt/lib/encode-mvt.ts +46 -0
- package/src/mvt/lib/get-schemas-from-tilejson.ts +64 -0
- package/src/mvt/lib/is-longitude-latitude-crs.ts +15 -0
- package/src/mvt/lib/mapbox-vt-pbf/geojson-to-vt.ts.disabled +76 -0
- package/src/mvt/lib/mapbox-vt-pbf/geojson-wrapper.ts +89 -0
- package/src/mvt/lib/mapbox-vt-pbf/to-vector-tile.ts +230 -0
- package/src/mvt/lib/mvt-pbf/mvt-constants.ts +135 -0
- package/src/mvt/lib/mvt-pbf/mvt-types.ts +22 -0
- package/src/mvt/lib/mvt-pbf/parse-geometry-from-pbf.ts +285 -0
- package/src/mvt/lib/mvt-pbf/parse-mvt-from-pbf.ts +310 -0
- package/src/mvt/lib/mvt-pbf/write-mvt-to-pbf.ts +162 -0
- package/src/mvt/lib/mvt-worker-transport.ts +74 -0
- package/src/mvt/lib/parse-mvt-geojson.ts +65 -0
- package/src/mvt/lib/parse-mvt.ts +145 -0
- package/src/mvt/lib/parse-tilejson.ts +397 -0
- package/src/mvt/lib/resolve-table-tile-parameters.ts +23 -0
- package/src/mvt/lib/types.ts +90 -0
- package/src/mvt/lib/utils/geometry-utils.ts +238 -0
- package/src/mvt/lib/vector-tile/LICENSE.txt +31 -0
- package/src/mvt/lib/vector-tile/vector-tile-feature.ts +430 -0
- package/src/mvt/lib/vector-tile/vector-tile-layer.ts +130 -0
- package/src/mvt/lib/vector-tile/vector-tile.ts +32 -0
- package/src/mvt/lib/vector-tiler/LICENSE +19 -0
- package/src/mvt/lib/vector-tiler/arrow-tile.ts +93 -0
- package/src/mvt/lib/vector-tiler/features/clip-features.ts +250 -0
- package/src/mvt/lib/vector-tiler/features/convert-feature.ts +213 -0
- package/src/mvt/lib/vector-tiler/features/proto-feature.ts +104 -0
- package/src/mvt/lib/vector-tiler/features/simplify-path.ts +84 -0
- package/src/mvt/lib/vector-tiler/features/wrap-features.ts +125 -0
- package/src/mvt/lib/vector-tiler/proto-tile.ts +217 -0
- package/src/mvt/lib/vector-tiler/tile-to-geojson.ts +104 -0
- package/src/mvt/lib/vector-tiler/transform-tile.ts +57 -0
- package/src/mvt/map-style-format.ts +18 -0
- package/src/mvt/map-style-loader-with-parser.ts +62 -0
- package/src/mvt/map-style-loader.ts +31 -0
- package/src/mvt/map-style-schema.ts +53 -0
- package/src/mvt/map-style.ts +218 -0
- package/src/mvt/mvt-format.ts +25 -0
- package/src/mvt/mvt-geojson-loader-types.ts +60 -0
- package/src/mvt/mvt-geojson-loader.ts +20 -0
- package/src/mvt/mvt-loader-with-parser.ts +53 -0
- package/src/mvt/mvt-loader.ts +73 -0
- package/src/mvt/mvt-source-loader.ts +410 -0
- package/src/mvt/mvt-writer.ts +35 -0
- package/src/mvt/table-tile-source-loader.ts +672 -0
- package/src/mvt/tilejson-format.ts +18 -0
- package/src/mvt/tilejson-loader-with-parser.ts +38 -0
- package/src/mvt/tilejson-loader.ts +42 -0
- package/src/mvt/tilejson-zod-schema.ts +199 -0
- package/src/mvt/unbundled.ts +13 -0
- package/src/mvt/workers/mvt-worker-node.ts +9 -0
- package/src/mvt/workers/mvt-worker.ts +8 -0
- package/src/pmtiles/bundled.ts +6 -0
- package/src/pmtiles/geoarrow.ts +188 -0
- package/src/pmtiles/index.ts +27 -0
- package/src/pmtiles/lib/blob-source.ts +41 -0
- package/src/pmtiles/lib/encode-pmtiles.ts +322 -0
- package/src/pmtiles/lib/parse-pmtiles.ts +180 -0
- package/src/pmtiles/lib/range-request-source.ts +60 -0
- package/src/pmtiles/lib/version.ts +8 -0
- package/src/pmtiles/pmtiles-format.ts +19 -0
- package/src/pmtiles/pmtiles-loader-with-parser.ts +60 -0
- package/src/pmtiles/pmtiles-loader.ts +30 -0
- package/src/pmtiles/pmtiles-source-loader.ts +346 -0
- package/src/pmtiles/pmtiles-writer-types.ts +45 -0
- package/src/pmtiles/pmtiles-writer.ts +26 -0
- package/src/pmtiles/raster.ts +289 -0
- package/src/pmtiles/source-info.ts +25 -0
- package/src/pmtiles/unbundled.ts +6 -0
- package/src/raster-set.ts +2 -2
- package/src/tile-matrix.ts +138 -0
- package/src/tileset-2d/tile-2d-header.ts +14 -13
- package/src/tileset-2d/tileset-2d.ts +81 -19
- package/dist/constants.d.ts +0 -38
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -39
- package/dist/constants.js.map +0 -1
- package/dist/point-cloud/point-cloud-tile.d.ts +0 -47
- package/dist/point-cloud/point-cloud-tile.d.ts.map +0 -1
- package/dist/point-cloud/point-cloud-tile.js +0 -70
- package/dist/point-cloud/point-cloud-tile.js.map +0 -1
- package/dist/point-cloud/point-cloud-tileset.d.ts +0 -135
- package/dist/point-cloud/point-cloud-tileset.d.ts.map +0 -1
- package/dist/point-cloud/point-cloud-tileset.js +0 -549
- package/dist/point-cloud/point-cloud-tileset.js.map +0 -1
- package/dist/point-cloud/types.d.ts +0 -81
- package/dist/point-cloud/types.d.ts.map +0 -1
- package/dist/point-cloud/types.js.map +0 -1
- package/dist/point-cloud-tile-source-loader-types.d.ts +0 -31
- package/dist/point-cloud-tile-source-loader-types.d.ts.map +0 -1
- package/dist/point-cloud-tile-source-loader-types.js +0 -34
- package/dist/point-cloud-tile-source-loader-types.js.map +0 -1
- package/dist/point-cloud-tile-source-loader.cjs +0 -81
- package/dist/point-cloud-tile-source-loader.cjs.map +0 -7
- package/dist/point-cloud-tile-source-loader.d.ts +0 -27
- package/dist/point-cloud-tile-source-loader.d.ts.map +0 -1
- package/dist/point-cloud-tile-source-loader.js +0 -17
- package/dist/point-cloud-tile-source-loader.js.map +0 -1
- package/dist/point-cloud-tile-source-types.d.ts +0 -15
- package/dist/point-cloud-tile-source-types.d.ts.map +0 -1
- package/dist/point-cloud-tile-source-types.js.map +0 -1
- package/dist/point-cloud-tile-source.cjs +0 -105
- package/dist/point-cloud-tile-source.cjs.map +0 -7
- package/dist/point-cloud-tile-source.d.ts +0 -36
- package/dist/point-cloud-tile-source.d.ts.map +0 -1
- package/dist/point-cloud-tile-source.js +0 -84
- package/dist/point-cloud-tile-source.js.map +0 -1
- package/dist/spatial/format-spatial-reference.d.ts +0 -68
- package/dist/spatial/format-spatial-reference.d.ts.map +0 -1
- package/dist/spatial/format-spatial-reference.js +0 -291
- package/dist/spatial/format-spatial-reference.js.map +0 -1
- package/dist/spatial/get-spatial-coordinate-frame.d.ts +0 -20
- package/dist/spatial/get-spatial-coordinate-frame.d.ts.map +0 -1
- package/dist/spatial/get-spatial-coordinate-frame.js +0 -139
- package/dist/spatial/get-spatial-coordinate-frame.js.map +0 -1
- package/dist/spatial/i3s-elevation.d.ts +0 -20
- package/dist/spatial/i3s-elevation.d.ts.map +0 -1
- package/dist/spatial/i3s-elevation.js +0 -90
- package/dist/spatial/i3s-elevation.js.map +0 -1
- package/dist/spatial/i3s-spatial-transformer.d.ts +0 -205
- package/dist/spatial/i3s-spatial-transformer.d.ts.map +0 -1
- package/dist/spatial/i3s-spatial-transformer.js +0 -731
- package/dist/spatial/i3s-spatial-transformer.js.map +0 -1
- package/dist/spatial/normalize-crs-identifier.d.ts +0 -15
- package/dist/spatial/normalize-crs-identifier.d.ts.map +0 -1
- package/dist/spatial/normalize-crs-identifier.js +0 -22
- package/dist/spatial/normalize-crs-identifier.js.map +0 -1
- package/dist/spatial/spatial-coordinate-transformer.d.ts +0 -54
- package/dist/spatial/spatial-coordinate-transformer.d.ts.map +0 -1
- package/dist/spatial/spatial-coordinate-transformer.js +0 -311
- package/dist/spatial/spatial-coordinate-transformer.js.map +0 -1
- package/dist/spatial/spatial-resource-registry.d.ts +0 -47
- package/dist/spatial/spatial-resource-registry.d.ts.map +0 -1
- package/dist/spatial/spatial-resource-registry.js +0 -76
- package/dist/spatial/spatial-resource-registry.js.map +0 -1
- package/dist/spatial/spatial-types.d.ts +0 -190
- package/dist/spatial/spatial-types.d.ts.map +0 -1
- package/dist/spatial/spatial-types.js +0 -192
- package/dist/spatial/spatial-types.js.map +0 -1
- package/dist/spatial/tiles-3d-spatial-transformer.d.ts +0 -32
- package/dist/spatial/tiles-3d-spatial-transformer.d.ts.map +0 -1
- package/dist/spatial/tiles-3d-spatial-transformer.js +0 -163
- package/dist/spatial/tiles-3d-spatial-transformer.js.map +0 -1
- package/dist/tileset-3d/common/indexed-archive-tileset-source.d.ts +0 -60
- package/dist/tileset-3d/common/indexed-archive-tileset-source.d.ts.map +0 -1
- package/dist/tileset-3d/common/indexed-archive-tileset-source.js +0 -130
- package/dist/tileset-3d/common/indexed-archive-tileset-source.js.map +0 -1
- package/dist/tileset-3d/common/tile-3d-contracts.d.ts +0 -63
- package/dist/tileset-3d/common/tile-3d-contracts.d.ts.map +0 -1
- package/dist/tileset-3d/common/tile-3d-contracts.js +0 -51
- package/dist/tileset-3d/common/tile-3d-contracts.js.map +0 -1
- package/dist/tileset-3d/common/tile-3d.d.ts +0 -410
- package/dist/tileset-3d/common/tile-3d.d.ts.map +0 -1
- package/dist/tileset-3d/common/tile-3d.js +0 -1056
- package/dist/tileset-3d/common/tile-3d.js.map +0 -1
- package/dist/tileset-3d/common/tileset-3d.d.ts +0 -369
- package/dist/tileset-3d/common/tileset-3d.d.ts.map +0 -1
- package/dist/tileset-3d/common/tileset-3d.js +0 -879
- package/dist/tileset-3d/common/tileset-3d.js.map +0 -1
- package/dist/tileset-3d/common/tileset-cache.d.ts +0 -29
- package/dist/tileset-3d/common/tileset-cache.d.ts.map +0 -1
- package/dist/tileset-3d/common/tileset-cache.js +0 -82
- package/dist/tileset-3d/common/tileset-cache.js.map +0 -1
- package/dist/tileset-3d/common/tileset-content-traversal.d.ts +0 -37
- package/dist/tileset-3d/common/tileset-content-traversal.d.ts.map +0 -1
- package/dist/tileset-3d/common/tileset-content-traversal.js +0 -80
- package/dist/tileset-3d/common/tileset-content-traversal.js.map +0 -1
- package/dist/tileset-3d/common/tileset-observability.d.ts +0 -60
- package/dist/tileset-3d/common/tileset-observability.d.ts.map +0 -1
- package/dist/tileset-3d/common/tileset-observability.js +0 -39
- package/dist/tileset-3d/common/tileset-observability.js.map +0 -1
- package/dist/tileset-3d/common/tileset-source.d.ts +0 -228
- package/dist/tileset-3d/common/tileset-source.d.ts.map +0 -1
- package/dist/tileset-3d/common/tileset-source.js +0 -17
- package/dist/tileset-3d/common/tileset-source.js.map +0 -1
- package/dist/tileset-3d/common/tileset-traverser.d.ts +0 -88
- package/dist/tileset-3d/common/tileset-traverser.d.ts.map +0 -1
- package/dist/tileset-3d/common/tileset-traverser.js +0 -341
- package/dist/tileset-3d/common/tileset-traverser.js.map +0 -1
- package/dist/tileset-3d/format-3d-tiles/implicit-tiling.d.ts +0 -182
- package/dist/tileset-3d/format-3d-tiles/implicit-tiling.d.ts.map +0 -1
- package/dist/tileset-3d/format-3d-tiles/implicit-tiling.js +0 -678
- package/dist/tileset-3d/format-3d-tiles/implicit-tiling.js.map +0 -1
- package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.d.ts +0 -221
- package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.d.ts.map +0 -1
- package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.js +0 -770
- package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.js.map +0 -1
- package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.d.ts +0 -111
- package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.d.ts.map +0 -1
- package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.js +0 -339
- package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.js.map +0 -1
- package/dist/tileset-3d/format-i3s/i3s-pending-tiles-register.d.ts +0 -27
- package/dist/tileset-3d/format-i3s/i3s-pending-tiles-register.d.ts.map +0 -1
- package/dist/tileset-3d/format-i3s/i3s-pending-tiles-register.js +0 -45
- package/dist/tileset-3d/format-i3s/i3s-pending-tiles-register.js.map +0 -1
- package/dist/tileset-3d/format-i3s/i3s-source.d.ts +0 -116
- package/dist/tileset-3d/format-i3s/i3s-source.d.ts.map +0 -1
- package/dist/tileset-3d/format-i3s/i3s-source.js +0 -450
- package/dist/tileset-3d/format-i3s/i3s-source.js.map +0 -1
- package/dist/tileset-3d/format-i3s/i3s-tile-manager.d.ts +0 -34
- package/dist/tileset-3d/format-i3s/i3s-tile-manager.d.ts.map +0 -1
- package/dist/tileset-3d/format-i3s/i3s-tile-manager.js +0 -81
- package/dist/tileset-3d/format-i3s/i3s-tile-manager.js.map +0 -1
- package/dist/tileset-3d/format-i3s/i3s-tileset-traverser.d.ts +0 -25
- package/dist/tileset-3d/format-i3s/i3s-tileset-traverser.d.ts.map +0 -1
- package/dist/tileset-3d/format-i3s/i3s-tileset-traverser.js +0 -84
- package/dist/tileset-3d/format-i3s/i3s-tileset-traverser.js.map +0 -1
- package/dist/tileset-3d/helpers/3d-tiles-options.d.ts +0 -5
- package/dist/tileset-3d/helpers/3d-tiles-options.d.ts.map +0 -1
- package/dist/tileset-3d/helpers/3d-tiles-options.js +0 -9
- package/dist/tileset-3d/helpers/3d-tiles-options.js.map +0 -1
- package/dist/tileset-3d/helpers/bounding-volume.d.ts +0 -23
- package/dist/tileset-3d/helpers/bounding-volume.d.ts.map +0 -1
- package/dist/tileset-3d/helpers/bounding-volume.js +0 -236
- package/dist/tileset-3d/helpers/bounding-volume.js.map +0 -1
- package/dist/tileset-3d/helpers/frame-state.d.ts +0 -93
- package/dist/tileset-3d/helpers/frame-state.d.ts.map +0 -1
- package/dist/tileset-3d/helpers/frame-state.js +0 -211
- package/dist/tileset-3d/helpers/frame-state.js.map +0 -1
- package/dist/tileset-3d/helpers/i3s-lod.d.ts +0 -20
- package/dist/tileset-3d/helpers/i3s-lod.d.ts.map +0 -1
- package/dist/tileset-3d/helpers/i3s-lod.js +0 -95
- package/dist/tileset-3d/helpers/i3s-lod.js.map +0 -1
- package/dist/tileset-3d/helpers/s2-bounding-volume.d.ts +0 -17
- package/dist/tileset-3d/helpers/s2-bounding-volume.d.ts.map +0 -1
- package/dist/tileset-3d/helpers/s2-bounding-volume.js +0 -17
- package/dist/tileset-3d/helpers/s2-bounding-volume.js.map +0 -1
- package/dist/tileset-3d/helpers/tiles-3d-lod.d.ts +0 -72
- package/dist/tileset-3d/helpers/tiles-3d-lod.d.ts.map +0 -1
- package/dist/tileset-3d/helpers/tiles-3d-lod.js +0 -257
- package/dist/tileset-3d/helpers/tiles-3d-lod.js.map +0 -1
- package/dist/tileset-3d/helpers/tiles-3d-request-priority.d.ts +0 -134
- package/dist/tileset-3d/helpers/tiles-3d-request-priority.d.ts.map +0 -1
- package/dist/tileset-3d/helpers/tiles-3d-request-priority.js +0 -179
- package/dist/tileset-3d/helpers/tiles-3d-request-priority.js.map +0 -1
- package/dist/tileset-3d/helpers/transform-utils.d.ts +0 -3
- package/dist/tileset-3d/helpers/transform-utils.d.ts.map +0 -1
- package/dist/tileset-3d/helpers/transform-utils.js +0 -86
- package/dist/tileset-3d/helpers/transform-utils.js.map +0 -1
- package/dist/tileset-3d/helpers/zoom.d.ts +0 -46
- package/dist/tileset-3d/helpers/zoom.d.ts.map +0 -1
- package/dist/tileset-3d/helpers/zoom.js +0 -86
- package/dist/tileset-3d/helpers/zoom.js.map +0 -1
- package/dist/types.d.ts +0 -48
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/doubly-linked-list-node.d.ts +0 -11
- package/dist/utils/doubly-linked-list-node.d.ts.map +0 -1
- package/dist/utils/doubly-linked-list-node.js +0 -20
- package/dist/utils/doubly-linked-list-node.js.map +0 -1
- package/dist/utils/doubly-linked-list.d.ts +0 -30
- package/dist/utils/doubly-linked-list.d.ts.map +0 -1
- package/dist/utils/doubly-linked-list.js +0 -93
- package/dist/utils/doubly-linked-list.js.map +0 -1
- package/dist/utils/managed-array.d.ts +0 -85
- package/dist/utils/managed-array.d.ts.map +0 -1
- package/dist/utils/managed-array.js +0 -152
- package/dist/utils/managed-array.js.map +0 -1
- package/src/constants.ts +0 -59
- package/src/point-cloud/point-cloud-tile.ts +0 -80
- package/src/point-cloud/point-cloud-tileset.ts +0 -767
- package/src/point-cloud/types.ts +0 -99
- package/src/point-cloud-tile-source-loader-types.ts +0 -53
- package/src/point-cloud-tile-source-loader.ts +0 -32
- package/src/point-cloud-tile-source-types.ts +0 -20
- package/src/point-cloud-tile-source.ts +0 -112
- package/src/spatial/format-spatial-reference.ts +0 -385
- package/src/spatial/get-spatial-coordinate-frame.ts +0 -169
- package/src/spatial/i3s-elevation.ts +0 -96
- package/src/spatial/i3s-spatial-transformer.ts +0 -1021
- package/src/spatial/normalize-crs-identifier.ts +0 -26
- package/src/spatial/spatial-coordinate-transformer.ts +0 -397
- package/src/spatial/spatial-resource-registry.ts +0 -90
- package/src/spatial/spatial-types.ts +0 -422
- package/src/spatial/tiles-3d-spatial-transformer.ts +0 -194
- package/src/tileset-3d/common/indexed-archive-tileset-source.ts +0 -205
- package/src/tileset-3d/common/tile-3d-contracts.ts +0 -115
- package/src/tileset-3d/common/tile-3d.ts +0 -1310
- package/src/tileset-3d/common/tileset-3d.ts +0 -1210
- package/src/tileset-3d/common/tileset-cache.ts +0 -111
- package/src/tileset-3d/common/tileset-content-traversal.ts +0 -114
- package/src/tileset-3d/common/tileset-observability.ts +0 -100
- package/src/tileset-3d/common/tileset-source.ts +0 -284
- package/src/tileset-3d/common/tileset-traverser.ts +0 -416
- package/src/tileset-3d/format-3d-tiles/implicit-tiling.ts +0 -1056
- package/src/tileset-3d/format-3d-tiles/tiles-3d-source.ts +0 -1025
- package/src/tileset-3d/format-3d-tiles/tileset-3d-traverser.ts +0 -391
- package/src/tileset-3d/format-i3s/i3s-pending-tiles-register.ts +0 -48
- package/src/tileset-3d/format-i3s/i3s-source.ts +0 -557
- package/src/tileset-3d/format-i3s/i3s-tile-manager.ts +0 -105
- package/src/tileset-3d/format-i3s/i3s-tileset-traverser.ts +0 -102
- package/src/tileset-3d/helpers/3d-tiles-options.ts +0 -11
- package/src/tileset-3d/helpers/bounding-volume.ts +0 -281
- package/src/tileset-3d/helpers/frame-state.ts +0 -322
- package/src/tileset-3d/helpers/i3s-lod.ts +0 -109
- package/src/tileset-3d/helpers/s2-bounding-volume.ts +0 -32
- package/src/tileset-3d/helpers/tiles-3d-lod.ts +0 -370
- package/src/tileset-3d/helpers/tiles-3d-request-priority.ts +0 -301
- package/src/tileset-3d/helpers/transform-utils.ts +0 -109
- package/src/tileset-3d/helpers/zoom.ts +0 -120
- package/src/types.ts +0 -54
- package/src/utils/doubly-linked-list-node.ts +0 -22
- package/src/utils/doubly-linked-list.ts +0 -105
- package/src/utils/managed-array.ts +0 -174
- /package/dist/{point-cloud → mvt/lib}/types.js +0 -0
|
@@ -0,0 +1,1183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __esm = (fn, res, err) => function __init() {
|
|
9
|
+
if (err) throw err[0];
|
|
10
|
+
try {
|
|
11
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
12
|
+
} catch (e) {
|
|
13
|
+
throw err = [e], e;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
|
|
38
|
+
// ../images/src/lib/utils/version.ts
|
|
39
|
+
var VERSION;
|
|
40
|
+
var init_version = __esm({
|
|
41
|
+
"../images/src/lib/utils/version.ts"() {
|
|
42
|
+
"use strict";
|
|
43
|
+
VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// ../images/src/lib/category-api/parsed-image-api.ts
|
|
48
|
+
function getImageType(image) {
|
|
49
|
+
const format = getImageTypeOrNull(image);
|
|
50
|
+
if (!format) {
|
|
51
|
+
throw new Error("Not an image");
|
|
52
|
+
}
|
|
53
|
+
return format;
|
|
54
|
+
}
|
|
55
|
+
function getImageSize(image) {
|
|
56
|
+
return getImageData(image);
|
|
57
|
+
}
|
|
58
|
+
function getImageData(image) {
|
|
59
|
+
switch (getImageType(image)) {
|
|
60
|
+
case "data":
|
|
61
|
+
return image;
|
|
62
|
+
case "imagebitmap":
|
|
63
|
+
if (isNodeImageBitmap(image)) {
|
|
64
|
+
return getNodeImageData(image);
|
|
65
|
+
}
|
|
66
|
+
return getBrowserImageData(image);
|
|
67
|
+
case "image":
|
|
68
|
+
return getBrowserImageData(image);
|
|
69
|
+
default:
|
|
70
|
+
throw new Error("getImageData");
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function isNodeImageBitmap(image) {
|
|
74
|
+
var _a2;
|
|
75
|
+
const isImageBitmapNode = (_a2 = globalThis.loaders) == null ? void 0 : _a2.isImageBitmapNode;
|
|
76
|
+
return Boolean(isImageBitmapNode == null ? void 0 : isImageBitmapNode(image));
|
|
77
|
+
}
|
|
78
|
+
function getNodeImageData(image) {
|
|
79
|
+
var _a2;
|
|
80
|
+
const getImageBitmapDataNode = (_a2 = globalThis.loaders) == null ? void 0 : _a2.getImageBitmapDataNode;
|
|
81
|
+
if (!getImageBitmapDataNode) {
|
|
82
|
+
throw new Error("getImageData");
|
|
83
|
+
}
|
|
84
|
+
return getImageBitmapDataNode(image);
|
|
85
|
+
}
|
|
86
|
+
function getBrowserImageData(image) {
|
|
87
|
+
const canvas = createBrowserCanvas(image.width, image.height);
|
|
88
|
+
const context = canvas.getContext("2d");
|
|
89
|
+
if (!context) {
|
|
90
|
+
throw new Error("getImageData");
|
|
91
|
+
}
|
|
92
|
+
canvas.width = image.width;
|
|
93
|
+
canvas.height = image.height;
|
|
94
|
+
context.drawImage(image, 0, 0);
|
|
95
|
+
return context.getImageData(0, 0, image.width, image.height);
|
|
96
|
+
}
|
|
97
|
+
function createBrowserCanvas(width, height) {
|
|
98
|
+
if (typeof OffscreenCanvas !== "undefined") {
|
|
99
|
+
return new OffscreenCanvas(width, height);
|
|
100
|
+
}
|
|
101
|
+
if (typeof document !== "undefined") {
|
|
102
|
+
const canvas = document.createElement("canvas");
|
|
103
|
+
canvas.width = width;
|
|
104
|
+
canvas.height = height;
|
|
105
|
+
return canvas;
|
|
106
|
+
}
|
|
107
|
+
throw new Error("getImageData");
|
|
108
|
+
}
|
|
109
|
+
function getImageTypeOrNull(image) {
|
|
110
|
+
if (typeof ImageBitmap !== "undefined" && image instanceof ImageBitmap) {
|
|
111
|
+
return "imagebitmap";
|
|
112
|
+
}
|
|
113
|
+
if (typeof Image !== "undefined" && image instanceof Image) {
|
|
114
|
+
return "image";
|
|
115
|
+
}
|
|
116
|
+
if (image && typeof image === "object" && image.data && image.width && image.height) {
|
|
117
|
+
return "data";
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
var init_parsed_image_api = __esm({
|
|
122
|
+
"../images/src/lib/category-api/parsed-image-api.ts"() {
|
|
123
|
+
"use strict";
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
// ../core/src/loader-utils/lib/module-utils/js-module-utils.ts
|
|
128
|
+
function registerJSModules(modules) {
|
|
129
|
+
globalThis.loaders ||= {};
|
|
130
|
+
globalThis.loaders.modules ||= {};
|
|
131
|
+
Object.assign(globalThis.loaders.modules, modules);
|
|
132
|
+
}
|
|
133
|
+
var init_js_module_utils = __esm({
|
|
134
|
+
"../core/src/loader-utils/lib/module-utils/js-module-utils.ts"() {
|
|
135
|
+
"use strict";
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
// ../core/src/loader-utils/lib/binary-utils/array-buffer-utils.ts
|
|
140
|
+
function concatenateArrayBuffers(...sources) {
|
|
141
|
+
return concatenateArrayBuffersFromArray(sources);
|
|
142
|
+
}
|
|
143
|
+
function concatenateArrayBuffersFromArray(sources) {
|
|
144
|
+
const sourceArrays = sources.map(
|
|
145
|
+
(source2) => source2 instanceof ArrayBuffer ? new Uint8Array(source2) : source2
|
|
146
|
+
);
|
|
147
|
+
const byteLength = sourceArrays.reduce((length, typedArray) => length + typedArray.byteLength, 0);
|
|
148
|
+
const result = new Uint8Array(byteLength);
|
|
149
|
+
let offset = 0;
|
|
150
|
+
for (const sourceArray of sourceArrays) {
|
|
151
|
+
result.set(sourceArray, offset);
|
|
152
|
+
offset += sourceArray.byteLength;
|
|
153
|
+
}
|
|
154
|
+
return result.buffer;
|
|
155
|
+
}
|
|
156
|
+
var init_array_buffer_utils = __esm({
|
|
157
|
+
"../core/src/loader-utils/lib/binary-utils/array-buffer-utils.ts"() {
|
|
158
|
+
"use strict";
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// ../core/src/loader-utils/lib/iterators/async-iteration.ts
|
|
163
|
+
async function concatenateArrayBuffersAsync(asyncIterator) {
|
|
164
|
+
const arrayBuffers = [];
|
|
165
|
+
for await (const chunk of asyncIterator) {
|
|
166
|
+
arrayBuffers.push(copyToArrayBuffer(chunk));
|
|
167
|
+
}
|
|
168
|
+
return concatenateArrayBuffers(...arrayBuffers);
|
|
169
|
+
}
|
|
170
|
+
function copyToArrayBuffer(chunk) {
|
|
171
|
+
if (chunk instanceof ArrayBuffer) {
|
|
172
|
+
return chunk;
|
|
173
|
+
}
|
|
174
|
+
if (ArrayBuffer.isView(chunk)) {
|
|
175
|
+
const { buffer, byteOffset, byteLength } = chunk;
|
|
176
|
+
return copyFromBuffer(buffer, byteOffset, byteLength);
|
|
177
|
+
}
|
|
178
|
+
return copyFromBuffer(chunk);
|
|
179
|
+
}
|
|
180
|
+
function copyFromBuffer(buffer, byteOffset = 0, byteLength = buffer.byteLength - byteOffset) {
|
|
181
|
+
const view = new Uint8Array(buffer, byteOffset, byteLength);
|
|
182
|
+
const copy = new Uint8Array(view.length);
|
|
183
|
+
copy.set(view);
|
|
184
|
+
return copy.buffer;
|
|
185
|
+
}
|
|
186
|
+
var init_async_iteration = __esm({
|
|
187
|
+
"../core/src/loader-utils/lib/iterators/async-iteration.ts"() {
|
|
188
|
+
"use strict";
|
|
189
|
+
init_array_buffer_utils();
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
// ../core/src/loader-utils/lib/request-utils/abort-utils.ts
|
|
194
|
+
function waitForPromiseWithSignal(promise, signal) {
|
|
195
|
+
if (!signal) return promise;
|
|
196
|
+
if (signal.aborted) {
|
|
197
|
+
void promise.catch(() => {
|
|
198
|
+
});
|
|
199
|
+
return Promise.reject(signal.reason);
|
|
200
|
+
}
|
|
201
|
+
return new Promise((resolve, reject) => {
|
|
202
|
+
const abort = () => {
|
|
203
|
+
signal.removeEventListener("abort", abort);
|
|
204
|
+
reject(signal.reason);
|
|
205
|
+
};
|
|
206
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
207
|
+
void promise.then(
|
|
208
|
+
(value) => {
|
|
209
|
+
signal.removeEventListener("abort", abort);
|
|
210
|
+
resolve(value);
|
|
211
|
+
},
|
|
212
|
+
(error) => {
|
|
213
|
+
signal.removeEventListener("abort", abort);
|
|
214
|
+
reject(error);
|
|
215
|
+
}
|
|
216
|
+
);
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
var init_abort_utils = __esm({
|
|
220
|
+
"../core/src/loader-utils/lib/request-utils/abort-utils.ts"() {
|
|
221
|
+
"use strict";
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
// ../core/src/loader-utils/lib/sources/raster-sampling.ts
|
|
226
|
+
function readRasterValue(raster, column, row, band) {
|
|
227
|
+
var _a2;
|
|
228
|
+
const index = row * raster.width + column;
|
|
229
|
+
if (Array.isArray(raster.data)) return Number((_a2 = raster.data[band]) == null ? void 0 : _a2[index]);
|
|
230
|
+
return Number(
|
|
231
|
+
raster.data[raster.interleaved ? index * raster.bandCount + band : band * raster.width * raster.height + index]
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
function isRasterSampleValid(raster, column, row, band) {
|
|
235
|
+
var _a2;
|
|
236
|
+
if (!Number.isInteger(column) || !Number.isInteger(row) || column < 0 || row < 0 || column >= raster.width || row >= raster.height || !Number.isInteger(band) || band < 0 || band >= raster.bandCount)
|
|
237
|
+
return false;
|
|
238
|
+
const value = readRasterValue(raster, column, row, band);
|
|
239
|
+
if (!Number.isFinite(value)) return false;
|
|
240
|
+
const metadata = (_a2 = raster.bands) == null ? void 0 : _a2[band];
|
|
241
|
+
const noData = (metadata == null ? void 0 : metadata.noData) === void 0 ? raster.noData : metadata.noData;
|
|
242
|
+
if (noData !== void 0 && noData !== null && value === (((metadata == null ? void 0 : metadata.dtype) ?? raster.dtype) === "float32" ? Math.fround(noData) : noData))
|
|
243
|
+
return false;
|
|
244
|
+
return (raster.validityMasks || []).every((mask) => {
|
|
245
|
+
if (mask.band !== void 0 && mask.band !== band) return true;
|
|
246
|
+
if (column >= mask.width || row >= mask.height) return false;
|
|
247
|
+
const index = (mask.offset ?? 0) + row * (mask.rowStride ?? mask.width) + column * (mask.pixelStride ?? 1);
|
|
248
|
+
return index >= 0 && index < mask.data.length && mask.data[index] !== void 0 && mask.data[index] !== 0;
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function sampleRaster(raster, pixel, options = {}) {
|
|
252
|
+
const bands = options.bands ?? Array.from({ length: raster.bandCount }, (_, index) => index);
|
|
253
|
+
if (bands.some((band) => !Number.isInteger(band) || band < 0 || band >= raster.bandCount))
|
|
254
|
+
throw new Error("Invalid raster band index");
|
|
255
|
+
const [column, row] = pixel;
|
|
256
|
+
const nearestColumn = Math.floor(column + 0.5);
|
|
257
|
+
const nearestRow = Math.floor(row + 0.5);
|
|
258
|
+
const miss = !Number.isFinite(column) || !Number.isFinite(row) || nearestColumn < 0 || nearestRow < 0 || nearestColumn >= raster.width || nearestRow >= raster.height;
|
|
259
|
+
const values = bands.map((band) => {
|
|
260
|
+
var _a2;
|
|
261
|
+
if (miss) return void 0;
|
|
262
|
+
let value = 0;
|
|
263
|
+
const metadata = (_a2 = raster.bands) == null ? void 0 : _a2[band];
|
|
264
|
+
if (options.method !== "bilinear" || (metadata == null ? void 0 : metadata.categorical)) {
|
|
265
|
+
if (!isRasterSampleValid(raster, nearestColumn, nearestRow, band)) return void 0;
|
|
266
|
+
value = readRasterValue(raster, nearestColumn, nearestRow, band);
|
|
267
|
+
} else {
|
|
268
|
+
const left = Math.floor(column);
|
|
269
|
+
const top = Math.floor(row);
|
|
270
|
+
for (let vertical = 0; vertical < 2; vertical++) {
|
|
271
|
+
for (let horizontal = 0; horizontal < 2; horizontal++) {
|
|
272
|
+
const weight = (horizontal ? column - left : 1 - column + left) * (vertical ? row - top : 1 - row + top);
|
|
273
|
+
if (weight === 0) continue;
|
|
274
|
+
if (!isRasterSampleValid(raster, left + horizontal, top + vertical, band))
|
|
275
|
+
return void 0;
|
|
276
|
+
value += weight * readRasterValue(raster, left + horizontal, top + vertical, band);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
const result = options.domain === "physical" ? value * ((metadata == null ? void 0 : metadata.scale) ?? 1) + ((metadata == null ? void 0 : metadata.offset) ?? 0) : value;
|
|
281
|
+
return Number.isFinite(result) ? result : void 0;
|
|
282
|
+
});
|
|
283
|
+
return {
|
|
284
|
+
miss,
|
|
285
|
+
values,
|
|
286
|
+
valid: values.map((value) => value !== void 0),
|
|
287
|
+
bands: bands.map((band) => {
|
|
288
|
+
var _a2, _b;
|
|
289
|
+
return ((_b = (_a2 = raster.bands) == null ? void 0 : _a2[band]) == null ? void 0 : _b.index) ?? band;
|
|
290
|
+
}),
|
|
291
|
+
overview: raster.overview,
|
|
292
|
+
provenance: raster.provenance
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
function rasterCoordinateToPixel(raster, coordinate, crs) {
|
|
296
|
+
if (!raster.crs || raster.crs !== crs)
|
|
297
|
+
throw new Error("Raster coordinate CRS must match payload CRS");
|
|
298
|
+
if (!raster.transform) throw new Error("Raster affine transform is unavailable");
|
|
299
|
+
const [columnScale, rowShear, originX, columnShear, rowScale, originY] = raster.transform;
|
|
300
|
+
const determinant = columnScale * rowScale - rowShear * columnShear;
|
|
301
|
+
if (!raster.transform.every(Number.isFinite) || !Number.isFinite(determinant) || determinant === 0)
|
|
302
|
+
throw new Error("Singular or invalid raster affine transform");
|
|
303
|
+
const deltaX = coordinate[0] - originX;
|
|
304
|
+
const deltaY = coordinate[1] - originY;
|
|
305
|
+
const shift = raster.pixelRegistration === "point" ? 0 : 0.5;
|
|
306
|
+
return [
|
|
307
|
+
(rowScale * deltaX - rowShear * deltaY) / determinant - shift + 0,
|
|
308
|
+
(columnScale * deltaY - columnShear * deltaX) / determinant - shift + 0
|
|
309
|
+
];
|
|
310
|
+
}
|
|
311
|
+
var init_raster_sampling = __esm({
|
|
312
|
+
"../core/src/loader-utils/lib/sources/raster-sampling.ts"() {
|
|
313
|
+
"use strict";
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
// ../core/src/loader-utils/index.ts
|
|
318
|
+
var init_loader_utils = __esm({
|
|
319
|
+
"../core/src/loader-utils/index.ts"() {
|
|
320
|
+
"use strict";
|
|
321
|
+
init_js_module_utils();
|
|
322
|
+
init_async_iteration();
|
|
323
|
+
init_raster_sampling();
|
|
324
|
+
init_abort_utils();
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
// ../compression/src/lib/compression.ts
|
|
329
|
+
var CompressionTransform, Compressor;
|
|
330
|
+
var init_compression = __esm({
|
|
331
|
+
"../compression/src/lib/compression.ts"() {
|
|
332
|
+
"use strict";
|
|
333
|
+
init_loader_utils();
|
|
334
|
+
CompressionTransform = class {
|
|
335
|
+
/** Preloads any dynamic libraries. May enable sync functions */
|
|
336
|
+
async preload(modules = {}) {
|
|
337
|
+
registerJSModules(modules);
|
|
338
|
+
return void 0;
|
|
339
|
+
}
|
|
340
|
+
// HELPERS
|
|
341
|
+
concatenate(asyncIterator) {
|
|
342
|
+
return concatenateArrayBuffersAsync(asyncIterator);
|
|
343
|
+
}
|
|
344
|
+
improveError(error) {
|
|
345
|
+
if (!error.message.includes(this.name)) {
|
|
346
|
+
error.message = `${this.name} ${error.message}`;
|
|
347
|
+
}
|
|
348
|
+
return error;
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
Compressor = class extends CompressionTransform {
|
|
352
|
+
constructor(options) {
|
|
353
|
+
super();
|
|
354
|
+
this.compressBatches = this.compressBatches.bind(this);
|
|
355
|
+
}
|
|
356
|
+
/** Asynchronously compresses data. */
|
|
357
|
+
async compress(input) {
|
|
358
|
+
await this.preload();
|
|
359
|
+
return this.compressSync(input);
|
|
360
|
+
}
|
|
361
|
+
/** Synchronously compresses data. */
|
|
362
|
+
compressSync(input) {
|
|
363
|
+
throw new Error(`${this.name}: sync compression not supported`);
|
|
364
|
+
}
|
|
365
|
+
/** Compresses batches. */
|
|
366
|
+
async *compressBatches(asyncIterator) {
|
|
367
|
+
const input = await this.concatenate(asyncIterator);
|
|
368
|
+
yield this.compress(input);
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
// ../compression/src/lib/compression-stream.ts
|
|
375
|
+
async function compressWithNativeCompressionStream(input, format) {
|
|
376
|
+
const outputBatches = compressBatchesWithNativeCompressionStream([input], format);
|
|
377
|
+
return outputBatches ? await concatenateBatches(outputBatches) : null;
|
|
378
|
+
}
|
|
379
|
+
function compressBatchesWithNativeCompressionStream(inputBatches, format) {
|
|
380
|
+
const compressionStream = createNativeCompressionStream(format);
|
|
381
|
+
return compressionStream ? transformBatches(inputBatches, compressionStream) : null;
|
|
382
|
+
}
|
|
383
|
+
function isNativeCompressionSupported(format) {
|
|
384
|
+
return Boolean(createNativeCompressionStream(format));
|
|
385
|
+
}
|
|
386
|
+
function createNativeCompressionStream(format) {
|
|
387
|
+
if (typeof globalThis.CompressionStream === "undefined") {
|
|
388
|
+
return null;
|
|
389
|
+
}
|
|
390
|
+
try {
|
|
391
|
+
const CompressionStreamConstructor = globalThis.CompressionStream;
|
|
392
|
+
return new CompressionStreamConstructor(format);
|
|
393
|
+
} catch (error) {
|
|
394
|
+
if (error instanceof TypeError || (error == null ? void 0 : error.name) === "TypeError") {
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
397
|
+
throw error;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
async function* transformBatches(inputBatches, compressionStream) {
|
|
401
|
+
const writer = compressionStream.writable.getWriter();
|
|
402
|
+
const reader = compressionStream.readable.getReader();
|
|
403
|
+
const writePromise = writeBatches(inputBatches, writer);
|
|
404
|
+
writePromise.catch(() => {
|
|
405
|
+
});
|
|
406
|
+
let outputCompleted = false;
|
|
407
|
+
try {
|
|
408
|
+
while (true) {
|
|
409
|
+
const { done, value } = await reader.read();
|
|
410
|
+
if (done) {
|
|
411
|
+
outputCompleted = true;
|
|
412
|
+
break;
|
|
413
|
+
}
|
|
414
|
+
yield new Uint8Array(value).buffer;
|
|
415
|
+
}
|
|
416
|
+
await writePromise;
|
|
417
|
+
} finally {
|
|
418
|
+
if (!outputCompleted) {
|
|
419
|
+
await reader.cancel().catch(() => {
|
|
420
|
+
});
|
|
421
|
+
await writer.abort().catch(() => {
|
|
422
|
+
});
|
|
423
|
+
await writePromise.catch(() => {
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
reader.releaseLock();
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
async function writeBatches(inputBatches, writer) {
|
|
430
|
+
try {
|
|
431
|
+
for await (const inputBatch of inputBatches) {
|
|
432
|
+
await writer.write(new Uint8Array(inputBatch));
|
|
433
|
+
}
|
|
434
|
+
await writer.close();
|
|
435
|
+
} catch (error) {
|
|
436
|
+
await writer.abort(error).catch(() => {
|
|
437
|
+
});
|
|
438
|
+
throw error;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
async function concatenateBatches(batches) {
|
|
442
|
+
const output = [];
|
|
443
|
+
let byteLength = 0;
|
|
444
|
+
for await (const batch of batches) {
|
|
445
|
+
const bytes = new Uint8Array(batch);
|
|
446
|
+
output.push(bytes);
|
|
447
|
+
byteLength += bytes.byteLength;
|
|
448
|
+
}
|
|
449
|
+
const result = new Uint8Array(byteLength);
|
|
450
|
+
let offset = 0;
|
|
451
|
+
for (const batch of output) {
|
|
452
|
+
result.set(batch, offset);
|
|
453
|
+
offset += batch.byteLength;
|
|
454
|
+
}
|
|
455
|
+
return result.buffer;
|
|
456
|
+
}
|
|
457
|
+
var init_compression_stream = __esm({
|
|
458
|
+
"../compression/src/lib/compression-stream.ts"() {
|
|
459
|
+
"use strict";
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
// ../compression/src/lib/native-compressor.ts
|
|
464
|
+
var native_compressor_exports = {};
|
|
465
|
+
__export(native_compressor_exports, {
|
|
466
|
+
NativeCompressor: () => NativeCompressor
|
|
467
|
+
});
|
|
468
|
+
var NativeCompressor;
|
|
469
|
+
var init_native_compressor = __esm({
|
|
470
|
+
"../compression/src/lib/native-compressor.ts"() {
|
|
471
|
+
"use strict";
|
|
472
|
+
init_compression();
|
|
473
|
+
init_compression_stream();
|
|
474
|
+
NativeCompressor = class extends Compressor {
|
|
475
|
+
name;
|
|
476
|
+
extensions;
|
|
477
|
+
contentEncodings;
|
|
478
|
+
isSupported = true;
|
|
479
|
+
/** Runtime stream format used for every operation. */
|
|
480
|
+
format;
|
|
481
|
+
constructor(metadata, format, options = {}) {
|
|
482
|
+
super(options);
|
|
483
|
+
this.name = metadata.name;
|
|
484
|
+
this.extensions = [...metadata.extensions];
|
|
485
|
+
this.contentEncodings = [...metadata.contentEncodings];
|
|
486
|
+
this.format = format;
|
|
487
|
+
}
|
|
488
|
+
/** Compresses one buffer with the runtime-provided stream. */
|
|
489
|
+
async compress(input) {
|
|
490
|
+
const output = await compressWithNativeCompressionStream(input, this.format);
|
|
491
|
+
if (!output) throw new Error(`${this.name}: built-in compression is no longer available`);
|
|
492
|
+
return output;
|
|
493
|
+
}
|
|
494
|
+
/** Compresses batches incrementally with the runtime-provided stream. */
|
|
495
|
+
async *compressBatches(inputBatches) {
|
|
496
|
+
const output = compressBatchesWithNativeCompressionStream(inputBatches, this.format);
|
|
497
|
+
if (!output) throw new Error(`${this.name}: built-in compression is no longer available`);
|
|
498
|
+
yield* output;
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
// ../compression/src/lib/compress-utils-compression.ts
|
|
505
|
+
async function* transformBatches2(stream, inputBatches, maximumOutputByteLength = Number.POSITIVE_INFINITY) {
|
|
506
|
+
let outputByteLength = 0;
|
|
507
|
+
try {
|
|
508
|
+
for await (const input of inputBatches) {
|
|
509
|
+
const output2 = stream.write(new Uint8Array(input));
|
|
510
|
+
if (output2.byteLength > maximumOutputByteLength - outputByteLength)
|
|
511
|
+
throw new RangeError("Decompressed output exceeds maxOutputByteLength");
|
|
512
|
+
outputByteLength += output2.byteLength;
|
|
513
|
+
if (output2.byteLength > 0) yield copyArrayBuffer(output2);
|
|
514
|
+
}
|
|
515
|
+
const output = stream.finish();
|
|
516
|
+
if (output.byteLength > maximumOutputByteLength - outputByteLength)
|
|
517
|
+
throw new RangeError("Decompressed output exceeds maxOutputByteLength");
|
|
518
|
+
if (output.byteLength > 0) yield copyArrayBuffer(output);
|
|
519
|
+
} finally {
|
|
520
|
+
stream.destroy();
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
function copyArrayBuffer(bytes) {
|
|
524
|
+
return bytes.slice().buffer;
|
|
525
|
+
}
|
|
526
|
+
var CompressUtilsCompressor;
|
|
527
|
+
var init_compress_utils_compression = __esm({
|
|
528
|
+
"../compression/src/lib/compress-utils-compression.ts"() {
|
|
529
|
+
"use strict";
|
|
530
|
+
init_compression();
|
|
531
|
+
CompressUtilsCompressor = class extends Compressor {
|
|
532
|
+
name;
|
|
533
|
+
extensions;
|
|
534
|
+
contentEncodings;
|
|
535
|
+
isSupported = true;
|
|
536
|
+
options;
|
|
537
|
+
loadModule;
|
|
538
|
+
/** Module initialized for synchronous operations. */
|
|
539
|
+
module = null;
|
|
540
|
+
/** Shared import and WASM initialization for concurrent callers. */
|
|
541
|
+
modulePromise = null;
|
|
542
|
+
/** Creates a format-specific compress-utils encoder. */
|
|
543
|
+
constructor(metadata, loadModule, options = {}) {
|
|
544
|
+
super(options);
|
|
545
|
+
this.name = metadata.name;
|
|
546
|
+
this.extensions = metadata.extensions || [];
|
|
547
|
+
this.contentEncodings = metadata.contentEncodings || [];
|
|
548
|
+
this.loadModule = loadModule;
|
|
549
|
+
this.options = options;
|
|
550
|
+
}
|
|
551
|
+
/** Imports and initializes the codec without loading the opposite direction. */
|
|
552
|
+
async preload(modules = {}) {
|
|
553
|
+
await super.preload(modules);
|
|
554
|
+
this.modulePromise ||= this.loadModule().then(async (module2) => {
|
|
555
|
+
var _a2;
|
|
556
|
+
await ((_a2 = module2.preload) == null ? void 0 : _a2.call(module2));
|
|
557
|
+
this.module = module2;
|
|
558
|
+
});
|
|
559
|
+
try {
|
|
560
|
+
await this.modulePromise;
|
|
561
|
+
} catch (error) {
|
|
562
|
+
this.modulePromise = null;
|
|
563
|
+
throw error;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
/** Runs synchronously after preload has initialized the WASM codec. */
|
|
567
|
+
compressSync(input) {
|
|
568
|
+
var _a2;
|
|
569
|
+
if (!((_a2 = this.module) == null ? void 0 : _a2.compressSync))
|
|
570
|
+
throw new Error(`${this.name}: call preload() before compressSync()`);
|
|
571
|
+
return copyArrayBuffer(
|
|
572
|
+
this.module.compressSync(new Uint8Array(input), this.options.compressUtils)
|
|
573
|
+
);
|
|
574
|
+
}
|
|
575
|
+
/** Compresses one buffer with the selected compress-utils encoder. */
|
|
576
|
+
async compress(input) {
|
|
577
|
+
await this.preload();
|
|
578
|
+
const module2 = this.module;
|
|
579
|
+
const output = await module2.compress(new Uint8Array(input), this.options.compressUtils);
|
|
580
|
+
return copyArrayBuffer(output);
|
|
581
|
+
}
|
|
582
|
+
/** Incrementally compresses input batches with compress-utils. */
|
|
583
|
+
async *compressBatches(inputBatches) {
|
|
584
|
+
await this.preload();
|
|
585
|
+
const module2 = this.module;
|
|
586
|
+
if (!module2.createCompressStream) {
|
|
587
|
+
yield await this.compress(await this.concatenate(inputBatches));
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
const stream = await module2.createCompressStream(this.options.compressUtils);
|
|
591
|
+
yield* transformBatches2(stream, inputBatches);
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
|
|
597
|
+
// ../compression/src/gzip-compressor-compress-utils.ts
|
|
598
|
+
var GZipCompressUtilsCompressor;
|
|
599
|
+
var init_gzip_compressor_compress_utils = __esm({
|
|
600
|
+
"../compression/src/gzip-compressor-compress-utils.ts"() {
|
|
601
|
+
"use strict";
|
|
602
|
+
init_compress_utils_compression();
|
|
603
|
+
GZipCompressUtilsCompressor = class extends CompressUtilsCompressor {
|
|
604
|
+
constructor(options = {}) {
|
|
605
|
+
super(
|
|
606
|
+
{ name: "gzip", extensions: ["gz", "gzip"], contentEncodings: ["gzip", "x-gzip"] },
|
|
607
|
+
() => import("compress-utils/gzip/compress"),
|
|
608
|
+
options
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
});
|
|
614
|
+
|
|
615
|
+
// ../compression/src/gzip-compressor.ts
|
|
616
|
+
var gzip_compressor_exports = {};
|
|
617
|
+
__export(gzip_compressor_exports, {
|
|
618
|
+
GZipCompressor: () => GZipCompressor
|
|
619
|
+
});
|
|
620
|
+
var GZipCompressor;
|
|
621
|
+
var init_gzip_compressor = __esm({
|
|
622
|
+
"../compression/src/gzip-compressor.ts"() {
|
|
623
|
+
"use strict";
|
|
624
|
+
init_gzip_compressor_compress_utils();
|
|
625
|
+
init_compression_stream();
|
|
626
|
+
GZipCompressor = class extends GZipCompressUtilsCompressor {
|
|
627
|
+
/** Compresses with native streams when available, otherwise lazily initializes WASM. */
|
|
628
|
+
async compress(input) {
|
|
629
|
+
if (this.options.useNative !== false) {
|
|
630
|
+
const output = await compressWithNativeCompressionStream(input, "gzip");
|
|
631
|
+
if (output) return output;
|
|
632
|
+
}
|
|
633
|
+
return super.compress(input);
|
|
634
|
+
}
|
|
635
|
+
/** Streams native batches when available, otherwise uses the WASM stream. */
|
|
636
|
+
async *compressBatches(inputBatches) {
|
|
637
|
+
if (this.options.useNative !== false) {
|
|
638
|
+
const output = compressBatchesWithNativeCompressionStream(inputBatches, "gzip");
|
|
639
|
+
if (output) {
|
|
640
|
+
yield* output;
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
yield* super.compressBatches(inputBatches);
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
// dist/pmtiles/raster.js
|
|
651
|
+
var raster_exports = {};
|
|
652
|
+
__export(raster_exports, {
|
|
653
|
+
encodeRasterPMTiles: () => encodeRasterPMTiles
|
|
654
|
+
});
|
|
655
|
+
module.exports = __toCommonJS(raster_exports);
|
|
656
|
+
|
|
657
|
+
// ../images/src/image-writer.ts
|
|
658
|
+
init_version();
|
|
659
|
+
|
|
660
|
+
// ../images/src/lib/encoders/encode-image.ts
|
|
661
|
+
init_parsed_image_api();
|
|
662
|
+
var _a;
|
|
663
|
+
var encodeImageNode = (_a = globalThis.loaders) == null ? void 0 : _a.encodeImageNode;
|
|
664
|
+
async function encodeImage(image, options) {
|
|
665
|
+
options = options || {};
|
|
666
|
+
options.image = options.image || {};
|
|
667
|
+
return encodeImageNode ? encodeImageNode(image, { type: options.image.mimeType }) : encodeImageInBrowser(image, options);
|
|
668
|
+
}
|
|
669
|
+
var qualityParamSupported = true;
|
|
670
|
+
async function encodeImageInBrowser(image, options) {
|
|
671
|
+
const { mimeType, jpegQuality } = options.image;
|
|
672
|
+
const { width, height } = getImageSize(image);
|
|
673
|
+
const canvas = typeof OffscreenCanvas !== "undefined" ? new OffscreenCanvas(width, height) : document.createElement("canvas");
|
|
674
|
+
canvas.width = width;
|
|
675
|
+
canvas.height = height;
|
|
676
|
+
drawImageToCanvas(image, canvas);
|
|
677
|
+
if ("convertToBlob" in canvas) {
|
|
678
|
+
const blob2 = await canvas.convertToBlob({ type: mimeType, quality: jpegQuality ?? void 0 });
|
|
679
|
+
return blob2.arrayBuffer();
|
|
680
|
+
}
|
|
681
|
+
const blob = await new Promise((resolve) => {
|
|
682
|
+
if (jpegQuality && qualityParamSupported) {
|
|
683
|
+
try {
|
|
684
|
+
canvas.toBlob(resolve, mimeType, jpegQuality);
|
|
685
|
+
return;
|
|
686
|
+
} catch (_error) {
|
|
687
|
+
qualityParamSupported = false;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
canvas.toBlob(resolve, mimeType);
|
|
691
|
+
});
|
|
692
|
+
if (!blob) {
|
|
693
|
+
throw new Error("image encoding failed");
|
|
694
|
+
}
|
|
695
|
+
return await blob.arrayBuffer();
|
|
696
|
+
}
|
|
697
|
+
function drawImageToCanvas(image, canvas, x = 0, y = 0) {
|
|
698
|
+
if (x === 0 && y === 0 && typeof ImageBitmap !== "undefined" && image instanceof ImageBitmap) {
|
|
699
|
+
const context2 = canvas.getContext("bitmaprenderer");
|
|
700
|
+
if (context2) {
|
|
701
|
+
context2.transferFromImageBitmap(image);
|
|
702
|
+
return canvas;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
const context = canvas.getContext("2d");
|
|
706
|
+
if (image.data) {
|
|
707
|
+
const clampedArray = new Uint8ClampedArray(image.data);
|
|
708
|
+
const imageData = new ImageData(clampedArray, image.width, image.height);
|
|
709
|
+
context.putImageData(imageData, 0, 0);
|
|
710
|
+
return canvas;
|
|
711
|
+
}
|
|
712
|
+
context.drawImage(image, 0, 0);
|
|
713
|
+
return canvas;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
// ../images/src/image-writer.ts
|
|
717
|
+
var ImageWriter = {
|
|
718
|
+
name: "Images",
|
|
719
|
+
id: "image",
|
|
720
|
+
module: "images",
|
|
721
|
+
version: VERSION,
|
|
722
|
+
extensions: ["jpeg"],
|
|
723
|
+
mimeTypes: [],
|
|
724
|
+
options: {
|
|
725
|
+
image: {
|
|
726
|
+
mimeType: "image/png",
|
|
727
|
+
jpegQuality: null
|
|
728
|
+
}
|
|
729
|
+
},
|
|
730
|
+
encode: encodeImage
|
|
731
|
+
};
|
|
732
|
+
|
|
733
|
+
// dist/pmtiles/raster.js
|
|
734
|
+
init_loader_utils();
|
|
735
|
+
|
|
736
|
+
// ../compression/src/lib/lazy-compression.ts
|
|
737
|
+
init_compression();
|
|
738
|
+
init_compression_stream();
|
|
739
|
+
var LazyCompressor = class extends Compressor {
|
|
740
|
+
name;
|
|
741
|
+
extensions;
|
|
742
|
+
contentEncodings;
|
|
743
|
+
isSupported = true;
|
|
744
|
+
/** Constructor options retained until a concrete implementation is selected. */
|
|
745
|
+
options;
|
|
746
|
+
/** Built-in stream format to probe, or null when the format has no built-in path. */
|
|
747
|
+
nativeFormat;
|
|
748
|
+
/** Returns whether built-in selection remains eligible for the merged preload options. */
|
|
749
|
+
shouldUseNative;
|
|
750
|
+
/** Dynamically imports the balanced fallback constructor. */
|
|
751
|
+
loadFallback;
|
|
752
|
+
/** Selected concrete implementation after preload completes. */
|
|
753
|
+
implementation = null;
|
|
754
|
+
/** Shared in-flight selection used by concurrent asynchronous calls. */
|
|
755
|
+
implementationPromise = null;
|
|
756
|
+
constructor(metadata, loadFallback, options = {}, nativeFormat = null, shouldUseNative = () => true) {
|
|
757
|
+
super(options);
|
|
758
|
+
this.name = metadata.name;
|
|
759
|
+
this.extensions = [...metadata.extensions];
|
|
760
|
+
this.contentEncodings = [...metadata.contentEncodings];
|
|
761
|
+
this.options = options;
|
|
762
|
+
this.nativeFormat = nativeFormat;
|
|
763
|
+
this.shouldUseNative = shouldUseNative;
|
|
764
|
+
this.loadFallback = loadFallback;
|
|
765
|
+
}
|
|
766
|
+
/** Selects and returns the built-in or dynamically imported fallback compressor. */
|
|
767
|
+
async preload(modules = {}) {
|
|
768
|
+
if (this.implementation) return this.implementation;
|
|
769
|
+
const options = mergeModules(this.options, modules);
|
|
770
|
+
this.implementationPromise ||= this.loadImplementation(options);
|
|
771
|
+
try {
|
|
772
|
+
this.implementation = await this.implementationPromise;
|
|
773
|
+
return this.implementation;
|
|
774
|
+
} catch (error) {
|
|
775
|
+
this.implementationPromise = null;
|
|
776
|
+
throw error;
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
/** Loads the selected concrete compressor. */
|
|
780
|
+
async loadImplementation(options) {
|
|
781
|
+
if (options.useNative !== false && this.nativeFormat && this.shouldUseNative(options) && isNativeCompressionSupported(this.nativeFormat)) {
|
|
782
|
+
const { NativeCompressor: NativeCompressor2 } = await Promise.resolve().then(() => (init_native_compressor(), native_compressor_exports));
|
|
783
|
+
return new NativeCompressor2(this, this.nativeFormat, options);
|
|
784
|
+
}
|
|
785
|
+
const Compressor2 = await this.loadFallback();
|
|
786
|
+
const implementation = new Compressor2({ ...options, useNative: false });
|
|
787
|
+
await implementation.preload(options.modules);
|
|
788
|
+
return implementation;
|
|
789
|
+
}
|
|
790
|
+
/** Compresses after lazily selecting the default implementation. */
|
|
791
|
+
async compress(input) {
|
|
792
|
+
return (await this.preload()).compress(input);
|
|
793
|
+
}
|
|
794
|
+
/** Compresses synchronously after an implementation has been preloaded. */
|
|
795
|
+
compressSync(input) {
|
|
796
|
+
if (!this.implementation) throw new Error(`${this.name}: call preload() before compressSync()`);
|
|
797
|
+
return this.implementation.compressSync(input);
|
|
798
|
+
}
|
|
799
|
+
/** Compresses batches after lazily selecting the default implementation. */
|
|
800
|
+
async *compressBatches(inputBatches) {
|
|
801
|
+
yield* (await this.preload()).compressBatches(inputBatches);
|
|
802
|
+
}
|
|
803
|
+
};
|
|
804
|
+
function mergeModules(options, modules) {
|
|
805
|
+
return { ...options, modules: { ...options.modules, ...modules } };
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
// ../compression/src/default-codecs.ts
|
|
809
|
+
var GZIP = { name: "gzip", extensions: ["gz"], contentEncodings: ["gzip"] };
|
|
810
|
+
var GZipCompressor2 = class extends LazyCompressor {
|
|
811
|
+
constructor(options = {}) {
|
|
812
|
+
super(GZIP, async () => (await Promise.resolve().then(() => (init_gzip_compressor(), gzip_compressor_exports))).GZipCompressor, options, "gzip");
|
|
813
|
+
}
|
|
814
|
+
};
|
|
815
|
+
|
|
816
|
+
// dist/pmtiles/lib/encode-pmtiles.js
|
|
817
|
+
var import_pmtiles = require("pmtiles");
|
|
818
|
+
var HEADER_BYTES = 127;
|
|
819
|
+
var MAX_ROOT_BYTES = 16384 - HEADER_BYTES;
|
|
820
|
+
var TILE_TYPES = { mvt: 1, png: 2, jpeg: 3, webp: 4, avif: 5, mlt: 6 };
|
|
821
|
+
var COMPRESSIONS = { none: 1, gzip: 2, brotli: 3, zstd: 4 };
|
|
822
|
+
async function encodePMTiles(input, options) {
|
|
823
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
824
|
+
(_a2 = options == null ? void 0 : options.signal) == null ? void 0 : _a2.throwIfAborted();
|
|
825
|
+
if (!options || !Object.hasOwn(TILE_TYPES, options.tileType))
|
|
826
|
+
throw new TypeError("PMTiles requires a supported tileType");
|
|
827
|
+
options = {
|
|
828
|
+
...options,
|
|
829
|
+
bounds: (_b = options.bounds) == null ? void 0 : _b.slice(),
|
|
830
|
+
center: (_c = options.center) == null ? void 0 : _c.slice()
|
|
831
|
+
};
|
|
832
|
+
const tileCompression = options.tileCompression ?? "none";
|
|
833
|
+
const internalCompression = options.internalCompression ?? "none";
|
|
834
|
+
if (!Object.hasOwn(COMPRESSIONS, tileCompression) || !["none", "gzip"].includes(internalCompression))
|
|
835
|
+
throw new TypeError("Unsupported PMTiles compression");
|
|
836
|
+
const maxTiles = validateLimit(options.maxTiles ?? 1e5, "tile");
|
|
837
|
+
const maxOutputBytes = validateLimit(options.maxOutputBytes ?? 256 * 1024 * 1024, "output");
|
|
838
|
+
const maxMetadataBytes = validateLimit(options.maxMetadataBytes ?? 1024 * 1024, "metadata");
|
|
839
|
+
const metadata = encodeMetadata(options.metadata ?? {}, options.tileType === "mvt", maxMetadataBytes);
|
|
840
|
+
const tiles = [];
|
|
841
|
+
const tileIds = /* @__PURE__ */ new Set();
|
|
842
|
+
const bounds = [180, 90, -180, -90];
|
|
843
|
+
let minZoom = 26;
|
|
844
|
+
let maxZoom = 0;
|
|
845
|
+
let payloadBytes = 0;
|
|
846
|
+
for await (const tile of input) {
|
|
847
|
+
(_d = options.signal) == null ? void 0 : _d.throwIfAborted();
|
|
848
|
+
if (tiles.length >= maxTiles)
|
|
849
|
+
throw new RangeError("PMTiles tile limit exceeded");
|
|
850
|
+
if (!Number.isInteger(tile.z) || tile.z < 0 || tile.z > 26 || !Number.isInteger(tile.x) || !Number.isInteger(tile.y) || tile.x < 0 || tile.y < 0 || tile.x >= 2 ** tile.z || tile.y >= 2 ** tile.z)
|
|
851
|
+
throw new RangeError("Invalid PMTiles XYZ tile coordinate");
|
|
852
|
+
const tileId = (0, import_pmtiles.zxyToTileId)(tile.z, tile.x, tile.y);
|
|
853
|
+
if (tileIds.has(tileId))
|
|
854
|
+
throw new Error("Duplicate PMTiles tile coordinate");
|
|
855
|
+
const data = tile.data;
|
|
856
|
+
if (!(data instanceof Blob) && !(data instanceof ArrayBuffer) && !ArrayBuffer.isView(data))
|
|
857
|
+
throw new TypeError("PMTiles tile data must be a Blob, ArrayBuffer or typed-array view");
|
|
858
|
+
const size = data instanceof Blob ? data.size : data.byteLength;
|
|
859
|
+
if (!size)
|
|
860
|
+
throw new RangeError("PMTiles tile payload must be nonempty");
|
|
861
|
+
payloadBytes += size;
|
|
862
|
+
if (HEADER_BYTES + payloadBytes > maxOutputBytes)
|
|
863
|
+
throw new RangeError("PMTiles output limit exceeded");
|
|
864
|
+
const bytes = data instanceof Blob ? new Uint8Array(await data.arrayBuffer()) : data instanceof ArrayBuffer ? new Uint8Array(data).slice() : new Uint8Array(data.buffer, data.byteOffset, data.byteLength).slice();
|
|
865
|
+
(_e = options.signal) == null ? void 0 : _e.throwIfAborted();
|
|
866
|
+
tileIds.add(tileId);
|
|
867
|
+
tiles.push({ tileId, bytes });
|
|
868
|
+
minZoom = Math.min(minZoom, tile.z);
|
|
869
|
+
maxZoom = Math.max(maxZoom, tile.z);
|
|
870
|
+
const width = 2 ** tile.z;
|
|
871
|
+
bounds[0] = Math.min(bounds[0], tile.x / width * 360 - 180);
|
|
872
|
+
bounds[1] = Math.min(bounds[1], getLatitude((tile.y + 1) / width));
|
|
873
|
+
bounds[2] = Math.max(bounds[2], (tile.x + 1) / width * 360 - 180);
|
|
874
|
+
bounds[3] = Math.max(bounds[3], getLatitude(tile.y / width));
|
|
875
|
+
}
|
|
876
|
+
if (!tiles.length)
|
|
877
|
+
throw new RangeError("PMTiles requires at least one tile");
|
|
878
|
+
const outputBounds = options.bounds ?? bounds;
|
|
879
|
+
validateBounds(outputBounds);
|
|
880
|
+
const center = options.center ?? [
|
|
881
|
+
(outputBounds[0] + outputBounds[2]) / 2,
|
|
882
|
+
(outputBounds[1] + outputBounds[3]) / 2,
|
|
883
|
+
minZoom
|
|
884
|
+
];
|
|
885
|
+
if (center.length !== 3 || !Number.isFinite(center[0]) || Math.abs(center[0]) > 180 || !Number.isFinite(center[1]) || Math.abs(center[1]) > 90 || !Number.isInteger(center[2]) || center[2] < minZoom || center[2] > maxZoom)
|
|
886
|
+
throw new RangeError("Invalid PMTiles center");
|
|
887
|
+
tiles.sort((first, second) => first.tileId - second.tileId);
|
|
888
|
+
let offset = 0;
|
|
889
|
+
const entries = tiles.map((tile) => {
|
|
890
|
+
const entry = { tileId: tile.tileId, offset, length: tile.bytes.byteLength, runLength: 1 };
|
|
891
|
+
offset += entry.length;
|
|
892
|
+
return entry;
|
|
893
|
+
});
|
|
894
|
+
const compress = async (bytes) => {
|
|
895
|
+
var _a3, _b2;
|
|
896
|
+
(_a3 = options.signal) == null ? void 0 : _a3.throwIfAborted();
|
|
897
|
+
const result = internalCompression === "gzip" ? new Uint8Array(await new GZipCompressor2().compress(bytes.buffer)) : bytes;
|
|
898
|
+
(_b2 = options.signal) == null ? void 0 : _b2.throwIfAborted();
|
|
899
|
+
return result;
|
|
900
|
+
};
|
|
901
|
+
let root = await compress(encodeDirectory(entries));
|
|
902
|
+
const leaves = [];
|
|
903
|
+
let leafBytes = 0;
|
|
904
|
+
if (root.byteLength > MAX_ROOT_BYTES) {
|
|
905
|
+
const pointers = [];
|
|
906
|
+
const entriesPerLeaf = Math.max(1024, Math.ceil(entries.length / 512));
|
|
907
|
+
for (let index = 0; index < entries.length; index += entriesPerLeaf) {
|
|
908
|
+
const leaf = await compress(encodeDirectory(entries.slice(index, index + entriesPerLeaf)));
|
|
909
|
+
pointers.push({
|
|
910
|
+
tileId: entries[index].tileId,
|
|
911
|
+
offset: leafBytes,
|
|
912
|
+
length: leaf.byteLength,
|
|
913
|
+
runLength: 0
|
|
914
|
+
});
|
|
915
|
+
leaves.push(leaf);
|
|
916
|
+
leafBytes += leaf.byteLength;
|
|
917
|
+
if (HEADER_BYTES + leafBytes + payloadBytes > maxOutputBytes)
|
|
918
|
+
throw new RangeError("PMTiles output limit exceeded");
|
|
919
|
+
}
|
|
920
|
+
root = await compress(encodeDirectory(pointers));
|
|
921
|
+
}
|
|
922
|
+
if (root.byteLength > MAX_ROOT_BYTES)
|
|
923
|
+
throw new RangeError("PMTiles root directory limit exceeded");
|
|
924
|
+
const encodedMetadata = await compress(metadata);
|
|
925
|
+
const metadataOffset = HEADER_BYTES + root.byteLength;
|
|
926
|
+
const leafOffset = metadataOffset + encodedMetadata.byteLength;
|
|
927
|
+
const tileOffset = leafOffset + leafBytes;
|
|
928
|
+
const outputLength = tileOffset + payloadBytes;
|
|
929
|
+
if (outputLength > maxOutputBytes)
|
|
930
|
+
throw new RangeError("PMTiles output limit exceeded");
|
|
931
|
+
const output = new Uint8Array(outputLength);
|
|
932
|
+
output.set(new TextEncoder().encode("PMTiles"));
|
|
933
|
+
output[7] = 3;
|
|
934
|
+
const header = new DataView(output.buffer);
|
|
935
|
+
const fields = [
|
|
936
|
+
HEADER_BYTES,
|
|
937
|
+
root.byteLength,
|
|
938
|
+
metadataOffset,
|
|
939
|
+
encodedMetadata.byteLength,
|
|
940
|
+
leafOffset,
|
|
941
|
+
leafBytes,
|
|
942
|
+
tileOffset,
|
|
943
|
+
payloadBytes,
|
|
944
|
+
tiles.length,
|
|
945
|
+
tiles.length,
|
|
946
|
+
tiles.length
|
|
947
|
+
];
|
|
948
|
+
fields.forEach((value, index) => header.setBigUint64(8 + index * 8, BigInt(value), true));
|
|
949
|
+
output.set([
|
|
950
|
+
1,
|
|
951
|
+
COMPRESSIONS[internalCompression],
|
|
952
|
+
COMPRESSIONS[tileCompression],
|
|
953
|
+
TILE_TYPES[options.tileType],
|
|
954
|
+
minZoom,
|
|
955
|
+
maxZoom
|
|
956
|
+
], 96);
|
|
957
|
+
outputBounds.forEach((value, index) => header.setInt32(102 + index * 4, Math.round(value * 1e7), true));
|
|
958
|
+
output[118] = center[2];
|
|
959
|
+
header.setInt32(119, Math.round(center[0] * 1e7), true);
|
|
960
|
+
header.setInt32(123, Math.round(center[1] * 1e7), true);
|
|
961
|
+
offset = HEADER_BYTES;
|
|
962
|
+
for (const section of [root, encodedMetadata, ...leaves, ...tiles.map((tile) => tile.bytes)]) {
|
|
963
|
+
output.set(section, offset);
|
|
964
|
+
offset += section.byteLength;
|
|
965
|
+
}
|
|
966
|
+
(_f = options.signal) == null ? void 0 : _f.throwIfAborted();
|
|
967
|
+
return output.buffer;
|
|
968
|
+
}
|
|
969
|
+
function encodeDirectory(entries) {
|
|
970
|
+
const bytes = [];
|
|
971
|
+
writeVarint(bytes, entries.length);
|
|
972
|
+
let previousTileId = 0;
|
|
973
|
+
for (const entry of entries) {
|
|
974
|
+
writeVarint(bytes, entry.tileId - previousTileId);
|
|
975
|
+
previousTileId = entry.tileId;
|
|
976
|
+
}
|
|
977
|
+
for (const entry of entries)
|
|
978
|
+
writeVarint(bytes, entry.runLength);
|
|
979
|
+
for (const entry of entries)
|
|
980
|
+
writeVarint(bytes, entry.length);
|
|
981
|
+
for (let index = 0; index < entries.length; index++) {
|
|
982
|
+
const entry = entries[index];
|
|
983
|
+
const previous = entries[index - 1];
|
|
984
|
+
writeVarint(bytes, previous && entry.offset === previous.offset + previous.length ? 0 : entry.offset + 1);
|
|
985
|
+
}
|
|
986
|
+
return Uint8Array.from(bytes);
|
|
987
|
+
}
|
|
988
|
+
function writeVarint(output, value) {
|
|
989
|
+
while (value >= 128) {
|
|
990
|
+
output.push(value % 128 + 128);
|
|
991
|
+
value = Math.floor(value / 128);
|
|
992
|
+
}
|
|
993
|
+
output.push(value);
|
|
994
|
+
}
|
|
995
|
+
function validateLimit(value, name) {
|
|
996
|
+
if (!Number.isSafeInteger(value) || value < 1)
|
|
997
|
+
throw new RangeError(`Invalid PMTiles ${name} limit`);
|
|
998
|
+
return value;
|
|
999
|
+
}
|
|
1000
|
+
function validateBounds(bounds) {
|
|
1001
|
+
if (bounds.length !== 4 || bounds.some((value) => !Number.isFinite(value)) || Math.abs(bounds[0]) > 180 || Math.abs(bounds[2]) > 180 || Math.abs(bounds[1]) > 90 || Math.abs(bounds[3]) > 90 || bounds[0] > bounds[2] || bounds[1] > bounds[3])
|
|
1002
|
+
throw new RangeError("Invalid PMTiles bounds");
|
|
1003
|
+
}
|
|
1004
|
+
function getLatitude(value) {
|
|
1005
|
+
return Math.atan(Math.sinh(Math.PI * (1 - 2 * value))) * 180 / Math.PI;
|
|
1006
|
+
}
|
|
1007
|
+
function encodeMetadata(metadata, mvt, limit) {
|
|
1008
|
+
if (!metadata || typeof metadata !== "object" || Array.isArray(metadata))
|
|
1009
|
+
throw new TypeError("PMTiles metadata must be a JSON object");
|
|
1010
|
+
const json = JSON.stringify(metadata);
|
|
1011
|
+
const normalized = JSON.parse(json);
|
|
1012
|
+
if (!normalized || typeof normalized !== "object" || Array.isArray(normalized))
|
|
1013
|
+
throw new TypeError("PMTiles metadata must serialize to a JSON object");
|
|
1014
|
+
if (mvt || normalized.vector_layers !== void 0) {
|
|
1015
|
+
const layers = normalized.vector_layers;
|
|
1016
|
+
const ids = /* @__PURE__ */ new Set();
|
|
1017
|
+
if (!Array.isArray(layers) || !layers.length)
|
|
1018
|
+
throw new TypeError("PMTiles vector_layers must declare at least one layer");
|
|
1019
|
+
for (const layer of layers) {
|
|
1020
|
+
if (!layer || typeof layer.id !== "string" || !layer.id || ids.has(layer.id) || !layer.fields || typeof layer.fields !== "object" || Array.isArray(layer.fields) || Object.values(layer.fields).some((value) => !["String", "Number", "Boolean"].includes(value)))
|
|
1021
|
+
throw new TypeError("Invalid PMTiles vector_layers declaration");
|
|
1022
|
+
ids.add(layer.id);
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
const bytes = new TextEncoder().encode(json);
|
|
1026
|
+
if (bytes.byteLength > limit)
|
|
1027
|
+
throw new RangeError("PMTiles metadata limit exceeded");
|
|
1028
|
+
return bytes;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
// dist/pmtiles/raster.js
|
|
1032
|
+
var HALF_WORLD = Math.PI * 6378137;
|
|
1033
|
+
async function encodeRasterPMTiles(source, options) {
|
|
1034
|
+
var _a2;
|
|
1035
|
+
const configuration = {
|
|
1036
|
+
...options,
|
|
1037
|
+
bands: (_a2 = options.bands) == null ? void 0 : _a2.slice(),
|
|
1038
|
+
selection: options.selection ? { ...options.selection } : void 0,
|
|
1039
|
+
pmtiles: { ...options.pmtiles }
|
|
1040
|
+
};
|
|
1041
|
+
const signal = configuration.pmtiles.signal;
|
|
1042
|
+
signal == null ? void 0 : signal.throwIfAborted();
|
|
1043
|
+
const tileSize = configuration.tileSize ?? 256;
|
|
1044
|
+
const maxSourcePixels = configuration.maxSourcePixels ?? 1024 * 1024;
|
|
1045
|
+
const maxDecodedBytes = configuration.maxDecodedBytes ?? 32 * 1024 * 1024;
|
|
1046
|
+
const maxTiles = configuration.pmtiles.maxTiles ?? 1e5;
|
|
1047
|
+
if (!Number.isSafeInteger(tileSize) || tileSize < 1 || tileSize > 1024 || !Number.isSafeInteger(maxSourcePixels) || maxSourcePixels < tileSize * tileSize || !Number.isSafeInteger(maxDecodedBytes) || maxDecodedBytes < tileSize * tileSize * 4 || !Number.isSafeInteger(maxTiles) || maxTiles < 1)
|
|
1048
|
+
throw new Error("Invalid raster PMTiles size or budget");
|
|
1049
|
+
const metadata = await waitForPromiseWithSignal(source.getMetadata({ signal }), signal);
|
|
1050
|
+
signal == null ? void 0 : signal.throwIfAborted();
|
|
1051
|
+
const sourceCRS = metadata.crs;
|
|
1052
|
+
if (sourceCRS !== "EPSG:3857" && sourceCRS !== "EPSG:4326" && sourceCRS !== "OGC:CRS84")
|
|
1053
|
+
throw new Error("Raster PMTiles requires EPSG:3857, EPSG:4326 or OGC:CRS84");
|
|
1054
|
+
const crs = sourceCRS;
|
|
1055
|
+
if (!Number.isSafeInteger(metadata.bandCount) || metadata.bandCount < 1)
|
|
1056
|
+
throw new Error("Invalid raster source band count");
|
|
1057
|
+
const bands = configuration.bands ?? Array.from({ length: Math.min(metadata.bandCount, 5) }, (_, index) => index);
|
|
1058
|
+
if (![1, 2, 3, 4].includes(bands.length) || new Set(bands).size !== bands.length || bands.some((band) => !Number.isSafeInteger(band) || band < 0 || band >= metadata.bandCount))
|
|
1059
|
+
throw new Error("Select one through four distinct raster bands");
|
|
1060
|
+
const sampleOptions = { bands: bands.map((_band, index) => index) };
|
|
1061
|
+
const archiveMetadata = { ...configuration.pmtiles.metadata };
|
|
1062
|
+
for (const name of [
|
|
1063
|
+
"vector_layers",
|
|
1064
|
+
"bounds",
|
|
1065
|
+
"minzoom",
|
|
1066
|
+
"maxzoom",
|
|
1067
|
+
"center",
|
|
1068
|
+
"tiles",
|
|
1069
|
+
"tilestats"
|
|
1070
|
+
])
|
|
1071
|
+
delete archiveMetadata[name];
|
|
1072
|
+
return encodePMTiles(encodeTiles(), {
|
|
1073
|
+
...configuration.pmtiles,
|
|
1074
|
+
metadata: archiveMetadata,
|
|
1075
|
+
tileType: "png",
|
|
1076
|
+
tileCompression: "none"
|
|
1077
|
+
});
|
|
1078
|
+
async function* encodeTiles() {
|
|
1079
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1080
|
+
let requested = 0;
|
|
1081
|
+
for await (const address of configuration.tiles) {
|
|
1082
|
+
signal == null ? void 0 : signal.throwIfAborted();
|
|
1083
|
+
const tile = { ...address };
|
|
1084
|
+
if (++requested > maxTiles)
|
|
1085
|
+
throw new Error("Raster PMTiles requested tile limit exceeded");
|
|
1086
|
+
if (!Number.isInteger(tile.z) || tile.z < 0 || tile.z > 26 || !Number.isInteger(tile.x) || !Number.isInteger(tile.y) || tile.x < 0 || tile.y < 0 || tile.x >= 2 ** tile.z || tile.y >= 2 ** tile.z)
|
|
1087
|
+
throw new Error("Invalid raster PMTiles selected XYZ address");
|
|
1088
|
+
const key = `${tile.z}/${tile.x}/${tile.y}`;
|
|
1089
|
+
if (seen.has(key))
|
|
1090
|
+
throw new Error("Duplicate raster PMTiles selected XYZ address");
|
|
1091
|
+
seen.add(key);
|
|
1092
|
+
const scale = 2 ** tile.z;
|
|
1093
|
+
const west = tile.x / scale;
|
|
1094
|
+
const east = (tile.x + 1) / scale;
|
|
1095
|
+
const north = tile.y / scale;
|
|
1096
|
+
const south = (tile.y + 1) / scale;
|
|
1097
|
+
const bounds = crs === "EPSG:3857" ? [
|
|
1098
|
+
[(2 * west - 1) * HALF_WORLD, (1 - 2 * south) * HALF_WORLD],
|
|
1099
|
+
[(2 * east - 1) * HALF_WORLD, (1 - 2 * north) * HALF_WORLD]
|
|
1100
|
+
] : [
|
|
1101
|
+
[360 * west - 180, getLatitude2(south)],
|
|
1102
|
+
[360 * east - 180, getLatitude2(north)]
|
|
1103
|
+
];
|
|
1104
|
+
const raster = await waitForPromiseWithSignal(source.getRasterForRegion({
|
|
1105
|
+
bounds,
|
|
1106
|
+
crs,
|
|
1107
|
+
width: tileSize,
|
|
1108
|
+
height: tileSize,
|
|
1109
|
+
bands: bands.slice(),
|
|
1110
|
+
selection: configuration.selection,
|
|
1111
|
+
interleaved: false,
|
|
1112
|
+
resampleMethod: "nearest",
|
|
1113
|
+
maxPixels: maxSourcePixels,
|
|
1114
|
+
maxDecodedBytes,
|
|
1115
|
+
signal
|
|
1116
|
+
}), signal);
|
|
1117
|
+
signal == null ? void 0 : signal.throwIfAborted();
|
|
1118
|
+
validateRaster(raster, bands.length, tileSize, maxSourcePixels, maxDecodedBytes);
|
|
1119
|
+
const pixels = new Uint8Array(tileSize * tileSize * 4);
|
|
1120
|
+
let visible = false;
|
|
1121
|
+
const firstX = bounds[0][0] + (bounds[1][0] - bounds[0][0]) / (2 * tileSize);
|
|
1122
|
+
const lastX = bounds[1][0] - (bounds[1][0] - bounds[0][0]) / (2 * tileSize);
|
|
1123
|
+
for (let row = 0; row < tileSize; row++) {
|
|
1124
|
+
if (row % 32 === 0) {
|
|
1125
|
+
signal == null ? void 0 : signal.throwIfAborted();
|
|
1126
|
+
if (row)
|
|
1127
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
1128
|
+
signal == null ? void 0 : signal.throwIfAborted();
|
|
1129
|
+
}
|
|
1130
|
+
const normalizedY = north + (row + 0.5) / (tileSize * scale);
|
|
1131
|
+
const sourceY = crs === "EPSG:3857" ? (1 - 2 * normalizedY) * HALF_WORLD : getLatitude2(normalizedY);
|
|
1132
|
+
const firstPixel = rasterCoordinateToPixel(raster, [firstX, sourceY], crs);
|
|
1133
|
+
const lastPixel = rasterCoordinateToPixel(raster, [lastX, sourceY], crs);
|
|
1134
|
+
for (let column = 0; column < tileSize; column++) {
|
|
1135
|
+
const fraction = tileSize === 1 ? 0 : column / (tileSize - 1);
|
|
1136
|
+
const sample = sampleRaster(raster, [
|
|
1137
|
+
firstPixel[0] + (lastPixel[0] - firstPixel[0]) * fraction,
|
|
1138
|
+
firstPixel[1] + (lastPixel[1] - firstPixel[1]) * fraction
|
|
1139
|
+
], sampleOptions);
|
|
1140
|
+
if (!sample.valid.every(Boolean))
|
|
1141
|
+
continue;
|
|
1142
|
+
const values = sample.values;
|
|
1143
|
+
const offset = (row * tileSize + column) * 4;
|
|
1144
|
+
const grayscale = values.length < 3;
|
|
1145
|
+
pixels[offset] = values[0];
|
|
1146
|
+
pixels[offset + 1] = grayscale ? values[0] : values[1];
|
|
1147
|
+
pixels[offset + 2] = grayscale ? values[0] : values[2];
|
|
1148
|
+
pixels[offset + 3] = values.length === 2 ? values[1] : values.length === 4 ? values[3] : 255;
|
|
1149
|
+
visible ||= pixels[offset + 3] > 0;
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
if (!visible)
|
|
1153
|
+
continue;
|
|
1154
|
+
const data = await waitForPromiseWithSignal(ImageWriter.encode({ data: pixels, width: tileSize, height: tileSize }, { image: { mimeType: "image/png" } }), signal);
|
|
1155
|
+
signal == null ? void 0 : signal.throwIfAborted();
|
|
1156
|
+
yield { ...tile, data };
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
function getLatitude2(normalizedY) {
|
|
1161
|
+
return Math.atan(Math.sinh(Math.PI * (1 - 2 * normalizedY))) * 180 / Math.PI;
|
|
1162
|
+
}
|
|
1163
|
+
function validateRaster(raster, bandCount, tileSize, maxPixels, maxBytes) {
|
|
1164
|
+
var _a2;
|
|
1165
|
+
const pixels = raster.width * raster.height;
|
|
1166
|
+
if (!Number.isSafeInteger(raster.width) || raster.width < 1 || !Number.isSafeInteger(raster.height) || raster.height < 1 || !Number.isSafeInteger(pixels) || pixels > maxPixels || raster.bandCount !== bandCount || raster.dtype !== "uint8" || raster.bands && raster.bands.length !== bandCount || ((_a2 = raster.bands) == null ? void 0 : _a2.some((band) => band.dtype !== "uint8" || (band.scale ?? 1) !== 1 || (band.offset ?? 0) !== 0)))
|
|
1167
|
+
throw new Error("Raster PMTiles requires bounded raw uint8 imagery with matching selected bands");
|
|
1168
|
+
const buffers = Array.isArray(raster.data) ? raster.data : [raster.data];
|
|
1169
|
+
const expectedLength = Array.isArray(raster.data) ? pixels : pixels * bandCount;
|
|
1170
|
+
if (Array.isArray(raster.data) && buffers.length !== bandCount || buffers.some((buffer) => !(buffer instanceof Uint8Array) && !(buffer instanceof Uint8ClampedArray) || buffer.length !== expectedLength))
|
|
1171
|
+
throw new Error("Invalid raster PMTiles sample buffers");
|
|
1172
|
+
for (const mask of raster.validityMasks ?? []) {
|
|
1173
|
+
const offset = mask.offset ?? 0;
|
|
1174
|
+
const pixelStride = mask.pixelStride ?? 1;
|
|
1175
|
+
const rowStride = mask.rowStride ?? mask.width;
|
|
1176
|
+
if (!(mask.data instanceof Uint8Array) || mask.width !== raster.width || mask.height !== raster.height || !Number.isSafeInteger(offset) || offset < 0 || !Number.isSafeInteger(pixelStride) || pixelStride < 1 || !Number.isSafeInteger(rowStride) || rowStride < 1 || offset + (mask.height - 1) * rowStride + (mask.width - 1) * pixelStride >= mask.data.length || mask.band !== void 0 && (!Number.isInteger(mask.band) || mask.band < 0 || mask.band >= bandCount))
|
|
1177
|
+
throw new Error("Invalid raster PMTiles validity mask");
|
|
1178
|
+
}
|
|
1179
|
+
const bytes = buffers.reduce((total, buffer) => total + buffer.byteLength, tileSize * tileSize * 4) + (raster.validityMasks ?? []).reduce((total, mask) => total + mask.data.byteLength, 0);
|
|
1180
|
+
if (bytes > maxBytes)
|
|
1181
|
+
throw new Error("Raster PMTiles decoded-byte budget exceeded");
|
|
1182
|
+
}
|
|
1183
|
+
//# sourceMappingURL=raster.cjs.map
|