@math.gl/geospatial 5.0.0-beta.9 → 5.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -2,11 +2,39 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
import {
|
|
6
|
+
Binary,
|
|
7
|
+
Bool,
|
|
8
|
+
FixedSizeList,
|
|
9
|
+
Float64,
|
|
10
|
+
DataType,
|
|
11
|
+
Precision,
|
|
12
|
+
makeData,
|
|
13
|
+
makeVector,
|
|
14
|
+
Field
|
|
15
|
+
} from 'apache-arrow';
|
|
16
|
+
import type {ArrowTableFunction} from '@math.gl/sql/arrow';
|
|
17
|
+
import {makeGeoArrowColumnFromArrowVector} from '@math.gl/core/arrow';
|
|
18
|
+
import {
|
|
19
|
+
materializeGeoArrowRows,
|
|
20
|
+
writeWKB,
|
|
21
|
+
isGeoArrowValueValid,
|
|
22
|
+
type GeoArrowColumn
|
|
23
|
+
} from '@math.gl/core/arrow';
|
|
24
|
+
import type {TurfBatchResult} from './turf';
|
|
25
|
+
|
|
26
|
+
import {area, bearing, centroid, distance, length, midpoint} from './turf';
|
|
27
|
+
import {
|
|
28
|
+
column,
|
|
29
|
+
geometryTypes,
|
|
30
|
+
lineKinds,
|
|
31
|
+
pointInPolygon,
|
|
32
|
+
pointKinds,
|
|
33
|
+
polygonKinds,
|
|
34
|
+
scalar,
|
|
35
|
+
spatialFunction
|
|
36
|
+
} from './spatial-sql';
|
|
37
|
+
import {planarBounds} from './spatial-planar';
|
|
10
38
|
|
|
11
39
|
/** Adapter for row-preserving numeric/Boolean functions from @math.gl/geospatial/turf. */
|
|
12
40
|
export type TurfArrowFunctionOptions<Fields extends readonly Field[] = readonly Field[]> = {
|
|
@@ -45,7 +73,9 @@ export function createTurfArrowFunction<const Fields extends readonly Field[]>(
|
|
|
45
73
|
nullHandling: 'propagate',
|
|
46
74
|
evaluate(vectors, {activeRows, length}) {
|
|
47
75
|
const columns = vectors.map((vector, index) => {
|
|
48
|
-
const column = makeGeoArrowColumnFromArrowVector(vector, {
|
|
76
|
+
const column = makeGeoArrowColumnFromArrowVector(vector, {
|
|
77
|
+
field: fields[index]
|
|
78
|
+
});
|
|
49
79
|
let offset = 0;
|
|
50
80
|
return {
|
|
51
81
|
...column,
|
|
@@ -95,3 +125,88 @@ export function createTurfArrowFunction<const Fields extends readonly Field[]>(
|
|
|
95
125
|
]
|
|
96
126
|
};
|
|
97
127
|
}
|
|
128
|
+
|
|
129
|
+
/** Returns the first geometry from a single-row Turf batch as GeoArrow WKB. */
|
|
130
|
+
function geometryResult(result: GeoArrowColumn): Uint8Array | null {
|
|
131
|
+
const [geometry] = materializeGeoArrowRows(result);
|
|
132
|
+
return geometry ? writeWKB(geometry, 'xy') : null;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** Returns great-circle point distance in kilometers. */
|
|
136
|
+
export const TURF_DISTANCE = /* @__PURE__ */ spatialFunction(
|
|
137
|
+
'TURF_DISTANCE',
|
|
138
|
+
[pointKinds, pointKinds],
|
|
139
|
+
/* @__PURE__ */ new Float64(),
|
|
140
|
+
([a, b]) => scalar(distance(column(a!), column(b!)))
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
/** Returns initial great-circle bearing in degrees. */
|
|
144
|
+
export const TURF_BEARING = /* @__PURE__ */ spatialFunction(
|
|
145
|
+
'TURF_BEARING',
|
|
146
|
+
[pointKinds, pointKinds],
|
|
147
|
+
/* @__PURE__ */ new Float64(),
|
|
148
|
+
([a, b]) => scalar(bearing(column(a!), column(b!)))
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
/** Returns spherical polygon area in square meters. */
|
|
152
|
+
export const TURF_AREA = /* @__PURE__ */ spatialFunction(
|
|
153
|
+
'TURF_AREA',
|
|
154
|
+
[polygonKinds],
|
|
155
|
+
/* @__PURE__ */ new Float64(),
|
|
156
|
+
([geometry]) => scalar(area(column(geometry!)))
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
/** Returns great-circle line length in kilometers. */
|
|
160
|
+
export const TURF_LENGTH = /* @__PURE__ */ spatialFunction(
|
|
161
|
+
'TURF_LENGTH',
|
|
162
|
+
[lineKinds],
|
|
163
|
+
/* @__PURE__ */ new Float64(),
|
|
164
|
+
([geometry]) => scalar(length(column(geometry!)))
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
/** Returns the Turf vertex-mean centroid as GeoArrow WKB. */
|
|
168
|
+
export const TURF_CENTROID = /* @__PURE__ */ spatialFunction(
|
|
169
|
+
'TURF_CENTROID',
|
|
170
|
+
[geometryTypes],
|
|
171
|
+
/* @__PURE__ */ new Binary(),
|
|
172
|
+
([geometry]) => geometryResult(centroid(column(geometry!)))
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
/** Returns the Turf great-circle midpoint as GeoArrow WKB. */
|
|
176
|
+
export const TURF_MIDPOINT = /* @__PURE__ */ spatialFunction(
|
|
177
|
+
'TURF_MIDPOINT',
|
|
178
|
+
[pointKinds, pointKinds],
|
|
179
|
+
/* @__PURE__ */ new Binary(),
|
|
180
|
+
([a, b]) => geometryResult(midpoint(column(a!), column(b!)))
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
/** Returns [minX, minY, maxX, maxY] per geometry. */
|
|
184
|
+
export const TURF_BBOX = /* @__PURE__ */ spatialFunction(
|
|
185
|
+
'TURF_BBOX',
|
|
186
|
+
[geometryTypes],
|
|
187
|
+
/* @__PURE__ */ new FixedSizeList(
|
|
188
|
+
4,
|
|
189
|
+
/* @__PURE__ */ new Field('value', /* @__PURE__ */ new Float64(), false)
|
|
190
|
+
),
|
|
191
|
+
([geometry]) => planarBounds(geometry!)
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
/** Tests whether a point is in a polygon, including its boundary, with Turf argument order. */
|
|
195
|
+
export const TURF_BOOLEAN_POINT_IN_POLYGON = /* @__PURE__ */ spatialFunction(
|
|
196
|
+
'TURF_BOOLEAN_POINT_IN_POLYGON',
|
|
197
|
+
[pointKinds, polygonKinds],
|
|
198
|
+
/* @__PURE__ */ new Bool(),
|
|
199
|
+
([point, polygon]) => pointInPolygon(point!, polygon!)
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
/** Opt-in SQL declarations for the initial row-preserving Turf function library. */
|
|
203
|
+
export const TURF_FUNCTIONS: readonly ArrowTableFunction[] = /* @__PURE__ */ Object.freeze([
|
|
204
|
+
TURF_DISTANCE,
|
|
205
|
+
TURF_BEARING,
|
|
206
|
+
TURF_AREA,
|
|
207
|
+
TURF_LENGTH,
|
|
208
|
+
TURF_CENTROID,
|
|
209
|
+
TURF_MIDPOINT,
|
|
210
|
+
TURF_BBOX,
|
|
211
|
+
TURF_BOOLEAN_POINT_IN_POLYGON
|
|
212
|
+
]);
|
package/src/turf.ts
CHANGED
|
@@ -2,13 +2,9 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import type {GeoArrowArray, GeoArrowColumn} from '@math.gl/arrow
|
|
6
|
-
import {isGeoArrowValueValid} from '@math.gl/arrow
|
|
7
|
-
import {
|
|
8
|
-
getGeoArrowRowBounds,
|
|
9
|
-
mapGeoArrowCoordinates,
|
|
10
|
-
rewindGeoArrow
|
|
11
|
-
} from '@math.gl/arrow/geoarrow-utils';
|
|
5
|
+
import type {GeoArrowArray, GeoArrowColumn} from '@math.gl/core/arrow';
|
|
6
|
+
import {isGeoArrowValueValid} from '@math.gl/core/arrow';
|
|
7
|
+
import {getGeoArrowRowBounds, mapGeoArrowCoordinates, rewindGeoArrow} from '@math.gl/core/arrow';
|
|
12
8
|
|
|
13
9
|
/** A nullable, row-aligned numeric or boolean result. Validity is an Arrow bitmap. */
|
|
14
10
|
export type TurfBatchResult<T extends Float64Array | Uint8Array> = {
|
package/src/type-utils.ts
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
// This file is derived from the Cesium math library under Apache 2 license
|
|
8
8
|
// See ../LICENSE for the retained Cesium notice and Apache-2.0 terms.
|
|
9
9
|
|
|
10
|
-
import type {NumericArray} from '@math.gl/core';
|
|
11
|
-
import {Vector3, toRadians, toDegrees, config} from '@math.gl/core';
|
|
10
|
+
import type {NumericArray} from '@math.gl/core/matrix';
|
|
11
|
+
import {Vector3, toRadians, toDegrees, config} from '@math.gl/core/matrix';
|
|
12
12
|
import {WGS84_CONSTANTS} from './constants';
|
|
13
13
|
|
|
14
14
|
type LngLatHeightObject = {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
// Replacement for the external assert method to reduce bundle size
|
|
5
|
+
// Note: We don't use the second "message" argument in calling code,
|
|
6
|
+
// so no need to support it here
|
|
7
|
+
export function assert(condition: unknown, message?: string): void {
|
|
8
|
+
if (!condition) {
|
|
9
|
+
throw new Error(message || '@math.gl/geospatial/web-mercator: assertion failed.');
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
import {assert} from './assert';
|
|
5
|
+
import {log2, clamp} from './math-utils';
|
|
6
|
+
import {MAX_LATITUDE, lngLatToWorld, worldToLngLat} from './web-mercator-utils';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Options for fitBounds
|
|
10
|
+
*/
|
|
11
|
+
export type FitBoundsOptions = {
|
|
12
|
+
/** viewport width */
|
|
13
|
+
width: number;
|
|
14
|
+
/** viewport height */
|
|
15
|
+
height: number;
|
|
16
|
+
/** [[lon, lat], [lon, lat]] */
|
|
17
|
+
bounds: [[number, number], [number, number]];
|
|
18
|
+
/** The width/height of the bounded area will never be smaller than this. 0.01 would be about 1000 meters (degree is ~110KM) */
|
|
19
|
+
minExtent?: number;
|
|
20
|
+
/** The maximum zoom level to fit the bounds within. */
|
|
21
|
+
maxZoom?: number; // ~x4,000,000 => About 10 meter extents
|
|
22
|
+
/**
|
|
23
|
+
* padding - The amount of padding in pixels to add to the given bounds.
|
|
24
|
+
* Can also be an object with top, bottom, left and right properties defining the padding.
|
|
25
|
+
*/
|
|
26
|
+
padding?: number | Padding;
|
|
27
|
+
/** Pixel offset from the padded center. Positive x moves right and positive y moves down. */
|
|
28
|
+
offset?: number[];
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* An object describing the padding to add to the bounds.
|
|
33
|
+
*/
|
|
34
|
+
export type Padding = {
|
|
35
|
+
/** Padding from top in pixels to add to the given bounds */
|
|
36
|
+
top: number;
|
|
37
|
+
/** Padding from bottom in pixels to add to the given bounds */
|
|
38
|
+
bottom: number;
|
|
39
|
+
/** Padding from left in pixels to add to the given bounds */
|
|
40
|
+
left: number;
|
|
41
|
+
/** Padding from right in pixels to add to the given bounds */
|
|
42
|
+
right: number;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
type ViewportProps = {
|
|
46
|
+
longitude: number;
|
|
47
|
+
latitude: number;
|
|
48
|
+
zoom: number;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Returns map settings {latitude, longitude, zoom}
|
|
53
|
+
* that will contain the provided corners within the provided width.
|
|
54
|
+
*
|
|
55
|
+
* > _Note: Only supports non-perspective mode._
|
|
56
|
+
*
|
|
57
|
+
* @param options fit bounds parameters
|
|
58
|
+
* @returns - latitude, longitude and zoom
|
|
59
|
+
*/
|
|
60
|
+
export function fitBounds(options: FitBoundsOptions): ViewportProps {
|
|
61
|
+
const {
|
|
62
|
+
width,
|
|
63
|
+
height,
|
|
64
|
+
bounds,
|
|
65
|
+
minExtent = 0, // 0.01 would be about 1000 meters (degree is ~110KM)
|
|
66
|
+
maxZoom = 24, // ~x4,000,000 => About 10 meter extents
|
|
67
|
+
offset = [0, 0]
|
|
68
|
+
} = options;
|
|
69
|
+
|
|
70
|
+
const [[west, south], [east, north]] = bounds;
|
|
71
|
+
const padding = getPaddingObject(options.padding);
|
|
72
|
+
|
|
73
|
+
const nw = lngLatToWorld([west, clamp(north, -MAX_LATITUDE, MAX_LATITUDE)]);
|
|
74
|
+
const se = lngLatToWorld([east, clamp(south, -MAX_LATITUDE, MAX_LATITUDE)]);
|
|
75
|
+
|
|
76
|
+
// width/height on the Web Mercator plane
|
|
77
|
+
const size = [
|
|
78
|
+
Math.max(Math.abs(se[0] - nw[0]), minExtent),
|
|
79
|
+
Math.max(Math.abs(se[1] - nw[1]), minExtent)
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
const targetSize = [
|
|
83
|
+
width - padding.left - padding.right - Math.abs(offset[0]) * 2,
|
|
84
|
+
height - padding.top - padding.bottom - Math.abs(offset[1]) * 2
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
assert(targetSize[0] > 0 && targetSize[1] > 0);
|
|
88
|
+
|
|
89
|
+
// scale = screen pixels per unit on the Web Mercator plane
|
|
90
|
+
const scaleX = targetSize[0] / size[0];
|
|
91
|
+
const scaleY = targetSize[1] / size[1];
|
|
92
|
+
|
|
93
|
+
const zoom = Math.min(maxZoom, log2(Math.abs(Math.min(scaleX, scaleY))));
|
|
94
|
+
assert(Number.isFinite(zoom));
|
|
95
|
+
|
|
96
|
+
// Translate the viewport center by the inverse of the desired screen-space shift.
|
|
97
|
+
const scale = 2 ** zoom;
|
|
98
|
+
const shiftX = (padding.left - padding.right) / 2 + offset[0];
|
|
99
|
+
const shiftY = (padding.top - padding.bottom) / 2 + offset[1];
|
|
100
|
+
const centerLngLat = worldToLngLat([
|
|
101
|
+
(se[0] + nw[0]) / 2 - shiftX / scale,
|
|
102
|
+
(se[1] + nw[1]) / 2 + shiftY / scale
|
|
103
|
+
]);
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
longitude: centerLngLat[0],
|
|
107
|
+
latitude: centerLngLat[1],
|
|
108
|
+
zoom
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Helpers
|
|
113
|
+
function getPaddingObject(padding: number | Padding = 0): Padding {
|
|
114
|
+
if (typeof padding === 'number') {
|
|
115
|
+
return {
|
|
116
|
+
top: padding,
|
|
117
|
+
bottom: padding,
|
|
118
|
+
left: padding,
|
|
119
|
+
right: padding
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Make sure all the required properties are set
|
|
124
|
+
assert(
|
|
125
|
+
Number.isFinite(padding.top) &&
|
|
126
|
+
Number.isFinite(padding.bottom) &&
|
|
127
|
+
Number.isFinite(padding.left) &&
|
|
128
|
+
Number.isFinite(padding.right)
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
return padding;
|
|
132
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
import {lerp} from './math-utils';
|
|
5
|
+
import {scaleToZoom, zoomToScale, lngLatToWorld, worldToLngLat} from './web-mercator-utils';
|
|
6
|
+
import {vec2} from '@math.gl/core/matrix';
|
|
7
|
+
|
|
8
|
+
import type {ViewportProps} from './normalize-viewport-props';
|
|
9
|
+
|
|
10
|
+
const EPSILON = 0.01;
|
|
11
|
+
const VIEWPORT_TRANSITION_PROPS = ['longitude', 'latitude', 'zoom'] as const;
|
|
12
|
+
const DEFAULT_OPTS = {
|
|
13
|
+
curve: 1.414,
|
|
14
|
+
speed: 1.2
|
|
15
|
+
// screenSpeed and maxDuration are used only if specified
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type FlytoTransitionOptions = {
|
|
19
|
+
curve?: number;
|
|
20
|
+
speed?: number;
|
|
21
|
+
screenSpeed?: number;
|
|
22
|
+
maxDuration?: number;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
type TransitionViewport = {
|
|
26
|
+
longitude: number;
|
|
27
|
+
latitude: number;
|
|
28
|
+
zoom: number;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* mapbox-gl-js flyTo : https://www.mapbox.com/mapbox-gl-js/api/#map#flyto.
|
|
33
|
+
* It implements “Smooth and efficient zooming and panning.” algorithm by
|
|
34
|
+
* "Jarke J. van Wijk and Wim A.A. Nuij"
|
|
35
|
+
*/
|
|
36
|
+
export function flyToViewport(
|
|
37
|
+
startProps: ViewportProps,
|
|
38
|
+
endProps: ViewportProps,
|
|
39
|
+
t: number,
|
|
40
|
+
options?: FlytoTransitionOptions
|
|
41
|
+
): {
|
|
42
|
+
longitude: number;
|
|
43
|
+
latitude: number;
|
|
44
|
+
zoom: number;
|
|
45
|
+
} {
|
|
46
|
+
// Equations from above paper are referred where needed.
|
|
47
|
+
|
|
48
|
+
const {startZoom, startCenterXY, uDelta, w0, u1, S, rho, rho2, r0} = getFlyToTransitionParams(
|
|
49
|
+
startProps,
|
|
50
|
+
endProps,
|
|
51
|
+
options
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
// If change in center is too small, do linear interpolaiton.
|
|
55
|
+
if (u1 < EPSILON) {
|
|
56
|
+
const viewport: TransitionViewport = {
|
|
57
|
+
longitude: 0,
|
|
58
|
+
latitude: 0,
|
|
59
|
+
zoom: 0
|
|
60
|
+
};
|
|
61
|
+
for (const key of VIEWPORT_TRANSITION_PROPS) {
|
|
62
|
+
const startValue = startProps[key];
|
|
63
|
+
const endValue = endProps[key];
|
|
64
|
+
viewport[key] = lerp(startValue, endValue, t);
|
|
65
|
+
}
|
|
66
|
+
return viewport;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const s = t * S;
|
|
70
|
+
|
|
71
|
+
const w = Math.cosh(r0) / Math.cosh(r0 + rho * s);
|
|
72
|
+
const u = (w0 * ((Math.cosh(r0) * Math.tanh(r0 + rho * s) - Math.sinh(r0)) / rho2)) / u1;
|
|
73
|
+
|
|
74
|
+
const scaleIncrement = 1 / w; // Using w method for scaling.
|
|
75
|
+
const newZoom = startZoom + scaleToZoom(scaleIncrement);
|
|
76
|
+
|
|
77
|
+
const newCenterWorld = vec2.scale([] as number[], uDelta, u) as [number, number];
|
|
78
|
+
vec2.add(newCenterWorld, newCenterWorld, startCenterXY);
|
|
79
|
+
|
|
80
|
+
const newCenter = worldToLngLat(newCenterWorld);
|
|
81
|
+
return {
|
|
82
|
+
longitude: newCenter[0],
|
|
83
|
+
latitude: newCenter[1],
|
|
84
|
+
zoom: newZoom
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// returns transition duration in milliseconds
|
|
89
|
+
export function getFlyToDuration(
|
|
90
|
+
startProps: ViewportProps,
|
|
91
|
+
endProps: ViewportProps,
|
|
92
|
+
options?: FlytoTransitionOptions
|
|
93
|
+
): number {
|
|
94
|
+
const opts = {...DEFAULT_OPTS, ...options};
|
|
95
|
+
const {screenSpeed, speed, maxDuration} = opts;
|
|
96
|
+
const {S, rho} = getFlyToTransitionParams(startProps, endProps, opts);
|
|
97
|
+
const length = 1000 * S;
|
|
98
|
+
let duration: number;
|
|
99
|
+
if (Number.isFinite(screenSpeed)) {
|
|
100
|
+
duration = length / (screenSpeed / rho);
|
|
101
|
+
} else {
|
|
102
|
+
duration = length / speed;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return Number.isFinite(maxDuration) && duration > maxDuration ? 0 : duration;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Private Methods
|
|
109
|
+
|
|
110
|
+
// Calculate all parameters that are static for given startProps and endProps
|
|
111
|
+
function getFlyToTransitionParams(
|
|
112
|
+
startProps: ViewportProps,
|
|
113
|
+
endProps: ViewportProps,
|
|
114
|
+
opts: FlytoTransitionOptions
|
|
115
|
+
): {
|
|
116
|
+
startZoom: number;
|
|
117
|
+
startCenterXY: [number, number];
|
|
118
|
+
uDelta: [number, number];
|
|
119
|
+
w0: number;
|
|
120
|
+
u1: number;
|
|
121
|
+
S: number;
|
|
122
|
+
rho: number;
|
|
123
|
+
rho2: number;
|
|
124
|
+
r0: number;
|
|
125
|
+
r1: number;
|
|
126
|
+
} {
|
|
127
|
+
opts = Object.assign({}, DEFAULT_OPTS, opts);
|
|
128
|
+
const rho = opts.curve;
|
|
129
|
+
const startZoom = startProps.zoom;
|
|
130
|
+
const startCenter: [number, number] = [startProps.longitude, startProps.latitude];
|
|
131
|
+
const startScale = zoomToScale(startZoom);
|
|
132
|
+
const endZoom = endProps.zoom;
|
|
133
|
+
const endCenter: [number, number] = [endProps.longitude, endProps.latitude];
|
|
134
|
+
const scale = zoomToScale(endZoom - startZoom);
|
|
135
|
+
|
|
136
|
+
const startCenterXY: [number, number] = lngLatToWorld(startCenter);
|
|
137
|
+
const endCenterXY: [number, number] = lngLatToWorld(endCenter);
|
|
138
|
+
const uDelta = vec2.sub([] as number[], endCenterXY, startCenterXY) as [number, number];
|
|
139
|
+
|
|
140
|
+
const w0 = Math.max(startProps.width, startProps.height);
|
|
141
|
+
const w1 = w0 / scale;
|
|
142
|
+
const u1 = vec2.length(uDelta) * startScale;
|
|
143
|
+
// u0 is treated as '0' in Eq (9).
|
|
144
|
+
|
|
145
|
+
// If u1 is too small, will generate invalid number
|
|
146
|
+
const _u1 = Math.max(u1, EPSILON);
|
|
147
|
+
|
|
148
|
+
// Implement Equation (9) from above algorithm.
|
|
149
|
+
const rho2 = rho * rho;
|
|
150
|
+
const b0 = (w1 * w1 - w0 * w0 + rho2 * rho2 * _u1 * _u1) / (2 * w0 * rho2 * _u1);
|
|
151
|
+
const b1 = (w1 * w1 - w0 * w0 - rho2 * rho2 * _u1 * _u1) / (2 * w1 * rho2 * _u1);
|
|
152
|
+
const r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0);
|
|
153
|
+
const r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
|
|
154
|
+
const S = (r1 - r0) / rho;
|
|
155
|
+
|
|
156
|
+
return {startZoom, startCenterXY, uDelta, w0, u1, S, rho, rho2, r0, r1};
|
|
157
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
/* eslint-disable camelcase */
|
|
5
|
+
import {vec2} from '@math.gl/core/matrix';
|
|
6
|
+
import type {WebMercatorViewport} from './web-mercator-viewport';
|
|
7
|
+
import {worldToLngLat} from './web-mercator-utils';
|
|
8
|
+
import {transformVector} from './math-utils';
|
|
9
|
+
|
|
10
|
+
const DEGREES_TO_RADIANS = Math.PI / 180;
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
* Returns the quad at the intersection of the frustum and the given z plane
|
|
14
|
+
* @param {WebMercatorViewport} viewport
|
|
15
|
+
* @param {Number} z - elevation in meters
|
|
16
|
+
*/
|
|
17
|
+
export function getBounds(viewport: WebMercatorViewport, z: number = 0): number[][] {
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
19
|
+
const {width, height, unproject} = viewport;
|
|
20
|
+
const unprojectOps = {targetZ: z};
|
|
21
|
+
const bottomLeft = unproject([0, height], unprojectOps);
|
|
22
|
+
const bottomRight = unproject([width, height], unprojectOps);
|
|
23
|
+
let topLeft: number[];
|
|
24
|
+
let topRight: number[];
|
|
25
|
+
|
|
26
|
+
const halfFov = viewport.fovy
|
|
27
|
+
? 0.5 * viewport.fovy * DEGREES_TO_RADIANS
|
|
28
|
+
: Math.atan(0.5 / viewport.altitude);
|
|
29
|
+
const angleToGround = (90 - viewport.pitch) * DEGREES_TO_RADIANS;
|
|
30
|
+
// The top plane is parallel to the ground if halfFov == angleToGround
|
|
31
|
+
if (halfFov > angleToGround - 0.01) {
|
|
32
|
+
// intersect with the far plane
|
|
33
|
+
topLeft = unprojectOnFarPlane(viewport, 0, z);
|
|
34
|
+
topRight = unprojectOnFarPlane(viewport, width, z);
|
|
35
|
+
} else {
|
|
36
|
+
// intersect with the top plane
|
|
37
|
+
topLeft = unproject([0, 0], unprojectOps);
|
|
38
|
+
topRight = unproject([width, 0], unprojectOps);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return [bottomLeft, bottomRight, topRight, topLeft];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/*
|
|
45
|
+
* Find a point on the far clipping plane of the viewport
|
|
46
|
+
* @param {WebMercatorViewport} viewport
|
|
47
|
+
* @param {Number} x - projected x in screen space
|
|
48
|
+
* @param {Number} targetZ - the elevation of the point in meters
|
|
49
|
+
*/
|
|
50
|
+
function unprojectOnFarPlane(viewport: WebMercatorViewport, x: number, targetZ: number): number[] {
|
|
51
|
+
const {pixelUnprojectionMatrix} = viewport;
|
|
52
|
+
const coord0 = transformVector(pixelUnprojectionMatrix, [x, 0, 1, 1]);
|
|
53
|
+
const coord1 = transformVector(pixelUnprojectionMatrix, [x, viewport.height, 1, 1]);
|
|
54
|
+
|
|
55
|
+
const z = targetZ * viewport.distanceScales.unitsPerMeter[2];
|
|
56
|
+
const t = (z - coord0[2]) / (coord1[2] - coord0[2]);
|
|
57
|
+
const coord = vec2.lerp([], coord0, coord1, t);
|
|
58
|
+
|
|
59
|
+
const result = worldToLngLat(coord);
|
|
60
|
+
result.push(targetZ);
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
// Classic web-mercator-project
|
|
5
|
+
export {WebMercatorViewport} from './web-mercator-viewport';
|
|
6
|
+
|
|
7
|
+
export {getBounds} from './get-bounds';
|
|
8
|
+
export {fitBounds} from './fit-bounds';
|
|
9
|
+
export {normalizeViewportProps} from './normalize-viewport-props';
|
|
10
|
+
export {flyToViewport, getFlyToDuration} from './fly-to-viewport';
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
MAX_LATITUDE,
|
|
14
|
+
lngLatToWorld,
|
|
15
|
+
worldToLngLat,
|
|
16
|
+
worldToPixels,
|
|
17
|
+
pixelsToWorld,
|
|
18
|
+
zoomToScale,
|
|
19
|
+
scaleToZoom,
|
|
20
|
+
altitudeToFovy,
|
|
21
|
+
fovyToAltitude,
|
|
22
|
+
getMeterZoom,
|
|
23
|
+
unitsPerMeter,
|
|
24
|
+
getDistanceScales,
|
|
25
|
+
addMetersToLngLat,
|
|
26
|
+
getViewMatrix,
|
|
27
|
+
getProjectionMatrix,
|
|
28
|
+
getProjectionParameters
|
|
29
|
+
} from './web-mercator-utils';
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
EPSG3857_EARTH_RADIUS,
|
|
33
|
+
EPSG3857_HALF_CIRCUMFERENCE,
|
|
34
|
+
EPSG3857_MAX_LATITUDE,
|
|
35
|
+
EPSG3857_UNITS_PER_METER,
|
|
36
|
+
lngLatToEPSG3857,
|
|
37
|
+
EPSG3857ToLngLat,
|
|
38
|
+
EPSG4326ToEPSG3857,
|
|
39
|
+
EPSG3857ToEPSG4326
|
|
40
|
+
} from './mercator-meters';
|
|
41
|
+
|
|
42
|
+
export type {EPSG3857Options} from './mercator-meters';
|
|
43
|
+
|
|
44
|
+
/** Types */
|
|
45
|
+
export type {FitBoundsOptions} from './fit-bounds';
|
|
46
|
+
export type {DistanceScales} from './web-mercator-utils';
|
|
47
|
+
|
|
48
|
+
/** @deprecated default export */
|
|
49
|
+
export {WebMercatorViewport as default} from './web-mercator-viewport';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
import {vec4} from '@math.gl/core/matrix';
|
|
5
|
+
|
|
6
|
+
// Helper, avoids low-precision 32 bit matrices from gl-matrix mat4.create()
|
|
7
|
+
export function createMat4(): number[] {
|
|
8
|
+
return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Transforms a vec4 with a projection matrix
|
|
12
|
+
export function transformVector(matrix: number[], vector: number[]): number[] {
|
|
13
|
+
const result = vec4.transformMat4([] as number[], vector, matrix);
|
|
14
|
+
vec4.scale(result, result, 1 / result[3]);
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function mod(value: number, divisor: number): number {
|
|
19
|
+
const modulus = value % divisor;
|
|
20
|
+
return modulus < 0 ? divisor + modulus : modulus;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function lerp(start: number, end: number, step: number): number {
|
|
24
|
+
return step * end + (1 - step) * start;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function clamp(x: number, min: number, max: number): number {
|
|
28
|
+
return x < min ? min : x > max ? max : x;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function ieLog2(x: number): number {
|
|
32
|
+
return Math.log(x) * Math.LOG2E;
|
|
33
|
+
}
|
|
34
|
+
// Handle missing log2 in IE 11
|
|
35
|
+
export const log2 = Math.log2 || ieLog2;
|