@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
|
@@ -0,0 +1,705 @@
|
|
|
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 = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
|
|
18
|
+
|
|
19
|
+
// dist/web-mercator/index.js
|
|
20
|
+
var index_exports = {};
|
|
21
|
+
__export(index_exports, {
|
|
22
|
+
EPSG3857ToEPSG4326: () => EPSG3857ToEPSG4326,
|
|
23
|
+
EPSG3857ToLngLat: () => EPSG3857ToLngLat,
|
|
24
|
+
EPSG3857_EARTH_RADIUS: () => EPSG3857_EARTH_RADIUS,
|
|
25
|
+
EPSG3857_HALF_CIRCUMFERENCE: () => EPSG3857_HALF_CIRCUMFERENCE,
|
|
26
|
+
EPSG3857_MAX_LATITUDE: () => EPSG3857_MAX_LATITUDE,
|
|
27
|
+
EPSG3857_UNITS_PER_METER: () => EPSG3857_UNITS_PER_METER,
|
|
28
|
+
EPSG4326ToEPSG3857: () => EPSG4326ToEPSG3857,
|
|
29
|
+
MAX_LATITUDE: () => MAX_LATITUDE,
|
|
30
|
+
WebMercatorViewport: () => WebMercatorViewport,
|
|
31
|
+
addMetersToLngLat: () => addMetersToLngLat,
|
|
32
|
+
altitudeToFovy: () => altitudeToFovy,
|
|
33
|
+
default: () => WebMercatorViewport,
|
|
34
|
+
fitBounds: () => fitBounds,
|
|
35
|
+
flyToViewport: () => flyToViewport,
|
|
36
|
+
fovyToAltitude: () => fovyToAltitude,
|
|
37
|
+
getBounds: () => getBounds,
|
|
38
|
+
getDistanceScales: () => getDistanceScales,
|
|
39
|
+
getFlyToDuration: () => getFlyToDuration,
|
|
40
|
+
getMeterZoom: () => getMeterZoom,
|
|
41
|
+
getProjectionMatrix: () => getProjectionMatrix,
|
|
42
|
+
getProjectionParameters: () => getProjectionParameters,
|
|
43
|
+
getViewMatrix: () => getViewMatrix,
|
|
44
|
+
lngLatToEPSG3857: () => lngLatToEPSG3857,
|
|
45
|
+
lngLatToWorld: () => lngLatToWorld,
|
|
46
|
+
normalizeViewportProps: () => normalizeViewportProps,
|
|
47
|
+
pixelsToWorld: () => pixelsToWorld,
|
|
48
|
+
scaleToZoom: () => scaleToZoom,
|
|
49
|
+
unitsPerMeter: () => unitsPerMeter,
|
|
50
|
+
worldToLngLat: () => worldToLngLat,
|
|
51
|
+
worldToPixels: () => worldToPixels,
|
|
52
|
+
zoomToScale: () => zoomToScale
|
|
53
|
+
});
|
|
54
|
+
module.exports = __toCommonJS(index_exports);
|
|
55
|
+
|
|
56
|
+
// dist/web-mercator/math-utils.js
|
|
57
|
+
var import_matrix = require("@math.gl/core/matrix");
|
|
58
|
+
function createMat4() {
|
|
59
|
+
return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
60
|
+
}
|
|
61
|
+
function transformVector(matrix, vector) {
|
|
62
|
+
const result = import_matrix.vec4.transformMat4([], vector, matrix);
|
|
63
|
+
import_matrix.vec4.scale(result, result, 1 / result[3]);
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
function mod(value, divisor) {
|
|
67
|
+
const modulus = value % divisor;
|
|
68
|
+
return modulus < 0 ? divisor + modulus : modulus;
|
|
69
|
+
}
|
|
70
|
+
function lerp(start, end, step) {
|
|
71
|
+
return step * end + (1 - step) * start;
|
|
72
|
+
}
|
|
73
|
+
function clamp(x, min, max) {
|
|
74
|
+
return x < min ? min : x > max ? max : x;
|
|
75
|
+
}
|
|
76
|
+
function ieLog2(x) {
|
|
77
|
+
return Math.log(x) * Math.LOG2E;
|
|
78
|
+
}
|
|
79
|
+
var log2 = Math.log2 || ieLog2;
|
|
80
|
+
|
|
81
|
+
// dist/web-mercator/web-mercator-utils.js
|
|
82
|
+
var import_matrix2 = require("@math.gl/core/matrix");
|
|
83
|
+
var import_matrix3 = require("@math.gl/core/matrix");
|
|
84
|
+
var import_matrix4 = require("@math.gl/core/matrix");
|
|
85
|
+
|
|
86
|
+
// dist/web-mercator/assert.js
|
|
87
|
+
function assert(condition, message) {
|
|
88
|
+
if (!condition) {
|
|
89
|
+
throw new Error(message || "@math.gl/geospatial/web-mercator: assertion failed.");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// dist/web-mercator/web-mercator-utils.js
|
|
94
|
+
var PI = Math.PI;
|
|
95
|
+
var PI_4 = PI / 4;
|
|
96
|
+
var DEGREES_TO_RADIANS = PI / 180;
|
|
97
|
+
var RADIANS_TO_DEGREES = 180 / PI;
|
|
98
|
+
var TILE_SIZE = 512;
|
|
99
|
+
var EARTH_CIRCUMFERENCE = 4003e4;
|
|
100
|
+
var MAX_LATITUDE = 85.051129;
|
|
101
|
+
var DEFAULT_ALTITUDE = 1.5;
|
|
102
|
+
function zoomToScale(zoom) {
|
|
103
|
+
return Math.pow(2, zoom);
|
|
104
|
+
}
|
|
105
|
+
function scaleToZoom(scale) {
|
|
106
|
+
return log2(scale);
|
|
107
|
+
}
|
|
108
|
+
function lngLatToWorld(lngLat) {
|
|
109
|
+
const [lng, lat] = lngLat;
|
|
110
|
+
assert(Number.isFinite(lng));
|
|
111
|
+
assert(Number.isFinite(lat) && lat >= -90 && lat <= 90, "invalid latitude");
|
|
112
|
+
const lambda2 = lng * DEGREES_TO_RADIANS;
|
|
113
|
+
const phi2 = lat * DEGREES_TO_RADIANS;
|
|
114
|
+
const x = TILE_SIZE * (lambda2 + PI) / (2 * PI);
|
|
115
|
+
const y = TILE_SIZE * (PI + Math.log(Math.tan(PI_4 + phi2 * 0.5))) / (2 * PI);
|
|
116
|
+
return [x, y];
|
|
117
|
+
}
|
|
118
|
+
function worldToLngLat(xy) {
|
|
119
|
+
const [x, y] = xy;
|
|
120
|
+
const lambda2 = x / TILE_SIZE * (2 * PI) - PI;
|
|
121
|
+
const phi2 = 2 * (Math.atan(Math.exp(y / TILE_SIZE * (2 * PI) - PI)) - PI_4);
|
|
122
|
+
return [lambda2 * RADIANS_TO_DEGREES, phi2 * RADIANS_TO_DEGREES];
|
|
123
|
+
}
|
|
124
|
+
function getMeterZoom(options) {
|
|
125
|
+
const { latitude } = options;
|
|
126
|
+
assert(Number.isFinite(latitude));
|
|
127
|
+
const latCosine = Math.cos(latitude * DEGREES_TO_RADIANS);
|
|
128
|
+
return scaleToZoom(EARTH_CIRCUMFERENCE * latCosine) - 9;
|
|
129
|
+
}
|
|
130
|
+
function unitsPerMeter(latitude) {
|
|
131
|
+
const latCosine = Math.cos(latitude * DEGREES_TO_RADIANS);
|
|
132
|
+
return TILE_SIZE / EARTH_CIRCUMFERENCE / latCosine;
|
|
133
|
+
}
|
|
134
|
+
function getDistanceScales(options) {
|
|
135
|
+
const { latitude, longitude, highPrecision = false } = options;
|
|
136
|
+
assert(Number.isFinite(latitude) && Number.isFinite(longitude));
|
|
137
|
+
const worldSize = TILE_SIZE;
|
|
138
|
+
const latCosine = Math.cos(latitude * DEGREES_TO_RADIANS);
|
|
139
|
+
const unitsPerDegreeX = worldSize / 360;
|
|
140
|
+
const unitsPerDegreeY = unitsPerDegreeX / latCosine;
|
|
141
|
+
const altUnitsPerMeter = worldSize / EARTH_CIRCUMFERENCE / latCosine;
|
|
142
|
+
const result = {
|
|
143
|
+
unitsPerMeter: [altUnitsPerMeter, altUnitsPerMeter, altUnitsPerMeter],
|
|
144
|
+
metersPerUnit: [1 / altUnitsPerMeter, 1 / altUnitsPerMeter, 1 / altUnitsPerMeter],
|
|
145
|
+
unitsPerDegree: [unitsPerDegreeX, unitsPerDegreeY, altUnitsPerMeter],
|
|
146
|
+
degreesPerUnit: [1 / unitsPerDegreeX, 1 / unitsPerDegreeY, 1 / altUnitsPerMeter]
|
|
147
|
+
};
|
|
148
|
+
if (highPrecision) {
|
|
149
|
+
const latCosine2 = DEGREES_TO_RADIANS * Math.tan(latitude * DEGREES_TO_RADIANS) / latCosine;
|
|
150
|
+
const unitsPerDegreeY2 = unitsPerDegreeX * latCosine2 / 2;
|
|
151
|
+
const altUnitsPerDegree2 = worldSize / EARTH_CIRCUMFERENCE * latCosine2;
|
|
152
|
+
const altUnitsPerMeter2 = altUnitsPerDegree2 / unitsPerDegreeY * altUnitsPerMeter;
|
|
153
|
+
result.unitsPerDegree2 = [0, unitsPerDegreeY2, altUnitsPerDegree2];
|
|
154
|
+
result.unitsPerMeter2 = [altUnitsPerMeter2, 0, altUnitsPerMeter2];
|
|
155
|
+
}
|
|
156
|
+
return result;
|
|
157
|
+
}
|
|
158
|
+
function addMetersToLngLat(lngLatZ, xyz) {
|
|
159
|
+
const [longitude, latitude, z0] = lngLatZ;
|
|
160
|
+
const [x, y, z] = xyz;
|
|
161
|
+
const { unitsPerMeter: unitsPerMeter2, unitsPerMeter2: unitsPerMeter22 } = getDistanceScales({
|
|
162
|
+
longitude,
|
|
163
|
+
latitude,
|
|
164
|
+
highPrecision: true
|
|
165
|
+
});
|
|
166
|
+
const worldspace = lngLatToWorld(lngLatZ);
|
|
167
|
+
worldspace[0] += x * (unitsPerMeter2[0] + unitsPerMeter22[0] * y);
|
|
168
|
+
worldspace[1] += y * (unitsPerMeter2[1] + unitsPerMeter22[1] * y);
|
|
169
|
+
const newLngLat = worldToLngLat(worldspace);
|
|
170
|
+
const newZ = (z0 || 0) + (z || 0);
|
|
171
|
+
return Number.isFinite(z0) || Number.isFinite(z) ? [newLngLat[0], newLngLat[1], newZ] : newLngLat;
|
|
172
|
+
}
|
|
173
|
+
function getViewMatrix(options) {
|
|
174
|
+
const {
|
|
175
|
+
// Viewport props
|
|
176
|
+
height,
|
|
177
|
+
pitch,
|
|
178
|
+
bearing,
|
|
179
|
+
altitude,
|
|
180
|
+
// Pre-calculated parameters
|
|
181
|
+
scale,
|
|
182
|
+
center
|
|
183
|
+
} = options;
|
|
184
|
+
const vm = createMat4();
|
|
185
|
+
import_matrix2.mat4.translate(vm, vm, [0, 0, -altitude]);
|
|
186
|
+
import_matrix2.mat4.rotateX(vm, vm, -pitch * DEGREES_TO_RADIANS);
|
|
187
|
+
import_matrix2.mat4.rotateZ(vm, vm, bearing * DEGREES_TO_RADIANS);
|
|
188
|
+
const relativeScale = scale / height;
|
|
189
|
+
import_matrix2.mat4.scale(vm, vm, [relativeScale, relativeScale, relativeScale]);
|
|
190
|
+
if (center) {
|
|
191
|
+
import_matrix2.mat4.translate(vm, vm, import_matrix4.vec3.negate([], center));
|
|
192
|
+
}
|
|
193
|
+
return vm;
|
|
194
|
+
}
|
|
195
|
+
function getProjectionParameters(options) {
|
|
196
|
+
const { width, height, altitude, pitch = 0, offset, center, scale, nearZMultiplier = 1, farZMultiplier = 1 } = options;
|
|
197
|
+
let { fovy = altitudeToFovy(DEFAULT_ALTITUDE) } = options;
|
|
198
|
+
if (altitude !== void 0) {
|
|
199
|
+
fovy = altitudeToFovy(altitude);
|
|
200
|
+
}
|
|
201
|
+
const fovRadians = fovy * DEGREES_TO_RADIANS;
|
|
202
|
+
const pitchRadians = pitch * DEGREES_TO_RADIANS;
|
|
203
|
+
const focalDistance = fovyToAltitude(fovy);
|
|
204
|
+
let cameraToSeaLevelDistance = focalDistance;
|
|
205
|
+
if (center) {
|
|
206
|
+
cameraToSeaLevelDistance += center[2] * scale / Math.cos(pitchRadians) / height;
|
|
207
|
+
}
|
|
208
|
+
const fovAboveCenter = fovRadians * (0.5 + (offset ? offset[1] : 0) / height);
|
|
209
|
+
const topHalfSurfaceDistance = Math.sin(fovAboveCenter) * cameraToSeaLevelDistance / Math.sin(clamp(Math.PI / 2 - pitchRadians - fovAboveCenter, 0.01, Math.PI - 0.01));
|
|
210
|
+
const furthestDistance = Math.sin(pitchRadians) * topHalfSurfaceDistance + cameraToSeaLevelDistance;
|
|
211
|
+
const horizonDistance = cameraToSeaLevelDistance * 10;
|
|
212
|
+
const farZ = Math.min(furthestDistance * farZMultiplier, horizonDistance);
|
|
213
|
+
return {
|
|
214
|
+
fov: fovRadians,
|
|
215
|
+
aspect: width / height,
|
|
216
|
+
focalDistance,
|
|
217
|
+
near: nearZMultiplier,
|
|
218
|
+
far: farZ
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
function getProjectionMatrix(options) {
|
|
222
|
+
const { fov, aspect, near, far } = getProjectionParameters(options);
|
|
223
|
+
const projectionMatrix = import_matrix2.mat4.perspective(
|
|
224
|
+
[],
|
|
225
|
+
fov,
|
|
226
|
+
// fov in radians
|
|
227
|
+
aspect,
|
|
228
|
+
// aspect ratio
|
|
229
|
+
near,
|
|
230
|
+
// near plane
|
|
231
|
+
far
|
|
232
|
+
// far plane
|
|
233
|
+
);
|
|
234
|
+
return projectionMatrix;
|
|
235
|
+
}
|
|
236
|
+
function altitudeToFovy(altitude) {
|
|
237
|
+
return 2 * Math.atan(0.5 / altitude) * RADIANS_TO_DEGREES;
|
|
238
|
+
}
|
|
239
|
+
function fovyToAltitude(fovy) {
|
|
240
|
+
return 0.5 / Math.tan(0.5 * fovy * DEGREES_TO_RADIANS);
|
|
241
|
+
}
|
|
242
|
+
function worldToPixels(xyz, pixelProjectionMatrix) {
|
|
243
|
+
const [x, y, z = 0] = xyz;
|
|
244
|
+
assert(Number.isFinite(x) && Number.isFinite(y) && Number.isFinite(z));
|
|
245
|
+
return transformVector(pixelProjectionMatrix, [x, y, z, 1]);
|
|
246
|
+
}
|
|
247
|
+
function pixelsToWorld(xyz, pixelUnprojectionMatrix, targetZ = 0) {
|
|
248
|
+
const [x, y, z] = xyz;
|
|
249
|
+
assert(Number.isFinite(x) && Number.isFinite(y), "invalid pixel coordinate");
|
|
250
|
+
if (Number.isFinite(z)) {
|
|
251
|
+
const coord = transformVector(pixelUnprojectionMatrix, [x, y, z, 1]);
|
|
252
|
+
return coord;
|
|
253
|
+
}
|
|
254
|
+
const coord0 = transformVector(pixelUnprojectionMatrix, [x, y, 0, 1]);
|
|
255
|
+
const coord1 = transformVector(pixelUnprojectionMatrix, [x, y, 1, 1]);
|
|
256
|
+
const z0 = coord0[2];
|
|
257
|
+
const z1 = coord1[2];
|
|
258
|
+
const t = z0 === z1 ? 0 : ((targetZ || 0) - z0) / (z1 - z0);
|
|
259
|
+
return import_matrix3.vec2.lerp([], coord0, coord1, t);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// dist/web-mercator/fit-bounds.js
|
|
263
|
+
function fitBounds(options) {
|
|
264
|
+
const {
|
|
265
|
+
width,
|
|
266
|
+
height,
|
|
267
|
+
bounds,
|
|
268
|
+
minExtent = 0,
|
|
269
|
+
// 0.01 would be about 1000 meters (degree is ~110KM)
|
|
270
|
+
maxZoom = 24,
|
|
271
|
+
// ~x4,000,000 => About 10 meter extents
|
|
272
|
+
offset = [0, 0]
|
|
273
|
+
} = options;
|
|
274
|
+
const [[west, south], [east, north]] = bounds;
|
|
275
|
+
const padding = getPaddingObject(options.padding);
|
|
276
|
+
const nw = lngLatToWorld([west, clamp(north, -MAX_LATITUDE, MAX_LATITUDE)]);
|
|
277
|
+
const se = lngLatToWorld([east, clamp(south, -MAX_LATITUDE, MAX_LATITUDE)]);
|
|
278
|
+
const size = [
|
|
279
|
+
Math.max(Math.abs(se[0] - nw[0]), minExtent),
|
|
280
|
+
Math.max(Math.abs(se[1] - nw[1]), minExtent)
|
|
281
|
+
];
|
|
282
|
+
const targetSize = [
|
|
283
|
+
width - padding.left - padding.right - Math.abs(offset[0]) * 2,
|
|
284
|
+
height - padding.top - padding.bottom - Math.abs(offset[1]) * 2
|
|
285
|
+
];
|
|
286
|
+
assert(targetSize[0] > 0 && targetSize[1] > 0);
|
|
287
|
+
const scaleX = targetSize[0] / size[0];
|
|
288
|
+
const scaleY = targetSize[1] / size[1];
|
|
289
|
+
const zoom = Math.min(maxZoom, log2(Math.abs(Math.min(scaleX, scaleY))));
|
|
290
|
+
assert(Number.isFinite(zoom));
|
|
291
|
+
const scale = 2 ** zoom;
|
|
292
|
+
const shiftX = (padding.left - padding.right) / 2 + offset[0];
|
|
293
|
+
const shiftY = (padding.top - padding.bottom) / 2 + offset[1];
|
|
294
|
+
const centerLngLat = worldToLngLat([
|
|
295
|
+
(se[0] + nw[0]) / 2 - shiftX / scale,
|
|
296
|
+
(se[1] + nw[1]) / 2 + shiftY / scale
|
|
297
|
+
]);
|
|
298
|
+
return {
|
|
299
|
+
longitude: centerLngLat[0],
|
|
300
|
+
latitude: centerLngLat[1],
|
|
301
|
+
zoom
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
function getPaddingObject(padding = 0) {
|
|
305
|
+
if (typeof padding === "number") {
|
|
306
|
+
return {
|
|
307
|
+
top: padding,
|
|
308
|
+
bottom: padding,
|
|
309
|
+
left: padding,
|
|
310
|
+
right: padding
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
assert(Number.isFinite(padding.top) && Number.isFinite(padding.bottom) && Number.isFinite(padding.left) && Number.isFinite(padding.right));
|
|
314
|
+
return padding;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// dist/web-mercator/get-bounds.js
|
|
318
|
+
var import_matrix5 = require("@math.gl/core/matrix");
|
|
319
|
+
var DEGREES_TO_RADIANS2 = Math.PI / 180;
|
|
320
|
+
function getBounds(viewport, z = 0) {
|
|
321
|
+
const { width, height, unproject } = viewport;
|
|
322
|
+
const unprojectOps = { targetZ: z };
|
|
323
|
+
const bottomLeft = unproject([0, height], unprojectOps);
|
|
324
|
+
const bottomRight = unproject([width, height], unprojectOps);
|
|
325
|
+
let topLeft;
|
|
326
|
+
let topRight;
|
|
327
|
+
const halfFov = viewport.fovy ? 0.5 * viewport.fovy * DEGREES_TO_RADIANS2 : Math.atan(0.5 / viewport.altitude);
|
|
328
|
+
const angleToGround = (90 - viewport.pitch) * DEGREES_TO_RADIANS2;
|
|
329
|
+
if (halfFov > angleToGround - 0.01) {
|
|
330
|
+
topLeft = unprojectOnFarPlane(viewport, 0, z);
|
|
331
|
+
topRight = unprojectOnFarPlane(viewport, width, z);
|
|
332
|
+
} else {
|
|
333
|
+
topLeft = unproject([0, 0], unprojectOps);
|
|
334
|
+
topRight = unproject([width, 0], unprojectOps);
|
|
335
|
+
}
|
|
336
|
+
return [bottomLeft, bottomRight, topRight, topLeft];
|
|
337
|
+
}
|
|
338
|
+
function unprojectOnFarPlane(viewport, x, targetZ) {
|
|
339
|
+
const { pixelUnprojectionMatrix } = viewport;
|
|
340
|
+
const coord0 = transformVector(pixelUnprojectionMatrix, [x, 0, 1, 1]);
|
|
341
|
+
const coord1 = transformVector(pixelUnprojectionMatrix, [x, viewport.height, 1, 1]);
|
|
342
|
+
const z = targetZ * viewport.distanceScales.unitsPerMeter[2];
|
|
343
|
+
const t = (z - coord0[2]) / (coord1[2] - coord0[2]);
|
|
344
|
+
const coord = import_matrix5.vec2.lerp([], coord0, coord1, t);
|
|
345
|
+
const result = worldToLngLat(coord);
|
|
346
|
+
result.push(targetZ);
|
|
347
|
+
return result;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// dist/web-mercator/web-mercator-viewport.js
|
|
351
|
+
var import_matrix6 = require("@math.gl/core/matrix");
|
|
352
|
+
var import_matrix7 = require("@math.gl/core/matrix");
|
|
353
|
+
var import_matrix8 = require("@math.gl/core/matrix");
|
|
354
|
+
var WebMercatorViewport = class _WebMercatorViewport {
|
|
355
|
+
/**
|
|
356
|
+
* @classdesc
|
|
357
|
+
* Creates view/projection matrices from mercator params
|
|
358
|
+
* Note: The Viewport is immutable in the sense that it only has accessors.
|
|
359
|
+
* A new viewport instance should be created if any parameters have changed.
|
|
360
|
+
*/
|
|
361
|
+
// eslint-disable-next-line max-statements
|
|
362
|
+
constructor(props = { width: 1, height: 1 }) {
|
|
363
|
+
this.equals = (viewport) => {
|
|
364
|
+
if (!(viewport instanceof _WebMercatorViewport)) {
|
|
365
|
+
return false;
|
|
366
|
+
}
|
|
367
|
+
return viewport.width === this.width && viewport.height === this.height && import_matrix6.mat4.equals(viewport.projectionMatrix, this.projectionMatrix) && import_matrix6.mat4.equals(viewport.viewMatrix, this.viewMatrix);
|
|
368
|
+
};
|
|
369
|
+
this.project = (lngLatZ, options = {}) => {
|
|
370
|
+
const { topLeft = true } = options;
|
|
371
|
+
const worldPosition = this.projectPosition(lngLatZ);
|
|
372
|
+
const coord = worldToPixels(worldPosition, this.pixelProjectionMatrix);
|
|
373
|
+
const [x, y] = coord;
|
|
374
|
+
const y2 = topLeft ? y : this.height - y;
|
|
375
|
+
return lngLatZ.length === 2 ? [x, y2] : [x, y2, coord[2]];
|
|
376
|
+
};
|
|
377
|
+
this.unproject = (xyz, options = {}) => {
|
|
378
|
+
const { topLeft = true, targetZ = void 0 } = options;
|
|
379
|
+
const [x, y, z] = xyz;
|
|
380
|
+
const y2 = topLeft ? y : this.height - y;
|
|
381
|
+
const targetZWorld = targetZ && targetZ * this.distanceScales.unitsPerMeter[2];
|
|
382
|
+
const coord = pixelsToWorld([x, y2, z], this.pixelUnprojectionMatrix, targetZWorld);
|
|
383
|
+
const [X, Y, Z] = this.unprojectPosition(coord);
|
|
384
|
+
if (Number.isFinite(z)) {
|
|
385
|
+
return [X, Y, Z];
|
|
386
|
+
}
|
|
387
|
+
return Number.isFinite(targetZ) ? [X, Y, targetZ] : [X, Y];
|
|
388
|
+
};
|
|
389
|
+
this.projectPosition = (xyz) => {
|
|
390
|
+
const [X, Y] = lngLatToWorld(xyz);
|
|
391
|
+
const Z = (xyz[2] || 0) * this.distanceScales.unitsPerMeter[2];
|
|
392
|
+
return [X, Y, Z];
|
|
393
|
+
};
|
|
394
|
+
this.unprojectPosition = (xyz) => {
|
|
395
|
+
const [X, Y] = worldToLngLat(xyz);
|
|
396
|
+
const Z = (xyz[2] || 0) * this.distanceScales.metersPerUnit[2];
|
|
397
|
+
return [X, Y, Z];
|
|
398
|
+
};
|
|
399
|
+
let {
|
|
400
|
+
// Map state
|
|
401
|
+
width,
|
|
402
|
+
height,
|
|
403
|
+
altitude = null,
|
|
404
|
+
fovy = null
|
|
405
|
+
} = props;
|
|
406
|
+
const { latitude = 0, longitude = 0, zoom = 0, pitch = 0, bearing = 0, position = null, nearZMultiplier = 0.02, farZMultiplier = 1.01 } = props;
|
|
407
|
+
width = width || 1;
|
|
408
|
+
height = height || 1;
|
|
409
|
+
if (fovy === null && altitude === null) {
|
|
410
|
+
altitude = DEFAULT_ALTITUDE;
|
|
411
|
+
fovy = altitudeToFovy(altitude);
|
|
412
|
+
} else if (fovy === null) {
|
|
413
|
+
fovy = altitudeToFovy(altitude);
|
|
414
|
+
} else if (altitude === null) {
|
|
415
|
+
altitude = fovyToAltitude(fovy);
|
|
416
|
+
}
|
|
417
|
+
const scale = zoomToScale(zoom);
|
|
418
|
+
altitude = Math.max(0.75, altitude);
|
|
419
|
+
const distanceScales = getDistanceScales({ longitude, latitude });
|
|
420
|
+
const center = lngLatToWorld([longitude, latitude]);
|
|
421
|
+
center.push(0);
|
|
422
|
+
if (position) {
|
|
423
|
+
import_matrix8.vec3.add(center, center, import_matrix8.vec3.mul([], position, distanceScales.unitsPerMeter));
|
|
424
|
+
}
|
|
425
|
+
this.projectionMatrix = getProjectionMatrix({
|
|
426
|
+
width,
|
|
427
|
+
height,
|
|
428
|
+
scale,
|
|
429
|
+
center,
|
|
430
|
+
pitch,
|
|
431
|
+
fovy,
|
|
432
|
+
nearZMultiplier,
|
|
433
|
+
farZMultiplier
|
|
434
|
+
});
|
|
435
|
+
this.viewMatrix = getViewMatrix({
|
|
436
|
+
height,
|
|
437
|
+
scale,
|
|
438
|
+
center,
|
|
439
|
+
pitch,
|
|
440
|
+
bearing,
|
|
441
|
+
altitude
|
|
442
|
+
});
|
|
443
|
+
this.width = width;
|
|
444
|
+
this.height = height;
|
|
445
|
+
this.scale = scale;
|
|
446
|
+
this.latitude = latitude;
|
|
447
|
+
this.longitude = longitude;
|
|
448
|
+
this.zoom = zoom;
|
|
449
|
+
this.pitch = pitch;
|
|
450
|
+
this.bearing = bearing;
|
|
451
|
+
this.altitude = altitude;
|
|
452
|
+
this.fovy = fovy;
|
|
453
|
+
this.center = center;
|
|
454
|
+
this.meterOffset = position || [0, 0, 0];
|
|
455
|
+
this.distanceScales = distanceScales;
|
|
456
|
+
this._initMatrices();
|
|
457
|
+
Object.freeze(this);
|
|
458
|
+
}
|
|
459
|
+
_initMatrices() {
|
|
460
|
+
const { width, height, projectionMatrix, viewMatrix } = this;
|
|
461
|
+
const vpm = createMat4();
|
|
462
|
+
import_matrix6.mat4.multiply(vpm, vpm, projectionMatrix);
|
|
463
|
+
import_matrix6.mat4.multiply(vpm, vpm, viewMatrix);
|
|
464
|
+
this.viewProjectionMatrix = vpm;
|
|
465
|
+
const m = createMat4();
|
|
466
|
+
import_matrix6.mat4.scale(m, m, [width / 2, -height / 2, 1]);
|
|
467
|
+
import_matrix6.mat4.translate(m, m, [1, -1, 0]);
|
|
468
|
+
import_matrix6.mat4.multiply(m, m, vpm);
|
|
469
|
+
const mInverse = import_matrix6.mat4.invert(createMat4(), m);
|
|
470
|
+
if (!mInverse) {
|
|
471
|
+
throw new Error("Pixel project matrix not invertible");
|
|
472
|
+
}
|
|
473
|
+
this.pixelProjectionMatrix = m;
|
|
474
|
+
this.pixelUnprojectionMatrix = mInverse;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Project [lng,lat] on sphere onto [x,y] on 512*512 Mercator Zoom 0 tile.
|
|
478
|
+
* Performs the nonlinear part of the web mercator projection.
|
|
479
|
+
* Remaining projection is done with 4x4 matrices which also handles
|
|
480
|
+
* perspective.
|
|
481
|
+
*
|
|
482
|
+
* @param lngLat - [lng, lat] coordinates
|
|
483
|
+
* Specifies a point on the sphere to project onto the map.
|
|
484
|
+
* @return [x,y] coordinates.
|
|
485
|
+
*/
|
|
486
|
+
projectFlat(lngLat) {
|
|
487
|
+
return lngLatToWorld(lngLat);
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Unproject world point [x,y] on map onto {lat, lon} on sphere
|
|
491
|
+
*
|
|
492
|
+
* @param xy - array with [x,y] members
|
|
493
|
+
* representing point on projected map plane
|
|
494
|
+
* @return - array with [lat,lon] of point on sphere.
|
|
495
|
+
* Has toArray method if you need a GeoJSON Array.
|
|
496
|
+
* Per cartographic tradition, lat and lon are specified as degrees.
|
|
497
|
+
*/
|
|
498
|
+
unprojectFlat(xy) {
|
|
499
|
+
return worldToLngLat(xy);
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Get the map center that place a given [lng, lat] coordinate at screen point [x, y]
|
|
503
|
+
* @param opt
|
|
504
|
+
* @param opt.lngLat - [lng,lat] coordinates
|
|
505
|
+
* Specifies a point on the sphere.
|
|
506
|
+
* @param opt.pos - [x,y] coordinates
|
|
507
|
+
* Specifies a point on the screen.
|
|
508
|
+
* @return [lng,lat] new map center.
|
|
509
|
+
*/
|
|
510
|
+
getMapCenterByLngLatPosition({ lngLat, pos }) {
|
|
511
|
+
const fromLocation = pixelsToWorld(pos, this.pixelUnprojectionMatrix);
|
|
512
|
+
const toLocation = lngLatToWorld(lngLat);
|
|
513
|
+
const translate = import_matrix7.vec2.add([], toLocation, import_matrix7.vec2.negate([], fromLocation));
|
|
514
|
+
const newCenter = import_matrix7.vec2.add([], this.center, translate);
|
|
515
|
+
return worldToLngLat(newCenter);
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Returns a new viewport that fit around the given rectangle.
|
|
519
|
+
* Only supports non-perspective mode.
|
|
520
|
+
* @param bounds - [[lon, lat], [lon, lat]]
|
|
521
|
+
* @param [options]
|
|
522
|
+
* @param [options.padding] - The amount of padding in pixels to add to the given bounds.
|
|
523
|
+
* @param [options.offset] - The center of the given bounds relative to the map's center,
|
|
524
|
+
* [x, y] measured in pixels.
|
|
525
|
+
* @returns {WebMercatorViewport}
|
|
526
|
+
*/
|
|
527
|
+
fitBounds(bounds, options = {}) {
|
|
528
|
+
const { width, height } = this;
|
|
529
|
+
const { longitude, latitude, zoom } = fitBounds(Object.assign({ width, height, bounds }, options));
|
|
530
|
+
return new _WebMercatorViewport({ width, height, longitude, latitude, zoom });
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Returns the bounding box of the viewport.
|
|
534
|
+
* @param [options]
|
|
535
|
+
* @param [options.z] - The altitude at which the bounds should be calculated.
|
|
536
|
+
* @returns {Array} bounds - [[lon, lat], [lon, lat]]
|
|
537
|
+
*/
|
|
538
|
+
getBounds(options) {
|
|
539
|
+
const corners = this.getBoundingRegion(options);
|
|
540
|
+
const west = Math.min(...corners.map((p) => p[0]));
|
|
541
|
+
const east = Math.max(...corners.map((p) => p[0]));
|
|
542
|
+
const south = Math.min(...corners.map((p) => p[1]));
|
|
543
|
+
const north = Math.max(...corners.map((p) => p[1]));
|
|
544
|
+
return [
|
|
545
|
+
[west, south],
|
|
546
|
+
[east, north]
|
|
547
|
+
];
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Returns the bounding box of the viewport.
|
|
551
|
+
* @param [options]
|
|
552
|
+
* @param [options.z] - The altitude at which the bounds should be calculated.
|
|
553
|
+
* @returns {Array} an array of 4 points that define the visible region
|
|
554
|
+
*/
|
|
555
|
+
getBoundingRegion(options = {}) {
|
|
556
|
+
return getBounds(this, options.z || 0);
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
// dist/web-mercator/normalize-viewport-props.js
|
|
561
|
+
var TILE_SIZE2 = 512;
|
|
562
|
+
function normalizeViewportProps(props) {
|
|
563
|
+
const { width, height, pitch = 0 } = props;
|
|
564
|
+
let { longitude, latitude, zoom, bearing = 0 } = props;
|
|
565
|
+
if (longitude < -180 || longitude > 180) {
|
|
566
|
+
longitude = mod(longitude + 180, 360) - 180;
|
|
567
|
+
}
|
|
568
|
+
if (bearing < -180 || bearing > 180) {
|
|
569
|
+
bearing = mod(bearing + 180, 360) - 180;
|
|
570
|
+
}
|
|
571
|
+
const minZoom = log2(height / TILE_SIZE2);
|
|
572
|
+
if (zoom <= minZoom) {
|
|
573
|
+
zoom = minZoom;
|
|
574
|
+
latitude = 0;
|
|
575
|
+
} else {
|
|
576
|
+
const halfHeightPixels = height / 2 / Math.pow(2, zoom);
|
|
577
|
+
const minLatitude = worldToLngLat([0, halfHeightPixels])[1];
|
|
578
|
+
if (latitude < minLatitude) {
|
|
579
|
+
latitude = minLatitude;
|
|
580
|
+
} else {
|
|
581
|
+
const maxLatitude = worldToLngLat([0, TILE_SIZE2 - halfHeightPixels])[1];
|
|
582
|
+
if (latitude > maxLatitude) {
|
|
583
|
+
latitude = maxLatitude;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
return { width, height, longitude, latitude, zoom, pitch, bearing };
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
// dist/web-mercator/fly-to-viewport.js
|
|
591
|
+
var import_matrix9 = require("@math.gl/core/matrix");
|
|
592
|
+
var EPSILON = 0.01;
|
|
593
|
+
var VIEWPORT_TRANSITION_PROPS = ["longitude", "latitude", "zoom"];
|
|
594
|
+
var DEFAULT_OPTS = {
|
|
595
|
+
curve: 1.414,
|
|
596
|
+
speed: 1.2
|
|
597
|
+
// screenSpeed and maxDuration are used only if specified
|
|
598
|
+
};
|
|
599
|
+
function flyToViewport(startProps, endProps, t, options) {
|
|
600
|
+
const { startZoom, startCenterXY, uDelta, w0, u1, S, rho, rho2, r0 } = getFlyToTransitionParams(startProps, endProps, options);
|
|
601
|
+
if (u1 < EPSILON) {
|
|
602
|
+
const viewport = {
|
|
603
|
+
longitude: 0,
|
|
604
|
+
latitude: 0,
|
|
605
|
+
zoom: 0
|
|
606
|
+
};
|
|
607
|
+
for (const key of VIEWPORT_TRANSITION_PROPS) {
|
|
608
|
+
const startValue = startProps[key];
|
|
609
|
+
const endValue = endProps[key];
|
|
610
|
+
viewport[key] = lerp(startValue, endValue, t);
|
|
611
|
+
}
|
|
612
|
+
return viewport;
|
|
613
|
+
}
|
|
614
|
+
const s = t * S;
|
|
615
|
+
const w = Math.cosh(r0) / Math.cosh(r0 + rho * s);
|
|
616
|
+
const u = w0 * ((Math.cosh(r0) * Math.tanh(r0 + rho * s) - Math.sinh(r0)) / rho2) / u1;
|
|
617
|
+
const scaleIncrement = 1 / w;
|
|
618
|
+
const newZoom = startZoom + scaleToZoom(scaleIncrement);
|
|
619
|
+
const newCenterWorld = import_matrix9.vec2.scale([], uDelta, u);
|
|
620
|
+
import_matrix9.vec2.add(newCenterWorld, newCenterWorld, startCenterXY);
|
|
621
|
+
const newCenter = worldToLngLat(newCenterWorld);
|
|
622
|
+
return {
|
|
623
|
+
longitude: newCenter[0],
|
|
624
|
+
latitude: newCenter[1],
|
|
625
|
+
zoom: newZoom
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
function getFlyToDuration(startProps, endProps, options) {
|
|
629
|
+
const opts = { ...DEFAULT_OPTS, ...options };
|
|
630
|
+
const { screenSpeed, speed, maxDuration } = opts;
|
|
631
|
+
const { S, rho } = getFlyToTransitionParams(startProps, endProps, opts);
|
|
632
|
+
const length = 1e3 * S;
|
|
633
|
+
let duration;
|
|
634
|
+
if (Number.isFinite(screenSpeed)) {
|
|
635
|
+
duration = length / (screenSpeed / rho);
|
|
636
|
+
} else {
|
|
637
|
+
duration = length / speed;
|
|
638
|
+
}
|
|
639
|
+
return Number.isFinite(maxDuration) && duration > maxDuration ? 0 : duration;
|
|
640
|
+
}
|
|
641
|
+
function getFlyToTransitionParams(startProps, endProps, opts) {
|
|
642
|
+
opts = Object.assign({}, DEFAULT_OPTS, opts);
|
|
643
|
+
const rho = opts.curve;
|
|
644
|
+
const startZoom = startProps.zoom;
|
|
645
|
+
const startCenter = [startProps.longitude, startProps.latitude];
|
|
646
|
+
const startScale = zoomToScale(startZoom);
|
|
647
|
+
const endZoom = endProps.zoom;
|
|
648
|
+
const endCenter = [endProps.longitude, endProps.latitude];
|
|
649
|
+
const scale = zoomToScale(endZoom - startZoom);
|
|
650
|
+
const startCenterXY = lngLatToWorld(startCenter);
|
|
651
|
+
const endCenterXY = lngLatToWorld(endCenter);
|
|
652
|
+
const uDelta = import_matrix9.vec2.sub([], endCenterXY, startCenterXY);
|
|
653
|
+
const w0 = Math.max(startProps.width, startProps.height);
|
|
654
|
+
const w1 = w0 / scale;
|
|
655
|
+
const u1 = import_matrix9.vec2.length(uDelta) * startScale;
|
|
656
|
+
const _u1 = Math.max(u1, EPSILON);
|
|
657
|
+
const rho2 = rho * rho;
|
|
658
|
+
const b0 = (w1 * w1 - w0 * w0 + rho2 * rho2 * _u1 * _u1) / (2 * w0 * rho2 * _u1);
|
|
659
|
+
const b1 = (w1 * w1 - w0 * w0 - rho2 * rho2 * _u1 * _u1) / (2 * w1 * rho2 * _u1);
|
|
660
|
+
const r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0);
|
|
661
|
+
const r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
|
|
662
|
+
const S = (r1 - r0) / rho;
|
|
663
|
+
return { startZoom, startCenterXY, uDelta, w0, u1, S, rho, rho2, r0, r1 };
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
// dist/web-mercator/mercator-meters.js
|
|
667
|
+
var PI2 = Math.PI;
|
|
668
|
+
var DEGREES_TO_RADIANS3 = PI2 / 180;
|
|
669
|
+
var RADIANS_TO_DEGREES2 = 180 / PI2;
|
|
670
|
+
var EPSG3857_EARTH_RADIUS = 6378137;
|
|
671
|
+
var EPSG3857_HALF_CIRCUMFERENCE = PI2 * EPSG3857_EARTH_RADIUS;
|
|
672
|
+
var EPSG3857_MAX_LATITUDE = Math.atan(Math.sinh(PI2)) * RADIANS_TO_DEGREES2;
|
|
673
|
+
var EPSG3857_UNITS_PER_METER = 512 / (2 * EPSG3857_HALF_CIRCUMFERENCE);
|
|
674
|
+
function lngLatToEPSG3857(lngLatZ, options = {}) {
|
|
675
|
+
const [longitude, latitude, z] = lngLatZ;
|
|
676
|
+
const { clampLatitude = true } = options;
|
|
677
|
+
if (!Number.isFinite(longitude) || !Number.isFinite(latitude)) {
|
|
678
|
+
throw new Error("Invalid longitude or latitude");
|
|
679
|
+
}
|
|
680
|
+
if (lngLatZ.length >= 3 && !Number.isFinite(z)) {
|
|
681
|
+
throw new Error("Invalid elevation");
|
|
682
|
+
}
|
|
683
|
+
const projectedLatitude = clampLatitude ? Math.max(-EPSG3857_MAX_LATITUDE, Math.min(EPSG3857_MAX_LATITUDE, latitude)) : latitude;
|
|
684
|
+
if (projectedLatitude < -EPSG3857_MAX_LATITUDE || projectedLatitude > EPSG3857_MAX_LATITUDE) {
|
|
685
|
+
throw new Error("Latitude is outside the finite EPSG:3857 range");
|
|
686
|
+
}
|
|
687
|
+
const x = EPSG3857_EARTH_RADIUS * longitude * DEGREES_TO_RADIANS3;
|
|
688
|
+
const y = EPSG3857_EARTH_RADIUS * Math.log(Math.tan(PI2 / 4 + projectedLatitude * DEGREES_TO_RADIANS3 / 2));
|
|
689
|
+
return lngLatZ.length >= 3 ? [x, y, z] : [x, y];
|
|
690
|
+
}
|
|
691
|
+
function EPSG3857ToLngLat(xyz) {
|
|
692
|
+
const [x, y, z] = xyz;
|
|
693
|
+
if (!Number.isFinite(x) || !Number.isFinite(y)) {
|
|
694
|
+
throw new Error("Invalid EPSG:3857 coordinate");
|
|
695
|
+
}
|
|
696
|
+
if (xyz.length >= 3 && !Number.isFinite(z)) {
|
|
697
|
+
throw new Error("Invalid elevation");
|
|
698
|
+
}
|
|
699
|
+
const longitude = x / EPSG3857_EARTH_RADIUS * RADIANS_TO_DEGREES2;
|
|
700
|
+
const latitude = Math.atan(Math.sinh(y / EPSG3857_EARTH_RADIUS)) * RADIANS_TO_DEGREES2;
|
|
701
|
+
return xyz.length >= 3 ? [longitude, latitude, z] : [longitude, latitude];
|
|
702
|
+
}
|
|
703
|
+
var EPSG4326ToEPSG3857 = lngLatToEPSG3857;
|
|
704
|
+
var EPSG3857ToEPSG4326 = EPSG3857ToLngLat;
|
|
705
|
+
//# sourceMappingURL=index.cjs.map
|