@loaders.gl/geospatial 5.0.0-beta.1 → 5.0.0-beta.10
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/README.md +6 -2
- package/WKT-README.md +1 -1
- package/dist/dbf-loader-types.cjs +68 -0
- package/dist/dbf-loader-types.cjs.map +7 -0
- package/dist/dbf-loader-types.d.ts +2 -0
- package/dist/dbf-loader-types.d.ts.map +1 -0
- package/dist/dbf-loader-types.js +2 -0
- package/dist/dbf-loader-types.js.map +1 -0
- package/dist/dbf-loader.cjs +83 -0
- package/dist/dbf-loader.cjs.map +7 -0
- package/dist/dbf-loader.d.ts +2 -0
- package/dist/dbf-loader.d.ts.map +1 -0
- package/dist/dbf-loader.js +2 -0
- package/dist/dbf-loader.js.map +1 -0
- package/dist/dbf-worker.js +1603 -678
- package/dist/flatgeobuf/flatgeobuf-loader-types.cjs +12 -8
- package/dist/flatgeobuf/flatgeobuf-loader-types.cjs.map +2 -2
- package/dist/flatgeobuf/flatgeobuf-loader-types.d.ts +25 -34
- package/dist/flatgeobuf/flatgeobuf-loader-types.d.ts.map +1 -1
- package/dist/flatgeobuf/flatgeobuf-loader-types.js +10 -5
- package/dist/flatgeobuf/flatgeobuf-loader-types.js.map +1 -1
- package/dist/flatgeobuf/flatgeobuf-loader.cjs +4 -2
- package/dist/flatgeobuf/flatgeobuf-loader.cjs.map +2 -2
- package/dist/flatgeobuf/flatgeobuf-loader.d.ts +22 -6
- package/dist/flatgeobuf/flatgeobuf-loader.d.ts.map +1 -1
- package/dist/flatgeobuf/flatgeobuf-loader.js +4 -2
- package/dist/flatgeobuf/flatgeobuf-loader.js.map +1 -1
- package/dist/flatgeobuf/flatgeobuf-source-loader.cjs +15 -23
- package/dist/flatgeobuf/flatgeobuf-source-loader.cjs.map +2 -2
- package/dist/flatgeobuf/flatgeobuf-source-loader.d.ts +8 -32
- package/dist/flatgeobuf/flatgeobuf-source-loader.d.ts.map +1 -1
- package/dist/flatgeobuf/flatgeobuf-source-loader.js +16 -22
- package/dist/flatgeobuf/flatgeobuf-source-loader.js.map +1 -1
- package/dist/flatgeobuf/index.cjs +2 -9
- package/dist/flatgeobuf/index.cjs.map +3 -3
- package/dist/flatgeobuf/index.d.ts +1 -3
- package/dist/flatgeobuf/index.d.ts.map +1 -1
- package/dist/flatgeobuf/index.js +1 -4
- package/dist/flatgeobuf/index.js.map +1 -1
- package/dist/flatgeobuf/lib/flatgeobuf-worker-transport.cjs +5 -36
- package/dist/flatgeobuf/lib/flatgeobuf-worker-transport.cjs.map +2 -2
- package/dist/flatgeobuf/lib/flatgeobuf-worker-transport.d.ts +5 -4
- package/dist/flatgeobuf/lib/flatgeobuf-worker-transport.d.ts.map +1 -1
- package/dist/flatgeobuf/lib/flatgeobuf-worker-transport.js +7 -34
- package/dist/flatgeobuf/lib/flatgeobuf-worker-transport.js.map +1 -1
- package/dist/flatgeobuf/lib/parse-flatgeobuf.cjs +3 -3
- package/dist/flatgeobuf/lib/parse-flatgeobuf.cjs.map +2 -2
- package/dist/flatgeobuf/lib/parse-flatgeobuf.d.ts +3 -2
- package/dist/flatgeobuf/lib/parse-flatgeobuf.d.ts.map +1 -1
- package/dist/flatgeobuf/lib/parse-flatgeobuf.js +3 -3
- package/dist/flatgeobuf/lib/parse-flatgeobuf.js.map +1 -1
- package/dist/flatgeobuf/unbundled.cjs +2 -4
- package/dist/flatgeobuf/unbundled.cjs.map +2 -2
- package/dist/flatgeobuf/unbundled.d.ts +1 -1
- package/dist/flatgeobuf/unbundled.d.ts.map +1 -1
- package/dist/flatgeobuf/unbundled.js +1 -1
- package/dist/flatgeobuf/unbundled.js.map +1 -1
- package/dist/flatgeobuf-loader-types.cjs +74 -0
- package/dist/flatgeobuf-loader-types.cjs.map +7 -0
- package/dist/flatgeobuf-loader-types.d.ts +2 -0
- package/dist/flatgeobuf-loader-types.d.ts.map +1 -0
- package/dist/flatgeobuf-loader-types.js +2 -0
- package/dist/flatgeobuf-loader-types.js.map +1 -0
- package/dist/flatgeobuf-loader.cjs +68 -0
- package/dist/flatgeobuf-loader.cjs.map +7 -0
- package/dist/flatgeobuf-loader.d.ts +2 -0
- package/dist/flatgeobuf-loader.d.ts.map +1 -0
- package/dist/flatgeobuf-loader.js +2 -0
- package/dist/flatgeobuf-loader.js.map +1 -0
- package/dist/flatgeobuf-source-loader.cjs +244 -0
- package/dist/flatgeobuf-source-loader.cjs.map +7 -0
- package/dist/flatgeobuf-source-loader.d.ts +2 -0
- package/dist/flatgeobuf-source-loader.d.ts.map +1 -0
- package/dist/flatgeobuf-source-loader.js +2 -0
- package/dist/flatgeobuf-source-loader.js.map +1 -0
- package/dist/flatgeobuf-worker.js +4862 -1773
- package/dist/geopackage/geopackage-loader-types.cjs +8 -2
- package/dist/geopackage/geopackage-loader-types.cjs.map +2 -2
- package/dist/geopackage/geopackage-loader-types.d.ts +19 -6
- package/dist/geopackage/geopackage-loader-types.d.ts.map +1 -1
- package/dist/geopackage/geopackage-loader-types.js +8 -2
- package/dist/geopackage/geopackage-loader-types.js.map +1 -1
- package/dist/geopackage/geopackage-loader.cjs +2 -0
- package/dist/geopackage/geopackage-loader.cjs.map +2 -2
- package/dist/geopackage/geopackage-loader.d.ts +11 -3
- package/dist/geopackage/geopackage-loader.d.ts.map +1 -1
- package/dist/geopackage/geopackage-loader.js +2 -0
- package/dist/geopackage/geopackage-loader.js.map +1 -1
- package/dist/geopackage/geopackage-source-loader.cjs +38 -38
- package/dist/geopackage/geopackage-source-loader.cjs.map +3 -3
- package/dist/geopackage/geopackage-source-loader.d.ts +17 -43
- package/dist/geopackage/geopackage-source-loader.d.ts.map +1 -1
- package/dist/geopackage/geopackage-source-loader.js +42 -42
- package/dist/geopackage/geopackage-source-loader.js.map +1 -1
- package/dist/geopackage/index.cjs +2 -4
- package/dist/geopackage/index.cjs.map +2 -2
- package/dist/geopackage/index.d.ts +1 -1
- package/dist/geopackage/index.d.ts.map +1 -1
- package/dist/geopackage/index.js +1 -1
- package/dist/geopackage/index.js.map +1 -1
- package/dist/geopackage/lib/parse-geopackage.cjs +8 -4
- package/dist/geopackage/lib/parse-geopackage.cjs.map +2 -2
- package/dist/geopackage/lib/parse-geopackage.d.ts +2 -1
- package/dist/geopackage/lib/parse-geopackage.d.ts.map +1 -1
- package/dist/geopackage/lib/parse-geopackage.js +8 -5
- package/dist/geopackage/lib/parse-geopackage.js.map +1 -1
- package/dist/geopackage-loader-types.cjs +69 -0
- package/dist/geopackage-loader-types.cjs.map +7 -0
- package/dist/geopackage-loader-types.d.ts +2 -0
- package/dist/geopackage-loader-types.d.ts.map +1 -0
- package/dist/geopackage-loader-types.js +2 -0
- package/dist/geopackage-loader-types.js.map +1 -0
- package/dist/geopackage-loader.cjs +41 -0
- package/dist/geopackage-loader.cjs.map +7 -0
- package/dist/geopackage-loader.d.ts +2 -0
- package/dist/geopackage-loader.d.ts.map +1 -0
- package/dist/geopackage-loader.js +2 -0
- package/dist/geopackage-loader.js.map +1 -0
- package/dist/geopackage-source-loader.cjs +265 -0
- package/dist/geopackage-source-loader.cjs.map +7 -0
- package/dist/geopackage-source-loader.d.ts +2 -0
- package/dist/geopackage-source-loader.d.ts.map +1 -0
- package/dist/geopackage-source-loader.js +2 -0
- package/dist/geopackage-source-loader.js.map +1 -0
- package/dist/gpx-loader-types.cjs +61 -0
- package/dist/gpx-loader-types.cjs.map +7 -0
- package/dist/gpx-loader-types.d.ts +2 -0
- package/dist/gpx-loader-types.d.ts.map +1 -0
- package/dist/gpx-loader-types.js +2 -0
- package/dist/gpx-loader-types.js.map +1 -0
- package/dist/gpx-loader.cjs +79 -0
- package/dist/gpx-loader.cjs.map +7 -0
- package/dist/gpx-loader.d.ts +2 -0
- package/dist/gpx-loader.d.ts.map +1 -0
- package/dist/gpx-loader.js +2 -0
- package/dist/gpx-loader.js.map +1 -0
- package/dist/hex-wkb-loader-types.cjs +74 -0
- package/dist/hex-wkb-loader-types.cjs.map +7 -0
- package/dist/hex-wkb-loader-types.d.ts +2 -0
- package/dist/hex-wkb-loader-types.d.ts.map +1 -0
- package/dist/hex-wkb-loader-types.js +2 -0
- package/dist/hex-wkb-loader-types.js.map +1 -0
- package/dist/hex-wkb-loader.cjs +69 -0
- package/dist/hex-wkb-loader.cjs.map +7 -0
- package/dist/hex-wkb-loader.d.ts +2 -0
- package/dist/hex-wkb-loader.d.ts.map +1 -0
- package/dist/hex-wkb-loader.js +2 -0
- package/dist/hex-wkb-loader.js.map +1 -0
- package/dist/index.cjs +0 -7
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/kml/bundled.cjs +0 -2
- package/dist/kml/bundled.cjs.map +2 -2
- package/dist/kml/bundled.d.ts +1 -1
- package/dist/kml/bundled.d.ts.map +1 -1
- package/dist/kml/bundled.js +1 -1
- package/dist/kml/bundled.js.map +1 -1
- package/dist/kml/gpx-loader-types.cjs +4 -2
- package/dist/kml/gpx-loader-types.cjs.map +2 -2
- package/dist/kml/gpx-loader-types.d.ts +11 -6
- package/dist/kml/gpx-loader-types.d.ts.map +1 -1
- package/dist/kml/gpx-loader-types.js +4 -2
- package/dist/kml/gpx-loader-types.js.map +1 -1
- package/dist/kml/gpx-loader.cjs +1 -1
- package/dist/kml/gpx-loader.cjs.map +2 -2
- package/dist/kml/gpx-loader.d.ts +9 -18
- package/dist/kml/gpx-loader.d.ts.map +1 -1
- package/dist/kml/gpx-loader.js +2 -2
- package/dist/kml/gpx-loader.js.map +1 -1
- package/dist/kml/index.cjs +0 -2
- package/dist/kml/index.cjs.map +2 -2
- package/dist/kml/index.d.ts +1 -1
- package/dist/kml/index.d.ts.map +1 -1
- package/dist/kml/index.js +1 -1
- package/dist/kml/index.js.map +1 -1
- package/dist/kml/kml-loader-types.cjs +5 -3
- package/dist/kml/kml-loader-types.cjs.map +2 -2
- package/dist/kml/kml-loader-types.d.ts +11 -6
- package/dist/kml/kml-loader-types.d.ts.map +1 -1
- package/dist/kml/kml-loader-types.js +5 -3
- package/dist/kml/kml-loader-types.js.map +1 -1
- package/dist/kml/kml-loader.cjs +1 -1
- package/dist/kml/kml-loader.cjs.map +2 -2
- package/dist/kml/kml-loader.d.ts +9 -18
- package/dist/kml/kml-loader.d.ts.map +1 -1
- package/dist/kml/kml-loader.js +2 -2
- package/dist/kml/kml-loader.js.map +1 -1
- package/dist/kml/kml-parser.cjs +4 -3
- package/dist/kml/kml-parser.cjs.map +2 -2
- package/dist/kml/kml-parser.d.ts.map +1 -1
- package/dist/kml/kml-parser.js +3 -2
- package/dist/kml/kml-parser.js.map +1 -1
- package/dist/kml/kml-writer.cjs +1 -1
- package/dist/kml/kml-writer.cjs.map +1 -1
- package/dist/kml/kml-writer.js +1 -1
- package/dist/kml/kml-writer.js.map +1 -1
- package/dist/kml/kmz-loader-types.cjs +12 -2
- package/dist/kml/kmz-loader-types.cjs.map +2 -2
- package/dist/kml/kmz-loader-types.d.ts +24 -6
- package/dist/kml/kmz-loader-types.d.ts.map +1 -1
- package/dist/kml/kmz-loader-types.js +10 -2
- package/dist/kml/kmz-loader-types.js.map +1 -1
- package/dist/kml/kmz-loader.cjs +5 -2
- package/dist/kml/kmz-loader.cjs.map +2 -2
- package/dist/kml/kmz-loader.d.ts +13 -3
- package/dist/kml/kmz-loader.d.ts.map +1 -1
- package/dist/kml/kmz-loader.js +5 -2
- package/dist/kml/kmz-loader.js.map +1 -1
- package/dist/kml/kmz-source.cjs +9 -23
- package/dist/kml/kmz-source.cjs.map +2 -2
- package/dist/kml/kmz-source.d.ts +2 -32
- package/dist/kml/kmz-source.d.ts.map +1 -1
- package/dist/kml/kmz-source.js +7 -19
- package/dist/kml/kmz-source.js.map +1 -1
- package/dist/kml/lib/feature-collection-to-arrow.cjs +1 -1
- package/dist/kml/lib/feature-collection-to-arrow.cjs.map +2 -2
- package/dist/kml/lib/feature-collection-to-arrow.d.ts +3 -2
- package/dist/kml/lib/feature-collection-to-arrow.d.ts.map +1 -1
- package/dist/kml/lib/feature-collection-to-arrow.js +1 -1
- package/dist/kml/lib/feature-collection-to-arrow.js.map +1 -1
- package/dist/kml/sports-track-parser.cjs +4 -3
- package/dist/kml/sports-track-parser.cjs.map +2 -2
- package/dist/kml/sports-track-parser.js +3 -2
- package/dist/kml/sports-track-parser.js.map +1 -1
- package/dist/kml/tcx-loader-types.cjs +4 -2
- package/dist/kml/tcx-loader-types.cjs.map +2 -2
- package/dist/kml/tcx-loader-types.d.ts +11 -6
- package/dist/kml/tcx-loader-types.d.ts.map +1 -1
- package/dist/kml/tcx-loader-types.js +4 -2
- package/dist/kml/tcx-loader-types.js.map +1 -1
- package/dist/kml/tcx-loader.cjs +1 -1
- package/dist/kml/tcx-loader.cjs.map +2 -2
- package/dist/kml/tcx-loader.d.ts +9 -18
- package/dist/kml/tcx-loader.d.ts.map +1 -1
- package/dist/kml/tcx-loader.js +2 -2
- package/dist/kml/tcx-loader.js.map +1 -1
- package/dist/kml/unbundled.cjs +0 -2
- package/dist/kml/unbundled.cjs.map +2 -2
- package/dist/kml/unbundled.d.ts +1 -1
- package/dist/kml/unbundled.d.ts.map +1 -1
- package/dist/kml/unbundled.js +1 -1
- package/dist/kml/unbundled.js.map +1 -1
- package/dist/kml-loader-types.cjs +61 -0
- package/dist/kml-loader-types.cjs.map +7 -0
- package/dist/kml-loader-types.d.ts +2 -0
- package/dist/kml-loader-types.d.ts.map +1 -0
- package/dist/kml-loader-types.js +2 -0
- package/dist/kml-loader-types.js.map +1 -0
- package/dist/kml-loader.cjs +77 -0
- package/dist/kml-loader.cjs.map +7 -0
- package/dist/kml-loader.d.ts +2 -0
- package/dist/kml-loader.d.ts.map +1 -0
- package/dist/kml-loader.js +2 -0
- package/dist/kml-loader.js.map +1 -0
- package/dist/kml-writer.cjs +212 -0
- package/dist/kml-writer.cjs.map +7 -0
- package/dist/kml-writer.d.ts +2 -0
- package/dist/kml-writer.d.ts.map +1 -0
- package/dist/kml-writer.js +2 -0
- package/dist/kml-writer.js.map +1 -0
- package/dist/kmz-loader-types.cjs +68 -0
- package/dist/kmz-loader-types.cjs.map +7 -0
- package/dist/kmz-loader-types.d.ts +2 -0
- package/dist/kmz-loader-types.d.ts.map +1 -0
- package/dist/kmz-loader-types.js +2 -0
- package/dist/kmz-loader-types.js.map +1 -0
- package/dist/kmz-loader.cjs +71 -0
- package/dist/kmz-loader.cjs.map +7 -0
- package/dist/kmz-loader.d.ts +2 -0
- package/dist/kmz-loader.d.ts.map +1 -0
- package/dist/kmz-loader.js +2 -0
- package/dist/kmz-loader.js.map +1 -0
- package/dist/kmz-source.cjs +177 -0
- package/dist/kmz-source.cjs.map +7 -0
- package/dist/kmz-source.d.ts +2 -0
- package/dist/kmz-source.d.ts.map +1 -0
- package/dist/kmz-source.js +2 -0
- package/dist/kmz-source.js.map +1 -0
- package/dist/shapefile/dbf-loader-types.cjs +5 -7
- package/dist/shapefile/dbf-loader-types.cjs.map +2 -2
- package/dist/shapefile/dbf-loader-types.d.ts +1 -3
- package/dist/shapefile/dbf-loader-types.d.ts.map +1 -1
- package/dist/shapefile/dbf-loader-types.js +3 -4
- package/dist/shapefile/dbf-loader-types.js.map +1 -1
- package/dist/shapefile/dbf-loader.cjs +24 -14
- package/dist/shapefile/dbf-loader.cjs.map +2 -2
- package/dist/shapefile/dbf-loader.d.ts +310 -4
- package/dist/shapefile/dbf-loader.d.ts.map +1 -1
- package/dist/shapefile/dbf-loader.js +30 -18
- package/dist/shapefile/dbf-loader.js.map +1 -1
- package/dist/shapefile/index.cjs +0 -6
- package/dist/shapefile/index.cjs.map +3 -3
- package/dist/shapefile/index.d.ts +0 -4
- package/dist/shapefile/index.d.ts.map +1 -1
- package/dist/shapefile/index.js +0 -5
- package/dist/shapefile/index.js.map +1 -1
- package/dist/shapefile/lib/parsers/build-geoarrow-geometry-arrow.cjs +1 -1
- package/dist/shapefile/lib/parsers/build-geoarrow-geometry-arrow.cjs.map +2 -2
- package/dist/shapefile/lib/parsers/build-geoarrow-geometry-arrow.js +1 -1
- package/dist/shapefile/lib/parsers/build-geoarrow-geometry-arrow.js.map +1 -1
- package/dist/shapefile/lib/parsers/parse-dbf-to-arrow.cjs.map +2 -2
- package/dist/shapefile/lib/parsers/parse-dbf-to-arrow.d.ts +4 -4
- package/dist/shapefile/lib/parsers/parse-dbf-to-arrow.d.ts.map +1 -1
- package/dist/shapefile/lib/parsers/parse-dbf-to-arrow.js.map +1 -1
- package/dist/shapefile/lib/parsers/parse-shapefile.cjs.map +1 -1
- package/dist/shapefile/lib/parsers/parse-shapefile.js +1 -1
- package/dist/shapefile/lib/parsers/parse-shapefile.js.map +1 -1
- package/dist/shapefile/lib/parsers/parse-shp-header.cjs +4 -3
- package/dist/shapefile/lib/parsers/parse-shp-header.cjs.map +2 -2
- package/dist/shapefile/lib/parsers/parse-shp-header.d.ts +2 -1
- package/dist/shapefile/lib/parsers/parse-shp-header.d.ts.map +1 -1
- package/dist/shapefile/lib/parsers/parse-shp-header.js +4 -5
- package/dist/shapefile/lib/parsers/parse-shp-header.js.map +1 -1
- package/dist/shapefile/lib/parsers/parse-shp-to-arrow.cjs +2 -2
- package/dist/shapefile/lib/parsers/parse-shp-to-arrow.cjs.map +2 -2
- package/dist/shapefile/lib/parsers/parse-shp-to-arrow.js +2 -2
- package/dist/shapefile/lib/parsers/parse-shp-to-arrow.js.map +1 -1
- package/dist/shapefile/lib/parsers/parse-shp.cjs +1 -1
- package/dist/shapefile/lib/parsers/parse-shp.cjs.map +2 -2
- package/dist/shapefile/lib/parsers/parse-shp.js +1 -1
- package/dist/shapefile/lib/parsers/parse-shp.js.map +1 -1
- package/dist/shapefile/lib/parsers/types.cjs.map +1 -1
- package/dist/shapefile/lib/parsers/types.d.ts +3 -3
- package/dist/shapefile/lib/parsers/types.d.ts.map +1 -1
- package/dist/shapefile/lib/shapefile-worker-transport.cjs +9 -3
- package/dist/shapefile/lib/shapefile-worker-transport.cjs.map +2 -2
- package/dist/shapefile/lib/shapefile-worker-transport.d.ts.map +1 -1
- package/dist/shapefile/lib/shapefile-worker-transport.js +7 -2
- package/dist/shapefile/lib/shapefile-worker-transport.js.map +1 -1
- package/dist/shapefile/shapefile-arrow-loader.cjs +48 -12
- package/dist/shapefile/shapefile-arrow-loader.cjs.map +3 -3
- package/dist/shapefile/shapefile-arrow-loader.d.ts.map +1 -1
- package/dist/shapefile/shapefile-arrow-loader.js +45 -10
- package/dist/shapefile/shapefile-arrow-loader.js.map +1 -1
- package/dist/shapefile/shapefile-loader-types.cjs +5 -3
- package/dist/shapefile/shapefile-loader-types.cjs.map +2 -2
- package/dist/shapefile/shapefile-loader-types.d.ts +17 -12
- package/dist/shapefile/shapefile-loader-types.d.ts.map +1 -1
- package/dist/shapefile/shapefile-loader-types.js +5 -3
- package/dist/shapefile/shapefile-loader-types.js.map +1 -1
- package/dist/shapefile/shapefile-loader.cjs +54 -5
- package/dist/shapefile/shapefile-loader.cjs.map +2 -2
- package/dist/shapefile/shapefile-loader.d.ts +42 -5
- package/dist/shapefile/shapefile-loader.d.ts.map +1 -1
- package/dist/shapefile/shapefile-loader.js +60 -5
- package/dist/shapefile/shapefile-loader.js.map +1 -1
- package/dist/shapefile/shp-loader-types.cjs +3 -5
- package/dist/shapefile/shp-loader-types.cjs.map +2 -2
- package/dist/shapefile/shp-loader-types.d.ts +1 -3
- package/dist/shapefile/shp-loader-types.d.ts.map +1 -1
- package/dist/shapefile/shp-loader-types.js +3 -4
- package/dist/shapefile/shp-loader-types.js.map +1 -1
- package/dist/shapefile/shp-loader.cjs +54 -6
- package/dist/shapefile/shp-loader.cjs.map +2 -2
- package/dist/shapefile/shp-loader.d.ts +190 -2
- package/dist/shapefile/shp-loader.d.ts.map +1 -1
- package/dist/shapefile/shp-loader.js +62 -8
- package/dist/shapefile/shp-loader.js.map +1 -1
- package/dist/shapefile/unbundled.cjs +0 -4
- package/dist/shapefile/unbundled.cjs.map +2 -2
- package/dist/shapefile/unbundled.d.ts +2 -2
- package/dist/shapefile/unbundled.d.ts.map +1 -1
- package/dist/shapefile/unbundled.js +2 -2
- package/dist/shapefile/unbundled.js.map +1 -1
- package/dist/shapefile-arrow-loader.cjs +415 -0
- package/dist/shapefile-arrow-loader.cjs.map +7 -0
- package/dist/shapefile-arrow-loader.d.ts +2 -0
- package/dist/shapefile-arrow-loader.d.ts.map +1 -0
- package/dist/shapefile-arrow-loader.js +2 -0
- package/dist/shapefile-arrow-loader.js.map +1 -0
- package/dist/shapefile-loader-types.cjs +67 -0
- package/dist/shapefile-loader-types.cjs.map +7 -0
- package/dist/shapefile-loader-types.d.ts +2 -0
- package/dist/shapefile-loader-types.d.ts.map +1 -0
- package/dist/shapefile-loader-types.js +2 -0
- package/dist/shapefile-loader-types.js.map +1 -0
- package/dist/shapefile-loader.cjs +124 -0
- package/dist/shapefile-loader.cjs.map +7 -0
- package/dist/shapefile-loader.d.ts +2 -0
- package/dist/shapefile-loader.d.ts.map +1 -0
- package/dist/shapefile-loader.js +2 -0
- package/dist/shapefile-loader.js.map +1 -0
- package/dist/shapefile-worker.js +28146 -26262
- package/dist/shp-loader-types.cjs +67 -0
- package/dist/shp-loader-types.cjs.map +7 -0
- package/dist/shp-loader-types.d.ts +2 -0
- package/dist/shp-loader-types.d.ts.map +1 -0
- package/dist/shp-loader-types.js +2 -0
- package/dist/shp-loader-types.js.map +1 -0
- package/dist/shp-loader.cjs +108 -0
- package/dist/shp-loader.cjs.map +7 -0
- package/dist/shp-loader.d.ts +2 -0
- package/dist/shp-loader.d.ts.map +1 -0
- package/dist/shp-loader.js +2 -0
- package/dist/shp-loader.js.map +1 -0
- package/dist/shp-worker.js +7881 -6208
- package/dist/tcx-loader-types.cjs +61 -0
- package/dist/tcx-loader-types.cjs.map +7 -0
- package/dist/tcx-loader-types.d.ts +2 -0
- package/dist/tcx-loader-types.d.ts.map +1 -0
- package/dist/tcx-loader-types.js +2 -0
- package/dist/tcx-loader-types.js.map +1 -0
- package/dist/tcx-loader.cjs +79 -0
- package/dist/tcx-loader.cjs.map +7 -0
- package/dist/tcx-loader.d.ts +2 -0
- package/dist/tcx-loader.d.ts.map +1 -0
- package/dist/tcx-loader.js +2 -0
- package/dist/tcx-loader.js.map +1 -0
- package/dist/twkb-loader-types.cjs +73 -0
- package/dist/twkb-loader-types.cjs.map +7 -0
- package/dist/twkb-loader-types.d.ts +2 -0
- package/dist/twkb-loader-types.d.ts.map +1 -0
- package/dist/twkb-loader-types.js +2 -0
- package/dist/twkb-loader-types.js.map +1 -0
- package/dist/twkb-loader.cjs +47 -0
- package/dist/twkb-loader.cjs.map +7 -0
- package/dist/twkb-loader.d.ts +2 -0
- package/dist/twkb-loader.d.ts.map +1 -0
- package/dist/twkb-loader.js +2 -0
- package/dist/twkb-loader.js.map +1 -0
- package/dist/twkb-writer.cjs +52 -0
- package/dist/twkb-writer.cjs.map +7 -0
- package/dist/twkb-writer.d.ts +2 -0
- package/dist/twkb-writer.d.ts.map +1 -0
- package/dist/twkb-writer.js +2 -0
- package/dist/twkb-writer.js.map +1 -0
- package/dist/wkb-loader-types.cjs +62 -0
- package/dist/wkb-loader-types.cjs.map +7 -0
- package/dist/wkb-loader-types.d.ts +2 -0
- package/dist/wkb-loader-types.d.ts.map +1 -0
- package/dist/wkb-loader-types.js +2 -0
- package/dist/wkb-loader-types.js.map +1 -0
- package/dist/wkb-loader.cjs +58 -0
- package/dist/wkb-loader.cjs.map +7 -0
- package/dist/wkb-loader.d.ts +2 -0
- package/dist/wkb-loader.d.ts.map +1 -0
- package/dist/wkb-loader.js +2 -0
- package/dist/wkb-loader.js.map +1 -0
- package/dist/wkb-writer.cjs +56 -0
- package/dist/wkb-writer.cjs.map +7 -0
- package/dist/wkb-writer.d.ts +2 -0
- package/dist/wkb-writer.d.ts.map +1 -0
- package/dist/wkb-writer.js +2 -0
- package/dist/wkb-writer.js.map +1 -0
- package/dist/wkt/hex-wkb-loader-types.cjs +1 -1
- package/dist/wkt/hex-wkb-loader-types.cjs.map +2 -2
- package/dist/wkt/hex-wkb-loader-types.d.ts +1 -1
- package/dist/wkt/hex-wkb-loader-types.js +1 -1
- package/dist/wkt/hex-wkb-loader-types.js.map +1 -1
- package/dist/wkt/index.cjs +0 -6
- package/dist/wkt/index.cjs.map +3 -3
- package/dist/wkt/index.d.ts +0 -4
- package/dist/wkt/index.d.ts.map +1 -1
- package/dist/wkt/index.js +0 -5
- package/dist/wkt/index.js.map +1 -1
- package/dist/wkt/lib/version.cjs +1 -1
- package/dist/wkt/lib/version.cjs.map +1 -1
- package/dist/wkt/lib/version.js +1 -1
- package/dist/wkt/lib/version.js.map +1 -1
- package/dist/wkt/twkb-loader-types.cjs +3 -6
- package/dist/wkt/twkb-loader-types.cjs.map +2 -2
- package/dist/wkt/twkb-loader-types.d.ts +0 -23
- package/dist/wkt/twkb-loader-types.d.ts.map +1 -1
- package/dist/wkt/twkb-loader-types.js +1 -3
- package/dist/wkt/twkb-loader-types.js.map +1 -1
- package/dist/wkt/twkb-loader.cjs +1 -1
- package/dist/wkt/twkb-loader.cjs.map +2 -2
- package/dist/wkt/twkb-loader.js +1 -1
- package/dist/wkt/twkb-loader.js.map +1 -1
- package/dist/wkt/unbundled.cjs +2 -6
- package/dist/wkt/unbundled.cjs.map +2 -2
- package/dist/wkt/unbundled.d.ts +2 -2
- package/dist/wkt/unbundled.d.ts.map +1 -1
- package/dist/wkt/unbundled.js +2 -2
- package/dist/wkt/unbundled.js.map +1 -1
- package/dist/wkt/wkb-loader-types.cjs +3 -6
- package/dist/wkt/wkb-loader-types.cjs.map +2 -2
- package/dist/wkt/wkb-loader-types.d.ts +2 -26
- package/dist/wkt/wkb-loader-types.d.ts.map +1 -1
- package/dist/wkt/wkb-loader-types.js +1 -3
- package/dist/wkt/wkb-loader-types.js.map +1 -1
- package/dist/wkt/wkb-loader.cjs +1 -1
- package/dist/wkt/wkb-loader.cjs.map +2 -2
- package/dist/wkt/wkb-loader.js +1 -1
- package/dist/wkt/wkb-loader.js.map +1 -1
- package/dist/wkt/wkt-crs-loader-types.cjs +1 -1
- package/dist/wkt/wkt-crs-loader-types.cjs.map +2 -2
- package/dist/wkt/wkt-crs-loader-types.d.ts +2 -2
- package/dist/wkt/wkt-crs-loader-types.js +1 -1
- package/dist/wkt/wkt-crs-loader-types.js.map +1 -1
- package/dist/wkt/wkt-format.cjs +2 -2
- package/dist/wkt/wkt-format.cjs.map +2 -2
- package/dist/wkt/wkt-format.js +1 -1
- package/dist/wkt/wkt-format.js.map +1 -1
- package/dist/wkt/wkt-loader-types.cjs +3 -6
- package/dist/wkt/wkt-loader-types.cjs.map +2 -2
- package/dist/wkt/wkt-loader-types.d.ts +2 -27
- package/dist/wkt/wkt-loader-types.d.ts.map +1 -1
- package/dist/wkt/wkt-loader-types.js +1 -3
- package/dist/wkt/wkt-loader-types.js.map +1 -1
- package/dist/wkt/wkt-loader.cjs +1 -1
- package/dist/wkt/wkt-loader.cjs.map +2 -2
- package/dist/wkt/wkt-loader.js +1 -1
- package/dist/wkt/wkt-loader.js.map +1 -1
- package/dist/wkt-crs-loader-types.cjs +66 -0
- package/dist/wkt-crs-loader-types.cjs.map +7 -0
- package/dist/wkt-crs-loader-types.d.ts +2 -0
- package/dist/wkt-crs-loader-types.d.ts.map +1 -0
- package/dist/wkt-crs-loader-types.js +2 -0
- package/dist/wkt-crs-loader-types.js.map +1 -0
- package/dist/wkt-crs-loader.cjs +40 -0
- package/dist/wkt-crs-loader.cjs.map +7 -0
- package/dist/wkt-crs-loader.d.ts +2 -0
- package/dist/wkt-crs-loader.d.ts.map +1 -0
- package/dist/wkt-crs-loader.js +2 -0
- package/dist/wkt-crs-loader.js.map +1 -0
- package/dist/wkt-crs-writer.cjs +54 -0
- package/dist/wkt-crs-writer.cjs.map +7 -0
- package/dist/wkt-crs-writer.d.ts +2 -0
- package/dist/wkt-crs-writer.d.ts.map +1 -0
- package/dist/wkt-crs-writer.js +2 -0
- package/dist/wkt-crs-writer.js.map +1 -0
- package/dist/wkt-loader-types.cjs +62 -0
- package/dist/wkt-loader-types.cjs.map +7 -0
- package/dist/wkt-loader-types.d.ts +2 -0
- package/dist/wkt-loader-types.d.ts.map +1 -0
- package/dist/wkt-loader-types.js +2 -0
- package/dist/wkt-loader-types.js.map +1 -0
- package/dist/wkt-loader.cjs +47 -0
- package/dist/wkt-loader.cjs.map +7 -0
- package/dist/wkt-loader.d.ts +2 -0
- package/dist/wkt-loader.d.ts.map +1 -0
- package/dist/wkt-loader.js +2 -0
- package/dist/wkt-loader.js.map +1 -0
- package/dist/wkt-worker.js +749 -124
- package/dist/wkt-writer.cjs +56 -0
- package/dist/wkt-writer.cjs.map +7 -0
- package/dist/wkt-writer.d.ts +2 -0
- package/dist/wkt-writer.d.ts.map +1 -0
- package/dist/wkt-writer.js +2 -0
- package/dist/wkt-writer.js.map +1 -0
- package/dist/workers/dbf-worker.cjs +4 -4
- package/dist/workers/dbf-worker.cjs.map +2 -2
- package/dist/workers/dbf-worker.js +5 -5
- package/dist/workers/dbf-worker.js.map +1 -1
- package/dist/workers/shapefile-worker.cjs +6 -6
- package/dist/workers/shapefile-worker.cjs.map +2 -2
- package/dist/workers/shapefile-worker.js +7 -9
- package/dist/workers/shapefile-worker.js.map +1 -1
- package/dist/workers/shp-worker.cjs +1 -1
- package/dist/workers/shp-worker.cjs.map +2 -2
- package/dist/workers/shp-worker.js +2 -2
- package/dist/workers/shp-worker.js.map +1 -1
- package/package.json +153 -131
- package/src/dbf-loader-types.ts +1 -0
- package/src/dbf-loader.ts +1 -0
- package/src/flatgeobuf/flatgeobuf-loader-types.ts +18 -17
- package/src/flatgeobuf/flatgeobuf-loader.ts +9 -11
- package/src/flatgeobuf/flatgeobuf-source-loader.ts +19 -32
- package/src/flatgeobuf/index.ts +1 -9
- package/src/flatgeobuf/lib/flatgeobuf-worker-transport.ts +12 -50
- package/src/flatgeobuf/lib/parse-flatgeobuf.ts +5 -5
- package/src/flatgeobuf/unbundled.ts +1 -1
- package/src/flatgeobuf-loader-types.ts +1 -0
- package/src/flatgeobuf-loader.ts +1 -0
- package/src/flatgeobuf-source-loader.ts +1 -0
- package/src/geopackage/geopackage-loader-types.ts +13 -8
- package/src/geopackage/geopackage-loader.ts +5 -2
- package/src/geopackage/geopackage-source-loader.ts +57 -58
- package/src/geopackage/index.ts +1 -1
- package/src/geopackage/lib/parse-geopackage.ts +10 -5
- package/src/geopackage-loader-types.ts +1 -0
- package/src/geopackage-loader.ts +1 -0
- package/src/geopackage-source-loader.ts +1 -0
- package/src/gpx-loader-types.ts +1 -0
- package/src/gpx-loader.ts +1 -0
- package/src/hex-wkb-loader-types.ts +1 -0
- package/src/hex-wkb-loader.ts +1 -0
- package/src/index.ts +2 -3
- package/src/kml/bundled.ts +1 -1
- package/src/kml/gpx-loader-types.ts +5 -3
- package/src/kml/gpx-loader.ts +8 -16
- package/src/kml/index.ts +1 -1
- package/src/kml/kml-loader-types.ts +7 -5
- package/src/kml/kml-loader.ts +8 -20
- package/src/kml/kml-parser.ts +3 -2
- package/src/kml/kmz-loader-types.ts +17 -4
- package/src/kml/kmz-loader.ts +7 -3
- package/src/kml/kmz-source.ts +12 -25
- package/src/kml/lib/feature-collection-to-arrow.ts +4 -10
- package/src/kml/sports-track-parser.ts +3 -2
- package/src/kml/tcx-loader-types.ts +5 -3
- package/src/kml/tcx-loader.ts +8 -16
- package/src/kml/unbundled.ts +1 -1
- package/src/kml-loader-types.ts +1 -0
- package/src/kml-loader.ts +1 -0
- package/src/kml-writer.ts +1 -0
- package/src/kmz-loader-types.ts +1 -0
- package/src/kmz-loader.ts +1 -0
- package/src/kmz-source.ts +1 -0
- package/src/shapefile/dbf-loader-types.ts +5 -7
- package/src/shapefile/dbf-loader.ts +43 -27
- package/src/shapefile/index.ts +0 -6
- package/src/shapefile/lib/parsers/build-geoarrow-geometry-arrow.ts +1 -1
- package/src/shapefile/lib/parsers/parse-dbf-to-arrow.ts +6 -5
- package/src/shapefile/lib/parsers/parse-shapefile.ts +1 -1
- package/src/shapefile/lib/parsers/parse-shp-header.ts +4 -5
- package/src/shapefile/lib/parsers/parse-shp-to-arrow.ts +2 -2
- package/src/shapefile/lib/parsers/parse-shp.ts +1 -1
- package/src/shapefile/lib/parsers/types.ts +3 -3
- package/src/shapefile/lib/shapefile-worker-transport.ts +10 -2
- package/src/shapefile/shapefile-arrow-loader.ts +62 -11
- package/src/shapefile/shapefile-loader-types.ts +11 -16
- package/src/shapefile/shapefile-loader.ts +75 -6
- package/src/shapefile/shp-loader-types.ts +6 -11
- package/src/shapefile/shp-loader.ts +73 -12
- package/src/shapefile/unbundled.ts +2 -2
- package/src/shapefile-arrow-loader.ts +1 -0
- package/src/shapefile-loader-types.ts +1 -0
- package/src/shapefile-loader.ts +1 -0
- package/src/shp-loader-types.ts +1 -0
- package/src/shp-loader.ts +1 -0
- package/src/tcx-loader-types.ts +1 -0
- package/src/tcx-loader.ts +1 -0
- package/src/twkb-loader-types.ts +1 -0
- package/src/twkb-loader.ts +1 -0
- package/src/twkb-writer.ts +1 -0
- package/src/wkb-loader-types.ts +1 -0
- package/src/wkb-loader.ts +1 -0
- package/src/wkb-writer.ts +1 -0
- package/src/wkt/hex-wkb-loader-types.ts +1 -1
- package/src/wkt/index.ts +0 -6
- package/src/wkt/twkb-loader-types.ts +1 -4
- package/src/wkt/twkb-loader.ts +1 -1
- package/src/wkt/unbundled.ts +2 -2
- package/src/wkt/wkb-loader-types.ts +1 -4
- package/src/wkt/wkb-loader.ts +1 -1
- package/src/wkt/wkt-crs-loader-types.ts +1 -1
- package/src/wkt/wkt-format.ts +1 -1
- package/src/wkt/wkt-loader-types.ts +1 -4
- package/src/wkt/wkt-loader.ts +1 -1
- package/src/wkt-crs-loader-types.ts +1 -0
- package/src/wkt-crs-loader.ts +1 -0
- package/src/wkt-crs-writer.ts +1 -0
- package/src/wkt-loader-types.ts +1 -0
- package/src/wkt-loader.ts +1 -0
- package/src/wkt-writer.ts +1 -0
- package/src/workers/dbf-worker.ts +5 -5
- package/src/workers/shapefile-worker.ts +7 -10
- package/src/workers/shp-worker.ts +2 -2
package/dist/dbf-worker.js
CHANGED
|
@@ -15,29 +15,44 @@
|
|
|
15
15
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
//
|
|
18
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/node/worker_threads-browser.js
|
|
19
19
|
var parentPort;
|
|
20
20
|
var init_worker_threads_browser = __esm({
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
parentPort = null;
|
|
21
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/node/worker_threads-browser.js"() {
|
|
22
|
+
parentPort = globalThis.process?.getBuiltinModule?.("node:worker_threads")?.parentPort ?? null;
|
|
24
23
|
}
|
|
25
24
|
});
|
|
26
25
|
|
|
27
|
-
//
|
|
26
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js
|
|
28
27
|
function getTransferList(object, recursive = true, transfers) {
|
|
29
28
|
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
const seen = /* @__PURE__ */ new Set();
|
|
30
|
+
function visit(value) {
|
|
31
|
+
if (!value || typeof value !== "object" || seen.has(value))
|
|
32
|
+
return;
|
|
33
|
+
seen.add(value);
|
|
34
|
+
if (isTransferable(value))
|
|
35
|
+
transfersSet.add(value);
|
|
36
|
+
else if (ArrayBuffer.isView(value)) {
|
|
37
|
+
if (isTransferable(value.buffer))
|
|
38
|
+
transfersSet.add(value.buffer);
|
|
39
|
+
} else if (recursive && typeof MessageChannel !== "undefined" && value instanceof MessageChannel) {
|
|
40
|
+
visit(value.port1);
|
|
41
|
+
visit(value.port2);
|
|
42
|
+
} else if (recursive && value instanceof Map) {
|
|
43
|
+
for (const [key, item] of value) {
|
|
44
|
+
visit(key);
|
|
45
|
+
visit(item);
|
|
46
|
+
}
|
|
47
|
+
} else if (recursive && value instanceof Set) {
|
|
48
|
+
for (const item of value)
|
|
49
|
+
visit(item);
|
|
50
|
+
} else if (recursive) {
|
|
51
|
+
for (const key of Object.keys(value))
|
|
52
|
+
visit(value[key]);
|
|
39
53
|
}
|
|
40
54
|
}
|
|
55
|
+
visit(object);
|
|
41
56
|
return transfers === void 0 ? Array.from(transfersSet) : [];
|
|
42
57
|
}
|
|
43
58
|
function isTransferable(object) {
|
|
@@ -59,12 +74,11 @@
|
|
|
59
74
|
return false;
|
|
60
75
|
}
|
|
61
76
|
var init_get_transfer_list = __esm({
|
|
62
|
-
"
|
|
63
|
-
"use strict";
|
|
77
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js"() {
|
|
64
78
|
}
|
|
65
79
|
});
|
|
66
80
|
|
|
67
|
-
//
|
|
81
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js
|
|
68
82
|
async function getParentPort() {
|
|
69
83
|
return parentPort;
|
|
70
84
|
}
|
|
@@ -77,31 +91,31 @@
|
|
|
77
91
|
}
|
|
78
92
|
var onMessageWrapperMap, WorkerBody;
|
|
79
93
|
var init_worker_body = __esm({
|
|
80
|
-
"
|
|
81
|
-
"use strict";
|
|
94
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js"() {
|
|
82
95
|
init_get_transfer_list();
|
|
83
96
|
init_worker_threads_browser();
|
|
84
97
|
onMessageWrapperMap = /* @__PURE__ */ new Map();
|
|
85
98
|
WorkerBody = class {
|
|
86
99
|
/** Check that we are actually in a worker thread */
|
|
87
100
|
static async inWorkerThread() {
|
|
88
|
-
|
|
101
|
+
const workerGlobalScope = globalThis.WorkerGlobalScope;
|
|
102
|
+
return typeof workerGlobalScope === "function" && globalThis instanceof workerGlobalScope || Boolean(await getParentPort());
|
|
89
103
|
}
|
|
90
104
|
/*
|
|
91
105
|
* (type: WorkerMessageType, payload: WorkerMessagePayload) => any
|
|
92
106
|
*/
|
|
93
107
|
static set onmessage(onMessage) {
|
|
94
108
|
async function handleMessage(message) {
|
|
95
|
-
const
|
|
96
|
-
const { type, payload } =
|
|
109
|
+
const parentPort3 = await getParentPort();
|
|
110
|
+
const { type, payload } = parentPort3 ? message : message.data;
|
|
97
111
|
onMessage(type, payload);
|
|
98
112
|
}
|
|
99
|
-
getParentPort().then((
|
|
100
|
-
if (
|
|
101
|
-
|
|
113
|
+
getParentPort().then((parentPort3) => {
|
|
114
|
+
if (parentPort3) {
|
|
115
|
+
parentPort3.on("message", (message) => {
|
|
102
116
|
handleMessage(message);
|
|
103
117
|
});
|
|
104
|
-
|
|
118
|
+
parentPort3.on("exit", () => console.debug("Node worker closing"));
|
|
105
119
|
} else {
|
|
106
120
|
globalThis.onmessage = handleMessage;
|
|
107
121
|
}
|
|
@@ -119,9 +133,9 @@
|
|
|
119
133
|
};
|
|
120
134
|
onMessageWrapperMap.set(onMessage, onMessageWrapper);
|
|
121
135
|
}
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
124
|
-
|
|
136
|
+
const parentPort3 = await getParentPort();
|
|
137
|
+
if (parentPort3) {
|
|
138
|
+
parentPort3.on("message", onMessageWrapper);
|
|
125
139
|
} else {
|
|
126
140
|
globalThis.addEventListener("message", onMessageWrapper);
|
|
127
141
|
}
|
|
@@ -132,9 +146,9 @@
|
|
|
132
146
|
if (!onMessageWrapper) {
|
|
133
147
|
return;
|
|
134
148
|
}
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
137
|
-
|
|
149
|
+
const parentPort3 = await getParentPort();
|
|
150
|
+
if (parentPort3) {
|
|
151
|
+
parentPort3.off("message", onMessageWrapper);
|
|
138
152
|
} else {
|
|
139
153
|
globalThis.removeEventListener("message", onMessageWrapper);
|
|
140
154
|
}
|
|
@@ -144,12 +158,12 @@
|
|
|
144
158
|
* @param type
|
|
145
159
|
* @param payload
|
|
146
160
|
*/
|
|
147
|
-
static async postMessage(type, payload) {
|
|
161
|
+
static async postMessage(type, payload, copy = false) {
|
|
148
162
|
const data = { source: "loaders.gl", type, payload };
|
|
149
|
-
const transferList = getTransferList(payload);
|
|
150
|
-
const
|
|
151
|
-
if (
|
|
152
|
-
|
|
163
|
+
const transferList = copy ? [] : getTransferList(payload);
|
|
164
|
+
const parentPort3 = await getParentPort();
|
|
165
|
+
if (parentPort3) {
|
|
166
|
+
parentPort3.postMessage(data, transferList);
|
|
153
167
|
} else {
|
|
154
168
|
globalThis.postMessage(data, transferList);
|
|
155
169
|
}
|
|
@@ -158,15 +172,11 @@
|
|
|
158
172
|
}
|
|
159
173
|
});
|
|
160
174
|
|
|
161
|
-
//
|
|
175
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js
|
|
162
176
|
var AsyncQueue;
|
|
163
177
|
var init_async_queue = __esm({
|
|
164
|
-
"
|
|
165
|
-
"use strict";
|
|
178
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js"() {
|
|
166
179
|
AsyncQueue = class {
|
|
167
|
-
_values;
|
|
168
|
-
_settlers;
|
|
169
|
-
_closed;
|
|
170
180
|
constructor() {
|
|
171
181
|
this._values = [];
|
|
172
182
|
this._settlers = [];
|
|
@@ -234,8 +244,63 @@
|
|
|
234
244
|
}
|
|
235
245
|
});
|
|
236
246
|
|
|
237
|
-
//
|
|
238
|
-
|
|
247
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js
|
|
248
|
+
var SharedWorkerState;
|
|
249
|
+
var init_shared_state = __esm({
|
|
250
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js"() {
|
|
251
|
+
SharedWorkerState = class {
|
|
252
|
+
constructor(buffer) {
|
|
253
|
+
if (typeof SharedArrayBuffer === "undefined" || !(buffer instanceof SharedArrayBuffer) || buffer.byteLength !== 16)
|
|
254
|
+
throw new Error("Expected a 16-byte shared worker control buffer");
|
|
255
|
+
this.buffer = buffer;
|
|
256
|
+
this.values = new Int32Array(buffer);
|
|
257
|
+
}
|
|
258
|
+
get snapshot() {
|
|
259
|
+
return {
|
|
260
|
+
cancelled: Atomics.load(this.values, 0) !== 0,
|
|
261
|
+
completed: Atomics.load(this.values, 1),
|
|
262
|
+
total: Atomics.load(this.values, 2),
|
|
263
|
+
revision: Atomics.load(this.values, 3)
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
cancel() {
|
|
267
|
+
Atomics.store(this.values, 0, 1);
|
|
268
|
+
Atomics.add(this.values, 3, 1);
|
|
269
|
+
Atomics.notify(this.values, 0);
|
|
270
|
+
}
|
|
271
|
+
throwIfCancelled() {
|
|
272
|
+
if (Atomics.load(this.values, 0) !== 0) {
|
|
273
|
+
const error = new Error("Shared worker task was cancelled");
|
|
274
|
+
error.name = "AbortError";
|
|
275
|
+
throw error;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
/** Integer counters for application-defined work; messages still carry phase names and units. */
|
|
279
|
+
setProgress(completed, total = -1) {
|
|
280
|
+
if (!Number.isInteger(completed) || completed < 0 || completed > 2147483647 || !Number.isInteger(total) || total < -1 || total > 2147483647) {
|
|
281
|
+
throw new RangeError("Shared progress requires nonnegative int32 counts (or total -1)");
|
|
282
|
+
}
|
|
283
|
+
Atomics.store(this.values, 1, completed);
|
|
284
|
+
Atomics.store(this.values, 2, total);
|
|
285
|
+
Atomics.add(this.values, 3, 1);
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/validate-output-ownership.js
|
|
292
|
+
function validateOutputOwnership(ownership) {
|
|
293
|
+
if (ownership !== void 0 && ownership !== "copy" && ownership !== "transfer") {
|
|
294
|
+
throw new Error("Invalid worker output ownership");
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
var init_validate_output_ownership = __esm({
|
|
298
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/validate-output-ownership.js"() {
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js
|
|
303
|
+
async function createWorker(process2, processInBatches, preload) {
|
|
239
304
|
if (!await WorkerBody.inWorkerThread()) {
|
|
240
305
|
return;
|
|
241
306
|
}
|
|
@@ -243,27 +308,59 @@
|
|
|
243
308
|
process: processOnMainThread
|
|
244
309
|
};
|
|
245
310
|
WorkerBody.onmessage = async (type, payload) => {
|
|
311
|
+
if (type === "cancel") {
|
|
312
|
+
activeController?.abort();
|
|
313
|
+
activeInputBatches?.close();
|
|
314
|
+
activeOutputAcknowledgements?.close();
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
const controller = type === "process" || type === "process-in-batches" ? new AbortController() : void 0;
|
|
318
|
+
if (controller)
|
|
319
|
+
activeController = controller;
|
|
320
|
+
const startedAt = performance.now();
|
|
246
321
|
const reporter = type === "process" || type === "process-in-batches" ? createProgressReporter() : void 0;
|
|
247
|
-
|
|
322
|
+
let sharedState;
|
|
323
|
+
const throwIfAborted = () => {
|
|
324
|
+
controller?.signal.throwIfAborted();
|
|
325
|
+
sharedState?.throwIfCancelled();
|
|
326
|
+
};
|
|
327
|
+
const jobContext = {
|
|
328
|
+
...context,
|
|
329
|
+
signal: controller?.signal,
|
|
330
|
+
sharedState,
|
|
331
|
+
throwIfAborted,
|
|
332
|
+
reportProgress: (progress) => {
|
|
333
|
+
if (!controller?.signal.aborted && !sharedState?.snapshot.cancelled)
|
|
334
|
+
reporter?.report(progress);
|
|
335
|
+
}
|
|
336
|
+
};
|
|
248
337
|
try {
|
|
338
|
+
if (controller && payload.options?.["sharedState"]) {
|
|
339
|
+
sharedState = new SharedWorkerState(payload.options["sharedState"]);
|
|
340
|
+
jobContext.sharedState = sharedState;
|
|
341
|
+
}
|
|
249
342
|
switch (type) {
|
|
250
343
|
case "preload":
|
|
344
|
+
await preload?.();
|
|
251
345
|
WorkerBody.postMessage("done", {});
|
|
252
346
|
break;
|
|
253
347
|
case "process":
|
|
254
|
-
|
|
348
|
+
throwIfAborted();
|
|
349
|
+
validateOutputOwnership(payload.options?.["outputOwnership"]);
|
|
350
|
+
if (!process2) {
|
|
255
351
|
throw new Error("Worker does not support atomic processing");
|
|
256
352
|
}
|
|
257
|
-
const result = await
|
|
258
|
-
|
|
259
|
-
payload.options || {},
|
|
260
|
-
jobContext,
|
|
261
|
-
payload.context || {}
|
|
262
|
-
);
|
|
353
|
+
const result = await process2(payload.input, payload.options || {}, jobContext, payload.context || {});
|
|
354
|
+
throwIfAborted();
|
|
263
355
|
reporter?.finish();
|
|
264
|
-
WorkerBody.postMessage("done", {
|
|
356
|
+
await WorkerBody.postMessage("done", {
|
|
357
|
+
result,
|
|
358
|
+
executionMs: performance.now() - startedAt
|
|
359
|
+
}, payload.options?.["outputOwnership"] === "copy");
|
|
265
360
|
break;
|
|
266
361
|
case "process-in-batches":
|
|
362
|
+
throwIfAborted();
|
|
363
|
+
validateOutputOwnership(payload.options?.["outputOwnership"]);
|
|
267
364
|
if (!processInBatches) {
|
|
268
365
|
throw new Error("Worker does not support batched processing");
|
|
269
366
|
}
|
|
@@ -272,18 +369,15 @@
|
|
|
272
369
|
activeInputBatches = inputBatches;
|
|
273
370
|
activeOutputAcknowledgements = outputAcknowledgements;
|
|
274
371
|
try {
|
|
275
|
-
const resultIterator = processInBatches(
|
|
276
|
-
createDemandDrivenIterator(inputBatches),
|
|
277
|
-
payload.options || {},
|
|
278
|
-
jobContext,
|
|
279
|
-
payload.context || {}
|
|
280
|
-
);
|
|
372
|
+
const resultIterator = processInBatches(createDemandDrivenIterator(inputBatches), payload.options || {}, jobContext, payload.context || {});
|
|
281
373
|
for await (const batch of resultIterator) {
|
|
282
|
-
|
|
374
|
+
throwIfAborted();
|
|
375
|
+
await WorkerBody.postMessage("output-batch", { result: batch }, payload.options?.["outputOwnership"] === "copy");
|
|
283
376
|
await outputAcknowledgements.next();
|
|
284
377
|
}
|
|
378
|
+
throwIfAborted();
|
|
285
379
|
reporter?.finish();
|
|
286
|
-
await WorkerBody.postMessage("done", {});
|
|
380
|
+
await WorkerBody.postMessage("done", { executionMs: performance.now() - startedAt });
|
|
287
381
|
} finally {
|
|
288
382
|
activeInputBatches = null;
|
|
289
383
|
activeOutputAcknowledgements = null;
|
|
@@ -310,11 +404,18 @@
|
|
|
310
404
|
default:
|
|
311
405
|
}
|
|
312
406
|
} catch (error) {
|
|
313
|
-
reporter?.finish();
|
|
407
|
+
reporter?.finish(controller?.signal.aborted || sharedState?.snapshot.cancelled);
|
|
314
408
|
const message = error instanceof Error ? error.message : "";
|
|
315
|
-
WorkerBody.postMessage("error", {
|
|
409
|
+
await WorkerBody.postMessage("error", {
|
|
410
|
+
error: message,
|
|
411
|
+
errorName: error instanceof Error ? error.name : "Error"
|
|
412
|
+
});
|
|
413
|
+
} finally {
|
|
414
|
+
if (controller && activeController === controller)
|
|
415
|
+
activeController = null;
|
|
316
416
|
}
|
|
317
417
|
};
|
|
418
|
+
await WorkerBody.postMessage("ready", {});
|
|
318
419
|
}
|
|
319
420
|
async function* createDemandDrivenIterator(inputBatches) {
|
|
320
421
|
while (true) {
|
|
@@ -327,81 +428,691 @@
|
|
|
327
428
|
}
|
|
328
429
|
}
|
|
329
430
|
function processOnMainThread(arrayBuffer, options = {}, jobContext = {}) {
|
|
431
|
+
const signal = activeController?.signal;
|
|
432
|
+
signal?.throwIfAborted();
|
|
330
433
|
return new Promise((resolve, reject) => {
|
|
331
434
|
const id = requestId++;
|
|
332
|
-
const
|
|
333
|
-
|
|
435
|
+
const cleanup = () => {
|
|
436
|
+
signal?.removeEventListener("abort", abort);
|
|
437
|
+
void WorkerBody.removeEventListener(onMessage);
|
|
438
|
+
};
|
|
439
|
+
const abort = () => {
|
|
440
|
+
cleanup();
|
|
441
|
+
reject(signal?.reason);
|
|
442
|
+
};
|
|
443
|
+
const onMessage = (type, payload) => {
|
|
444
|
+
if (payload.id !== id)
|
|
334
445
|
return;
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
case "error":
|
|
342
|
-
WorkerBody.removeEventListener(onMessage);
|
|
343
|
-
reject(payload2.error);
|
|
344
|
-
break;
|
|
345
|
-
default:
|
|
446
|
+
if (type === "done") {
|
|
447
|
+
cleanup();
|
|
448
|
+
resolve(payload.result);
|
|
449
|
+
} else if (type === "error") {
|
|
450
|
+
cleanup();
|
|
451
|
+
reject(payload.error);
|
|
346
452
|
}
|
|
347
453
|
};
|
|
348
|
-
WorkerBody.addEventListener(onMessage)
|
|
349
|
-
|
|
350
|
-
|
|
454
|
+
void WorkerBody.addEventListener(onMessage).then(async () => {
|
|
455
|
+
if (signal?.aborted) {
|
|
456
|
+
abort();
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
460
|
+
await WorkerBody.postMessage("process", {
|
|
461
|
+
id,
|
|
462
|
+
input: arrayBuffer,
|
|
463
|
+
options,
|
|
464
|
+
context: jobContext
|
|
465
|
+
});
|
|
466
|
+
}).catch((error) => {
|
|
467
|
+
cleanup();
|
|
468
|
+
reject(error);
|
|
469
|
+
});
|
|
351
470
|
});
|
|
352
471
|
}
|
|
353
472
|
function createProgressReporter() {
|
|
354
|
-
let
|
|
473
|
+
let pending2;
|
|
355
474
|
let finished = false;
|
|
356
475
|
let scheduled = false;
|
|
357
476
|
const flush = () => {
|
|
358
477
|
scheduled = false;
|
|
359
|
-
if (
|
|
360
|
-
WorkerBody.postMessage("progress", { progress:
|
|
361
|
-
|
|
478
|
+
if (pending2) {
|
|
479
|
+
WorkerBody.postMessage("progress", { progress: pending2 });
|
|
480
|
+
pending2 = void 0;
|
|
362
481
|
}
|
|
363
482
|
};
|
|
364
483
|
return {
|
|
365
484
|
/** Records progress while retaining phase transitions. */
|
|
366
485
|
report(progress) {
|
|
367
|
-
if (finished)
|
|
368
|
-
|
|
369
|
-
|
|
486
|
+
if (finished)
|
|
487
|
+
return;
|
|
488
|
+
if (pending2 && pending2.phase !== progress.phase)
|
|
489
|
+
flush();
|
|
490
|
+
pending2 = { ...progress };
|
|
370
491
|
if (!scheduled) {
|
|
371
492
|
scheduled = true;
|
|
372
493
|
setTimeout(flush, 0);
|
|
373
494
|
}
|
|
374
495
|
},
|
|
375
496
|
/** Flushes final progress and suppresses reports from stale callbacks. */
|
|
376
|
-
finish() {
|
|
497
|
+
finish(discard = false) {
|
|
498
|
+
if (discard)
|
|
499
|
+
pending2 = void 0;
|
|
377
500
|
flush();
|
|
378
501
|
finished = true;
|
|
379
502
|
}
|
|
380
503
|
};
|
|
381
504
|
}
|
|
382
|
-
var requestId, activeInputBatches, activeOutputAcknowledgements;
|
|
505
|
+
var requestId, activeController, activeInputBatches, activeOutputAcknowledgements;
|
|
383
506
|
var init_create_worker = __esm({
|
|
384
|
-
"
|
|
385
|
-
|
|
507
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js"() {
|
|
508
|
+
init_shared_state();
|
|
386
509
|
init_async_queue();
|
|
387
510
|
init_worker_body();
|
|
511
|
+
init_validate_output_ownership();
|
|
388
512
|
requestId = 0;
|
|
513
|
+
activeController = null;
|
|
389
514
|
activeInputBatches = null;
|
|
390
515
|
activeOutputAcknowledgements = null;
|
|
391
516
|
}
|
|
392
517
|
});
|
|
393
518
|
|
|
394
|
-
//
|
|
519
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/index.js
|
|
520
|
+
var import_meta, path, moduleUrl;
|
|
395
521
|
var init_worker_utils = __esm({
|
|
522
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/index.js"() {
|
|
523
|
+
init_worker_body();
|
|
524
|
+
init_create_worker();
|
|
525
|
+
init_get_transfer_list();
|
|
526
|
+
import_meta = {};
|
|
527
|
+
path = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
|
|
528
|
+
moduleUrl = path ? `file://${path.startsWith("/") ? "" : "/"}${encodeURI(path).replace(/#/g, "%23").replace(/\?/g, "%3F")}` : import_meta.url;
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js
|
|
533
|
+
function preloadTaskCode(task, signal) {
|
|
534
|
+
if (!task.preload)
|
|
535
|
+
return Promise.resolve();
|
|
536
|
+
let promise = pending.get(task);
|
|
537
|
+
if (!promise) {
|
|
538
|
+
promise = Promise.resolve().then(() => task.preload()).then(() => {
|
|
539
|
+
loaded.add(task);
|
|
540
|
+
});
|
|
541
|
+
pending.set(task, promise);
|
|
542
|
+
void promise.catch(() => pending.delete(task));
|
|
543
|
+
}
|
|
544
|
+
return withSignal(promise, signal);
|
|
545
|
+
}
|
|
546
|
+
function withSignal(operation, signal) {
|
|
547
|
+
if (!signal)
|
|
548
|
+
return operation;
|
|
549
|
+
return new Promise((resolve, reject) => {
|
|
550
|
+
const abort = () => {
|
|
551
|
+
signal.removeEventListener("abort", abort);
|
|
552
|
+
reject(signal.reason);
|
|
553
|
+
};
|
|
554
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
555
|
+
if (signal.aborted)
|
|
556
|
+
abort();
|
|
557
|
+
operation.then((value) => {
|
|
558
|
+
signal.removeEventListener("abort", abort);
|
|
559
|
+
resolve(value);
|
|
560
|
+
}, (error) => {
|
|
561
|
+
signal.removeEventListener("abort", abort);
|
|
562
|
+
reject(error);
|
|
563
|
+
});
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
var pending, loaded;
|
|
567
|
+
var init_task_preload = __esm({
|
|
568
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js"() {
|
|
569
|
+
pending = /* @__PURE__ */ new WeakMap();
|
|
570
|
+
loaded = /* @__PURE__ */ new WeakSet();
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-channel.js
|
|
575
|
+
var TaskRequestError, TaskChannel;
|
|
576
|
+
var init_task_channel = __esm({
|
|
577
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/task-channel.js"() {
|
|
578
|
+
TaskRequestError = class extends Error {
|
|
579
|
+
};
|
|
580
|
+
TaskChannel = class {
|
|
581
|
+
constructor(options) {
|
|
582
|
+
this.options = options;
|
|
583
|
+
this.nextId = 1;
|
|
584
|
+
this.pending = /* @__PURE__ */ new Map();
|
|
585
|
+
this.incoming = /* @__PURE__ */ new Map();
|
|
586
|
+
}
|
|
587
|
+
/** Send a request without serializing other in-flight requests. */
|
|
588
|
+
request(operation, value, signal, transfer = []) {
|
|
589
|
+
if (this.failure)
|
|
590
|
+
return Promise.reject(this.failure.reason);
|
|
591
|
+
if (signal?.aborted)
|
|
592
|
+
return Promise.reject(signal.reason);
|
|
593
|
+
const id = this.nextId++;
|
|
594
|
+
return new Promise((resolve, reject) => {
|
|
595
|
+
const abort = () => {
|
|
596
|
+
const pending2 = this.pending.get(id);
|
|
597
|
+
if (!pending2)
|
|
598
|
+
return;
|
|
599
|
+
this.pending.delete(id);
|
|
600
|
+
pending2.cleanup();
|
|
601
|
+
reject(signal?.reason);
|
|
602
|
+
this.send({ source: "math.gl/tasks", kind: "cancel", id });
|
|
603
|
+
};
|
|
604
|
+
this.pending.set(id, {
|
|
605
|
+
resolve,
|
|
606
|
+
reject,
|
|
607
|
+
cleanup: () => signal?.removeEventListener("abort", abort)
|
|
608
|
+
});
|
|
609
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
610
|
+
this.send({ source: "math.gl/tasks", kind: "request", id, operation, value }, transfer);
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
/** Send a one-way notification. */
|
|
614
|
+
emit(operation, value, transfer = []) {
|
|
615
|
+
if (this.failure)
|
|
616
|
+
throw this.failure.reason;
|
|
617
|
+
this.send({ source: "math.gl/tasks", kind: "event", id: 0, operation, value }, transfer);
|
|
618
|
+
}
|
|
619
|
+
/** Dispatch a transport message; unrelated protocols are ignored. */
|
|
620
|
+
receive(message) {
|
|
621
|
+
if (this.failure || message?.source !== "math.gl/tasks")
|
|
622
|
+
return;
|
|
623
|
+
if (message.kind === "failure") {
|
|
624
|
+
const reason = new Error(message.error?.message ?? "Task channel failed");
|
|
625
|
+
this.close(reason);
|
|
626
|
+
this.options.onFailure?.(reason);
|
|
627
|
+
} else if (message.kind === "result" || message.kind === "error") {
|
|
628
|
+
const pending2 = this.pending.get(message.id);
|
|
629
|
+
if (!pending2)
|
|
630
|
+
return;
|
|
631
|
+
this.pending.delete(message.id);
|
|
632
|
+
pending2.cleanup();
|
|
633
|
+
if (message.kind === "result")
|
|
634
|
+
pending2.resolve(message.value);
|
|
635
|
+
else {
|
|
636
|
+
const error = new TaskRequestError(message.error?.message ?? "Task request failed");
|
|
637
|
+
error.name = message.error?.name ?? "Error";
|
|
638
|
+
pending2.reject(error);
|
|
639
|
+
}
|
|
640
|
+
} else if (message.kind === "cancel") {
|
|
641
|
+
this.incoming.get(message.id)?.abort(new DOMException("Task request cancelled", "AbortError"));
|
|
642
|
+
} else if (message.kind === "event") {
|
|
643
|
+
try {
|
|
644
|
+
this.options.handleEvent?.(message.operation, message.value);
|
|
645
|
+
} catch (error) {
|
|
646
|
+
this.fail(error);
|
|
647
|
+
}
|
|
648
|
+
} else if (message.kind === "request") {
|
|
649
|
+
if (this.incoming.has(message.id)) {
|
|
650
|
+
this.fail(new Error("Duplicate task request identifier"));
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
const controller = new AbortController();
|
|
654
|
+
this.incoming.set(message.id, controller);
|
|
655
|
+
void Promise.resolve().then(() => {
|
|
656
|
+
controller.signal.throwIfAborted();
|
|
657
|
+
return this.options.handleRequest(message.operation, message.value, controller.signal);
|
|
658
|
+
}).then((value) => {
|
|
659
|
+
if (!controller.signal.aborted && !this.failure) {
|
|
660
|
+
this.send({ source: "math.gl/tasks", kind: "result", id: message.id, value }, this.options.getResultTransferList?.(value, message.value));
|
|
661
|
+
}
|
|
662
|
+
}).catch((reason) => {
|
|
663
|
+
if (!controller.signal.aborted && !this.failure) {
|
|
664
|
+
this.send({
|
|
665
|
+
source: "math.gl/tasks",
|
|
666
|
+
kind: "error",
|
|
667
|
+
id: message.id,
|
|
668
|
+
error: {
|
|
669
|
+
name: reason instanceof Error ? reason.name : "Error",
|
|
670
|
+
message: reason instanceof Error ? reason.message : String(reason)
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
}).finally(() => this.incoming.delete(message.id));
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
/** Reject all outstanding calls with a common cause and abort incoming callbacks. */
|
|
678
|
+
close(reason = new Error("Task channel closed")) {
|
|
679
|
+
if (this.failure)
|
|
680
|
+
return;
|
|
681
|
+
this.failure = { reason };
|
|
682
|
+
for (const pending2 of this.pending.values()) {
|
|
683
|
+
pending2.cleanup();
|
|
684
|
+
pending2.reject(reason);
|
|
685
|
+
}
|
|
686
|
+
this.pending.clear();
|
|
687
|
+
for (const controller of this.incoming.values())
|
|
688
|
+
controller.abort(reason);
|
|
689
|
+
this.incoming.clear();
|
|
690
|
+
}
|
|
691
|
+
send(message, transfer = []) {
|
|
692
|
+
if (this.failure)
|
|
693
|
+
return;
|
|
694
|
+
try {
|
|
695
|
+
this.options.send(message, transfer);
|
|
696
|
+
} catch (error) {
|
|
697
|
+
this.fail(error);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
/** Invalidate the channel and notify the peer when the transport still works. */
|
|
701
|
+
fail(reason) {
|
|
702
|
+
if (this.failure)
|
|
703
|
+
return;
|
|
704
|
+
this.close(reason);
|
|
705
|
+
try {
|
|
706
|
+
this.options.send({
|
|
707
|
+
source: "math.gl/tasks",
|
|
708
|
+
kind: "failure",
|
|
709
|
+
id: 0,
|
|
710
|
+
error: {
|
|
711
|
+
name: reason instanceof Error ? reason.name : "Error",
|
|
712
|
+
message: reason instanceof Error ? reason.message : String(reason)
|
|
713
|
+
}
|
|
714
|
+
}, []);
|
|
715
|
+
} catch {
|
|
716
|
+
}
|
|
717
|
+
this.options.onFailure?.(reason);
|
|
718
|
+
}
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
|
|
723
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-runtime.js
|
|
724
|
+
function assertPayload(value) {
|
|
725
|
+
if (!value || typeof value !== "object" || Object.getPrototypeOf(value) !== Object.prototype) {
|
|
726
|
+
throw new TypeError("Task payloads must be plain objects with named fields");
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
function clonePayload(value, ownership = "copy") {
|
|
730
|
+
assertPayload(value);
|
|
731
|
+
if (!["copy", "transfer", "share"].includes(ownership))
|
|
732
|
+
throw new TypeError("Invalid input ownership");
|
|
733
|
+
const transfer = getTransferList(value);
|
|
734
|
+
if (ownership === "share" && transfer.length)
|
|
735
|
+
throw new TypeError("Share requires shared storage");
|
|
736
|
+
return structuredClone(value, {
|
|
737
|
+
transfer: ownership === "transfer" ? transfer : []
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
function taskContext(state, context = {}) {
|
|
741
|
+
const signal = context.signal ?? new AbortController().signal;
|
|
742
|
+
return {
|
|
743
|
+
state,
|
|
744
|
+
signal,
|
|
745
|
+
requestHost: async (operation, payload, controls) => {
|
|
746
|
+
signal.throwIfAborted();
|
|
747
|
+
if (!context.requestHost)
|
|
748
|
+
throw new Error("No host request handler configured");
|
|
749
|
+
return context.requestHost(operation, payload, controls);
|
|
750
|
+
},
|
|
751
|
+
emitHost: (operation, payload) => {
|
|
752
|
+
signal.throwIfAborted();
|
|
753
|
+
context.emitHost?.(operation, payload);
|
|
754
|
+
},
|
|
755
|
+
throwIfAborted: () => {
|
|
756
|
+
signal.throwIfAborted();
|
|
757
|
+
context.throwIfAborted?.();
|
|
758
|
+
},
|
|
759
|
+
reportProgress: (progress) => context.reportProgress?.({
|
|
760
|
+
...progress,
|
|
761
|
+
phase: progress.phase ?? "process",
|
|
762
|
+
unit: progress.unit ?? "items"
|
|
763
|
+
})
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
async function initializeTaskWorker(task) {
|
|
767
|
+
if (!await WorkerBody.inWorkerThread())
|
|
768
|
+
throw new Error("initializeTaskWorker must run inside a worker");
|
|
769
|
+
if (installed)
|
|
770
|
+
throw new Error("A task is already installed in this worker");
|
|
771
|
+
installed = true;
|
|
772
|
+
const runtime = new TaskRuntime(task);
|
|
773
|
+
let channelStream;
|
|
774
|
+
const channel = new TaskChannel({
|
|
775
|
+
getResultTransferList: (value, request) => request.outputOwnership === "transfer" ? getTransferList(value) : [],
|
|
776
|
+
send: (message, transfer) => {
|
|
777
|
+
const snapshot = structuredClone(message, { transfer });
|
|
778
|
+
void WorkerBody.postMessage("task-channel", snapshot).catch((reason) => channel.fail(reason));
|
|
779
|
+
},
|
|
780
|
+
handleRequest: async (operation, value, signal) => {
|
|
781
|
+
const request = value;
|
|
782
|
+
const context = {
|
|
783
|
+
signal,
|
|
784
|
+
reportProgress: (progress) => channel.emit("task:progress", { id: request.progressId, progress }),
|
|
785
|
+
requestHost: (operation2, payload, controls = {}) => {
|
|
786
|
+
const request2 = {
|
|
787
|
+
operation: operation2,
|
|
788
|
+
payload: clonePayload(payload, controls.inputOwnership),
|
|
789
|
+
outputOwnership: controls.outputOwnership ?? "copy"
|
|
790
|
+
};
|
|
791
|
+
return channel.request("task:host-request", request2, signal, getTransferList(request2));
|
|
792
|
+
},
|
|
793
|
+
emitHost: (operation2, payload) => channel.emit("task:host-event", { operation: operation2, payload, id: request.progressId })
|
|
794
|
+
};
|
|
795
|
+
switch (operation) {
|
|
796
|
+
case "initialize":
|
|
797
|
+
return runtime.initialize(request.input, context);
|
|
798
|
+
case "process":
|
|
799
|
+
return runtime.process(request.input, request.options, context);
|
|
800
|
+
case "stream-open": {
|
|
801
|
+
if (channelStream)
|
|
802
|
+
throw new Error("A task stream is already open");
|
|
803
|
+
async function* inputs() {
|
|
804
|
+
while (true) {
|
|
805
|
+
const result = await channel.request("task:next-input", { outputOwnership: "transfer" }, signal);
|
|
806
|
+
if (result.done)
|
|
807
|
+
return;
|
|
808
|
+
yield result.value;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
channelStream = runtime.stream(inputs(), request.options, context)[Symbol.asyncIterator]();
|
|
812
|
+
return {};
|
|
813
|
+
}
|
|
814
|
+
case "stream-next":
|
|
815
|
+
if (!channelStream)
|
|
816
|
+
throw new Error("No active task stream");
|
|
817
|
+
return channelStream.next();
|
|
818
|
+
case "stream-close":
|
|
819
|
+
try {
|
|
820
|
+
await channelStream?.return?.();
|
|
821
|
+
} finally {
|
|
822
|
+
channelStream = void 0;
|
|
823
|
+
}
|
|
824
|
+
return {};
|
|
825
|
+
case "destroy":
|
|
826
|
+
return runtime.destroy();
|
|
827
|
+
default:
|
|
828
|
+
throw new Error("Unknown task channel operation");
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
});
|
|
832
|
+
await WorkerBody.addEventListener((type, payload) => {
|
|
833
|
+
if (type === "task-channel")
|
|
834
|
+
channel.receive(payload);
|
|
835
|
+
});
|
|
836
|
+
let streamOptions = {};
|
|
837
|
+
return createWorker(async (request, _options, context) => {
|
|
838
|
+
switch (request.operation) {
|
|
839
|
+
case "initialize":
|
|
840
|
+
return runtime.initialize(request.input, context);
|
|
841
|
+
case "destroy":
|
|
842
|
+
return runtime.destroy();
|
|
843
|
+
case "stream-options":
|
|
844
|
+
streamOptions = request.options;
|
|
845
|
+
return {};
|
|
846
|
+
case "process":
|
|
847
|
+
return runtime.process(request.input, request.options, context);
|
|
848
|
+
default:
|
|
849
|
+
throw new Error("Unknown task operation");
|
|
850
|
+
}
|
|
851
|
+
}, async function* (inputs, _options, context) {
|
|
852
|
+
async function* batches() {
|
|
853
|
+
for await (const input of inputs) {
|
|
854
|
+
assertPayload(input);
|
|
855
|
+
yield input;
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
try {
|
|
859
|
+
yield* runtime.stream(batches(), streamOptions, context);
|
|
860
|
+
} finally {
|
|
861
|
+
streamOptions = {};
|
|
862
|
+
}
|
|
863
|
+
}, () => preloadTaskCode(task));
|
|
864
|
+
}
|
|
865
|
+
var TaskRuntime, installed;
|
|
866
|
+
var init_task_runtime = __esm({
|
|
867
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/task-runtime.js"() {
|
|
868
|
+
init_worker_utils();
|
|
869
|
+
init_task_preload();
|
|
870
|
+
init_task_channel();
|
|
871
|
+
TaskRuntime = class {
|
|
872
|
+
constructor(task) {
|
|
873
|
+
this.task = task;
|
|
874
|
+
this.initialized = false;
|
|
875
|
+
}
|
|
876
|
+
async initialize(input, context = {}) {
|
|
877
|
+
if (this.initialized)
|
|
878
|
+
throw new Error("Task is already initialized");
|
|
879
|
+
assertPayload(input);
|
|
880
|
+
await preloadTaskCode(this.task, context.signal);
|
|
881
|
+
context.signal?.throwIfAborted();
|
|
882
|
+
this.state = await this.task.initialize?.(input, taskContext(void 0, context));
|
|
883
|
+
this.initialized = true;
|
|
884
|
+
return {};
|
|
885
|
+
}
|
|
886
|
+
async destroy() {
|
|
887
|
+
if (this.initialized) {
|
|
888
|
+
this.initialized = false;
|
|
889
|
+
const state = this.state;
|
|
890
|
+
this.state = void 0;
|
|
891
|
+
if (this.task.initialize)
|
|
892
|
+
await this.task.destroy?.(state);
|
|
893
|
+
}
|
|
894
|
+
return {};
|
|
895
|
+
}
|
|
896
|
+
async process(input, options, context = {}) {
|
|
897
|
+
if (!this.initialized)
|
|
898
|
+
throw new Error("Task is not initialized");
|
|
899
|
+
if (!this.task.process)
|
|
900
|
+
throw new Error("Task has no atomic processor");
|
|
901
|
+
assertPayload(input);
|
|
902
|
+
const result = await this.task.process(input, options, taskContext(this.state, context));
|
|
903
|
+
assertPayload(result);
|
|
904
|
+
return result;
|
|
905
|
+
}
|
|
906
|
+
async *stream(inputs, options, context = {}) {
|
|
907
|
+
if (!this.initialized)
|
|
908
|
+
throw new Error("Task is not initialized");
|
|
909
|
+
if (!this.task.processInBatches)
|
|
910
|
+
throw new Error("Task has no streaming processor");
|
|
911
|
+
for await (const output of this.task.processInBatches(inputs, options, taskContext(this.state, context))) {
|
|
912
|
+
assertPayload(output);
|
|
913
|
+
yield output;
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
};
|
|
917
|
+
installed = false;
|
|
918
|
+
}
|
|
919
|
+
});
|
|
920
|
+
|
|
921
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/index.js
|
|
922
|
+
var init_tasks = __esm({
|
|
923
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/index.js"() {
|
|
924
|
+
init_task_runtime();
|
|
925
|
+
}
|
|
926
|
+
});
|
|
927
|
+
|
|
928
|
+
// ../../node_modules/@math.gl/tasks/dist/index.js
|
|
929
|
+
var init_dist = __esm({
|
|
930
|
+
"../../node_modules/@math.gl/tasks/dist/index.js"() {
|
|
931
|
+
init_tasks();
|
|
932
|
+
}
|
|
933
|
+
});
|
|
934
|
+
|
|
935
|
+
// ../core/src/worker-utils/lib/node/worker_threads-browser.ts
|
|
936
|
+
var worker_threads_browser_exports = {};
|
|
937
|
+
__export(worker_threads_browser_exports, {
|
|
938
|
+
NodeWorker: () => NodeWorker,
|
|
939
|
+
parentPort: () => parentPort2
|
|
940
|
+
});
|
|
941
|
+
var NodeWorker, parentPort2;
|
|
942
|
+
var init_worker_threads_browser2 = __esm({
|
|
943
|
+
"../core/src/worker-utils/lib/node/worker_threads-browser.ts"() {
|
|
944
|
+
"use strict";
|
|
945
|
+
NodeWorker = class {
|
|
946
|
+
/** Restores the native worker constructor when this browser shim is embedded in a Node bundle. */
|
|
947
|
+
constructor(...arguments_) {
|
|
948
|
+
const runtimeProcess = globalThis.process;
|
|
949
|
+
const WorkerConstructor = runtimeProcess?.getBuiltinModule?.("node:worker_threads").Worker;
|
|
950
|
+
if (WorkerConstructor) {
|
|
951
|
+
return new WorkerConstructor(...arguments_);
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
/** No-op browser fallback matching the native Worker API. */
|
|
955
|
+
terminate() {
|
|
956
|
+
}
|
|
957
|
+
};
|
|
958
|
+
parentPort2 = null;
|
|
959
|
+
}
|
|
960
|
+
});
|
|
961
|
+
|
|
962
|
+
// ../core/src/worker-utils/lib/worker-api/task-runtime.ts
|
|
963
|
+
function normalizeTaskProgress(progress) {
|
|
964
|
+
return { ...progress, phase: progress.phase ?? "process", unit: progress.unit ?? "items" };
|
|
965
|
+
}
|
|
966
|
+
async function isWorkerThread() {
|
|
967
|
+
if (typeof self !== "undefined" && typeof document === "undefined" && typeof self.postMessage === "function")
|
|
968
|
+
return true;
|
|
969
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
970
|
+
const { isMainThread } = await Promise.resolve().then(() => (init_worker_threads_browser2(), worker_threads_browser_exports));
|
|
971
|
+
return !isMainThread;
|
|
972
|
+
}
|
|
973
|
+
return false;
|
|
974
|
+
}
|
|
975
|
+
var initializeTaskWorker2;
|
|
976
|
+
var init_task_runtime2 = __esm({
|
|
977
|
+
"../core/src/worker-utils/lib/worker-api/task-runtime.ts"() {
|
|
978
|
+
"use strict";
|
|
979
|
+
init_dist();
|
|
980
|
+
initializeTaskWorker2 = initializeTaskWorker;
|
|
981
|
+
}
|
|
982
|
+
});
|
|
983
|
+
|
|
984
|
+
// ../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts
|
|
985
|
+
function getTransferList2(object, recursive = true, transfers) {
|
|
986
|
+
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
987
|
+
if (!object) {
|
|
988
|
+
} else if (isTransferable2(object)) {
|
|
989
|
+
transfersSet.add(object);
|
|
990
|
+
} else if (isTransferable2(object.buffer)) {
|
|
991
|
+
transfersSet.add(object.buffer);
|
|
992
|
+
} else if (ArrayBuffer.isView(object)) {
|
|
993
|
+
} else if (recursive && typeof object === "object") {
|
|
994
|
+
for (const key in object) {
|
|
995
|
+
getTransferList2(object[key], recursive, transfersSet);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
return transfers === void 0 ? Array.from(transfersSet) : [];
|
|
999
|
+
}
|
|
1000
|
+
function isTransferable2(object) {
|
|
1001
|
+
if (!object) {
|
|
1002
|
+
return false;
|
|
1003
|
+
}
|
|
1004
|
+
if (object instanceof ArrayBuffer) {
|
|
1005
|
+
return true;
|
|
1006
|
+
}
|
|
1007
|
+
if (typeof MessagePort !== "undefined" && object instanceof MessagePort) {
|
|
1008
|
+
return true;
|
|
1009
|
+
}
|
|
1010
|
+
if (typeof ImageBitmap !== "undefined" && object instanceof ImageBitmap) {
|
|
1011
|
+
return true;
|
|
1012
|
+
}
|
|
1013
|
+
if (typeof OffscreenCanvas !== "undefined" && object instanceof OffscreenCanvas) {
|
|
1014
|
+
return true;
|
|
1015
|
+
}
|
|
1016
|
+
return false;
|
|
1017
|
+
}
|
|
1018
|
+
var init_get_transfer_list2 = __esm({
|
|
1019
|
+
"../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts"() {
|
|
1020
|
+
"use strict";
|
|
1021
|
+
}
|
|
1022
|
+
});
|
|
1023
|
+
|
|
1024
|
+
// ../core/src/worker-utils/lib/worker-api/create-worker.ts
|
|
1025
|
+
async function createWorker2(process2, processInBatches) {
|
|
1026
|
+
if (!await isWorkerThread()) return;
|
|
1027
|
+
await initializeTaskWorker2(createWorkerTask(process2, processInBatches));
|
|
1028
|
+
}
|
|
1029
|
+
function createWorkerTask(process2, processInBatches) {
|
|
1030
|
+
return {
|
|
1031
|
+
id: "loaders.gl",
|
|
1032
|
+
initialize: (state) => state,
|
|
1033
|
+
destroy: (state) => state.port?.close(),
|
|
1034
|
+
process: async ({ value }, options, context) => {
|
|
1035
|
+
if (!process2) throw new Error("Worker does not support atomic processing");
|
|
1036
|
+
return { value: await process2(value, options, createContext(context), context.state.context) };
|
|
1037
|
+
},
|
|
1038
|
+
...processInBatches ? {
|
|
1039
|
+
processInBatches: async function* (inputs, options, context) {
|
|
1040
|
+
async function* values() {
|
|
1041
|
+
for await (const input of inputs) yield input.value;
|
|
1042
|
+
}
|
|
1043
|
+
for await (const value of processInBatches(
|
|
1044
|
+
values(),
|
|
1045
|
+
options,
|
|
1046
|
+
createContext(context),
|
|
1047
|
+
context.state.context
|
|
1048
|
+
)) {
|
|
1049
|
+
yield { value };
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
} : {}
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
function createContext(context) {
|
|
1056
|
+
let requestIdentifier = 0;
|
|
1057
|
+
const port = context.state.port;
|
|
1058
|
+
return {
|
|
1059
|
+
signal: context.signal,
|
|
1060
|
+
throwIfAborted: () => context.throwIfAborted(),
|
|
1061
|
+
reportProgress: (progress) => context.reportProgress(normalizeTaskProgress(progress)),
|
|
1062
|
+
process: port ? (input, options = {}, jobContext = {}) => {
|
|
1063
|
+
context.throwIfAborted();
|
|
1064
|
+
const identifier = ++requestIdentifier;
|
|
1065
|
+
return new Promise((resolve, reject) => {
|
|
1066
|
+
const onMessage = (event) => {
|
|
1067
|
+
if (event.data.identifier !== identifier) return;
|
|
1068
|
+
cleanup();
|
|
1069
|
+
if (event.data.error) {
|
|
1070
|
+
const error = new Error(event.data.error.message);
|
|
1071
|
+
error.name = event.data.error.name;
|
|
1072
|
+
reject(error);
|
|
1073
|
+
} else resolve(event.data.value);
|
|
1074
|
+
};
|
|
1075
|
+
const onAbort = () => {
|
|
1076
|
+
cleanup();
|
|
1077
|
+
reject(context.signal.reason);
|
|
1078
|
+
};
|
|
1079
|
+
const cleanup = () => {
|
|
1080
|
+
port.removeEventListener("message", onMessage);
|
|
1081
|
+
context.signal.removeEventListener("abort", onAbort);
|
|
1082
|
+
};
|
|
1083
|
+
port.addEventListener("message", onMessage);
|
|
1084
|
+
context.signal.addEventListener("abort", onAbort, { once: true });
|
|
1085
|
+
port.start();
|
|
1086
|
+
try {
|
|
1087
|
+
const request = { identifier, input, options, context: jobContext };
|
|
1088
|
+
port.postMessage(request, getTransferList2(request));
|
|
1089
|
+
} catch (error) {
|
|
1090
|
+
cleanup();
|
|
1091
|
+
reject(error);
|
|
1092
|
+
}
|
|
1093
|
+
});
|
|
1094
|
+
} : void 0
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
1097
|
+
var init_create_worker2 = __esm({
|
|
1098
|
+
"../core/src/worker-utils/lib/worker-api/create-worker.ts"() {
|
|
1099
|
+
"use strict";
|
|
1100
|
+
init_task_runtime2();
|
|
1101
|
+
init_get_transfer_list2();
|
|
1102
|
+
}
|
|
1103
|
+
});
|
|
1104
|
+
|
|
1105
|
+
// ../core/src/worker-utils/index.ts
|
|
1106
|
+
var init_worker_utils2 = __esm({
|
|
396
1107
|
"../core/src/worker-utils/index.ts"() {
|
|
397
1108
|
"use strict";
|
|
398
|
-
|
|
1109
|
+
init_create_worker2();
|
|
399
1110
|
}
|
|
400
1111
|
});
|
|
401
1112
|
|
|
402
1113
|
// ../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts
|
|
403
1114
|
async function createLoaderWorker(loader, selectLoader = () => loader) {
|
|
404
|
-
await
|
|
1115
|
+
await createWorker2(
|
|
405
1116
|
(input, options, workerContext, loaderContext) => processLoaderWorkerData(
|
|
406
1117
|
selectLoader(options || {}),
|
|
407
1118
|
input,
|
|
@@ -539,7 +1250,7 @@
|
|
|
539
1250
|
var init_create_loader_worker = __esm({
|
|
540
1251
|
"../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts"() {
|
|
541
1252
|
"use strict";
|
|
542
|
-
|
|
1253
|
+
init_worker_utils2();
|
|
543
1254
|
}
|
|
544
1255
|
});
|
|
545
1256
|
|
|
@@ -822,277 +1533,6 @@
|
|
|
822
1533
|
}
|
|
823
1534
|
});
|
|
824
1535
|
|
|
825
|
-
// src/shapefile/lib/streaming/binary-chunk-reader.ts
|
|
826
|
-
var init_binary_chunk_reader2 = __esm({
|
|
827
|
-
"src/shapefile/lib/streaming/binary-chunk-reader.ts"() {
|
|
828
|
-
"use strict";
|
|
829
|
-
init_loader_utils();
|
|
830
|
-
}
|
|
831
|
-
});
|
|
832
|
-
|
|
833
|
-
// src/shapefile/lib/parsers/parse-dbf.ts
|
|
834
|
-
function parseDBF(arrayBuffer, options = {}) {
|
|
835
|
-
const dbfParser = new DBFParser({
|
|
836
|
-
...options,
|
|
837
|
-
dbf: {
|
|
838
|
-
...options.dbf,
|
|
839
|
-
batchSize: void 0
|
|
840
|
-
}
|
|
841
|
-
});
|
|
842
|
-
dbfParser.write(arrayBuffer);
|
|
843
|
-
dbfParser.end();
|
|
844
|
-
const { data, schema } = dbfParser.result;
|
|
845
|
-
const shape = options?.dbf?.shape;
|
|
846
|
-
switch (shape) {
|
|
847
|
-
case "object-row-table": {
|
|
848
|
-
const table = {
|
|
849
|
-
shape: "object-row-table",
|
|
850
|
-
schema,
|
|
851
|
-
data
|
|
852
|
-
};
|
|
853
|
-
return table;
|
|
854
|
-
}
|
|
855
|
-
case "table":
|
|
856
|
-
return { schema, rows: data };
|
|
857
|
-
case "rows":
|
|
858
|
-
default:
|
|
859
|
-
return data;
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
async function* parseDBFInBatches(asyncIterator, options = {}) {
|
|
863
|
-
const parser = new DBFParser(options);
|
|
864
|
-
let headerReturned = false;
|
|
865
|
-
for await (const arrayBuffer of toArrayBufferIterator(asyncIterator)) {
|
|
866
|
-
parser.write(arrayBuffer);
|
|
867
|
-
if (!headerReturned && parser.result.dbfHeader) {
|
|
868
|
-
headerReturned = true;
|
|
869
|
-
yield parser.result.dbfHeader;
|
|
870
|
-
}
|
|
871
|
-
if (parser.result.data.length > 0) {
|
|
872
|
-
yield parser.result.data;
|
|
873
|
-
parser.result.data = [];
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
parser.end();
|
|
877
|
-
if (parser.result.data.length > 0) {
|
|
878
|
-
yield parser.result.data;
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
function parseState(state, result, binaryReader, textDecoder, options) {
|
|
882
|
-
while (true) {
|
|
883
|
-
try {
|
|
884
|
-
switch (state) {
|
|
885
|
-
case 4 /* ERROR */:
|
|
886
|
-
case 3 /* END */:
|
|
887
|
-
return state;
|
|
888
|
-
case 0 /* START */:
|
|
889
|
-
const dataView = binaryReader.getDataView(DBF_HEADER_SIZE);
|
|
890
|
-
if (!dataView) {
|
|
891
|
-
return state;
|
|
892
|
-
}
|
|
893
|
-
result.dbfHeader = parseDBFHeader(dataView);
|
|
894
|
-
result.progress = {
|
|
895
|
-
bytesUsed: 0,
|
|
896
|
-
rowsTotal: result.dbfHeader.nRecords,
|
|
897
|
-
rows: 0
|
|
898
|
-
};
|
|
899
|
-
state = 1 /* FIELD_DESCRIPTORS */;
|
|
900
|
-
break;
|
|
901
|
-
case 1 /* FIELD_DESCRIPTORS */:
|
|
902
|
-
const fieldDescriptorView = binaryReader.getDataView(
|
|
903
|
-
// @ts-ignore
|
|
904
|
-
result.dbfHeader.headerLength - DBF_HEADER_SIZE
|
|
905
|
-
);
|
|
906
|
-
if (!fieldDescriptorView) {
|
|
907
|
-
return state;
|
|
908
|
-
}
|
|
909
|
-
result.dbfFields = parseFieldDescriptors(fieldDescriptorView, textDecoder);
|
|
910
|
-
result.schema = {
|
|
911
|
-
fields: result.dbfFields.map((dbfField) => makeField(dbfField)),
|
|
912
|
-
metadata: {}
|
|
913
|
-
};
|
|
914
|
-
state = 2 /* FIELD_PROPERTIES */;
|
|
915
|
-
binaryReader.skip(1);
|
|
916
|
-
break;
|
|
917
|
-
case 2 /* FIELD_PROPERTIES */:
|
|
918
|
-
const { recordLength = 0, nRecords = 0 } = result?.dbfHeader || {};
|
|
919
|
-
while ((result.progress?.rows || 0) < nRecords) {
|
|
920
|
-
const batchSize = options.dbf?.batchSize || Number.POSITIVE_INFINITY;
|
|
921
|
-
if (result.data.length >= batchSize) {
|
|
922
|
-
return state;
|
|
923
|
-
}
|
|
924
|
-
const recordView = binaryReader.getDataView(recordLength - 1);
|
|
925
|
-
if (!recordView) {
|
|
926
|
-
return state;
|
|
927
|
-
}
|
|
928
|
-
binaryReader.skip(1);
|
|
929
|
-
const row = parseRow(recordView, result.dbfFields, textDecoder);
|
|
930
|
-
result.data.push(row);
|
|
931
|
-
result.progress.rows++;
|
|
932
|
-
}
|
|
933
|
-
state = 3 /* END */;
|
|
934
|
-
break;
|
|
935
|
-
default:
|
|
936
|
-
state = 4 /* ERROR */;
|
|
937
|
-
result.error = `illegal parser state ${state}`;
|
|
938
|
-
return state;
|
|
939
|
-
}
|
|
940
|
-
} catch (error) {
|
|
941
|
-
state = 4 /* ERROR */;
|
|
942
|
-
result.error = `DBF parsing failed: ${error.message}`;
|
|
943
|
-
return state;
|
|
944
|
-
}
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
function parseDBFHeader(headerView) {
|
|
948
|
-
return {
|
|
949
|
-
// Last updated date
|
|
950
|
-
year: headerView.getUint8(1) + 1900,
|
|
951
|
-
month: headerView.getUint8(2),
|
|
952
|
-
day: headerView.getUint8(3),
|
|
953
|
-
// Number of records in data file
|
|
954
|
-
nRecords: headerView.getUint32(4, LITTLE_ENDIAN),
|
|
955
|
-
// Length of header in bytes
|
|
956
|
-
headerLength: headerView.getUint16(8, LITTLE_ENDIAN),
|
|
957
|
-
// Length of each record
|
|
958
|
-
recordLength: headerView.getUint16(10, LITTLE_ENDIAN),
|
|
959
|
-
// Not sure if this is usually set
|
|
960
|
-
languageDriver: headerView.getUint8(29)
|
|
961
|
-
};
|
|
962
|
-
}
|
|
963
|
-
function parseFieldDescriptors(view, textDecoder) {
|
|
964
|
-
const nFields = (view.byteLength - 1) / 32;
|
|
965
|
-
const fields = [];
|
|
966
|
-
let offset = 0;
|
|
967
|
-
for (let i = 0; i < nFields; i++) {
|
|
968
|
-
const name = textDecoder.decode(new Uint8Array(view.buffer, view.byteOffset + offset, 11)).replace(/\u0000/g, "");
|
|
969
|
-
fields.push({
|
|
970
|
-
name,
|
|
971
|
-
dataType: String.fromCharCode(view.getUint8(offset + 11)),
|
|
972
|
-
fieldLength: view.getUint8(offset + 16),
|
|
973
|
-
decimal: view.getUint8(offset + 17)
|
|
974
|
-
});
|
|
975
|
-
offset += 32;
|
|
976
|
-
}
|
|
977
|
-
return fields;
|
|
978
|
-
}
|
|
979
|
-
function parseRow(view, fields, textDecoder) {
|
|
980
|
-
const out = {};
|
|
981
|
-
let offset = 0;
|
|
982
|
-
for (const field of fields) {
|
|
983
|
-
const text = textDecoder.decode(
|
|
984
|
-
new Uint8Array(view.buffer, view.byteOffset + offset, field.fieldLength)
|
|
985
|
-
);
|
|
986
|
-
out[field.name] = parseField(text, field.dataType);
|
|
987
|
-
offset += field.fieldLength;
|
|
988
|
-
}
|
|
989
|
-
return out;
|
|
990
|
-
}
|
|
991
|
-
function parseField(text, dataType) {
|
|
992
|
-
switch (dataType) {
|
|
993
|
-
case "B":
|
|
994
|
-
return parseNumber(text);
|
|
995
|
-
case "C":
|
|
996
|
-
return parseCharacter(text);
|
|
997
|
-
case "F":
|
|
998
|
-
return parseNumber(text);
|
|
999
|
-
case "N":
|
|
1000
|
-
return parseNumber(text);
|
|
1001
|
-
case "O":
|
|
1002
|
-
return parseNumber(text);
|
|
1003
|
-
case "D":
|
|
1004
|
-
return parseDate(text);
|
|
1005
|
-
case "L":
|
|
1006
|
-
return parseBoolean(text);
|
|
1007
|
-
default:
|
|
1008
|
-
throw new Error("Unsupported data type");
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
function parseDate(str) {
|
|
1012
|
-
return Date.UTC(str.slice(0, 4), parseInt(str.slice(4, 6), 10) - 1, str.slice(6, 8));
|
|
1013
|
-
}
|
|
1014
|
-
function parseBoolean(value) {
|
|
1015
|
-
return /^[nf]$/i.test(value) ? false : /^[yt]$/i.test(value) ? true : null;
|
|
1016
|
-
}
|
|
1017
|
-
function parseNumber(text) {
|
|
1018
|
-
const number = parseFloat(text);
|
|
1019
|
-
return Number.isNaN(number) ? null : number;
|
|
1020
|
-
}
|
|
1021
|
-
function parseCharacter(text) {
|
|
1022
|
-
return text.trim() || null;
|
|
1023
|
-
}
|
|
1024
|
-
function makeField({ name, dataType, fieldLength, decimal }) {
|
|
1025
|
-
switch (dataType) {
|
|
1026
|
-
case "B":
|
|
1027
|
-
return { name, type: "float64", nullable: true, metadata: {} };
|
|
1028
|
-
case "C":
|
|
1029
|
-
return { name, type: "utf8", nullable: true, metadata: {} };
|
|
1030
|
-
case "F":
|
|
1031
|
-
return { name, type: "float64", nullable: true, metadata: {} };
|
|
1032
|
-
case "N":
|
|
1033
|
-
return { name, type: "float64", nullable: true, metadata: {} };
|
|
1034
|
-
case "O":
|
|
1035
|
-
return { name, type: "float64", nullable: true, metadata: {} };
|
|
1036
|
-
case "D":
|
|
1037
|
-
return { name, type: "timestamp-millisecond", nullable: true, metadata: {} };
|
|
1038
|
-
case "L":
|
|
1039
|
-
return { name, type: "bool", nullable: true, metadata: {} };
|
|
1040
|
-
default:
|
|
1041
|
-
throw new Error("Unsupported data type");
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
var LITTLE_ENDIAN, DBF_HEADER_SIZE, DBFParser;
|
|
1045
|
-
var init_parse_dbf = __esm({
|
|
1046
|
-
"src/shapefile/lib/parsers/parse-dbf.ts"() {
|
|
1047
|
-
"use strict";
|
|
1048
|
-
init_loader_utils();
|
|
1049
|
-
init_binary_chunk_reader2();
|
|
1050
|
-
LITTLE_ENDIAN = true;
|
|
1051
|
-
DBF_HEADER_SIZE = 32;
|
|
1052
|
-
DBFParser = class {
|
|
1053
|
-
binaryReader = new BinaryChunkReader();
|
|
1054
|
-
textDecoder;
|
|
1055
|
-
options;
|
|
1056
|
-
state = 0 /* START */;
|
|
1057
|
-
result = {
|
|
1058
|
-
data: []
|
|
1059
|
-
};
|
|
1060
|
-
constructor(options) {
|
|
1061
|
-
const { encoding = "latin1" } = options.dbf || {};
|
|
1062
|
-
this.options = options;
|
|
1063
|
-
this.textDecoder = new TextDecoder(encoding);
|
|
1064
|
-
}
|
|
1065
|
-
/**
|
|
1066
|
-
* @param arrayBuffer
|
|
1067
|
-
*/
|
|
1068
|
-
write(arrayBuffer) {
|
|
1069
|
-
this.binaryReader.write(arrayBuffer);
|
|
1070
|
-
this.state = parseState(
|
|
1071
|
-
this.state,
|
|
1072
|
-
this.result,
|
|
1073
|
-
this.binaryReader,
|
|
1074
|
-
this.textDecoder,
|
|
1075
|
-
this.options
|
|
1076
|
-
);
|
|
1077
|
-
}
|
|
1078
|
-
end() {
|
|
1079
|
-
this.binaryReader.end();
|
|
1080
|
-
this.state = parseState(
|
|
1081
|
-
this.state,
|
|
1082
|
-
this.result,
|
|
1083
|
-
this.binaryReader,
|
|
1084
|
-
this.textDecoder,
|
|
1085
|
-
this.options
|
|
1086
|
-
);
|
|
1087
|
-
if (this.state !== 3 /* END */) {
|
|
1088
|
-
this.state = 4 /* ERROR */;
|
|
1089
|
-
this.result.error = "DBF incomplete file";
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
};
|
|
1093
|
-
}
|
|
1094
|
-
});
|
|
1095
|
-
|
|
1096
1536
|
// ../../node_modules/tslib/tslib.es6.mjs
|
|
1097
1537
|
function __rest(s, e) {
|
|
1098
1538
|
var t = {};
|
|
@@ -8743,11 +9183,11 @@ return true;`);
|
|
|
8743
9183
|
this._offsets = new OffsetsBufferBuilder(opts.type);
|
|
8744
9184
|
}
|
|
8745
9185
|
setValue(index, value) {
|
|
8746
|
-
const
|
|
8747
|
-
const current =
|
|
9186
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
9187
|
+
const current = pending2.get(index);
|
|
8748
9188
|
current && (this._pendingLength -= current.length);
|
|
8749
9189
|
this._pendingLength += value instanceof MapRow ? value[kKeys].length : value.length;
|
|
8750
|
-
|
|
9190
|
+
pending2.set(index, value);
|
|
8751
9191
|
}
|
|
8752
9192
|
setValid(index, isValid) {
|
|
8753
9193
|
if (!super.setValid(index, isValid)) {
|
|
@@ -8770,12 +9210,12 @@ return true;`);
|
|
|
8770
9210
|
return super.finish();
|
|
8771
9211
|
}
|
|
8772
9212
|
_flush() {
|
|
8773
|
-
const
|
|
9213
|
+
const pending2 = this._pending;
|
|
8774
9214
|
const pendingLength = this._pendingLength;
|
|
8775
9215
|
this._pendingLength = 0;
|
|
8776
9216
|
this._pending = void 0;
|
|
8777
|
-
if (
|
|
8778
|
-
this._flushPending(
|
|
9217
|
+
if (pending2 && pending2.size > 0) {
|
|
9218
|
+
this._flushPending(pending2, pendingLength);
|
|
8779
9219
|
}
|
|
8780
9220
|
return this;
|
|
8781
9221
|
}
|
|
@@ -11361,11 +11801,11 @@ return true;`);
|
|
|
11361
11801
|
setValue(index, value) {
|
|
11362
11802
|
return super.setValue(index, toUint8Array(value));
|
|
11363
11803
|
}
|
|
11364
|
-
_flushPending(
|
|
11804
|
+
_flushPending(pending2, pendingLength) {
|
|
11365
11805
|
const offsets = this._offsets;
|
|
11366
11806
|
const data = this._values.reserve(pendingLength).buffer;
|
|
11367
11807
|
let offset = 0;
|
|
11368
|
-
for (const [index, value] of
|
|
11808
|
+
for (const [index, value] of pending2) {
|
|
11369
11809
|
if (value === void 0) {
|
|
11370
11810
|
offsets.set(index, 0);
|
|
11371
11811
|
} else {
|
|
@@ -11402,11 +11842,11 @@ return true;`);
|
|
|
11402
11842
|
setValue(index, value) {
|
|
11403
11843
|
return super.setValue(index, toUint8Array(value));
|
|
11404
11844
|
}
|
|
11405
|
-
_flushPending(
|
|
11845
|
+
_flushPending(pending2, pendingLength) {
|
|
11406
11846
|
const offsets = this._offsets;
|
|
11407
11847
|
const data = this._values.reserve(pendingLength).buffer;
|
|
11408
11848
|
let offset = 0;
|
|
11409
|
-
for (const [index, value] of
|
|
11849
|
+
for (const [index, value] of pending2) {
|
|
11410
11850
|
if (value === void 0) {
|
|
11411
11851
|
offsets.set(index, BigInt(0));
|
|
11412
11852
|
} else {
|
|
@@ -11717,10 +12157,10 @@ return true;`);
|
|
|
11717
12157
|
this.type = new List2(new Field2(name, child.type, true));
|
|
11718
12158
|
return this.numChildren - 1;
|
|
11719
12159
|
}
|
|
11720
|
-
_flushPending(
|
|
12160
|
+
_flushPending(pending2) {
|
|
11721
12161
|
const offsets = this._offsets;
|
|
11722
12162
|
const [child] = this.children;
|
|
11723
|
-
for (const [index, value] of
|
|
12163
|
+
for (const [index, value] of pending2) {
|
|
11724
12164
|
if (typeof value === "undefined") {
|
|
11725
12165
|
offsets.set(index, 0);
|
|
11726
12166
|
} else {
|
|
@@ -11759,10 +12199,10 @@ return true;`);
|
|
|
11759
12199
|
this.type = new LargeList2(new Field2(name, child.type, true));
|
|
11760
12200
|
return this.numChildren - 1;
|
|
11761
12201
|
}
|
|
11762
|
-
_flushPending(
|
|
12202
|
+
_flushPending(pending2) {
|
|
11763
12203
|
const offsets = this._offsets;
|
|
11764
12204
|
const [child] = this.children;
|
|
11765
|
-
for (const [index, value] of
|
|
12205
|
+
for (const [index, value] of pending2) {
|
|
11766
12206
|
if (typeof value === "undefined") {
|
|
11767
12207
|
offsets.set(index, BigInt(0));
|
|
11768
12208
|
} else {
|
|
@@ -11792,11 +12232,11 @@ return true;`);
|
|
|
11792
12232
|
}
|
|
11793
12233
|
setValue(index, value) {
|
|
11794
12234
|
const row = value instanceof Map ? value : new Map(Object.entries(value));
|
|
11795
|
-
const
|
|
11796
|
-
const current =
|
|
12235
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
12236
|
+
const current = pending2.get(index);
|
|
11797
12237
|
current && (this._pendingLength -= current.size);
|
|
11798
12238
|
this._pendingLength += row.size;
|
|
11799
|
-
|
|
12239
|
+
pending2.set(index, row);
|
|
11800
12240
|
}
|
|
11801
12241
|
addChild(child, name = `${this.numChildren}`) {
|
|
11802
12242
|
if (this.numChildren > 0) {
|
|
@@ -11806,10 +12246,10 @@ return true;`);
|
|
|
11806
12246
|
this.type = new Map_(new Field2(name, child.type, true), this.type.keysSorted);
|
|
11807
12247
|
return this.numChildren - 1;
|
|
11808
12248
|
}
|
|
11809
|
-
_flushPending(
|
|
12249
|
+
_flushPending(pending2) {
|
|
11810
12250
|
const offsets = this._offsets;
|
|
11811
12251
|
const [child] = this.children;
|
|
11812
|
-
for (const [index, value] of
|
|
12252
|
+
for (const [index, value] of pending2) {
|
|
11813
12253
|
if (value === void 0) {
|
|
11814
12254
|
offsets.set(index, 0);
|
|
11815
12255
|
} else {
|
|
@@ -12018,7 +12458,7 @@ return true;`);
|
|
|
12018
12458
|
return super.setValue(index, encodeUtf8(value));
|
|
12019
12459
|
}
|
|
12020
12460
|
// @ts-ignore
|
|
12021
|
-
_flushPending(
|
|
12461
|
+
_flushPending(pending2, pendingLength) {
|
|
12022
12462
|
}
|
|
12023
12463
|
};
|
|
12024
12464
|
Utf8Builder.prototype._flushPending = BinaryBuilder.prototype._flushPending;
|
|
@@ -12049,7 +12489,7 @@ return true;`);
|
|
|
12049
12489
|
return super.setValue(index, encodeUtf8(value));
|
|
12050
12490
|
}
|
|
12051
12491
|
// @ts-ignore
|
|
12052
|
-
_flushPending(
|
|
12492
|
+
_flushPending(pending2, pendingLength) {
|
|
12053
12493
|
}
|
|
12054
12494
|
};
|
|
12055
12495
|
LargeUtf8Builder.prototype._flushPending = LargeBinaryBuilder.prototype._flushPending;
|
|
@@ -16337,213 +16777,472 @@ return true;`);
|
|
|
16337
16777
|
case "interval-yearmonth":
|
|
16338
16778
|
return new IntervalYearMonth();
|
|
16339
16779
|
default:
|
|
16340
|
-
throw new Error("array type not supported");
|
|
16780
|
+
throw new Error("array type not supported");
|
|
16781
|
+
}
|
|
16782
|
+
}
|
|
16783
|
+
function getOptionalArrowConstructor(typeName) {
|
|
16784
|
+
return Arrow_dom_exports[typeName];
|
|
16785
|
+
}
|
|
16786
|
+
function isArrowViewType(arrowType, viewTypeName) {
|
|
16787
|
+
const constructor = getOptionalArrowConstructor(viewTypeName);
|
|
16788
|
+
if (constructor && arrowType instanceof constructor) {
|
|
16789
|
+
return true;
|
|
16790
|
+
}
|
|
16791
|
+
const guards = DataType;
|
|
16792
|
+
const guard = viewTypeName === "BinaryView" ? guards.isBinaryView : guards.isUtf8View;
|
|
16793
|
+
return Boolean(guard?.(arrowType));
|
|
16794
|
+
}
|
|
16795
|
+
function isOptionalArrowType(arrowType, typeName) {
|
|
16796
|
+
const constructor = getOptionalArrowConstructor(typeName);
|
|
16797
|
+
return Boolean(constructor && arrowType instanceof constructor);
|
|
16798
|
+
}
|
|
16799
|
+
function makeVariableWidthArrowType(viewTypeName, fallbackType, options) {
|
|
16800
|
+
const viewTypeMode = options?.viewTypes || "never";
|
|
16801
|
+
if (viewTypeMode === "never") {
|
|
16802
|
+
return fallbackType;
|
|
16803
|
+
}
|
|
16804
|
+
const constructor = getOptionalArrowConstructor(viewTypeName);
|
|
16805
|
+
if (constructor) {
|
|
16806
|
+
return new constructor();
|
|
16807
|
+
}
|
|
16808
|
+
if (viewTypeMode === "require") {
|
|
16809
|
+
throw new Error(
|
|
16810
|
+
`${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
|
|
16811
|
+
);
|
|
16812
|
+
}
|
|
16813
|
+
return fallbackType;
|
|
16814
|
+
}
|
|
16815
|
+
function makeRequiredArrowViewType(viewTypeName) {
|
|
16816
|
+
const constructor = getOptionalArrowConstructor(viewTypeName);
|
|
16817
|
+
if (!constructor) {
|
|
16818
|
+
throw new Error(
|
|
16819
|
+
`${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
|
|
16820
|
+
);
|
|
16821
|
+
}
|
|
16822
|
+
return new constructor();
|
|
16823
|
+
}
|
|
16824
|
+
function serializeArrowDictionaryKeyType(arrowType) {
|
|
16825
|
+
if (arrowType instanceof Int_) {
|
|
16826
|
+
const prefix = arrowType.isSigned ? "int" : "uint";
|
|
16827
|
+
const keyType = `${prefix}${arrowType.bitWidth}`;
|
|
16828
|
+
if (isSchemaDictionaryKeyType(keyType)) {
|
|
16829
|
+
return keyType;
|
|
16830
|
+
}
|
|
16831
|
+
}
|
|
16832
|
+
switch (arrowType.constructor) {
|
|
16833
|
+
case Int8:
|
|
16834
|
+
return "int8";
|
|
16835
|
+
case Int16:
|
|
16836
|
+
return "int16";
|
|
16837
|
+
case Int32:
|
|
16838
|
+
return "int32";
|
|
16839
|
+
case Uint8:
|
|
16840
|
+
return "uint8";
|
|
16841
|
+
case Uint16:
|
|
16842
|
+
return "uint16";
|
|
16843
|
+
case Uint32:
|
|
16844
|
+
return "uint32";
|
|
16845
|
+
default:
|
|
16846
|
+
throw new Error(`arrow dictionary index type not supported: ${arrowType.constructor.name}`);
|
|
16847
|
+
}
|
|
16848
|
+
}
|
|
16849
|
+
function isSchemaDictionaryKeyType(keyType) {
|
|
16850
|
+
return ["int8", "int16", "int32", "uint8", "uint16", "uint32"].includes(keyType);
|
|
16851
|
+
}
|
|
16852
|
+
function deserializeArrowDictionaryKeyType(keyType) {
|
|
16853
|
+
switch (keyType) {
|
|
16854
|
+
case "int8":
|
|
16855
|
+
return new Int8();
|
|
16856
|
+
case "int16":
|
|
16857
|
+
return new Int16();
|
|
16858
|
+
case "int32":
|
|
16859
|
+
return new Int32();
|
|
16860
|
+
case "uint8":
|
|
16861
|
+
return new Uint8();
|
|
16862
|
+
case "uint16":
|
|
16863
|
+
return new Uint16();
|
|
16864
|
+
case "uint32":
|
|
16865
|
+
return new Uint32();
|
|
16866
|
+
default:
|
|
16867
|
+
throw new Error(`schema dictionary index type not supported: ${keyType}`);
|
|
16868
|
+
}
|
|
16869
|
+
}
|
|
16870
|
+
var init_convert_arrow_schema = __esm({
|
|
16871
|
+
"../core/src/schema-utils/lib/schema/convert-arrow-schema.ts"() {
|
|
16872
|
+
"use strict";
|
|
16873
|
+
init_Arrow_dom();
|
|
16874
|
+
}
|
|
16875
|
+
});
|
|
16876
|
+
|
|
16877
|
+
// ../core/src/schema-utils/lib/arrow/arrow-metadata.ts
|
|
16878
|
+
function snapshotArrowSchema(schema) {
|
|
16879
|
+
return deserializeArrowSchema(serializeArrowSchema(schema));
|
|
16880
|
+
}
|
|
16881
|
+
function makeArrowMetadataBatch(schema) {
|
|
16882
|
+
return new RecordBatch3(snapshotArrowSchema(schema), void 0);
|
|
16883
|
+
}
|
|
16884
|
+
var init_arrow_metadata = __esm({
|
|
16885
|
+
"../core/src/schema-utils/lib/arrow/arrow-metadata.ts"() {
|
|
16886
|
+
"use strict";
|
|
16887
|
+
init_Arrow_dom();
|
|
16888
|
+
init_convert_arrow_schema();
|
|
16889
|
+
}
|
|
16890
|
+
});
|
|
16891
|
+
|
|
16892
|
+
// ../core/src/schema-utils/lib/table/batch-builder/arrow-table-builder.ts
|
|
16893
|
+
var ArrowTableBuilder;
|
|
16894
|
+
var init_arrow_table_builder = __esm({
|
|
16895
|
+
"../core/src/schema-utils/lib/table/batch-builder/arrow-table-builder.ts"() {
|
|
16896
|
+
"use strict";
|
|
16897
|
+
init_arrow_metadata();
|
|
16898
|
+
init_Arrow_dom();
|
|
16899
|
+
init_convert_arrow_schema();
|
|
16900
|
+
ArrowTableBuilder = class {
|
|
16901
|
+
schema;
|
|
16902
|
+
arrowSchema;
|
|
16903
|
+
arrowBuilders;
|
|
16904
|
+
length;
|
|
16905
|
+
constructor(schema, options) {
|
|
16906
|
+
this.arrowSchema = convertSchemaToArrow(schema, options);
|
|
16907
|
+
this.schema = options?.viewTypes && options.viewTypes !== "never" ? convertArrowToSchema(this.arrowSchema) : schema;
|
|
16908
|
+
this.arrowBuilders = this.arrowSchema.fields.map(
|
|
16909
|
+
(field) => makeBuilder({ type: field.type, nullValues: [null, void 0] })
|
|
16910
|
+
);
|
|
16911
|
+
this.length = 0;
|
|
16912
|
+
}
|
|
16913
|
+
addObjectRow(row) {
|
|
16914
|
+
for (let i = 0; i < this.arrowBuilders.length; i++) {
|
|
16915
|
+
const columnName = this.schema.fields[i].name;
|
|
16916
|
+
const value = row[columnName];
|
|
16917
|
+
this.arrowBuilders[i].append(value);
|
|
16918
|
+
}
|
|
16919
|
+
this.length++;
|
|
16920
|
+
}
|
|
16921
|
+
addArrayRow(row) {
|
|
16922
|
+
for (let i = 0; i < this.arrowBuilders.length; i++) {
|
|
16923
|
+
this.arrowBuilders[i].append(row[i]);
|
|
16924
|
+
}
|
|
16925
|
+
this.length++;
|
|
16926
|
+
}
|
|
16927
|
+
/** Emits the declared schema before any rows are buffered. */
|
|
16928
|
+
firstBatch() {
|
|
16929
|
+
return this.length === 0 ? this._getArrowRecordBatch() : null;
|
|
16930
|
+
}
|
|
16931
|
+
/** Flushes the buffered rows as a native record batch. */
|
|
16932
|
+
flushBatch() {
|
|
16933
|
+
return this.length === 0 ? null : this._getArrowRecordBatch();
|
|
16934
|
+
}
|
|
16935
|
+
/** Finishes the builders and returns the final native batch when it has rows or fields. */
|
|
16936
|
+
finishBatch() {
|
|
16937
|
+
const batch = this._getArrowRecordBatch();
|
|
16938
|
+
this.arrowBuilders.forEach((builder) => builder.finish());
|
|
16939
|
+
return batch.numCols || batch.numRows ? batch : null;
|
|
16940
|
+
}
|
|
16941
|
+
/** Finishes the builders and returns a native Arrow table. */
|
|
16942
|
+
finishTable() {
|
|
16943
|
+
const batch = this._getArrowRecordBatch();
|
|
16944
|
+
this.arrowBuilders.forEach((builder) => builder.finish());
|
|
16945
|
+
return new Table(batch);
|
|
16946
|
+
}
|
|
16947
|
+
/** Extract a record batch flushing the currently accumulated data in the builders */
|
|
16948
|
+
_getArrowRecordBatch() {
|
|
16949
|
+
const { arrowBuilders, arrowSchema } = this;
|
|
16950
|
+
const arrowDatas = arrowBuilders.map((builder) => builder.flush());
|
|
16951
|
+
const length = arrowDatas[0]?.length || this.length;
|
|
16952
|
+
this.length = 0;
|
|
16953
|
+
const structField = new Struct(arrowSchema.fields);
|
|
16954
|
+
const arrowStructData = new Data(structField, 0, length, 0, void 0, arrowDatas);
|
|
16955
|
+
const arrowRecordBatch = new RecordBatch3(
|
|
16956
|
+
snapshotArrowSchema(arrowSchema),
|
|
16957
|
+
arrowStructData
|
|
16958
|
+
);
|
|
16959
|
+
return arrowRecordBatch;
|
|
16960
|
+
}
|
|
16961
|
+
};
|
|
16962
|
+
}
|
|
16963
|
+
});
|
|
16964
|
+
|
|
16965
|
+
// ../core/src/schema-utils/index.ts
|
|
16966
|
+
var init_schema_utils = __esm({
|
|
16967
|
+
"../core/src/schema-utils/index.ts"() {
|
|
16968
|
+
"use strict";
|
|
16969
|
+
init_convert_arrow_schema();
|
|
16970
|
+
init_arrow_table_builder();
|
|
16971
|
+
init_arrow_metadata();
|
|
16972
|
+
}
|
|
16973
|
+
});
|
|
16974
|
+
|
|
16975
|
+
// src/shapefile/lib/streaming/binary-chunk-reader.ts
|
|
16976
|
+
var init_binary_chunk_reader2 = __esm({
|
|
16977
|
+
"src/shapefile/lib/streaming/binary-chunk-reader.ts"() {
|
|
16978
|
+
"use strict";
|
|
16979
|
+
init_loader_utils();
|
|
16980
|
+
}
|
|
16981
|
+
});
|
|
16982
|
+
|
|
16983
|
+
// src/shapefile/lib/parsers/parse-dbf.ts
|
|
16984
|
+
function parseDBF(arrayBuffer, options = {}) {
|
|
16985
|
+
const dbfParser = new DBFParser({
|
|
16986
|
+
...options,
|
|
16987
|
+
dbf: {
|
|
16988
|
+
...options.dbf,
|
|
16989
|
+
batchSize: void 0
|
|
16990
|
+
}
|
|
16991
|
+
});
|
|
16992
|
+
dbfParser.write(arrayBuffer);
|
|
16993
|
+
dbfParser.end();
|
|
16994
|
+
const { data, schema } = dbfParser.result;
|
|
16995
|
+
const shape = options?.dbf?.shape;
|
|
16996
|
+
switch (shape) {
|
|
16997
|
+
case "object-row-table": {
|
|
16998
|
+
const table = {
|
|
16999
|
+
shape: "object-row-table",
|
|
17000
|
+
schema,
|
|
17001
|
+
data
|
|
17002
|
+
};
|
|
17003
|
+
return table;
|
|
17004
|
+
}
|
|
17005
|
+
case "table":
|
|
17006
|
+
return { schema, rows: data };
|
|
17007
|
+
case "rows":
|
|
17008
|
+
default:
|
|
17009
|
+
return data;
|
|
16341
17010
|
}
|
|
16342
17011
|
}
|
|
16343
|
-
function
|
|
16344
|
-
|
|
17012
|
+
async function* parseDBFInBatches(asyncIterator, options = {}) {
|
|
17013
|
+
const parser = new DBFParser(options);
|
|
17014
|
+
let headerReturned = false;
|
|
17015
|
+
for await (const arrayBuffer of toArrayBufferIterator(asyncIterator)) {
|
|
17016
|
+
parser.write(arrayBuffer);
|
|
17017
|
+
if (!headerReturned && parser.result.dbfHeader) {
|
|
17018
|
+
headerReturned = true;
|
|
17019
|
+
yield parser.result.dbfHeader;
|
|
17020
|
+
}
|
|
17021
|
+
if (parser.result.data.length > 0) {
|
|
17022
|
+
yield parser.result.data;
|
|
17023
|
+
parser.result.data = [];
|
|
17024
|
+
}
|
|
17025
|
+
}
|
|
17026
|
+
parser.end();
|
|
17027
|
+
if (parser.result.data.length > 0) {
|
|
17028
|
+
yield parser.result.data;
|
|
17029
|
+
}
|
|
16345
17030
|
}
|
|
16346
|
-
function
|
|
16347
|
-
|
|
16348
|
-
|
|
16349
|
-
|
|
17031
|
+
function parseState(state, result, binaryReader, textDecoder, options) {
|
|
17032
|
+
while (true) {
|
|
17033
|
+
try {
|
|
17034
|
+
switch (state) {
|
|
17035
|
+
case 4 /* ERROR */:
|
|
17036
|
+
case 3 /* END */:
|
|
17037
|
+
return state;
|
|
17038
|
+
case 0 /* START */:
|
|
17039
|
+
const dataView = binaryReader.getDataView(DBF_HEADER_SIZE);
|
|
17040
|
+
if (!dataView) {
|
|
17041
|
+
return state;
|
|
17042
|
+
}
|
|
17043
|
+
result.dbfHeader = parseDBFHeader(dataView);
|
|
17044
|
+
result.progress = {
|
|
17045
|
+
bytesUsed: 0,
|
|
17046
|
+
rowsTotal: result.dbfHeader.nRecords,
|
|
17047
|
+
rows: 0
|
|
17048
|
+
};
|
|
17049
|
+
state = 1 /* FIELD_DESCRIPTORS */;
|
|
17050
|
+
break;
|
|
17051
|
+
case 1 /* FIELD_DESCRIPTORS */:
|
|
17052
|
+
const fieldDescriptorView = binaryReader.getDataView(
|
|
17053
|
+
// @ts-ignore
|
|
17054
|
+
result.dbfHeader.headerLength - DBF_HEADER_SIZE
|
|
17055
|
+
);
|
|
17056
|
+
if (!fieldDescriptorView) {
|
|
17057
|
+
return state;
|
|
17058
|
+
}
|
|
17059
|
+
result.dbfFields = parseFieldDescriptors(fieldDescriptorView, textDecoder);
|
|
17060
|
+
result.schema = {
|
|
17061
|
+
fields: result.dbfFields.map((dbfField) => makeField(dbfField)),
|
|
17062
|
+
metadata: {}
|
|
17063
|
+
};
|
|
17064
|
+
state = 2 /* FIELD_PROPERTIES */;
|
|
17065
|
+
binaryReader.skip(1);
|
|
17066
|
+
break;
|
|
17067
|
+
case 2 /* FIELD_PROPERTIES */:
|
|
17068
|
+
const { recordLength = 0, nRecords = 0 } = result?.dbfHeader || {};
|
|
17069
|
+
while ((result.progress?.rows || 0) < nRecords) {
|
|
17070
|
+
const batchSize = options.dbf?.batchSize || Number.POSITIVE_INFINITY;
|
|
17071
|
+
if (result.data.length >= batchSize) {
|
|
17072
|
+
return state;
|
|
17073
|
+
}
|
|
17074
|
+
const recordView = binaryReader.getDataView(recordLength - 1);
|
|
17075
|
+
if (!recordView) {
|
|
17076
|
+
return state;
|
|
17077
|
+
}
|
|
17078
|
+
binaryReader.skip(1);
|
|
17079
|
+
const row = parseRow(recordView, result.dbfFields, textDecoder);
|
|
17080
|
+
result.data.push(row);
|
|
17081
|
+
result.progress.rows++;
|
|
17082
|
+
}
|
|
17083
|
+
state = 3 /* END */;
|
|
17084
|
+
break;
|
|
17085
|
+
default:
|
|
17086
|
+
state = 4 /* ERROR */;
|
|
17087
|
+
result.error = `illegal parser state ${state}`;
|
|
17088
|
+
return state;
|
|
17089
|
+
}
|
|
17090
|
+
} catch (error) {
|
|
17091
|
+
state = 4 /* ERROR */;
|
|
17092
|
+
result.error = `DBF parsing failed: ${error.message}`;
|
|
17093
|
+
return state;
|
|
17094
|
+
}
|
|
16350
17095
|
}
|
|
16351
|
-
const guards = DataType;
|
|
16352
|
-
const guard = viewTypeName === "BinaryView" ? guards.isBinaryView : guards.isUtf8View;
|
|
16353
|
-
return Boolean(guard?.(arrowType));
|
|
16354
17096
|
}
|
|
16355
|
-
function
|
|
16356
|
-
|
|
16357
|
-
|
|
17097
|
+
function parseDBFHeader(headerView) {
|
|
17098
|
+
return {
|
|
17099
|
+
// Last updated date
|
|
17100
|
+
year: headerView.getUint8(1) + 1900,
|
|
17101
|
+
month: headerView.getUint8(2),
|
|
17102
|
+
day: headerView.getUint8(3),
|
|
17103
|
+
// Number of records in data file
|
|
17104
|
+
nRecords: headerView.getUint32(4, LITTLE_ENDIAN),
|
|
17105
|
+
// Length of header in bytes
|
|
17106
|
+
headerLength: headerView.getUint16(8, LITTLE_ENDIAN),
|
|
17107
|
+
// Length of each record
|
|
17108
|
+
recordLength: headerView.getUint16(10, LITTLE_ENDIAN),
|
|
17109
|
+
// Not sure if this is usually set
|
|
17110
|
+
languageDriver: headerView.getUint8(29)
|
|
17111
|
+
};
|
|
16358
17112
|
}
|
|
16359
|
-
function
|
|
16360
|
-
const
|
|
16361
|
-
|
|
16362
|
-
|
|
16363
|
-
|
|
16364
|
-
|
|
16365
|
-
|
|
16366
|
-
|
|
16367
|
-
|
|
16368
|
-
|
|
16369
|
-
|
|
16370
|
-
|
|
16371
|
-
|
|
17113
|
+
function parseFieldDescriptors(view, textDecoder) {
|
|
17114
|
+
const nFields = (view.byteLength - 1) / 32;
|
|
17115
|
+
const fields = [];
|
|
17116
|
+
let offset = 0;
|
|
17117
|
+
for (let i = 0; i < nFields; i++) {
|
|
17118
|
+
const name = textDecoder.decode(new Uint8Array(view.buffer, view.byteOffset + offset, 11)).replace(/\u0000/g, "");
|
|
17119
|
+
fields.push({
|
|
17120
|
+
name,
|
|
17121
|
+
dataType: String.fromCharCode(view.getUint8(offset + 11)),
|
|
17122
|
+
fieldLength: view.getUint8(offset + 16),
|
|
17123
|
+
decimal: view.getUint8(offset + 17)
|
|
17124
|
+
});
|
|
17125
|
+
offset += 32;
|
|
16372
17126
|
}
|
|
16373
|
-
return
|
|
17127
|
+
return fields;
|
|
16374
17128
|
}
|
|
16375
|
-
function
|
|
16376
|
-
const
|
|
16377
|
-
|
|
16378
|
-
|
|
16379
|
-
|
|
17129
|
+
function parseRow(view, fields, textDecoder) {
|
|
17130
|
+
const out = {};
|
|
17131
|
+
let offset = 0;
|
|
17132
|
+
for (const field of fields) {
|
|
17133
|
+
const text = textDecoder.decode(
|
|
17134
|
+
new Uint8Array(view.buffer, view.byteOffset + offset, field.fieldLength)
|
|
16380
17135
|
);
|
|
17136
|
+
out[field.name] = parseField(text, field.dataType);
|
|
17137
|
+
offset += field.fieldLength;
|
|
16381
17138
|
}
|
|
16382
|
-
return
|
|
17139
|
+
return out;
|
|
16383
17140
|
}
|
|
16384
|
-
function
|
|
16385
|
-
|
|
16386
|
-
|
|
16387
|
-
|
|
16388
|
-
|
|
16389
|
-
return
|
|
16390
|
-
|
|
16391
|
-
|
|
16392
|
-
|
|
16393
|
-
|
|
16394
|
-
|
|
16395
|
-
|
|
16396
|
-
|
|
16397
|
-
|
|
16398
|
-
|
|
16399
|
-
|
|
16400
|
-
return "uint8";
|
|
16401
|
-
case Uint16:
|
|
16402
|
-
return "uint16";
|
|
16403
|
-
case Uint32:
|
|
16404
|
-
return "uint32";
|
|
17141
|
+
function parseField(text, dataType) {
|
|
17142
|
+
switch (dataType) {
|
|
17143
|
+
case "B":
|
|
17144
|
+
return parseNumber(text);
|
|
17145
|
+
case "C":
|
|
17146
|
+
return parseCharacter(text);
|
|
17147
|
+
case "F":
|
|
17148
|
+
return parseNumber(text);
|
|
17149
|
+
case "N":
|
|
17150
|
+
return parseNumber(text);
|
|
17151
|
+
case "O":
|
|
17152
|
+
return parseNumber(text);
|
|
17153
|
+
case "D":
|
|
17154
|
+
return parseDate(text);
|
|
17155
|
+
case "L":
|
|
17156
|
+
return parseBoolean(text);
|
|
16405
17157
|
default:
|
|
16406
|
-
throw new Error(
|
|
17158
|
+
throw new Error("Unsupported data type");
|
|
16407
17159
|
}
|
|
16408
17160
|
}
|
|
16409
|
-
function
|
|
16410
|
-
return
|
|
17161
|
+
function parseDate(str) {
|
|
17162
|
+
return Date.UTC(str.slice(0, 4), parseInt(str.slice(4, 6), 10) - 1, str.slice(6, 8));
|
|
16411
17163
|
}
|
|
16412
|
-
function
|
|
16413
|
-
|
|
16414
|
-
|
|
16415
|
-
|
|
16416
|
-
|
|
16417
|
-
|
|
16418
|
-
|
|
16419
|
-
|
|
16420
|
-
|
|
16421
|
-
|
|
16422
|
-
|
|
16423
|
-
|
|
16424
|
-
case "
|
|
16425
|
-
return
|
|
17164
|
+
function parseBoolean(value) {
|
|
17165
|
+
return /^[nf]$/i.test(value) ? false : /^[yt]$/i.test(value) ? true : null;
|
|
17166
|
+
}
|
|
17167
|
+
function parseNumber(text) {
|
|
17168
|
+
const number = parseFloat(text);
|
|
17169
|
+
return Number.isNaN(number) ? null : number;
|
|
17170
|
+
}
|
|
17171
|
+
function parseCharacter(text) {
|
|
17172
|
+
return text.trim() || null;
|
|
17173
|
+
}
|
|
17174
|
+
function makeField({ name, dataType, fieldLength, decimal }) {
|
|
17175
|
+
switch (dataType) {
|
|
17176
|
+
case "B":
|
|
17177
|
+
return { name, type: "float64", nullable: true, metadata: {} };
|
|
17178
|
+
case "C":
|
|
17179
|
+
return { name, type: "utf8", nullable: true, metadata: {} };
|
|
17180
|
+
case "F":
|
|
17181
|
+
return { name, type: "float64", nullable: true, metadata: {} };
|
|
17182
|
+
case "N":
|
|
17183
|
+
return { name, type: "float64", nullable: true, metadata: {} };
|
|
17184
|
+
case "O":
|
|
17185
|
+
return { name, type: "float64", nullable: true, metadata: {} };
|
|
17186
|
+
case "D":
|
|
17187
|
+
return { name, type: "timestamp-millisecond", nullable: true, metadata: {} };
|
|
17188
|
+
case "L":
|
|
17189
|
+
return { name, type: "bool", nullable: true, metadata: {} };
|
|
16426
17190
|
default:
|
|
16427
|
-
throw new Error(
|
|
17191
|
+
throw new Error("Unsupported data type");
|
|
16428
17192
|
}
|
|
16429
17193
|
}
|
|
16430
|
-
var
|
|
16431
|
-
|
|
16432
|
-
|
|
16433
|
-
init_Arrow_dom();
|
|
16434
|
-
}
|
|
16435
|
-
});
|
|
16436
|
-
|
|
16437
|
-
// ../core/src/schema-utils/lib/table/batch-builder/arrow-table-builder.ts
|
|
16438
|
-
var ArrowTableBuilder;
|
|
16439
|
-
var init_arrow_table_builder = __esm({
|
|
16440
|
-
"../core/src/schema-utils/lib/table/batch-builder/arrow-table-builder.ts"() {
|
|
17194
|
+
var LITTLE_ENDIAN, DBF_HEADER_SIZE, DBFParser;
|
|
17195
|
+
var init_parse_dbf = __esm({
|
|
17196
|
+
"src/shapefile/lib/parsers/parse-dbf.ts"() {
|
|
16441
17197
|
"use strict";
|
|
16442
|
-
|
|
16443
|
-
|
|
16444
|
-
|
|
16445
|
-
|
|
16446
|
-
|
|
16447
|
-
|
|
16448
|
-
|
|
16449
|
-
|
|
16450
|
-
|
|
16451
|
-
|
|
16452
|
-
|
|
16453
|
-
|
|
16454
|
-
|
|
16455
|
-
|
|
16456
|
-
|
|
16457
|
-
|
|
16458
|
-
for (let i = 0; i < this.arrowBuilders.length; i++) {
|
|
16459
|
-
const columnName = this.schema.fields[i].name;
|
|
16460
|
-
const value = row[columnName];
|
|
16461
|
-
this.arrowBuilders[i].append(value);
|
|
16462
|
-
}
|
|
16463
|
-
this.length++;
|
|
16464
|
-
}
|
|
16465
|
-
addArrayRow(row) {
|
|
16466
|
-
for (let i = 0; i < this.arrowBuilders.length; i++) {
|
|
16467
|
-
this.arrowBuilders[i].append(row[i]);
|
|
16468
|
-
}
|
|
16469
|
-
this.length++;
|
|
16470
|
-
}
|
|
16471
|
-
/** Makes sure that a first batch with schema is sent even if no rows */
|
|
16472
|
-
firstBatch() {
|
|
16473
|
-
const arrowRecordBatch = this._getArrowRecordBatch();
|
|
16474
|
-
if (arrowRecordBatch.numCols !== 0) {
|
|
16475
|
-
return null;
|
|
16476
|
-
}
|
|
16477
|
-
return {
|
|
16478
|
-
shape: "arrow-table",
|
|
16479
|
-
batchType: "data",
|
|
16480
|
-
length: arrowRecordBatch.numRows,
|
|
16481
|
-
schema: this.schema,
|
|
16482
|
-
data: new Table(arrowRecordBatch)
|
|
16483
|
-
};
|
|
17198
|
+
init_loader_utils();
|
|
17199
|
+
init_binary_chunk_reader2();
|
|
17200
|
+
LITTLE_ENDIAN = true;
|
|
17201
|
+
DBF_HEADER_SIZE = 32;
|
|
17202
|
+
DBFParser = class {
|
|
17203
|
+
binaryReader = new BinaryChunkReader();
|
|
17204
|
+
textDecoder;
|
|
17205
|
+
options;
|
|
17206
|
+
state = 0 /* START */;
|
|
17207
|
+
result = {
|
|
17208
|
+
data: []
|
|
17209
|
+
};
|
|
17210
|
+
constructor(options) {
|
|
17211
|
+
const { encoding = "latin1" } = options.dbf || {};
|
|
17212
|
+
this.options = options;
|
|
17213
|
+
this.textDecoder = new TextDecoder(encoding);
|
|
16484
17214
|
}
|
|
16485
|
-
/**
|
|
16486
|
-
|
|
16487
|
-
|
|
16488
|
-
|
|
16489
|
-
|
|
16490
|
-
|
|
16491
|
-
|
|
16492
|
-
|
|
16493
|
-
|
|
16494
|
-
|
|
16495
|
-
|
|
16496
|
-
|
|
16497
|
-
};
|
|
17215
|
+
/**
|
|
17216
|
+
* @param arrayBuffer
|
|
17217
|
+
*/
|
|
17218
|
+
write(arrayBuffer) {
|
|
17219
|
+
this.binaryReader.write(arrayBuffer);
|
|
17220
|
+
this.state = parseState(
|
|
17221
|
+
this.state,
|
|
17222
|
+
this.result,
|
|
17223
|
+
this.binaryReader,
|
|
17224
|
+
this.textDecoder,
|
|
17225
|
+
this.options
|
|
17226
|
+
);
|
|
16498
17227
|
}
|
|
16499
|
-
|
|
16500
|
-
|
|
16501
|
-
|
|
16502
|
-
|
|
16503
|
-
|
|
16504
|
-
|
|
17228
|
+
end() {
|
|
17229
|
+
this.binaryReader.end();
|
|
17230
|
+
this.state = parseState(
|
|
17231
|
+
this.state,
|
|
17232
|
+
this.result,
|
|
17233
|
+
this.binaryReader,
|
|
17234
|
+
this.textDecoder,
|
|
17235
|
+
this.options
|
|
17236
|
+
);
|
|
17237
|
+
if (this.state !== 3 /* END */) {
|
|
17238
|
+
this.state = 4 /* ERROR */;
|
|
17239
|
+
this.result.error = "DBF incomplete file";
|
|
16505
17240
|
}
|
|
16506
|
-
return {
|
|
16507
|
-
shape: "arrow-table",
|
|
16508
|
-
batchType: "data",
|
|
16509
|
-
length: arrowRecordBatch.numRows,
|
|
16510
|
-
schema: this.schema,
|
|
16511
|
-
data: new Table(arrowRecordBatch)
|
|
16512
|
-
};
|
|
16513
|
-
}
|
|
16514
|
-
/** Return a table with all the accumulated data */
|
|
16515
|
-
finishTable() {
|
|
16516
|
-
const arrowRecordBatch = this._getArrowRecordBatch();
|
|
16517
|
-
this.arrowBuilders.forEach((builder) => builder.finish());
|
|
16518
|
-
return {
|
|
16519
|
-
shape: "arrow-table",
|
|
16520
|
-
schema: this.schema,
|
|
16521
|
-
data: new Table(arrowRecordBatch)
|
|
16522
|
-
};
|
|
16523
|
-
}
|
|
16524
|
-
/** Extract a record batch flushing the currently accumulated data in the builders */
|
|
16525
|
-
_getArrowRecordBatch() {
|
|
16526
|
-
const { arrowBuilders, arrowSchema } = this;
|
|
16527
|
-
const arrowDatas = arrowBuilders.map((builder) => builder.flush());
|
|
16528
|
-
const length = arrowDatas[0]?.length || this.length;
|
|
16529
|
-
this.length = 0;
|
|
16530
|
-
const structField = new Struct(arrowSchema.fields);
|
|
16531
|
-
const arrowStructData = new Data(structField, 0, length, 0, void 0, arrowDatas);
|
|
16532
|
-
const arrowRecordBatch = new RecordBatch3(arrowSchema, arrowStructData);
|
|
16533
|
-
return arrowRecordBatch;
|
|
16534
17241
|
}
|
|
16535
17242
|
};
|
|
16536
17243
|
}
|
|
16537
17244
|
});
|
|
16538
17245
|
|
|
16539
|
-
// ../core/src/schema-utils/index.ts
|
|
16540
|
-
var init_schema_utils = __esm({
|
|
16541
|
-
"../core/src/schema-utils/index.ts"() {
|
|
16542
|
-
"use strict";
|
|
16543
|
-
init_arrow_table_builder();
|
|
16544
|
-
}
|
|
16545
|
-
});
|
|
16546
|
-
|
|
16547
17246
|
// src/shapefile/lib/parsers/parse-dbf-to-arrow.ts
|
|
16548
17247
|
function parseDBF2(arrayBuffer, options = {}) {
|
|
16549
17248
|
const dbfParser = new DBFParser2({
|
|
@@ -16841,11 +17540,11 @@ return true;`);
|
|
|
16841
17540
|
const { DBFLoaderWithParser: DBFLoaderWithParser2 } = await Promise.resolve().then(() => (init_dbf(), dbf_exports));
|
|
16842
17541
|
return DBFLoaderWithParser2;
|
|
16843
17542
|
}
|
|
16844
|
-
var VERSION, DBFLoader
|
|
17543
|
+
var VERSION, DBFLoader;
|
|
16845
17544
|
var init_dbf_loader_types = __esm({
|
|
16846
17545
|
"src/shapefile/dbf-loader-types.ts"() {
|
|
16847
17546
|
"use strict";
|
|
16848
|
-
VERSION = true ? "5.0.0-beta.
|
|
17547
|
+
VERSION = true ? "5.0.0-beta.10" : "latest";
|
|
16849
17548
|
DBFLoader = {
|
|
16850
17549
|
name: "DBF",
|
|
16851
17550
|
dataType: null,
|
|
@@ -16855,24 +17554,83 @@ return true;`);
|
|
|
16855
17554
|
version: VERSION,
|
|
16856
17555
|
worker: true,
|
|
16857
17556
|
workerInBatches: true,
|
|
17557
|
+
supportsNativeArrow: true,
|
|
16858
17558
|
category: "table",
|
|
16859
17559
|
extensions: ["dbf"],
|
|
16860
17560
|
mimeTypes: ["application/x-dbf"],
|
|
16861
17561
|
options: {
|
|
16862
17562
|
dbf: {
|
|
16863
17563
|
encoding: "latin1",
|
|
16864
|
-
shape: "arrow
|
|
17564
|
+
shape: "arrow"
|
|
16865
17565
|
}
|
|
16866
17566
|
},
|
|
16867
17567
|
preload: preloadDBFLoader
|
|
16868
17568
|
};
|
|
16869
|
-
DBFWorkerLoader = DBFLoader;
|
|
16870
17569
|
}
|
|
16871
17570
|
});
|
|
16872
17571
|
|
|
16873
|
-
//
|
|
17572
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-helpers.js
|
|
17573
|
+
var init_indexed_arrow_helpers = __esm({
|
|
17574
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-helpers.js"() {
|
|
17575
|
+
}
|
|
17576
|
+
});
|
|
17577
|
+
|
|
17578
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-schema-utils.js
|
|
17579
|
+
var init_arrow_schema_utils = __esm({
|
|
17580
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-schema-utils.js"() {
|
|
17581
|
+
}
|
|
17582
|
+
});
|
|
17583
|
+
|
|
17584
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js
|
|
17585
|
+
function getArrowVariadicBuffers(data) {
|
|
17586
|
+
return data.variadicBuffers ?? [];
|
|
17587
|
+
}
|
|
17588
|
+
function createArrowData(type, offset, length, nullCount, buffers, children, dictionary, variadicBuffers) {
|
|
17589
|
+
return Reflect.construct(Data, [
|
|
17590
|
+
type,
|
|
17591
|
+
offset,
|
|
17592
|
+
length,
|
|
17593
|
+
nullCount,
|
|
17594
|
+
buffers,
|
|
17595
|
+
children,
|
|
17596
|
+
dictionary,
|
|
17597
|
+
variadicBuffers
|
|
17598
|
+
]);
|
|
17599
|
+
}
|
|
17600
|
+
var init_arrow_data = __esm({
|
|
17601
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js"() {
|
|
17602
|
+
init_Arrow_dom();
|
|
17603
|
+
}
|
|
17604
|
+
});
|
|
17605
|
+
|
|
17606
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-record-batch.js
|
|
17607
|
+
function getRecordBatchMetadata(batch) {
|
|
17608
|
+
return batch.metadata;
|
|
17609
|
+
}
|
|
17610
|
+
function createRecordBatchWithMetadata(schema, data, metadata) {
|
|
17611
|
+
if ("metadata" in RecordBatch3.prototype) {
|
|
17612
|
+
const MetadataRecordBatch = RecordBatch3;
|
|
17613
|
+
return Object.assign(new MetadataRecordBatch(schema, data, metadata), { data });
|
|
17614
|
+
}
|
|
17615
|
+
const batch = Object.assign(new RecordBatch3(schema, data), { data });
|
|
17616
|
+
return metadata === void 0 ? batch : Object.assign(batch, { metadata });
|
|
17617
|
+
}
|
|
17618
|
+
var init_arrow_record_batch = __esm({
|
|
17619
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-record-batch.js"() {
|
|
17620
|
+
init_Arrow_dom();
|
|
17621
|
+
}
|
|
17622
|
+
});
|
|
17623
|
+
|
|
17624
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js
|
|
16874
17625
|
function splitArrowBuffers(input, options = {}) {
|
|
16875
|
-
const
|
|
17626
|
+
const retainedBuffers = /* @__PURE__ */ new Set();
|
|
17627
|
+
const visited = /* @__PURE__ */ new Set();
|
|
17628
|
+
for (const retained of options.retain ?? []) {
|
|
17629
|
+
const chunks = isArrowTable2(retained) ? retained.batches.map((batch) => batch.data) : isArrowVector2(retained) ? retained.data : [isArrowRecordBatch2(retained) ? retained.data : retained];
|
|
17630
|
+
for (const data of chunks)
|
|
17631
|
+
collectArrowBuffers(data, retainedBuffers, visited);
|
|
17632
|
+
}
|
|
17633
|
+
const context = { ...options, copies: /* @__PURE__ */ new WeakMap(), retainedBuffers };
|
|
16876
17634
|
if (isArrowTable2(input)) {
|
|
16877
17635
|
return splitArrowTableBuffersInternal(input, context);
|
|
16878
17636
|
}
|
|
@@ -16893,17 +17651,13 @@ return true;`);
|
|
|
16893
17651
|
function isArrowVector2(input) {
|
|
16894
17652
|
return "data" in input && Array.isArray(input.data);
|
|
16895
17653
|
}
|
|
16896
|
-
function splitArrowTableBuffersInternal(
|
|
16897
|
-
const recordBatches =
|
|
16898
|
-
|
|
16899
|
-
);
|
|
16900
|
-
return new Table(table.schema, recordBatches);
|
|
17654
|
+
function splitArrowTableBuffersInternal(arrowTable, options) {
|
|
17655
|
+
const recordBatches = arrowTable.batches.map((recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options));
|
|
17656
|
+
return new Table(arrowTable.schema, recordBatches);
|
|
16901
17657
|
}
|
|
16902
17658
|
function splitArrowRecordBatchBuffers(recordBatch, options) {
|
|
16903
|
-
|
|
16904
|
-
|
|
16905
|
-
splitArrowDataBuffers(recordBatch.data, options)
|
|
16906
|
-
);
|
|
17659
|
+
const data = splitArrowDataBuffers(recordBatch.data, options);
|
|
17660
|
+
return createRecordBatchWithMetadata(recordBatch.schema, data, getRecordBatchMetadata(recordBatch));
|
|
16907
17661
|
}
|
|
16908
17662
|
function splitArrowDataBuffers(data, options) {
|
|
16909
17663
|
const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
|
|
@@ -16914,7 +17668,7 @@ return true;`);
|
|
|
16914
17668
|
[BufferType.VALIDITY]: splitArrowBuffer(data.buffers[BufferType.VALIDITY], options),
|
|
16915
17669
|
[BufferType.TYPE]: splitArrowBuffer(data.buffers[BufferType.TYPE], options)
|
|
16916
17670
|
};
|
|
16917
|
-
return
|
|
17671
|
+
return createArrowData(
|
|
16918
17672
|
data.type,
|
|
16919
17673
|
data.offset,
|
|
16920
17674
|
data.length,
|
|
@@ -16922,25 +17676,37 @@ return true;`);
|
|
|
16922
17676
|
data._nullCount,
|
|
16923
17677
|
buffers,
|
|
16924
17678
|
children,
|
|
16925
|
-
dictionary
|
|
17679
|
+
dictionary,
|
|
17680
|
+
getArrowVariadicBuffers(data).map((buffer) => splitArrowBuffer(buffer, options))
|
|
16926
17681
|
);
|
|
16927
17682
|
}
|
|
16928
17683
|
function splitArrowVectorBuffers(vector, options) {
|
|
16929
17684
|
return new Vector(vector.data.map((data) => splitArrowDataBuffers(data, options)));
|
|
16930
17685
|
}
|
|
17686
|
+
function collectArrowBuffers(data, buffers, visited) {
|
|
17687
|
+
if (visited.has(data))
|
|
17688
|
+
return;
|
|
17689
|
+
visited.add(data);
|
|
17690
|
+
for (const view of [...Object.values(data.buffers), ...getArrowVariadicBuffers(data)]) {
|
|
17691
|
+
if (isArrowTypedArray(view))
|
|
17692
|
+
buffers.add(view.buffer);
|
|
17693
|
+
}
|
|
17694
|
+
for (const child of data.children)
|
|
17695
|
+
collectArrowBuffers(child, buffers, visited);
|
|
17696
|
+
for (const chunk of data.dictionary?.data ?? [])
|
|
17697
|
+
collectArrowBuffers(chunk, buffers, visited);
|
|
17698
|
+
}
|
|
16931
17699
|
function splitArrowBuffer(array, options) {
|
|
16932
17700
|
if (!isArrowTypedArray(array)) {
|
|
16933
17701
|
return array;
|
|
16934
17702
|
}
|
|
16935
|
-
|
|
16936
|
-
|
|
16937
|
-
}
|
|
16938
|
-
if (options.copy !== "all" && array.byteOffset === 0 && array.byteLength === array.buffer.byteLength) {
|
|
17703
|
+
const sliced = array.byteOffset !== 0 || array.byteLength !== array.buffer.byteLength;
|
|
17704
|
+
if (!options.retainedBuffers.has(array.buffer) && options.copy !== "all" && (options.copy === "none" || !sliced)) {
|
|
16939
17705
|
return array;
|
|
16940
17706
|
}
|
|
16941
17707
|
let copy = options.copies.get(array);
|
|
16942
17708
|
if (!copy) {
|
|
16943
|
-
copy = array.slice();
|
|
17709
|
+
copy = array instanceof Uint8Array ? new Uint8Array(array) : array.slice();
|
|
16944
17710
|
options.copies.set(array, copy);
|
|
16945
17711
|
}
|
|
16946
17712
|
return copy;
|
|
@@ -16949,44 +17715,193 @@ return true;`);
|
|
|
16949
17715
|
return ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
16950
17716
|
}
|
|
16951
17717
|
var init_split_arrow_buffers = __esm({
|
|
16952
|
-
"
|
|
16953
|
-
"use strict";
|
|
17718
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js"() {
|
|
16954
17719
|
init_Arrow_dom();
|
|
17720
|
+
init_arrow_record_batch();
|
|
17721
|
+
init_arrow_data();
|
|
17722
|
+
}
|
|
17723
|
+
});
|
|
17724
|
+
|
|
17725
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/take-arrow-rows.js
|
|
17726
|
+
var init_take_arrow_rows = __esm({
|
|
17727
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/take-arrow-rows.js"() {
|
|
17728
|
+
init_arrow_data();
|
|
17729
|
+
init_split_arrow_buffers();
|
|
17730
|
+
}
|
|
17731
|
+
});
|
|
17732
|
+
|
|
17733
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js
|
|
17734
|
+
var init_indexed_arrow_vector = __esm({
|
|
17735
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js"() {
|
|
17736
|
+
init_indexed_arrow_helpers();
|
|
17737
|
+
}
|
|
17738
|
+
});
|
|
17739
|
+
|
|
17740
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js
|
|
17741
|
+
var init_indexed_arrow_table = __esm({
|
|
17742
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js"() {
|
|
17743
|
+
init_indexed_arrow_helpers();
|
|
17744
|
+
init_arrow_schema_utils();
|
|
17745
|
+
init_take_arrow_rows();
|
|
17746
|
+
init_indexed_arrow_vector();
|
|
17747
|
+
}
|
|
17748
|
+
});
|
|
17749
|
+
|
|
17750
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js
|
|
17751
|
+
var init_mapped_arrow_table = __esm({
|
|
17752
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js"() {
|
|
17753
|
+
init_indexed_arrow_helpers();
|
|
17754
|
+
init_indexed_arrow_table();
|
|
17755
|
+
}
|
|
17756
|
+
});
|
|
17757
|
+
|
|
17758
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js
|
|
17759
|
+
var init_rename_arrow_columns = __esm({
|
|
17760
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js"() {
|
|
17761
|
+
init_arrow_schema_utils();
|
|
16955
17762
|
}
|
|
16956
17763
|
});
|
|
16957
17764
|
|
|
16958
|
-
//
|
|
16959
|
-
function dehydrateArrowTable(
|
|
16960
|
-
const splitTable = splitArrowBuffers(
|
|
17765
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js
|
|
17766
|
+
function dehydrateArrowTable(arrowTable, options) {
|
|
17767
|
+
const splitTable = splitArrowBuffers(arrowTable, options);
|
|
16961
17768
|
return {
|
|
16962
|
-
shape: "arrow-table",
|
|
16963
17769
|
transport: "arrow-js",
|
|
16964
|
-
|
|
16965
|
-
|
|
17770
|
+
version: 1,
|
|
17771
|
+
schema: tableToIPC(new Table(splitTable.schema, [])),
|
|
17772
|
+
metadataVersion: splitTable.schema.metadataVersion,
|
|
17773
|
+
batches: splitTable.batches.map((batch) => {
|
|
17774
|
+
const metadata = getRecordBatchMetadata(batch);
|
|
17775
|
+
return {
|
|
17776
|
+
...dehydrateArrowData(batch.data),
|
|
17777
|
+
...metadata !== void 0 ? { metadata: [...metadata] } : {}
|
|
17778
|
+
};
|
|
17779
|
+
})
|
|
16966
17780
|
};
|
|
16967
17781
|
}
|
|
16968
17782
|
function hydrateArrowTable(table) {
|
|
16969
|
-
|
|
16970
|
-
|
|
16971
|
-
|
|
16972
|
-
);
|
|
16973
|
-
|
|
17783
|
+
if (table.transport !== "arrow-js" || table.version !== 1) {
|
|
17784
|
+
throw new Error("Unsupported Arrow column-buffer transport protocol.");
|
|
17785
|
+
}
|
|
17786
|
+
const decodedSchema = tableFromIPC(table.schema).schema;
|
|
17787
|
+
const schema = new Schema2(decodedSchema.fields, decodedSchema.metadata, decodedSchema.dictionaries, table.metadataVersion);
|
|
17788
|
+
const type = new Struct(schema.fields);
|
|
17789
|
+
const batches = table.batches.map((payload) => {
|
|
17790
|
+
const data = hydrateArrowData(payload, type);
|
|
17791
|
+
return createRecordBatchWithMetadata(schema, data, payload.metadata && new Map(payload.metadata));
|
|
17792
|
+
});
|
|
17793
|
+
return new Table(schema, batches);
|
|
17794
|
+
}
|
|
17795
|
+
function dehydrateArrowData(data) {
|
|
17796
|
+
return {
|
|
17797
|
+
offset: data.offset,
|
|
17798
|
+
length: data.length,
|
|
17799
|
+
nullCount: data.nullCount,
|
|
17800
|
+
buffers: {
|
|
17801
|
+
[BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
|
|
17802
|
+
[BufferType.DATA]: data.buffers[BufferType.DATA],
|
|
17803
|
+
[BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
|
|
17804
|
+
[BufferType.TYPE]: data.buffers[BufferType.TYPE]
|
|
17805
|
+
},
|
|
17806
|
+
children: data.children.map((child) => dehydrateArrowData(child)),
|
|
17807
|
+
variadicBuffers: getArrowVariadicBuffers(data),
|
|
17808
|
+
dictionary: data.dictionary?.data.map((chunk) => dehydrateArrowData(chunk))
|
|
17809
|
+
};
|
|
17810
|
+
}
|
|
17811
|
+
function hydrateArrowData(data, type) {
|
|
17812
|
+
const children = data.children.map((child, index) => hydrateArrowData(child, type.children[index].type));
|
|
17813
|
+
const dictionary = data.dictionary && DataType.isDictionary(type) ? new Vector(data.dictionary.map((chunk) => hydrateArrowData(chunk, type.dictionary))) : void 0;
|
|
17814
|
+
return createArrowData(type, data.offset, data.length, data.nullCount, data.buffers, children, dictionary, data.variadicBuffers);
|
|
17815
|
+
}
|
|
17816
|
+
function dehydrateArrowRecordBatch(batch, options) {
|
|
17817
|
+
return dehydrateArrowTable(new Table(batch.schema, [batch]), options);
|
|
17818
|
+
}
|
|
17819
|
+
function hydrateArrowRecordBatch(payload) {
|
|
17820
|
+
if (payload.batches.length !== 1) {
|
|
17821
|
+
throw new Error("Arrow record batch transport requires exactly one batch.");
|
|
17822
|
+
}
|
|
17823
|
+
return hydrateArrowTable(payload).batches[0];
|
|
16974
17824
|
}
|
|
17825
|
+
var init_arrow_table_transport = __esm({
|
|
17826
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js"() {
|
|
17827
|
+
init_Arrow_dom();
|
|
17828
|
+
init_arrow_record_batch();
|
|
17829
|
+
init_arrow_data();
|
|
17830
|
+
init_split_arrow_buffers();
|
|
17831
|
+
}
|
|
17832
|
+
});
|
|
17833
|
+
|
|
17834
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-column-utils.js
|
|
17835
|
+
var init_arrow_column_utils = __esm({
|
|
17836
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-column-utils.js"() {
|
|
17837
|
+
}
|
|
17838
|
+
});
|
|
17839
|
+
|
|
17840
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/index.js
|
|
17841
|
+
var init_arrow = __esm({
|
|
17842
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/index.js"() {
|
|
17843
|
+
init_indexed_arrow_table();
|
|
17844
|
+
init_indexed_arrow_vector();
|
|
17845
|
+
init_mapped_arrow_table();
|
|
17846
|
+
init_arrow_schema_utils();
|
|
17847
|
+
init_rename_arrow_columns();
|
|
17848
|
+
init_split_arrow_buffers();
|
|
17849
|
+
init_arrow_table_transport();
|
|
17850
|
+
init_arrow_column_utils();
|
|
17851
|
+
init_take_arrow_rows();
|
|
17852
|
+
init_arrow_record_batch();
|
|
17853
|
+
}
|
|
17854
|
+
});
|
|
17855
|
+
|
|
17856
|
+
// ../../node_modules/@math.gl/arrow/dist/index.js
|
|
17857
|
+
var init_dist2 = __esm({
|
|
17858
|
+
"../../node_modules/@math.gl/arrow/dist/index.js"() {
|
|
17859
|
+
init_arrow();
|
|
17860
|
+
}
|
|
17861
|
+
});
|
|
17862
|
+
|
|
17863
|
+
// ../core/src/arrow-worker-transport.ts
|
|
16975
17864
|
function serializeArrowWorkerTable(result) {
|
|
16976
17865
|
if (!isArrowTableWrapper(result)) {
|
|
16977
17866
|
throw new Error("Workers require Arrow table output");
|
|
16978
17867
|
}
|
|
16979
|
-
const { data, ...metadata } = result;
|
|
17868
|
+
const { data, shape: _shape, ...metadata } = result;
|
|
16980
17869
|
return {
|
|
16981
|
-
|
|
16982
|
-
|
|
17870
|
+
transport: "arrow-column-envelope",
|
|
17871
|
+
metadata: structuredClone(metadata),
|
|
17872
|
+
...serializeWorkerColumns(data, { copy: "all" })
|
|
16983
17873
|
};
|
|
16984
17874
|
}
|
|
16985
17875
|
function deserializeArrowWorkerTable(result) {
|
|
16986
|
-
if (
|
|
17876
|
+
if (isArrowWorkerEnvelope(result)) {
|
|
17877
|
+
return { ...result.metadata, shape: "arrow-table", data: hydrateWorkerTable(result) };
|
|
17878
|
+
}
|
|
17879
|
+
if (isLegacyArrowWorkerEnvelope(result)) {
|
|
17880
|
+
const { arrowBatchMetadata: _snapshots, data: _columns, ...metadata } = result;
|
|
17881
|
+
return { ...metadata, data: hydrateWorkerTable(result) };
|
|
17882
|
+
}
|
|
17883
|
+
throw new Error("Workers require Arrow column transport");
|
|
17884
|
+
}
|
|
17885
|
+
function serializeNativeArrowWorkerResult(result, options = { copy: "all" }) {
|
|
17886
|
+
const batch = result instanceof RecordBatch3;
|
|
17887
|
+
if (!batch && !(result instanceof Table)) {
|
|
17888
|
+
throw new Error("Workers require Arrow table output");
|
|
17889
|
+
}
|
|
17890
|
+
return {
|
|
17891
|
+
transport: batch ? "arrow-record-batch" : "arrow-table-columns",
|
|
17892
|
+
columns: batch ? { data: dehydrateArrowRecordBatch(result, options) } : serializeWorkerColumns(result, options)
|
|
17893
|
+
};
|
|
17894
|
+
}
|
|
17895
|
+
function deserializeNativeArrowWorkerResult(result) {
|
|
17896
|
+
const payload = result;
|
|
17897
|
+
if (payload?.transport !== "arrow-table-columns" && payload?.transport !== "arrow-record-batch" || !hasArrowWorkerColumns(payload.columns)) {
|
|
16987
17898
|
throw new Error("Workers require Arrow column transport");
|
|
16988
17899
|
}
|
|
16989
|
-
|
|
17900
|
+
if (payload.transport === "arrow-record-batch" && !payload.columns.arrowBatchMetadata) {
|
|
17901
|
+
return hydrateArrowRecordBatch(payload.columns.data);
|
|
17902
|
+
}
|
|
17903
|
+
const data = hydrateWorkerTable(payload.columns);
|
|
17904
|
+
return payload.transport === "arrow-record-batch" ? data.batches[0] : data;
|
|
16990
17905
|
}
|
|
16991
17906
|
function isArrowTableWrapper(value) {
|
|
16992
17907
|
const table = value;
|
|
@@ -16994,71 +17909,69 @@ return true;`);
|
|
|
16994
17909
|
table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
|
|
16995
17910
|
);
|
|
16996
17911
|
}
|
|
16997
|
-
function
|
|
16998
|
-
const
|
|
16999
|
-
return
|
|
17000
|
-
table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
|
|
17001
|
-
);
|
|
17912
|
+
function hasArrowWorkerColumns(value) {
|
|
17913
|
+
const columns = value;
|
|
17914
|
+
return columns?.data?.transport === "arrow-js" && Array.isArray(columns.data.batches);
|
|
17002
17915
|
}
|
|
17003
|
-
function
|
|
17004
|
-
return
|
|
17916
|
+
function isArrowWorkerEnvelope(value) {
|
|
17917
|
+
return value?.transport === "arrow-column-envelope" && hasArrowWorkerColumns(value);
|
|
17005
17918
|
}
|
|
17006
|
-
function
|
|
17919
|
+
function isLegacyArrowWorkerEnvelope(value) {
|
|
17920
|
+
return value?.shape === "arrow-table" && hasArrowWorkerColumns(value);
|
|
17921
|
+
}
|
|
17922
|
+
function serializeWorkerColumns(table, options) {
|
|
17007
17923
|
return {
|
|
17008
|
-
|
|
17009
|
-
|
|
17010
|
-
length: data.length,
|
|
17011
|
-
// @ts-expect-error _nullCount is protected. Preserve the Arrow lazy null-count state.
|
|
17012
|
-
nullCount: data._nullCount,
|
|
17013
|
-
buffers: {
|
|
17014
|
-
[BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
|
|
17015
|
-
[BufferType.DATA]: data.buffers[BufferType.DATA],
|
|
17016
|
-
[BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
|
|
17017
|
-
[BufferType.TYPE]: data.buffers[BufferType.TYPE]
|
|
17018
|
-
},
|
|
17019
|
-
children: data.children.map((childData) => dehydrateArrowData(childData)),
|
|
17020
|
-
dictionary: data.dictionary ? dehydrateArrowVector(data.dictionary) : void 0
|
|
17924
|
+
arrowBatchMetadata: snapshotBatchMetadata(table),
|
|
17925
|
+
data: dehydrateWorkerTable(table, options)
|
|
17021
17926
|
};
|
|
17022
17927
|
}
|
|
17023
|
-
function
|
|
17024
|
-
|
|
17928
|
+
function dehydrateWorkerTable(table, options) {
|
|
17929
|
+
const payload = dehydrateArrowTable(table, options);
|
|
17930
|
+
if (table.numCols === 0) {
|
|
17931
|
+
for (const [index, batch] of table.batches.entries()) {
|
|
17932
|
+
payload.batches[index].length = batch.numRows;
|
|
17933
|
+
}
|
|
17934
|
+
}
|
|
17935
|
+
return payload;
|
|
17025
17936
|
}
|
|
17026
|
-
function
|
|
17027
|
-
|
|
17028
|
-
|
|
17029
|
-
|
|
17030
|
-
|
|
17031
|
-
data.offset,
|
|
17032
|
-
data.length,
|
|
17033
|
-
data.nullCount,
|
|
17034
|
-
data.buffers,
|
|
17035
|
-
children,
|
|
17036
|
-
dictionary
|
|
17037
|
-
);
|
|
17937
|
+
function snapshotBatchMetadata(table) {
|
|
17938
|
+
return table.batches.map((batch) => ({
|
|
17939
|
+
schema: tableToIPC(new Table(batch.schema, [])),
|
|
17940
|
+
metadata: Array.from(batch.metadata)
|
|
17941
|
+
}));
|
|
17038
17942
|
}
|
|
17039
|
-
function
|
|
17040
|
-
|
|
17943
|
+
function hydrateWorkerTable(result) {
|
|
17944
|
+
const { arrowBatchMetadata, data } = result;
|
|
17945
|
+
const table = hydrateArrowTable(data);
|
|
17946
|
+
const batches = table.batches.map((batch, index) => {
|
|
17947
|
+
const snapshot = arrowBatchMetadata?.[index];
|
|
17948
|
+
const restored = snapshot ? new RecordBatch3(
|
|
17949
|
+
tableFromIPC(snapshot.schema).schema,
|
|
17950
|
+
batch.data,
|
|
17951
|
+
new Map(snapshot.metadata)
|
|
17952
|
+
) : batch;
|
|
17953
|
+
const rowCount = data.batches[index].length;
|
|
17954
|
+
if (restored.numCols === 0 && restored.numRows !== rowCount) {
|
|
17955
|
+
Object.defineProperty(restored, "data", {
|
|
17956
|
+
value: new Data(new Struct([]), 0, rowCount, 0, void 0, [])
|
|
17957
|
+
});
|
|
17958
|
+
}
|
|
17959
|
+
return restored;
|
|
17960
|
+
});
|
|
17961
|
+
return new Table(table.schema, batches);
|
|
17041
17962
|
}
|
|
17042
|
-
var
|
|
17043
|
-
"../core/src/
|
|
17963
|
+
var init_arrow_worker_transport = __esm({
|
|
17964
|
+
"../core/src/arrow-worker-transport.ts"() {
|
|
17044
17965
|
"use strict";
|
|
17045
17966
|
init_Arrow_dom();
|
|
17046
|
-
|
|
17047
|
-
init_split_arrow_buffers();
|
|
17048
|
-
}
|
|
17049
|
-
});
|
|
17050
|
-
|
|
17051
|
-
// ../core/src/schema-utils/arrow-transport.ts
|
|
17052
|
-
var init_arrow_transport = __esm({
|
|
17053
|
-
"../core/src/schema-utils/arrow-transport.ts"() {
|
|
17054
|
-
"use strict";
|
|
17055
|
-
init_arrow_table_transport();
|
|
17056
|
-
init_split_arrow_buffers();
|
|
17967
|
+
init_dist2();
|
|
17057
17968
|
}
|
|
17058
17969
|
});
|
|
17059
17970
|
|
|
17060
17971
|
// src/shapefile/lib/shapefile-worker-transport.ts
|
|
17061
17972
|
function serializeShapefileWorkerResult(result) {
|
|
17973
|
+
if (result instanceof Table || result instanceof RecordBatch3)
|
|
17974
|
+
return serializeNativeArrowWorkerResult(result);
|
|
17062
17975
|
if (result?.shape === "arrow-table") return serializeArrowWorkerTable(result);
|
|
17063
17976
|
if (Array.isArray(result) && result.every((value) => value === null || value instanceof Uint8Array)) {
|
|
17064
17977
|
return { transport: "shp-wkb", geometries: result.map((value) => value?.slice() ?? null) };
|
|
@@ -17077,7 +17990,10 @@ return true;`);
|
|
|
17077
17990
|
throw new Error("Shapefile workers require Arrow columns or WKB buffers");
|
|
17078
17991
|
}
|
|
17079
17992
|
function deserializeShapefileWorkerResult(result) {
|
|
17080
|
-
if (result?.
|
|
17993
|
+
if (result?.transport === "arrow-table-columns" || result?.transport === "arrow-record-batch")
|
|
17994
|
+
return deserializeNativeArrowWorkerResult(result);
|
|
17995
|
+
if (result?.transport === "arrow-column-envelope" || result?.shape === "arrow-table")
|
|
17996
|
+
return deserializeArrowWorkerTable(result);
|
|
17081
17997
|
if (result?.transport === "shapefile-header") return result.header;
|
|
17082
17998
|
if (result?.transport === "shp-wkb") {
|
|
17083
17999
|
return result.header ? {
|
|
@@ -17094,55 +18010,64 @@ return true;`);
|
|
|
17094
18010
|
var init_shapefile_worker_transport = __esm({
|
|
17095
18011
|
"src/shapefile/lib/shapefile-worker-transport.ts"() {
|
|
17096
18012
|
"use strict";
|
|
17097
|
-
|
|
18013
|
+
init_Arrow_dom();
|
|
18014
|
+
init_arrow_worker_transport();
|
|
17098
18015
|
serializeShapefileWorkerBatch = serializeShapefileWorkerResult;
|
|
17099
18016
|
}
|
|
17100
18017
|
});
|
|
17101
18018
|
|
|
17102
18019
|
// src/shapefile/dbf-loader.ts
|
|
17103
18020
|
function getDBFShape(options) {
|
|
17104
|
-
return options?.dbf?.shape || "arrow
|
|
18021
|
+
return options?.dbf?.shape || "arrow";
|
|
17105
18022
|
}
|
|
17106
18023
|
function deserializeDBFWorkerResult(result, options) {
|
|
17107
|
-
const
|
|
18024
|
+
const value = deserializeShapefileWorkerResult(result);
|
|
18025
|
+
const table = "shape" in value ? value.data : value;
|
|
17108
18026
|
const shape = getDBFShape(options);
|
|
17109
|
-
if (shape === "arrow
|
|
17110
|
-
const rows = table.
|
|
18027
|
+
if (shape === "arrow") return table;
|
|
18028
|
+
const rows = table.toArray().map((row) => row.toJSON());
|
|
17111
18029
|
if (shape === "rows") return rows;
|
|
17112
|
-
|
|
17113
|
-
|
|
18030
|
+
const schema = convertArrowToSchema(table.schema);
|
|
18031
|
+
if (shape === "table") return { schema, rows };
|
|
18032
|
+
return { shape: "object-row-table", schema, data: rows };
|
|
17114
18033
|
}
|
|
17115
18034
|
function deserializeDBFWorkerBatch(result, options) {
|
|
17116
|
-
|
|
17117
|
-
const
|
|
17118
|
-
return
|
|
18035
|
+
const value = deserializeShapefileWorkerResult(result);
|
|
18036
|
+
const batch = "shape" in value ? value.data.batches[0] ?? makeArrowMetadataBatch(value.data.schema) : value;
|
|
18037
|
+
return batch instanceof RecordBatch3 && getDBFShape(options) !== "arrow" ? batch.toArray().map((row) => row.toJSON()) : batch;
|
|
17119
18038
|
}
|
|
17120
|
-
var _DBFWorkerLoaderPreload, DBFWorkerLoaderMetadataWithoutPreload, _DBFLoaderPreload, DBFLoaderMetadataWithoutPreload, DBFWorkerLoaderWithParser, DBFLoaderWithParser;
|
|
18039
|
+
var _DBFWorkerLoaderPreload, DBFWorkerLoaderMetadataWithoutPreload, _DBFLoaderPreload, DBFLoaderMetadataWithoutPreload, DBFWorkerLoaderWithParser, DBFColumnLoader, DBFLoaderWithParser;
|
|
17121
18040
|
var init_dbf_loader = __esm({
|
|
17122
18041
|
"src/shapefile/dbf-loader.ts"() {
|
|
17123
18042
|
"use strict";
|
|
18043
|
+
init_Arrow_dom();
|
|
18044
|
+
init_schema_utils();
|
|
17124
18045
|
init_parse_dbf();
|
|
17125
18046
|
init_parse_dbf_to_arrow();
|
|
17126
18047
|
init_dbf_loader_types();
|
|
17127
18048
|
init_dbf_loader_types();
|
|
17128
18049
|
init_shapefile_worker_transport();
|
|
17129
|
-
({ preload: _DBFWorkerLoaderPreload, ...DBFWorkerLoaderMetadataWithoutPreload } =
|
|
18050
|
+
({ preload: _DBFWorkerLoaderPreload, ...DBFWorkerLoaderMetadataWithoutPreload } = DBFLoader);
|
|
17130
18051
|
({ preload: _DBFLoaderPreload, ...DBFLoaderMetadataWithoutPreload } = DBFLoader);
|
|
17131
18052
|
DBFWorkerLoaderWithParser = {
|
|
17132
18053
|
...DBFWorkerLoaderMetadataWithoutPreload
|
|
17133
18054
|
};
|
|
17134
|
-
|
|
18055
|
+
DBFColumnLoader = {
|
|
17135
18056
|
...DBFLoaderMetadataWithoutPreload,
|
|
17136
|
-
|
|
17137
|
-
|
|
18057
|
+
dataType: null,
|
|
18058
|
+
batchType: null,
|
|
18059
|
+
parse: async (arrayBuffer, options) => getDBFShape(options) === "arrow" ? parseDBF2(arrayBuffer, options) : parseDBF(arrayBuffer, options),
|
|
18060
|
+
parseSync: (arrayBuffer, options) => getDBFShape(options) === "arrow" ? parseDBF2(arrayBuffer, options) : parseDBF(arrayBuffer, options),
|
|
17138
18061
|
parseInBatches(arrayBufferIterator, options) {
|
|
17139
|
-
|
|
18062
|
+
const batchOptions = typeof options?.core?.batchSize === "number" ? { ...options, dbf: { ...options.dbf, batchSize: options.core.batchSize } } : options;
|
|
18063
|
+
return getDBFShape(batchOptions) === "arrow" ? parseDBFInBatches2(arrayBufferIterator, batchOptions) : parseDBFInBatches(arrayBufferIterator, batchOptions);
|
|
17140
18064
|
},
|
|
17141
18065
|
serializeWorkerResult: serializeShapefileWorkerResult,
|
|
17142
18066
|
deserializeWorkerResult: deserializeDBFWorkerResult,
|
|
17143
18067
|
serializeWorkerBatch: serializeShapefileWorkerBatch,
|
|
17144
18068
|
deserializeWorkerBatch: deserializeDBFWorkerBatch
|
|
17145
18069
|
};
|
|
18070
|
+
DBFLoaderWithParser = DBFColumnLoader;
|
|
17146
18071
|
}
|
|
17147
18072
|
});
|
|
17148
18073
|
|
|
@@ -17151,12 +18076,12 @@ return true;`);
|
|
|
17151
18076
|
init_dbf_loader();
|
|
17152
18077
|
init_parse_dbf_to_arrow();
|
|
17153
18078
|
createLoaderWorker({
|
|
17154
|
-
...
|
|
18079
|
+
...DBFColumnLoader,
|
|
17155
18080
|
/** Decodes attributes directly into Arrow buffers for every requested output shape. */
|
|
17156
18081
|
parse(input, options) {
|
|
17157
|
-
return
|
|
18082
|
+
return DBFColumnLoader.parse(input, {
|
|
17158
18083
|
...options,
|
|
17159
|
-
dbf: { ...options?.dbf, shape: "arrow
|
|
18084
|
+
dbf: { ...options?.dbf, shape: "arrow" }
|
|
17160
18085
|
});
|
|
17161
18086
|
},
|
|
17162
18087
|
/** Preserves legacy header events while returning only column buffers for row data. */
|
|
@@ -17164,7 +18089,7 @@ return true;`);
|
|
|
17164
18089
|
return parseDBFArrowBatches(
|
|
17165
18090
|
input,
|
|
17166
18091
|
options,
|
|
17167
|
-
options?.dbf?.shape !== "arrow
|
|
18092
|
+
options?.dbf?.shape !== "arrow"
|
|
17168
18093
|
);
|
|
17169
18094
|
}
|
|
17170
18095
|
});
|