@math.gl/geospatial 5.0.0-beta.9 → 5.0.0-rc.1
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 +3 -3
- package/dist/crs/crs-descriptor-types.d.ts +2 -1
- package/dist/crs/crs-descriptor-types.d.ts.map +1 -1
- package/dist/crs/index.cjs +54 -0
- package/dist/crs/index.cjs.map +2 -2
- package/dist/crs/index.d.ts +1 -0
- package/dist/crs/index.d.ts.map +1 -1
- package/dist/crs/index.js +1 -0
- package/dist/crs/index.js.map +1 -1
- package/dist/crs/spatial-reference-metadata.d.ts +20 -0
- package/dist/crs/spatial-reference-metadata.d.ts.map +1 -0
- package/dist/crs/spatial-reference-metadata.js +86 -0
- package/dist/crs/spatial-reference-metadata.js.map +1 -0
- package/dist/ellipsoid-helpers/ellipsoid-transform.d.ts +1 -1
- package/dist/ellipsoid-helpers/ellipsoid-transform.d.ts.map +1 -1
- package/dist/ellipsoid-helpers/ellipsoid-transform.js +2 -2
- package/dist/ellipsoid-helpers/ellipsoid-transform.js.map +1 -1
- package/dist/ellipsoid-helpers/scale-to-geodetic-surface.js +1 -1
- package/dist/ellipsoid-helpers/scale-to-geodetic-surface.js.map +1 -1
- package/dist/ellipsoid-helpers/tangent-plane-numerics.d.ts +1 -1
- package/dist/ellipsoid-helpers/tangent-plane-numerics.d.ts.map +1 -1
- package/dist/ellipsoid-tangent-plane.d.ts +2 -2
- package/dist/ellipsoid-tangent-plane.d.ts.map +1 -1
- package/dist/ellipsoid-tangent-plane.js +1 -1
- package/dist/ellipsoid-tangent-plane.js.map +1 -1
- package/dist/ellipsoid-transforms.d.ts +2 -2
- package/dist/ellipsoid-transforms.d.ts.map +1 -1
- package/dist/ellipsoid-transforms.js +1 -1
- package/dist/ellipsoid-transforms.js.map +1 -1
- package/dist/ellipsoid.d.ts +2 -2
- package/dist/ellipsoid.d.ts.map +1 -1
- package/dist/ellipsoid.js +2 -2
- package/dist/ellipsoid.js.map +1 -1
- package/dist/expressions.d.ts +1 -1
- package/dist/expressions.d.ts.map +1 -1
- package/dist/expressions.js +1 -1
- package/dist/expressions.js.map +1 -1
- package/dist/geodesic-buffer.d.ts +1 -1
- package/dist/geodesic-buffer.d.ts.map +1 -1
- package/dist/geodesic-path.d.ts +1 -1
- package/dist/geodesic-path.d.ts.map +1 -1
- package/dist/geometry-constructors.d.ts +6 -0
- package/dist/geometry-constructors.d.ts.map +1 -0
- package/dist/geometry-constructors.js +37 -0
- package/dist/geometry-constructors.js.map +1 -0
- package/dist/geometry-inspection.d.ts +8 -0
- package/dist/geometry-inspection.d.ts.map +1 -0
- package/dist/geometry-inspection.js +61 -0
- package/dist/geometry-inspection.js.map +1 -0
- package/dist/index.cjs +2514 -558
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +164 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +106 -0
- package/dist/index.js.map +1 -1
- package/dist/line-simplification.d.ts +4 -0
- package/dist/line-simplification.d.ts.map +1 -0
- package/dist/line-simplification.js +83 -0
- package/dist/line-simplification.js.map +1 -0
- package/dist/linear-referencing.d.ts +6 -0
- package/dist/linear-referencing.d.ts.map +1 -0
- package/dist/linear-referencing.js +74 -0
- package/dist/linear-referencing.js.map +1 -0
- package/dist/lng-lat-rectangle.d.ts +1 -1
- package/dist/lng-lat-rectangle.d.ts.map +1 -1
- package/dist/lng-lat-rectangle.js +1 -1
- package/dist/lng-lat-rectangle.js.map +1 -1
- package/dist/local-reference-frame.d.ts +3 -3
- package/dist/local-reference-frame.d.ts.map +1 -1
- package/dist/local-reference-frame.js +2 -2
- package/dist/local-reference-frame.js.map +1 -1
- package/dist/make-obb-from-region.d.ts +1 -1
- package/dist/make-obb-from-region.d.ts.map +1 -1
- package/dist/make-obb-from-region.js +1 -1
- package/dist/make-obb-from-region.js.map +1 -1
- package/dist/maps/air-ocean-mesh.js +1 -1
- package/dist/maps/air-ocean-mesh.js.map +1 -1
- package/dist/maps/myriahedral/unfold.d.ts +1 -1
- package/dist/maps/myriahedral/unfold.d.ts.map +1 -1
- package/dist/maps/myriahedral/unfold.js +1 -1
- package/dist/maps/myriahedral/unfold.js.map +1 -1
- package/dist/maps/presets.cjs +6 -6
- package/dist/maps/presets.cjs.map +2 -2
- package/dist/maps.cjs +6 -6
- package/dist/maps.cjs.map +2 -2
- package/dist/projection/deformation.cjs +5 -5
- package/dist/projection/deformation.cjs.map +2 -2
- package/dist/projection/experimental/core.cjs +8 -4
- package/dist/projection/experimental/core.cjs.map +1 -1
- package/dist/projection/experimental/crs/spatial-reference.d.ts.map +1 -1
- package/dist/projection/experimental/crs/spatial-reference.js.map +1 -1
- package/dist/projection/experimental/crs/types.d.ts +1 -1
- package/dist/projection/experimental/crs/types.d.ts.map +1 -1
- package/dist/projection/experimental/crs-rendering-scale.d.ts.map +1 -1
- package/dist/projection/experimental/crs-rendering-scale.js +13 -2
- package/dist/projection/experimental/crs-rendering-scale.js.map +1 -1
- package/dist/projection/experimental/datum.js +1 -1
- package/dist/projection/experimental/datum.js.map +1 -1
- package/dist/projection/experimental/entries/projections/geocent.cjs +3 -3
- package/dist/projection/experimental/entries/projections/geocent.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/aea.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/aea.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/aea.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/aea.js +4 -1
- package/dist/projection/experimental/lazy-projections/aea.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/bonne.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/bonne.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/bonne.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/bonne.js +4 -1
- package/dist/projection/experimental/lazy-projections/bonne.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/cass.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/cass.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/cass.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/cass.js +4 -1
- package/dist/projection/experimental/lazy-projections/cass.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/eck6.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/eck6.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/eck6.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/eck6.js +4 -1
- package/dist/projection/experimental/lazy-projections/eck6.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/eqdc.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/eqdc.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/eqdc.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/eqdc.js +4 -1
- package/dist/projection/experimental/lazy-projections/eqdc.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/eqearth.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/eqearth.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/eqearth.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/eqearth.js +4 -1
- package/dist/projection/experimental/lazy-projections/eqearth.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/equi.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/equi.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/equi.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/equi.js +4 -1
- package/dist/projection/experimental/lazy-projections/equi.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/geocent.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/geocent.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/geocent.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/geocent.js +4 -1
- package/dist/projection/experimental/lazy-projections/geocent.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/geos.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/geos.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/geos.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/geos.js +4 -1
- package/dist/projection/experimental/lazy-projections/geos.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/gnom.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/gnom.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/gnom.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/gnom.js +4 -1
- package/dist/projection/experimental/lazy-projections/gnom.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/index.cjs +100 -27
- package/dist/projection/experimental/lazy-projections/index.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/krovak.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/krovak.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/krovak.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/krovak.js +4 -1
- package/dist/projection/experimental/lazy-projections/krovak.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/merc.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/merc.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/merc.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/merc.js +4 -1
- package/dist/projection/experimental/lazy-projections/merc.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/mill.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/mill.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/mill.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/mill.js +4 -1
- package/dist/projection/experimental/lazy-projections/mill.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/moll.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/moll.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/moll.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/moll.js +4 -1
- package/dist/projection/experimental/lazy-projections/moll.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/nzmg.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/nzmg.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/nzmg.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/nzmg.js +4 -1
- package/dist/projection/experimental/lazy-projections/nzmg.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/omerc.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/omerc.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/omerc.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/omerc.js +4 -1
- package/dist/projection/experimental/lazy-projections/omerc.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/ortho.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/ortho.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/ortho.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/ortho.js +4 -1
- package/dist/projection/experimental/lazy-projections/ortho.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/poly.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/poly.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/poly.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/poly.js +4 -1
- package/dist/projection/experimental/lazy-projections/poly.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/robin.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/robin.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/robin.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/robin.js +4 -1
- package/dist/projection/experimental/lazy-projections/robin.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/sinu.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/sinu.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/sinu.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/sinu.js +4 -1
- package/dist/projection/experimental/lazy-projections/sinu.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/stere.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/stere.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/stere.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/stere.js +4 -1
- package/dist/projection/experimental/lazy-projections/stere.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/tpers.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/tpers.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/tpers.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/tpers.js +4 -1
- package/dist/projection/experimental/lazy-projections/tpers.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/vandg.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/vandg.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/vandg.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/vandg.js +4 -1
- package/dist/projection/experimental/lazy-projections/vandg.js.map +1 -1
- package/dist/projection/experimental/spatial-deformation.js +1 -1
- package/dist/projection/experimental/spatial-deformation.js.map +1 -1
- package/dist/projection/index.cjs +8 -4
- package/dist/projection/index.cjs.map +1 -1
- package/dist/projection/index.d.ts.map +1 -1
- package/dist/projection/index.js.map +1 -1
- package/dist/projection/lib/projection.js.map +1 -1
- package/dist/projection/pipeline.cjs +3 -3
- package/dist/projection/pipeline.cjs.map +1 -1
- package/dist/projection/temporal.cjs +5 -5
- package/dist/projection/temporal.cjs.map +2 -2
- package/dist/projection/transform-analysis.cjs +3 -3
- package/dist/projection/transform-analysis.cjs.map +1 -1
- package/dist/rhumb-path.d.ts +1 -1
- package/dist/rhumb-path.d.ts.map +1 -1
- package/dist/spatial-planar-intersects.d.ts +4 -0
- package/dist/spatial-planar-intersects.d.ts.map +1 -0
- package/dist/spatial-planar-intersects.js +108 -0
- package/dist/spatial-planar-intersects.js.map +1 -0
- package/dist/spatial-planar.d.ts +16 -0
- package/dist/spatial-planar.d.ts.map +1 -0
- package/dist/spatial-planar.js +240 -0
- package/dist/spatial-planar.js.map +1 -0
- package/dist/spatial-sql.d.ts +45 -0
- package/dist/spatial-sql.d.ts.map +1 -0
- package/dist/spatial-sql.js +192 -0
- package/dist/spatial-sql.js.map +1 -0
- package/dist/st-functions.cjs +1616 -0
- package/dist/st-functions.cjs.map +6 -0
- package/dist/st-functions.d.ts +307 -0
- package/dist/st-functions.d.ts.map +1 -0
- package/dist/st-functions.js +593 -0
- package/dist/st-functions.js.map +1 -0
- package/dist/subdivide-globe-mesh.js +1 -1
- package/dist/subdivide-globe-mesh.js.map +1 -1
- package/dist/tasks/index.cjs +216 -98
- package/dist/tasks/index.cjs.map +2 -2
- package/dist/tasks/terrain-residency.d.ts +9 -0
- package/dist/tasks/terrain-residency.d.ts.map +1 -1
- package/dist/tasks/terrain-residency.js +98 -19
- package/dist/tasks/terrain-residency.js.map +1 -1
- package/dist/terrain/cutout-polygons.d.ts +21 -0
- package/dist/terrain/cutout-polygons.d.ts.map +1 -0
- package/dist/terrain/cutout-polygons.js +172 -0
- package/dist/terrain/cutout-polygons.js.map +1 -0
- package/dist/terrain/cutout-region.d.ts +34 -0
- package/dist/terrain/cutout-region.d.ts.map +1 -0
- package/dist/terrain/cutout-region.js +33 -0
- package/dist/terrain/cutout-region.js.map +1 -0
- package/dist/terrain/cutout-skirts.d.ts +34 -0
- package/dist/terrain/cutout-skirts.d.ts.map +1 -0
- package/dist/terrain/cutout-skirts.js +29 -0
- package/dist/terrain/cutout-skirts.js.map +1 -0
- package/dist/terrain/depression-fill.d.ts +25 -0
- package/dist/terrain/depression-fill.d.ts.map +1 -0
- package/dist/terrain/depression-fill.js +106 -0
- package/dist/terrain/depression-fill.js.map +1 -0
- package/dist/terrain/geographic-cutout.d.ts +38 -0
- package/dist/terrain/geographic-cutout.d.ts.map +1 -0
- package/dist/terrain/geographic-cutout.js +120 -0
- package/dist/terrain/geographic-cutout.js.map +1 -0
- package/dist/terrain/geographic-lod-seams.d.ts +10 -0
- package/dist/terrain/geographic-lod-seams.d.ts.map +1 -0
- package/dist/terrain/geographic-lod-seams.js +100 -0
- package/dist/terrain/geographic-lod-seams.js.map +1 -0
- package/dist/terrain/geographic-neighbor.d.ts +18 -0
- package/dist/terrain/geographic-neighbor.d.ts.map +1 -0
- package/dist/terrain/geographic-neighbor.js +44 -0
- package/dist/terrain/geographic-neighbor.js.map +1 -0
- package/dist/terrain/geographic-poles.d.ts +24 -0
- package/dist/terrain/geographic-poles.d.ts.map +1 -0
- package/dist/terrain/geographic-poles.js +34 -0
- package/dist/terrain/geographic-poles.js.map +1 -0
- package/dist/terrain/hydrology.d.ts +42 -0
- package/dist/terrain/hydrology.d.ts.map +1 -0
- package/dist/terrain/hydrology.js +112 -0
- package/dist/terrain/hydrology.js.map +1 -0
- package/dist/terrain/index.cjs +2135 -161
- package/dist/terrain/index.cjs.map +3 -3
- package/dist/terrain/index.d.ts +23 -1
- package/dist/terrain/index.d.ts.map +1 -1
- package/dist/terrain/index.js +21 -0
- package/dist/terrain/index.js.map +1 -1
- package/dist/terrain/lod-screen-error.d.ts +28 -0
- package/dist/terrain/lod-screen-error.d.ts.map +1 -0
- package/dist/terrain/lod-screen-error.js +95 -0
- package/dist/terrain/lod-screen-error.js.map +1 -0
- package/dist/terrain/lod-select.d.ts +26 -10
- package/dist/terrain/lod-select.d.ts.map +1 -1
- package/dist/terrain/lod-select.js +27 -14
- package/dist/terrain/lod-select.js.map +1 -1
- package/dist/terrain/lod-stitch.d.ts +2 -0
- package/dist/terrain/lod-stitch.d.ts.map +1 -1
- package/dist/terrain/lod-stitch.js +21 -6
- package/dist/terrain/lod-stitch.js.map +1 -1
- package/dist/terrain/mesh-cutout.d.ts +45 -0
- package/dist/terrain/mesh-cutout.d.ts.map +1 -0
- package/dist/terrain/mesh-cutout.js +336 -0
- package/dist/terrain/mesh-cutout.js.map +1 -0
- package/dist/terrain/mesh-skirts.d.ts +8 -2
- package/dist/terrain/mesh-skirts.d.ts.map +1 -1
- package/dist/terrain/mesh-skirts.js +5 -4
- package/dist/terrain/mesh-skirts.js.map +1 -1
- package/dist/terrain/mixed-halo-update.d.ts.map +1 -1
- package/dist/terrain/mixed-halo-update.js +58 -23
- package/dist/terrain/mixed-halo-update.js.map +1 -1
- package/dist/terrain/mixed-vertex-halos.d.ts +24 -1
- package/dist/terrain/mixed-vertex-halos.d.ts.map +1 -1
- package/dist/terrain/mixed-vertex-halos.js +75 -58
- package/dist/terrain/mixed-vertex-halos.js.map +1 -1
- package/dist/terrain/regional-viewshed.d.ts +55 -0
- package/dist/terrain/regional-viewshed.d.ts.map +1 -0
- package/dist/terrain/regional-viewshed.js +119 -0
- package/dist/terrain/regional-viewshed.js.map +1 -0
- package/dist/terrain/surface.d.ts +1 -1
- package/dist/terrain/surface.d.ts.map +1 -1
- package/dist/terrain/surface.js +1 -1
- package/dist/terrain/surface.js.map +1 -1
- package/dist/terrain/sweep-capsule.d.ts +27 -0
- package/dist/terrain/sweep-capsule.d.ts.map +1 -0
- package/dist/terrain/sweep-capsule.js +104 -0
- package/dist/terrain/sweep-capsule.js.map +1 -0
- package/dist/terrain/sweep-cylinder.d.ts +16 -0
- package/dist/terrain/sweep-cylinder.d.ts.map +1 -0
- package/dist/terrain/sweep-cylinder.js +52 -0
- package/dist/terrain/sweep-cylinder.js.map +1 -0
- package/dist/terrain/sweep-plane.d.ts +9 -0
- package/dist/terrain/sweep-plane.d.ts.map +1 -0
- package/dist/terrain/sweep-plane.js +52 -0
- package/dist/terrain/sweep-plane.js.map +1 -0
- package/dist/terrain/sweep-polytope.d.ts +42 -0
- package/dist/terrain/sweep-polytope.d.ts.map +1 -0
- package/dist/terrain/sweep-polytope.js +189 -0
- package/dist/terrain/sweep-polytope.js.map +1 -0
- package/dist/terrain/sweep-rotating-capsule.d.ts +17 -0
- package/dist/terrain/sweep-rotating-capsule.d.ts.map +1 -0
- package/dist/terrain/sweep-rotating-capsule.js +118 -0
- package/dist/terrain/sweep-rotating-capsule.js.map +1 -0
- package/dist/terrain/sweep-rotation.d.ts +35 -0
- package/dist/terrain/sweep-rotation.d.ts.map +1 -0
- package/dist/terrain/sweep-rotation.js +114 -0
- package/dist/terrain/sweep-rotation.js.map +1 -0
- package/dist/terrain/sweep-sphere.d.ts +27 -0
- package/dist/terrain/sweep-sphere.d.ts.map +1 -0
- package/dist/terrain/sweep-sphere.js +69 -0
- package/dist/terrain/sweep-sphere.js.map +1 -0
- package/dist/terrain/tile-cutout-update.d.ts +73 -0
- package/dist/terrain/tile-cutout-update.d.ts.map +1 -0
- package/dist/terrain/tile-cutout-update.js +181 -0
- package/dist/terrain/tile-cutout-update.js.map +1 -0
- package/dist/terrain/tile-cutout.d.ts +33 -0
- package/dist/terrain/tile-cutout.d.ts.map +1 -0
- package/dist/terrain/tile-cutout.js +93 -0
- package/dist/terrain/tile-cutout.js.map +1 -0
- package/dist/terrain/watershed-accumulation.d.ts +20 -0
- package/dist/terrain/watershed-accumulation.d.ts.map +1 -0
- package/dist/terrain/watershed-accumulation.js +53 -0
- package/dist/terrain/watershed-accumulation.js.map +1 -0
- package/dist/triaxial.d.ts +1 -1
- package/dist/triaxial.d.ts.map +1 -1
- package/dist/turf-expressions.cjs +1997 -0
- package/dist/turf-expressions.cjs.map +6 -0
- package/dist/turf-expressions.d.ts +3 -0
- package/dist/turf-expressions.d.ts.map +1 -0
- package/dist/turf-expressions.js +7 -0
- package/dist/turf-expressions.js.map +1 -0
- package/dist/turf-functions.cjs +743 -0
- package/dist/turf-functions.cjs.map +6 -0
- package/dist/turf-functions.d.ts +90 -0
- package/dist/turf-functions.d.ts.map +1 -0
- package/dist/{turf/expressions.js → turf-functions.js} +51 -5
- package/dist/turf-functions.js.map +1 -0
- package/dist/turf.cjs +25 -25
- package/dist/turf.cjs.map +2 -2
- package/dist/turf.d.ts +1 -1
- package/dist/turf.d.ts.map +1 -1
- package/dist/turf.js +2 -2
- package/dist/turf.js.map +1 -1
- package/dist/type-utils.d.ts +1 -1
- package/dist/type-utils.d.ts.map +1 -1
- package/dist/type-utils.js +1 -1
- package/dist/type-utils.js.map +1 -1
- package/dist/web-mercator/assert.d.ts +2 -0
- package/dist/web-mercator/assert.d.ts.map +1 -0
- package/dist/web-mercator/assert.js +12 -0
- package/dist/web-mercator/assert.js.map +1 -0
- package/dist/web-mercator/fit-bounds.d.ts +52 -0
- package/dist/web-mercator/fit-bounds.d.ts.map +1 -0
- package/dist/web-mercator/fit-bounds.js +70 -0
- package/dist/web-mercator/fit-bounds.js.map +1 -0
- package/dist/web-mercator/fly-to-viewport.d.ts +19 -0
- package/dist/web-mercator/fly-to-viewport.d.ts.map +1 -0
- package/dist/web-mercator/fly-to-viewport.js +94 -0
- package/dist/web-mercator/fly-to-viewport.js.map +1 -0
- package/dist/web-mercator/get-bounds.d.ts +3 -0
- package/dist/web-mercator/get-bounds.d.ts.map +1 -0
- package/dist/web-mercator/get-bounds.js +56 -0
- package/dist/web-mercator/get-bounds.js.map +1 -0
- package/dist/web-mercator/index.cjs +705 -0
- package/dist/web-mercator/index.cjs.map +6 -0
- package/dist/web-mercator/index.d.ts +14 -0
- package/dist/web-mercator/index.d.ts.map +1 -0
- package/dist/web-mercator/index.js +14 -0
- package/dist/web-mercator/index.js.map +1 -0
- package/dist/web-mercator/math-utils.d.ts +7 -0
- package/dist/web-mercator/math-utils.d.ts.map +1 -0
- package/dist/web-mercator/math-utils.js +30 -0
- package/dist/web-mercator/math-utils.js.map +1 -0
- package/dist/web-mercator/mercator-meters.d.ts +29 -0
- package/dist/web-mercator/mercator-meters.d.ts.map +1 -0
- package/dist/web-mercator/mercator-meters.js +61 -0
- package/dist/web-mercator/mercator-meters.js.map +1 -0
- package/dist/web-mercator/normalize-viewport-props.d.ts +16 -0
- package/dist/web-mercator/normalize-viewport-props.d.ts.map +1 -0
- package/dist/web-mercator/normalize-viewport-props.js +45 -0
- package/dist/web-mercator/normalize-viewport-props.js.map +1 -0
- package/dist/web-mercator/web-mercator-utils.d.ts +192 -0
- package/dist/web-mercator/web-mercator-utils.d.ts.map +1 -0
- package/dist/web-mercator/web-mercator-utils.js +321 -0
- package/dist/web-mercator/web-mercator-utils.js.map +1 -0
- package/dist/web-mercator/web-mercator-viewport.d.ts +177 -0
- package/dist/web-mercator/web-mercator-viewport.d.ts.map +1 -0
- package/dist/web-mercator/web-mercator-viewport.js +276 -0
- package/dist/web-mercator/web-mercator-viewport.js.map +1 -0
- package/dist/web-mercator.d.ts +1 -1
- package/dist/web-mercator.d.ts.map +1 -1
- package/dist/web-mercator.js +1 -1
- package/dist/web-mercator.js.map +1 -1
- package/package.json +34 -462
- package/src/crs/crs-descriptor-types.ts +2 -1
- package/src/crs/index.ts +7 -0
- package/src/crs/spatial-reference-metadata.ts +118 -0
- package/src/ellipsoid-helpers/ellipsoid-transform.ts +3 -3
- package/src/ellipsoid-helpers/scale-to-geodetic-surface.ts +1 -1
- package/src/ellipsoid-helpers/tangent-plane-numerics.ts +1 -1
- package/src/ellipsoid-tangent-plane.ts +2 -2
- package/src/ellipsoid-transforms.ts +2 -2
- package/src/ellipsoid.ts +7 -3
- package/src/expressions.ts +2 -2
- package/src/geodesic-buffer.ts +1 -1
- package/src/geodesic-path.ts +1 -1
- package/src/geometry-constructors.ts +36 -0
- package/src/geometry-inspection.ts +66 -0
- package/src/index.ts +271 -4
- package/src/line-simplification.ts +97 -0
- package/src/linear-referencing.ts +94 -0
- package/src/lng-lat-rectangle.ts +1 -1
- package/src/local-reference-frame.ts +4 -4
- package/src/make-obb-from-region.ts +9 -1
- package/src/maps/air-ocean-mesh.ts +1 -1
- package/src/maps/myriahedral/unfold.ts +1 -1
- package/src/projection/experimental/crs/spatial-reference.ts +1 -6
- package/src/projection/experimental/crs/types.ts +2 -2
- package/src/projection/experimental/crs/wkt.ts +1 -1
- package/src/projection/experimental/crs-descriptor.ts +1 -1
- package/src/projection/experimental/crs-rendering-scale.ts +16 -4
- package/src/projection/experimental/datum.ts +1 -1
- package/src/projection/experimental/lazy-projections/aea.ts +4 -1
- package/src/projection/experimental/lazy-projections/bonne.ts +4 -1
- package/src/projection/experimental/lazy-projections/cass.ts +4 -1
- package/src/projection/experimental/lazy-projections/eck6.ts +4 -1
- package/src/projection/experimental/lazy-projections/eqdc.ts +4 -1
- package/src/projection/experimental/lazy-projections/eqearth.ts +4 -1
- package/src/projection/experimental/lazy-projections/equi.ts +4 -1
- package/src/projection/experimental/lazy-projections/geocent.ts +4 -1
- package/src/projection/experimental/lazy-projections/geos.ts +4 -1
- package/src/projection/experimental/lazy-projections/gnom.ts +4 -1
- package/src/projection/experimental/lazy-projections/krovak.ts +4 -1
- package/src/projection/experimental/lazy-projections/merc.ts +4 -1
- package/src/projection/experimental/lazy-projections/mill.ts +4 -1
- package/src/projection/experimental/lazy-projections/moll.ts +4 -1
- package/src/projection/experimental/lazy-projections/nzmg.ts +4 -1
- package/src/projection/experimental/lazy-projections/omerc.ts +4 -1
- package/src/projection/experimental/lazy-projections/ortho.ts +4 -1
- package/src/projection/experimental/lazy-projections/poly.ts +4 -1
- package/src/projection/experimental/lazy-projections/robin.ts +4 -1
- package/src/projection/experimental/lazy-projections/sinu.ts +4 -1
- package/src/projection/experimental/lazy-projections/stere.ts +4 -1
- package/src/projection/experimental/lazy-projections/tpers.ts +4 -1
- package/src/projection/experimental/lazy-projections/vandg.ts +4 -1
- package/src/projection/experimental/spatial-deformation.ts +1 -1
- package/src/projection/index.ts +1 -1
- package/src/projection/lib/projection.ts +1 -1
- package/src/rhumb-path.ts +1 -1
- package/src/spatial-planar-intersects.ts +134 -0
- package/src/spatial-planar.ts +266 -0
- package/src/spatial-sql.ts +276 -0
- package/src/st-functions.ts +852 -0
- package/src/subdivide-globe-mesh.ts +1 -1
- package/src/tasks/terrain-residency.ts +120 -24
- package/src/terrain/cutout-polygons.ts +202 -0
- package/src/terrain/cutout-region.ts +54 -0
- package/src/terrain/cutout-skirts.ts +52 -0
- package/src/terrain/depression-fill.ts +125 -0
- package/src/terrain/geographic-cutout.ts +154 -0
- package/src/terrain/geographic-lod-seams.ts +109 -0
- package/src/terrain/geographic-neighbor.ts +58 -0
- package/src/terrain/geographic-poles.ts +52 -0
- package/src/terrain/hydrology.ts +149 -0
- package/src/terrain/index.ts +122 -1
- package/src/terrain/lod-screen-error.ts +128 -0
- package/src/terrain/lod-select.ts +65 -31
- package/src/terrain/lod-stitch.ts +25 -7
- package/src/terrain/mesh-cutout.ts +420 -0
- package/src/terrain/mesh-skirts.ts +10 -7
- package/src/terrain/mixed-halo-update.ts +54 -20
- package/src/terrain/mixed-vertex-halos.ts +94 -78
- package/src/terrain/regional-viewshed.ts +177 -0
- package/src/terrain/surface.ts +1 -1
- package/src/terrain/sweep-capsule.ts +148 -0
- package/src/terrain/sweep-cylinder.ts +64 -0
- package/src/terrain/sweep-plane.ts +61 -0
- package/src/terrain/sweep-polytope.ts +253 -0
- package/src/terrain/sweep-rotating-capsule.ts +139 -0
- package/src/terrain/sweep-rotation.ts +149 -0
- package/src/terrain/sweep-sphere.ts +100 -0
- package/src/terrain/tile-cutout-update.ts +293 -0
- package/src/terrain/tile-cutout.ts +123 -0
- package/src/terrain/watershed-accumulation.ts +67 -0
- package/src/triaxial.ts +1 -1
- package/src/turf-expressions.ts +7 -0
- package/src/{turf/expressions.ts → turf-functions.ts} +121 -6
- package/src/turf.ts +3 -7
- package/src/type-utils.ts +2 -2
- package/src/web-mercator/assert.ts +11 -0
- package/src/web-mercator/fit-bounds.ts +132 -0
- package/src/web-mercator/fly-to-viewport.ts +157 -0
- package/src/web-mercator/get-bounds.ts +62 -0
- package/src/web-mercator/index.ts +49 -0
- package/src/web-mercator/math-utils.ts +35 -0
- package/src/web-mercator/mercator-meters.ts +83 -0
- package/src/web-mercator/normalize-viewport-props.ts +58 -0
- package/src/web-mercator/web-mercator-utils.ts +468 -0
- package/src/web-mercator/web-mercator-viewport.ts +406 -0
- package/src/web-mercator.ts +1 -1
- package/dist/projection/experimental/index.cjs +0 -11707
- package/dist/projection/experimental/index.cjs.map +0 -6
- package/dist/turf/expressions.cjs +0 -87
- package/dist/turf/expressions.cjs.map +0 -6
- package/dist/turf/expressions.d.ts +0 -24
- package/dist/turf/expressions.d.ts.map +0 -1
- package/dist/turf/expressions.js.map +0 -1
|
@@ -0,0 +1,743 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// dist/turf-functions.js
|
|
20
|
+
var turf_functions_exports = {};
|
|
21
|
+
__export(turf_functions_exports, {
|
|
22
|
+
TURF_AREA: () => TURF_AREA,
|
|
23
|
+
TURF_BBOX: () => TURF_BBOX,
|
|
24
|
+
TURF_BEARING: () => TURF_BEARING,
|
|
25
|
+
TURF_BOOLEAN_POINT_IN_POLYGON: () => TURF_BOOLEAN_POINT_IN_POLYGON,
|
|
26
|
+
TURF_CENTROID: () => TURF_CENTROID,
|
|
27
|
+
TURF_DISTANCE: () => TURF_DISTANCE,
|
|
28
|
+
TURF_FUNCTIONS: () => TURF_FUNCTIONS,
|
|
29
|
+
TURF_LENGTH: () => TURF_LENGTH,
|
|
30
|
+
TURF_MIDPOINT: () => TURF_MIDPOINT,
|
|
31
|
+
createTurfArrowFunction: () => createTurfArrowFunction
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(turf_functions_exports);
|
|
34
|
+
var import_apache_arrow2 = require("apache-arrow");
|
|
35
|
+
var import_arrow4 = require("@math.gl/core/arrow");
|
|
36
|
+
var import_arrow5 = require("@math.gl/core/arrow");
|
|
37
|
+
|
|
38
|
+
// dist/turf.js
|
|
39
|
+
var import_arrow = require("@math.gl/core/arrow");
|
|
40
|
+
var import_arrow2 = require("@math.gl/core/arrow");
|
|
41
|
+
var RADIUS = 63710088e-1;
|
|
42
|
+
var RAD = Math.PI / 180;
|
|
43
|
+
var depths = {
|
|
44
|
+
"geoarrow.point": 0,
|
|
45
|
+
"geoarrow.multipoint": 1,
|
|
46
|
+
"geoarrow.linestring": 1,
|
|
47
|
+
"geoarrow.multilinestring": 2,
|
|
48
|
+
"geoarrow.polygon": 2,
|
|
49
|
+
"geoarrow.multipolygon": 3
|
|
50
|
+
};
|
|
51
|
+
function rows(column2, allowed) {
|
|
52
|
+
if (!allowed.includes(column2.encoding))
|
|
53
|
+
throw new Error(`Unsupported GeoArrow encoding ${column2.encoding}; expected ${allowed.join(", ")}`);
|
|
54
|
+
const result2 = [];
|
|
55
|
+
for (const array of column2.chunks)
|
|
56
|
+
for (let index = 0; index < array.length; index++)
|
|
57
|
+
result2.push({ array, index, valid: (0, import_arrow.isGeoArrowValueValid)(array.validity, index) });
|
|
58
|
+
return result2;
|
|
59
|
+
}
|
|
60
|
+
function range(array, index) {
|
|
61
|
+
if (array.kind !== "list")
|
|
62
|
+
throw new Error("Invalid GeoArrow list storage");
|
|
63
|
+
const i = (array.offset || 0) + index;
|
|
64
|
+
const base = Number(array.offsetBase ?? 0);
|
|
65
|
+
const a = Number(array.offsets[i]) - base, b = Number(array.offsets[i + 1]) - base;
|
|
66
|
+
if (!Number.isSafeInteger(a) || !Number.isSafeInteger(b))
|
|
67
|
+
throw new Error("Invalid GeoArrow list offsets");
|
|
68
|
+
return [a, b];
|
|
69
|
+
}
|
|
70
|
+
function scalar(array, index) {
|
|
71
|
+
if (array.kind !== "primitive")
|
|
72
|
+
throw new Error("Invalid GeoArrow coordinate");
|
|
73
|
+
if (!(0, import_arrow.isGeoArrowValueValid)(array.validity, index))
|
|
74
|
+
return NaN;
|
|
75
|
+
return Number(array.values[(array.offset || 0) + index * (array.stride || 1)]);
|
|
76
|
+
}
|
|
77
|
+
function point(array, index) {
|
|
78
|
+
if (!(0, import_arrow.isGeoArrowValueValid)(array.validity, index))
|
|
79
|
+
return null;
|
|
80
|
+
if (array.kind === "fixed-size-list") {
|
|
81
|
+
const i = ((array.offset || 0) + index) * array.size;
|
|
82
|
+
const x = scalar(array.child, i), y = scalar(array.child, i + 1);
|
|
83
|
+
return !Number.isFinite(x) || !Number.isFinite(y) ? null : [x, y];
|
|
84
|
+
}
|
|
85
|
+
if (array.kind === "struct") {
|
|
86
|
+
const i = (array.offset || 0) + index;
|
|
87
|
+
const x = scalar(array.children["x"], i), y = scalar(array.children["y"], i);
|
|
88
|
+
return !Number.isFinite(x) || !Number.isFinite(y) ? null : [x, y];
|
|
89
|
+
}
|
|
90
|
+
throw new Error("Invalid GeoArrow coordinate storage");
|
|
91
|
+
}
|
|
92
|
+
function walk(array, index, depth, visit) {
|
|
93
|
+
if (!(0, import_arrow.isGeoArrowValueValid)(array.validity, index))
|
|
94
|
+
return;
|
|
95
|
+
if (!depth) {
|
|
96
|
+
const p = point(array, index);
|
|
97
|
+
if (p)
|
|
98
|
+
visit(p);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const [a, b] = range(array, index);
|
|
102
|
+
if (array.kind !== "list")
|
|
103
|
+
throw new Error("Invalid GeoArrow list storage");
|
|
104
|
+
for (let i = a; i < b; i++)
|
|
105
|
+
walk(array.child, i, depth - 1, visit);
|
|
106
|
+
}
|
|
107
|
+
function lines(array, index, depth, visit) {
|
|
108
|
+
if (!(0, import_arrow.isGeoArrowValueValid)(array.validity, index))
|
|
109
|
+
return;
|
|
110
|
+
const [a, b] = range(array, index);
|
|
111
|
+
if (array.kind !== "list")
|
|
112
|
+
throw new Error("Invalid GeoArrow list storage");
|
|
113
|
+
if (depth === 1)
|
|
114
|
+
visit(array.child, a, b);
|
|
115
|
+
else
|
|
116
|
+
for (let i = a; i < b; i++)
|
|
117
|
+
lines(array.child, i, depth - 1, visit);
|
|
118
|
+
}
|
|
119
|
+
function valid(bitmap, i) {
|
|
120
|
+
bitmap[i >> 3] |= 1 << (i & 7);
|
|
121
|
+
}
|
|
122
|
+
function result(n, boolean = false) {
|
|
123
|
+
return {
|
|
124
|
+
values: boolean ? new Uint8Array(n) : new Float64Array(n),
|
|
125
|
+
validity: new Uint8Array(Math.ceil(n / 8))
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function paired(a, b) {
|
|
129
|
+
if (a.length === b.length)
|
|
130
|
+
return a.length;
|
|
131
|
+
if (a.length === 1)
|
|
132
|
+
return b.length;
|
|
133
|
+
if (b.length === 1)
|
|
134
|
+
return a.length;
|
|
135
|
+
throw new Error("GeoArrow batch lengths must match or one input must contain one row");
|
|
136
|
+
}
|
|
137
|
+
function units(radians, unit = "kilometers") {
|
|
138
|
+
switch (unit) {
|
|
139
|
+
case "kilometers":
|
|
140
|
+
return radians * RADIUS / 1e3;
|
|
141
|
+
case "meters":
|
|
142
|
+
return radians * RADIUS;
|
|
143
|
+
case "miles":
|
|
144
|
+
return radians * RADIUS / 1609.344;
|
|
145
|
+
case "nauticalmiles":
|
|
146
|
+
return radians * RADIUS / 1852;
|
|
147
|
+
case "radians":
|
|
148
|
+
return radians;
|
|
149
|
+
case "degrees":
|
|
150
|
+
return radians / RAD;
|
|
151
|
+
default:
|
|
152
|
+
throw new Error(`Unsupported units: ${unit}`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function angular(a, b) {
|
|
156
|
+
const dlat = (b[1] - a[1]) * RAD, dlon = (b[0] - a[0]) * RAD;
|
|
157
|
+
const h = Math.sin(dlat / 2) ** 2 + Math.cos(a[1] * RAD) * Math.cos(b[1] * RAD) * Math.sin(dlon / 2) ** 2;
|
|
158
|
+
return 2 * Math.atan2(Math.sqrt(h), Math.sqrt(Math.max(0, 1 - h)));
|
|
159
|
+
}
|
|
160
|
+
var native = Object.keys(depths);
|
|
161
|
+
var points = ["geoarrow.point"];
|
|
162
|
+
var polygons = ["geoarrow.polygon", "geoarrow.multipolygon"];
|
|
163
|
+
function pointPair(a, b, fn) {
|
|
164
|
+
const left = rows(a, points), right = rows(b, points), n = paired(left, right), out = result(n);
|
|
165
|
+
for (let i = 0; i < n; i++) {
|
|
166
|
+
const x = left[left.length === 1 ? 0 : i], y = right[right.length === 1 ? 0 : i];
|
|
167
|
+
if (!x.valid || !y.valid)
|
|
168
|
+
continue;
|
|
169
|
+
const p = point(x.array, x.index), q = point(y.array, y.index);
|
|
170
|
+
if (p && q) {
|
|
171
|
+
out.values[i] = fn(p, q);
|
|
172
|
+
valid(out.validity, i);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return out;
|
|
176
|
+
}
|
|
177
|
+
function distance(a, b, options = {}) {
|
|
178
|
+
return pointPair(a, b, (p, q) => units(angular(p, q), options.units));
|
|
179
|
+
}
|
|
180
|
+
function bearing(a, b) {
|
|
181
|
+
return pointPair(a, b, (p, q) => {
|
|
182
|
+
const d = (q[0] - p[0]) * RAD, y = Math.sin(d) * Math.cos(q[1] * RAD), x = Math.cos(p[1] * RAD) * Math.sin(q[1] * RAD) - Math.sin(p[1] * RAD) * Math.cos(q[1] * RAD) * Math.cos(d);
|
|
183
|
+
return Math.atan2(y, x) / RAD;
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
function length(column2, options = {}) {
|
|
187
|
+
const input = rows(column2, ["geoarrow.linestring", "geoarrow.multilinestring"]), out = result(input.length);
|
|
188
|
+
input.forEach((row, i) => {
|
|
189
|
+
if (!row.valid)
|
|
190
|
+
return;
|
|
191
|
+
let sum = 0;
|
|
192
|
+
lines(row.array, row.index, depths[column2.encoding], (array, a, b) => {
|
|
193
|
+
let prev = null;
|
|
194
|
+
for (let j = a; j < b; j++) {
|
|
195
|
+
const p = point(array, j);
|
|
196
|
+
if (p && prev)
|
|
197
|
+
sum += angular(prev, p);
|
|
198
|
+
prev = p;
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
out.values[i] = units(sum, options.units);
|
|
202
|
+
valid(out.validity, i);
|
|
203
|
+
});
|
|
204
|
+
return out;
|
|
205
|
+
}
|
|
206
|
+
function ringArea(array, a, b) {
|
|
207
|
+
const n = b - a - 1;
|
|
208
|
+
if (n <= 2)
|
|
209
|
+
return 0;
|
|
210
|
+
let sum = 0;
|
|
211
|
+
for (let i = 0; i < n; i++) {
|
|
212
|
+
const p = point(array, a + i), q = point(array, a + (i + 1) % n), r = point(array, a + (i + 2) % n);
|
|
213
|
+
if (p && q && r)
|
|
214
|
+
sum += (r[0] - p[0]) * RAD * Math.sin(q[1] * RAD);
|
|
215
|
+
}
|
|
216
|
+
return sum * RADIUS * RADIUS / 2;
|
|
217
|
+
}
|
|
218
|
+
function polygonArea(array, index) {
|
|
219
|
+
const [a, b] = range(array, index);
|
|
220
|
+
if (array.kind !== "list")
|
|
221
|
+
throw new Error("Invalid polygon");
|
|
222
|
+
if (a === b || !(0, import_arrow.isGeoArrowValueValid)(array.child.validity, a))
|
|
223
|
+
return 0;
|
|
224
|
+
let sum = 0;
|
|
225
|
+
for (let i = a; i < b; i++) {
|
|
226
|
+
if (!(0, import_arrow.isGeoArrowValueValid)(array.child.validity, i))
|
|
227
|
+
continue;
|
|
228
|
+
const [x, y] = range(array.child, i);
|
|
229
|
+
if (array.child.kind !== "list")
|
|
230
|
+
throw new Error("Invalid polygon ring");
|
|
231
|
+
const v = Math.abs(ringArea(array.child.child, x, y));
|
|
232
|
+
sum += i === a ? v : -v;
|
|
233
|
+
}
|
|
234
|
+
return sum;
|
|
235
|
+
}
|
|
236
|
+
function area(column2) {
|
|
237
|
+
const input = rows(column2, polygons), out = result(input.length);
|
|
238
|
+
input.forEach((row, i) => {
|
|
239
|
+
if (!row.valid)
|
|
240
|
+
return;
|
|
241
|
+
let sum = 0;
|
|
242
|
+
if (column2.encoding === "geoarrow.polygon")
|
|
243
|
+
sum = polygonArea(row.array, row.index);
|
|
244
|
+
else {
|
|
245
|
+
const [a, b] = range(row.array, row.index);
|
|
246
|
+
if (row.array.kind !== "list")
|
|
247
|
+
throw new Error("Invalid multipolygon");
|
|
248
|
+
for (let j = a; j < b; j++)
|
|
249
|
+
if ((0, import_arrow.isGeoArrowValueValid)(row.array.child.validity, j))
|
|
250
|
+
sum += polygonArea(row.array.child, j);
|
|
251
|
+
}
|
|
252
|
+
out.values[i] = sum;
|
|
253
|
+
valid(out.validity, i);
|
|
254
|
+
});
|
|
255
|
+
return out;
|
|
256
|
+
}
|
|
257
|
+
function centroid(column2) {
|
|
258
|
+
const input = rows(column2, native), values = new Float64Array(input.length * 2), validity = new Uint8Array(Math.ceil(input.length / 8));
|
|
259
|
+
input.forEach((row, i) => {
|
|
260
|
+
if (!row.valid)
|
|
261
|
+
return;
|
|
262
|
+
let x = 0, y = 0, n = 0;
|
|
263
|
+
const add = (p) => {
|
|
264
|
+
x += p[0];
|
|
265
|
+
y += p[1];
|
|
266
|
+
n++;
|
|
267
|
+
};
|
|
268
|
+
if (polygons.includes(column2.encoding))
|
|
269
|
+
lines(row.array, row.index, depths[column2.encoding], (array, a, b) => {
|
|
270
|
+
for (let j = a; j < Math.max(a, b - 1); j++) {
|
|
271
|
+
const p = point(array, j);
|
|
272
|
+
if (p)
|
|
273
|
+
add(p);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
else
|
|
277
|
+
walk(row.array, row.index, depths[column2.encoding], add);
|
|
278
|
+
if (n) {
|
|
279
|
+
values[i * 2] = x / n;
|
|
280
|
+
values[i * 2 + 1] = y / n;
|
|
281
|
+
valid(validity, i);
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
return {
|
|
285
|
+
encoding: "geoarrow.point",
|
|
286
|
+
dimension: "xy",
|
|
287
|
+
coordinateLayout: "interleaved",
|
|
288
|
+
spatialReference: column2.spatialReference,
|
|
289
|
+
edges: column2.edges,
|
|
290
|
+
metadata: column2.metadata,
|
|
291
|
+
chunks: [
|
|
292
|
+
{
|
|
293
|
+
kind: "fixed-size-list",
|
|
294
|
+
size: 2,
|
|
295
|
+
length: input.length,
|
|
296
|
+
validity: { values: validity },
|
|
297
|
+
child: { kind: "primitive", length: values.length, values }
|
|
298
|
+
}
|
|
299
|
+
]
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
function ringContains(array, a, b, p) {
|
|
303
|
+
let inside = false;
|
|
304
|
+
for (let i = a, j = b - 1; i < b; j = i++) {
|
|
305
|
+
const u = point(array, i), v = point(array, j);
|
|
306
|
+
if (!u || !v)
|
|
307
|
+
continue;
|
|
308
|
+
const cross = (p[0] - u[0]) * (v[1] - u[1]) - (p[1] - u[1]) * (v[0] - u[0]);
|
|
309
|
+
if (cross === 0 && p[0] >= Math.min(u[0], v[0]) && p[0] <= Math.max(u[0], v[0]) && p[1] >= Math.min(u[1], v[1]) && p[1] <= Math.max(u[1], v[1]))
|
|
310
|
+
return 0;
|
|
311
|
+
if (u[1] > p[1] !== v[1] > p[1] && p[0] < (v[0] - u[0]) * (p[1] - u[1]) / (v[1] - u[1]) + u[0])
|
|
312
|
+
inside = !inside;
|
|
313
|
+
}
|
|
314
|
+
return inside ? 1 : -1;
|
|
315
|
+
}
|
|
316
|
+
function polygonContains(array, index, p) {
|
|
317
|
+
const [a, b] = range(array, index);
|
|
318
|
+
if (array.kind !== "list")
|
|
319
|
+
throw new Error("Invalid polygon");
|
|
320
|
+
if (a === b || !(0, import_arrow.isGeoArrowValueValid)(array.child.validity, a))
|
|
321
|
+
return -1;
|
|
322
|
+
for (let i = a; i < b; i++) {
|
|
323
|
+
if (!(0, import_arrow.isGeoArrowValueValid)(array.child.validity, i))
|
|
324
|
+
continue;
|
|
325
|
+
const [x, y] = range(array.child, i);
|
|
326
|
+
if (array.child.kind !== "list")
|
|
327
|
+
throw new Error("Invalid polygon ring");
|
|
328
|
+
const c = ringContains(array.child.child, x, y, p);
|
|
329
|
+
if (c === 0)
|
|
330
|
+
return 0;
|
|
331
|
+
if (i === a && c < 0 || i > a && c > 0)
|
|
332
|
+
return -1;
|
|
333
|
+
}
|
|
334
|
+
return a === b ? -1 : 1;
|
|
335
|
+
}
|
|
336
|
+
function booleanPointInPolygon(pointColumn, polygonColumn, options = {}) {
|
|
337
|
+
const a = rows(pointColumn, points), b = rows(polygonColumn, polygons), n = paired(a, b), out = result(n, true);
|
|
338
|
+
for (let i = 0; i < n; i++) {
|
|
339
|
+
const x = a[a.length === 1 ? 0 : i], y = b[b.length === 1 ? 0 : i];
|
|
340
|
+
if (!x.valid || !y.valid)
|
|
341
|
+
continue;
|
|
342
|
+
const p = point(x.array, x.index);
|
|
343
|
+
if (!p)
|
|
344
|
+
continue;
|
|
345
|
+
let hit = false;
|
|
346
|
+
if (polygonColumn.encoding === "geoarrow.polygon") {
|
|
347
|
+
const c = polygonContains(y.array, y.index, p);
|
|
348
|
+
hit = c > 0 || c === 0 && !options.ignoreBoundary;
|
|
349
|
+
} else {
|
|
350
|
+
const [start, end] = range(y.array, y.index);
|
|
351
|
+
if (y.array.kind !== "list")
|
|
352
|
+
throw new Error("Invalid multipolygon");
|
|
353
|
+
for (let j = start; j < end; j++) {
|
|
354
|
+
if (!(0, import_arrow.isGeoArrowValueValid)(y.array.child.validity, j))
|
|
355
|
+
continue;
|
|
356
|
+
const c = polygonContains(y.array.child, j, p);
|
|
357
|
+
if (c > 0 || c === 0 && !options.ignoreBoundary) {
|
|
358
|
+
hit = true;
|
|
359
|
+
break;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
out.values[i] = Number(hit);
|
|
364
|
+
valid(out.validity, i);
|
|
365
|
+
}
|
|
366
|
+
return out;
|
|
367
|
+
}
|
|
368
|
+
function pointOutput(source, count, calculate) {
|
|
369
|
+
const values = new Float64Array(count * 2);
|
|
370
|
+
const validity = new Uint8Array(Math.ceil(count / 8));
|
|
371
|
+
for (let i = 0; i < count; i++) {
|
|
372
|
+
const p = calculate(i);
|
|
373
|
+
if (p) {
|
|
374
|
+
values.set(p, i * 2);
|
|
375
|
+
valid(validity, i);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
return {
|
|
379
|
+
encoding: "geoarrow.point",
|
|
380
|
+
dimension: "xy",
|
|
381
|
+
coordinateLayout: "interleaved",
|
|
382
|
+
spatialReference: source.spatialReference,
|
|
383
|
+
metadata: source.metadata,
|
|
384
|
+
edges: source.edges,
|
|
385
|
+
chunks: [
|
|
386
|
+
{
|
|
387
|
+
kind: "fixed-size-list",
|
|
388
|
+
size: 2,
|
|
389
|
+
length: count,
|
|
390
|
+
validity: { values: validity },
|
|
391
|
+
child: { kind: "primitive", length: values.length, values }
|
|
392
|
+
}
|
|
393
|
+
]
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
function destinationPoint(p, radians, bearingDegrees) {
|
|
397
|
+
const latitude = p[1] * RAD, bearing2 = bearingDegrees * RAD;
|
|
398
|
+
const y = Math.asin(Math.sin(latitude) * Math.cos(radians) + Math.cos(latitude) * Math.sin(radians) * Math.cos(bearing2));
|
|
399
|
+
const x = p[0] * RAD + Math.atan2(Math.sin(bearing2) * Math.sin(radians) * Math.cos(latitude), Math.cos(radians) - Math.sin(latitude) * Math.sin(y));
|
|
400
|
+
return [x / RAD, y / RAD];
|
|
401
|
+
}
|
|
402
|
+
function midpoint(a, b) {
|
|
403
|
+
const left = rows(a, points), right = rows(b, points), count = paired(left, right);
|
|
404
|
+
return pointOutput(a, count, (i) => {
|
|
405
|
+
const x = left[left.length === 1 ? 0 : i], y = right[right.length === 1 ? 0 : i];
|
|
406
|
+
if (!x.valid || !y.valid)
|
|
407
|
+
return null;
|
|
408
|
+
const p = point(x.array, x.index), q = point(y.array, y.index);
|
|
409
|
+
if (!p || !q)
|
|
410
|
+
return null;
|
|
411
|
+
const delta = (q[0] - p[0]) * RAD;
|
|
412
|
+
const angle = Math.atan2(Math.sin(delta) * Math.cos(q[1] * RAD), Math.cos(p[1] * RAD) * Math.sin(q[1] * RAD) - Math.sin(p[1] * RAD) * Math.cos(q[1] * RAD) * Math.cos(delta));
|
|
413
|
+
return destinationPoint(p, angular(p, q) / 2, angle / RAD);
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
var lineFamilies = ["geoarrow.linestring", "geoarrow.multilinestring", ...polygons];
|
|
417
|
+
|
|
418
|
+
// dist/spatial-sql.js
|
|
419
|
+
var import_apache_arrow = require("apache-arrow");
|
|
420
|
+
var import_arrow3 = require("@math.gl/core/arrow");
|
|
421
|
+
var EXTENSION_NAME = "ARROW:extension:name";
|
|
422
|
+
var EXTENSION_METADATA = "ARROW:extension:metadata";
|
|
423
|
+
var geometryTypes = [
|
|
424
|
+
"Point",
|
|
425
|
+
"MultiPoint",
|
|
426
|
+
"LineString",
|
|
427
|
+
"MultiLineString",
|
|
428
|
+
"Polygon",
|
|
429
|
+
"MultiPolygon"
|
|
430
|
+
];
|
|
431
|
+
var pointKinds = ["Point"];
|
|
432
|
+
var lineKinds = ["LineString", "MultiLineString"];
|
|
433
|
+
var polygonKinds = ["Polygon", "MultiPolygon"];
|
|
434
|
+
function readGeometryValue(vector, field, active, value, captureMembers = false) {
|
|
435
|
+
if (import_apache_arrow.DataType.isBinary(field.type) || import_apache_arrow.DataType.isLargeBinary(field.type)) {
|
|
436
|
+
return (row) => {
|
|
437
|
+
const { geometry, dimension, srid, members } = (0, import_arrow3.parseWKB)(vector.get(row), {
|
|
438
|
+
captureMembers
|
|
439
|
+
});
|
|
440
|
+
if (srid)
|
|
441
|
+
throw new Error("Use GeoArrow field metadata for CRS information instead of EWKB SRIDs");
|
|
442
|
+
return value(geometry.type === "Point" && geometry.coordinates.every(Number.isNaN) ? { type: "Point", coordinates: [] } : geometry, dimension, members);
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
const column2 = readActiveGeoArrowColumn(vector, field, active);
|
|
446
|
+
const geometries = (0, import_arrow3.materializeGeoArrowRows)(column2);
|
|
447
|
+
return (row) => value(geometries[row], column2.dimension);
|
|
448
|
+
}
|
|
449
|
+
function readActiveGeoArrowColumn(vector, field, active) {
|
|
450
|
+
const column2 = (0, import_arrow3.makeGeoArrowColumnFromArrowVector)(vector, { field });
|
|
451
|
+
let offset = 0;
|
|
452
|
+
const chunks = column2.chunks.map((chunk) => {
|
|
453
|
+
const start = offset;
|
|
454
|
+
offset += chunk.length;
|
|
455
|
+
let needsMask = false;
|
|
456
|
+
for (let row = 0; row < chunk.length; row++) {
|
|
457
|
+
if (!active[start + row] && (0, import_arrow3.isGeoArrowValueValid)(chunk.validity, row)) {
|
|
458
|
+
needsMask = true;
|
|
459
|
+
break;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
if (!needsMask)
|
|
463
|
+
return chunk;
|
|
464
|
+
const values = new Uint8Array(Math.ceil(chunk.length / 8));
|
|
465
|
+
for (let row = 0; row < chunk.length; row++) {
|
|
466
|
+
if (active[start + row] && (0, import_arrow3.isGeoArrowValueValid)(chunk.validity, row)) {
|
|
467
|
+
values[row >> 3] |= 1 << (row & 7);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
return { ...chunk, validity: { values } };
|
|
471
|
+
});
|
|
472
|
+
return { ...column2, chunks };
|
|
473
|
+
}
|
|
474
|
+
function planarGeometry(geometry, dimension) {
|
|
475
|
+
if (dimension !== "xy")
|
|
476
|
+
throw new Error("Spatial SQL functions require 2D geometry");
|
|
477
|
+
return geometry;
|
|
478
|
+
}
|
|
479
|
+
function spatialFunction(name, signatures, type, evaluate, numericArguments = 0, allDimensions = false, skipNullGeometries = false) {
|
|
480
|
+
return {
|
|
481
|
+
kind: "scalar",
|
|
482
|
+
name,
|
|
483
|
+
prototypes: [],
|
|
484
|
+
/** Binds the allowed geometry types and result metadata to a call. */
|
|
485
|
+
resolvePrototype(fields) {
|
|
486
|
+
var _a;
|
|
487
|
+
if (fields.length !== signatures.length + numericArguments)
|
|
488
|
+
return void 0;
|
|
489
|
+
const geometryFields = fields.slice(0, signatures.length);
|
|
490
|
+
const numberFields = fields.slice(signatures.length).map((field) => {
|
|
491
|
+
if (field && !import_apache_arrow.DataType.isInt(field.type) && !import_apache_arrow.DataType.isFloat(field.type))
|
|
492
|
+
throw new Error(`${name} requires numeric arguments`);
|
|
493
|
+
return field ?? new import_apache_arrow.Field("number", new import_apache_arrow.Float64(), true);
|
|
494
|
+
});
|
|
495
|
+
const extensions = geometryFields.map((field, index) => {
|
|
496
|
+
if (!field)
|
|
497
|
+
return void 0;
|
|
498
|
+
const extension = (0, import_arrow3.getGeoArrowFieldInfo)(field);
|
|
499
|
+
const encoding = extension == null ? void 0 : extension.encoding;
|
|
500
|
+
const kinds = signatures[index];
|
|
501
|
+
if (encoding === "geoarrow.wkb" && (import_apache_arrow.DataType.isBinary(field.type) || import_apache_arrow.DataType.isLargeBinary(field.type))) {
|
|
502
|
+
} else if (kinds.some((kind) => encoding === "geoarrow." + kind.toLowerCase())) {
|
|
503
|
+
if (!allDimensions && (extension == null ? void 0 : extension.dimension) !== "xy")
|
|
504
|
+
throw new Error(`${name} requires 2D geometry`);
|
|
505
|
+
} else {
|
|
506
|
+
throw new Error(`${name} argument ${index + 1} requires GeoArrow ${kinds.join(" or ")}`);
|
|
507
|
+
}
|
|
508
|
+
if (name.startsWith("ST_") && name !== "ST_SRID" && name !== "ST_SetSRID" && (extension == null ? void 0 : extension.metadata["edges"]) === "spherical")
|
|
509
|
+
throw new Error(`${name} requires planar geometry`);
|
|
510
|
+
return extension;
|
|
511
|
+
});
|
|
512
|
+
const crsValues = extensions.map((extension) => extension == null ? void 0 : extension.metadata["crs"]).filter((crs) => crs !== void 0 && crs !== null);
|
|
513
|
+
if (name.startsWith("ST_") && crsValues.some((crs) => JSON.stringify(crs) !== JSON.stringify(crsValues[0]))) {
|
|
514
|
+
throw new Error(`${name} requires arguments in the same CRS`);
|
|
515
|
+
}
|
|
516
|
+
const metadata = /* @__PURE__ */ new Map();
|
|
517
|
+
if (import_apache_arrow.DataType.isBinary(type)) {
|
|
518
|
+
metadata.set(EXTENSION_NAME, "geoarrow.wkb");
|
|
519
|
+
const inputMetadata = (_a = geometryFields.find((field) => field == null ? void 0 : field.metadata.has(EXTENSION_METADATA))) == null ? void 0 : _a.metadata.get(EXTENSION_METADATA);
|
|
520
|
+
if (inputMetadata)
|
|
521
|
+
metadata.set(EXTENSION_METADATA, inputMetadata);
|
|
522
|
+
}
|
|
523
|
+
const arguments_ = [
|
|
524
|
+
...geometryFields.map((field) => field ?? new import_apache_arrow.Field("geometry", new import_apache_arrow.Binary(), true)),
|
|
525
|
+
...numberFields
|
|
526
|
+
];
|
|
527
|
+
return {
|
|
528
|
+
arguments: arguments_,
|
|
529
|
+
nullHandling: skipNullGeometries ? "call" : "propagate",
|
|
530
|
+
result: new import_apache_arrow.Field(name, type, true, metadata),
|
|
531
|
+
/** Evaluates active rows and retains their positions in the output batch. */
|
|
532
|
+
evaluate(vectors, { activeRows, length: rowCount }) {
|
|
533
|
+
const numbers = vectors.slice(signatures.length);
|
|
534
|
+
const readers = vectors.slice(0, signatures.length).map((vector, index) => readGeometryValue(vector, arguments_[index], activeRows, allDimensions ? (g, dimension, members) => ({ ...g, dimension, members }) : planarGeometry, name === "ST_GeometryN"));
|
|
535
|
+
const values = new Array(rowCount).fill(null);
|
|
536
|
+
for (let row = 0; row < rowCount; row++) {
|
|
537
|
+
if (!activeRows[row])
|
|
538
|
+
continue;
|
|
539
|
+
const geometries = [];
|
|
540
|
+
for (let index = 0; index < readers.length; index++) {
|
|
541
|
+
if (skipNullGeometries && !vectors[index].isValid(row))
|
|
542
|
+
continue;
|
|
543
|
+
const geometry = readers[index](row);
|
|
544
|
+
if (!signatures[index].includes(geometry.type))
|
|
545
|
+
throw new Error(`${name} argument ${index + 1} does not support ${geometry.type} at row ${row}`);
|
|
546
|
+
geometries.push(geometry);
|
|
547
|
+
}
|
|
548
|
+
values[row] = evaluate(geometries, ...numbers.map((vector) => Number(vector.get(row))));
|
|
549
|
+
}
|
|
550
|
+
return (0, import_apache_arrow.vectorFromArray)(values, type);
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
function pointCoordinates(geometry) {
|
|
557
|
+
return geometry.type === "Point" && Number.isFinite(geometry.coordinates[0]) && Number.isFinite(geometry.coordinates[1]) ? geometry.coordinates : null;
|
|
558
|
+
}
|
|
559
|
+
function column(geometry) {
|
|
560
|
+
return (0, import_arrow3.makeGeoArrowColumnFromGeometryRows)([geometry], { dimension: "xy" });
|
|
561
|
+
}
|
|
562
|
+
function scalar2(result2) {
|
|
563
|
+
return result2.validity[0] & 1 ? result2.values[0] : null;
|
|
564
|
+
}
|
|
565
|
+
function pointInPolygon(point2, polygon, ignoreBoundary = false) {
|
|
566
|
+
if (!pointCoordinates(point2))
|
|
567
|
+
return null;
|
|
568
|
+
const value = scalar2(booleanPointInPolygon(column(point2), column(polygon), { ignoreBoundary }));
|
|
569
|
+
return value === null ? null : value === 1;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
// dist/spatial-planar.js
|
|
573
|
+
function isPresentPoint(position) {
|
|
574
|
+
return Number.isFinite(position[0]) && Number.isFinite(position[1]);
|
|
575
|
+
}
|
|
576
|
+
function visitPaths(geometry, visit) {
|
|
577
|
+
switch (geometry.type) {
|
|
578
|
+
case "Point":
|
|
579
|
+
if (isPresentPoint(geometry.coordinates))
|
|
580
|
+
visit([geometry.coordinates]);
|
|
581
|
+
break;
|
|
582
|
+
case "MultiPoint":
|
|
583
|
+
visit(geometry.coordinates.filter(isPresentPoint));
|
|
584
|
+
break;
|
|
585
|
+
case "LineString":
|
|
586
|
+
visit(geometry.coordinates);
|
|
587
|
+
break;
|
|
588
|
+
case "MultiLineString":
|
|
589
|
+
case "Polygon":
|
|
590
|
+
geometry.coordinates.forEach(visit);
|
|
591
|
+
break;
|
|
592
|
+
case "MultiPolygon":
|
|
593
|
+
geometry.coordinates.forEach((polygon) => polygon.forEach(visit));
|
|
594
|
+
break;
|
|
595
|
+
case "GeometryCollection":
|
|
596
|
+
geometry.geometries.forEach((child) => visitPaths(child, visit));
|
|
597
|
+
break;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
function planarBounds(geometry) {
|
|
601
|
+
let minX = Infinity;
|
|
602
|
+
let minY = Infinity;
|
|
603
|
+
let maxX = -Infinity;
|
|
604
|
+
let maxY = -Infinity;
|
|
605
|
+
visitPaths(geometry, (path) => {
|
|
606
|
+
for (const [x, y] of path) {
|
|
607
|
+
minX = Math.min(minX, x);
|
|
608
|
+
minY = Math.min(minY, y);
|
|
609
|
+
maxX = Math.max(maxX, x);
|
|
610
|
+
maxY = Math.max(maxY, y);
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
return minX <= maxX ? [minX, minY, maxX, maxY] : null;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
// dist/turf-functions.js
|
|
617
|
+
function createTurfArrowFunction(options) {
|
|
618
|
+
const { result: result2, evaluate } = options;
|
|
619
|
+
const fields = [...options.arguments];
|
|
620
|
+
const boolean = import_apache_arrow2.DataType.isBool(result2.type);
|
|
621
|
+
if (!boolean && !(import_apache_arrow2.DataType.isFloat(result2.type) && result2.type.precision === import_apache_arrow2.Precision.DOUBLE))
|
|
622
|
+
throw new Error("Turf expressions require a Float64 or Bool result");
|
|
623
|
+
if (!result2.nullable)
|
|
624
|
+
throw new Error("Turf expression results must be nullable");
|
|
625
|
+
return {
|
|
626
|
+
name: options.name,
|
|
627
|
+
prototypes: [
|
|
628
|
+
{
|
|
629
|
+
arguments: fields,
|
|
630
|
+
result: result2,
|
|
631
|
+
nullHandling: "propagate",
|
|
632
|
+
evaluate(vectors, { activeRows, length: length2 }) {
|
|
633
|
+
const columns = vectors.map((vector, index) => {
|
|
634
|
+
const column2 = (0, import_arrow4.makeGeoArrowColumnFromArrowVector)(vector, {
|
|
635
|
+
field: fields[index]
|
|
636
|
+
});
|
|
637
|
+
let offset = 0;
|
|
638
|
+
return {
|
|
639
|
+
...column2,
|
|
640
|
+
chunks: column2.chunks.map((chunk) => {
|
|
641
|
+
const validity2 = new Uint8Array(Math.ceil(chunk.length / 8));
|
|
642
|
+
for (let row = 0; row < chunk.length; row++) {
|
|
643
|
+
if (activeRows[offset + row] && (0, import_arrow5.isGeoArrowValueValid)(chunk.validity, row))
|
|
644
|
+
validity2[row >> 3] |= 1 << (row & 7);
|
|
645
|
+
}
|
|
646
|
+
offset += chunk.length;
|
|
647
|
+
return { ...chunk, validity: { values: validity2 } };
|
|
648
|
+
})
|
|
649
|
+
};
|
|
650
|
+
});
|
|
651
|
+
const output = evaluate(...columns);
|
|
652
|
+
if (output.values.length !== length2 || output.validity.length < Math.ceil(length2 / 8) || (boolean ? !(output.values instanceof Uint8Array) : !(output.values instanceof Float64Array)))
|
|
653
|
+
throw new Error("Turf expression kernel must return one declared scalar per input row");
|
|
654
|
+
const validity = new Uint8Array(Math.ceil(length2 / 8));
|
|
655
|
+
const values = boolean ? new Uint8Array(Math.ceil(length2 / 8)) : output.values;
|
|
656
|
+
let nullCount = 0;
|
|
657
|
+
for (let row = 0; row < length2; row++) {
|
|
658
|
+
const bit = 1 << (row & 7);
|
|
659
|
+
if (activeRows[row] && output.validity[row >> 3] & bit) {
|
|
660
|
+
validity[row >> 3] |= bit;
|
|
661
|
+
if (boolean && output.values[row])
|
|
662
|
+
values[row >> 3] |= bit;
|
|
663
|
+
} else
|
|
664
|
+
nullCount++;
|
|
665
|
+
}
|
|
666
|
+
return (0, import_apache_arrow2.makeVector)((0, import_apache_arrow2.makeData)({
|
|
667
|
+
type: result2.type,
|
|
668
|
+
data: values,
|
|
669
|
+
length: length2,
|
|
670
|
+
nullBitmap: validity,
|
|
671
|
+
nullCount
|
|
672
|
+
}));
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
]
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
function geometryResult(result2) {
|
|
679
|
+
const [geometry] = (0, import_arrow5.materializeGeoArrowRows)(result2);
|
|
680
|
+
return geometry ? (0, import_arrow5.writeWKB)(geometry, "xy") : null;
|
|
681
|
+
}
|
|
682
|
+
var TURF_DISTANCE = /* @__PURE__ */ spatialFunction(
|
|
683
|
+
"TURF_DISTANCE",
|
|
684
|
+
[pointKinds, pointKinds],
|
|
685
|
+
/* @__PURE__ */ new import_apache_arrow2.Float64(),
|
|
686
|
+
([a, b]) => scalar2(distance(column(a), column(b)))
|
|
687
|
+
);
|
|
688
|
+
var TURF_BEARING = /* @__PURE__ */ spatialFunction(
|
|
689
|
+
"TURF_BEARING",
|
|
690
|
+
[pointKinds, pointKinds],
|
|
691
|
+
/* @__PURE__ */ new import_apache_arrow2.Float64(),
|
|
692
|
+
([a, b]) => scalar2(bearing(column(a), column(b)))
|
|
693
|
+
);
|
|
694
|
+
var TURF_AREA = /* @__PURE__ */ spatialFunction(
|
|
695
|
+
"TURF_AREA",
|
|
696
|
+
[polygonKinds],
|
|
697
|
+
/* @__PURE__ */ new import_apache_arrow2.Float64(),
|
|
698
|
+
([geometry]) => scalar2(area(column(geometry)))
|
|
699
|
+
);
|
|
700
|
+
var TURF_LENGTH = /* @__PURE__ */ spatialFunction(
|
|
701
|
+
"TURF_LENGTH",
|
|
702
|
+
[lineKinds],
|
|
703
|
+
/* @__PURE__ */ new import_apache_arrow2.Float64(),
|
|
704
|
+
([geometry]) => scalar2(length(column(geometry)))
|
|
705
|
+
);
|
|
706
|
+
var TURF_CENTROID = /* @__PURE__ */ spatialFunction(
|
|
707
|
+
"TURF_CENTROID",
|
|
708
|
+
[geometryTypes],
|
|
709
|
+
/* @__PURE__ */ new import_apache_arrow2.Binary(),
|
|
710
|
+
([geometry]) => geometryResult(centroid(column(geometry)))
|
|
711
|
+
);
|
|
712
|
+
var TURF_MIDPOINT = /* @__PURE__ */ spatialFunction(
|
|
713
|
+
"TURF_MIDPOINT",
|
|
714
|
+
[pointKinds, pointKinds],
|
|
715
|
+
/* @__PURE__ */ new import_apache_arrow2.Binary(),
|
|
716
|
+
([a, b]) => geometryResult(midpoint(column(a), column(b)))
|
|
717
|
+
);
|
|
718
|
+
var TURF_BBOX = /* @__PURE__ */ spatialFunction(
|
|
719
|
+
"TURF_BBOX",
|
|
720
|
+
[geometryTypes],
|
|
721
|
+
/* @__PURE__ */ new import_apache_arrow2.FixedSizeList(
|
|
722
|
+
4,
|
|
723
|
+
/* @__PURE__ */ new import_apache_arrow2.Field("value", /* @__PURE__ */ new import_apache_arrow2.Float64(), false)
|
|
724
|
+
),
|
|
725
|
+
([geometry]) => planarBounds(geometry)
|
|
726
|
+
);
|
|
727
|
+
var TURF_BOOLEAN_POINT_IN_POLYGON = /* @__PURE__ */ spatialFunction(
|
|
728
|
+
"TURF_BOOLEAN_POINT_IN_POLYGON",
|
|
729
|
+
[pointKinds, polygonKinds],
|
|
730
|
+
/* @__PURE__ */ new import_apache_arrow2.Bool(),
|
|
731
|
+
([point2, polygon]) => pointInPolygon(point2, polygon)
|
|
732
|
+
);
|
|
733
|
+
var TURF_FUNCTIONS = /* @__PURE__ */ Object.freeze([
|
|
734
|
+
TURF_DISTANCE,
|
|
735
|
+
TURF_BEARING,
|
|
736
|
+
TURF_AREA,
|
|
737
|
+
TURF_LENGTH,
|
|
738
|
+
TURF_CENTROID,
|
|
739
|
+
TURF_MIDPOINT,
|
|
740
|
+
TURF_BBOX,
|
|
741
|
+
TURF_BOOLEAN_POINT_IN_POLYGON
|
|
742
|
+
]);
|
|
743
|
+
//# sourceMappingURL=turf-functions.cjs.map
|