@math.gl/geospatial 5.0.0-beta.8 → 5.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/crs/crs-descriptor-types.d.ts +2 -1
- package/dist/crs/crs-descriptor-types.d.ts.map +1 -1
- package/dist/crs/index.cjs +54 -0
- package/dist/crs/index.cjs.map +2 -2
- package/dist/crs/index.d.ts +1 -0
- package/dist/crs/index.d.ts.map +1 -1
- package/dist/crs/index.js +1 -0
- package/dist/crs/index.js.map +1 -1
- package/dist/crs/spatial-reference-metadata.d.ts +20 -0
- package/dist/crs/spatial-reference-metadata.d.ts.map +1 -0
- package/dist/crs/spatial-reference-metadata.js +86 -0
- package/dist/crs/spatial-reference-metadata.js.map +1 -0
- package/dist/ellipsoid-helpers/ellipsoid-transform.d.ts +1 -1
- package/dist/ellipsoid-helpers/ellipsoid-transform.d.ts.map +1 -1
- package/dist/ellipsoid-helpers/ellipsoid-transform.js +2 -2
- package/dist/ellipsoid-helpers/ellipsoid-transform.js.map +1 -1
- package/dist/ellipsoid-helpers/scale-to-geodetic-surface.js +1 -1
- package/dist/ellipsoid-helpers/scale-to-geodetic-surface.js.map +1 -1
- package/dist/ellipsoid-helpers/tangent-plane-numerics.d.ts +1 -1
- package/dist/ellipsoid-helpers/tangent-plane-numerics.d.ts.map +1 -1
- package/dist/ellipsoid-tangent-plane.d.ts +2 -2
- package/dist/ellipsoid-tangent-plane.d.ts.map +1 -1
- package/dist/ellipsoid-tangent-plane.js +1 -1
- package/dist/ellipsoid-tangent-plane.js.map +1 -1
- package/dist/ellipsoid-transforms.d.ts +2 -2
- package/dist/ellipsoid-transforms.d.ts.map +1 -1
- package/dist/ellipsoid-transforms.js +1 -1
- package/dist/ellipsoid-transforms.js.map +1 -1
- package/dist/ellipsoid.d.ts +2 -2
- package/dist/ellipsoid.d.ts.map +1 -1
- package/dist/ellipsoid.js +2 -2
- package/dist/ellipsoid.js.map +1 -1
- package/dist/expressions.d.ts +1 -1
- package/dist/expressions.d.ts.map +1 -1
- package/dist/expressions.js +1 -1
- package/dist/expressions.js.map +1 -1
- package/dist/geodesic-buffer.d.ts +1 -1
- package/dist/geodesic-buffer.d.ts.map +1 -1
- package/dist/geodesic-path.d.ts +1 -1
- package/dist/geodesic-path.d.ts.map +1 -1
- package/dist/geometry-constructors.d.ts +6 -0
- package/dist/geometry-constructors.d.ts.map +1 -0
- package/dist/geometry-constructors.js +37 -0
- package/dist/geometry-constructors.js.map +1 -0
- package/dist/geometry-inspection.d.ts +8 -0
- package/dist/geometry-inspection.d.ts.map +1 -0
- package/dist/geometry-inspection.js +61 -0
- package/dist/geometry-inspection.js.map +1 -0
- package/dist/index.cjs +3773 -846
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +173 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +115 -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 +1266 -155
- package/dist/tasks/index.cjs.map +3 -3
- package/dist/tasks/index.d.ts +12 -0
- package/dist/tasks/index.d.ts.map +1 -1
- package/dist/tasks/index.js +26 -0
- package/dist/tasks/index.js.map +1 -1
- package/dist/tasks/terrain-coverage-worker.d.ts +2 -0
- package/dist/tasks/terrain-coverage-worker.d.ts.map +1 -0
- package/dist/tasks/terrain-coverage-worker.js +7 -0
- package/dist/tasks/terrain-coverage-worker.js.map +1 -0
- package/dist/tasks/terrain-coverage.d.ts +25 -0
- package/dist/tasks/terrain-coverage.d.ts.map +1 -0
- package/dist/tasks/terrain-coverage.js +15 -0
- package/dist/tasks/terrain-coverage.js.map +1 -0
- package/dist/tasks/terrain-residency-worker.d.ts +2 -0
- package/dist/tasks/terrain-residency-worker.d.ts.map +1 -0
- package/dist/tasks/terrain-residency-worker.js +7 -0
- package/dist/tasks/terrain-residency-worker.js.map +1 -0
- package/dist/tasks/terrain-residency.d.ts +73 -0
- package/dist/tasks/terrain-residency.d.ts.map +1 -0
- package/dist/tasks/terrain-residency.js +203 -0
- package/dist/tasks/terrain-residency.js.map +1 -0
- package/dist/terrain/breakline-mesh.d.ts +18 -0
- package/dist/terrain/breakline-mesh.d.ts.map +1 -0
- package/dist/terrain/breakline-mesh.js +126 -0
- package/dist/terrain/breakline-mesh.js.map +1 -0
- package/dist/terrain/breakline-preprocess.d.ts +11 -0
- package/dist/terrain/breakline-preprocess.d.ts.map +1 -0
- package/dist/terrain/breakline-preprocess.js +94 -0
- package/dist/terrain/breakline-preprocess.js.map +1 -0
- package/dist/terrain/continuous-mesh-error.d.ts +34 -0
- package/dist/terrain/continuous-mesh-error.d.ts.map +1 -0
- package/dist/terrain/continuous-mesh-error.js +221 -0
- package/dist/terrain/continuous-mesh-error.js.map +1 -0
- 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/geographic-seam.d.ts +21 -0
- package/dist/terrain/geographic-seam.d.ts.map +1 -0
- package/dist/terrain/geographic-seam.js +52 -0
- package/dist/terrain/geographic-seam.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 +3158 -213
- package/dist/terrain/index.cjs.map +3 -3
- package/dist/terrain/index.d.ts +32 -0
- package/dist/terrain/index.d.ts.map +1 -1
- package/dist/terrain/index.js +30 -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 +48 -0
- package/dist/terrain/lod-select.d.ts.map +1 -0
- package/dist/terrain/lod-select.js +73 -0
- package/dist/terrain/lod-select.js.map +1 -0
- package/dist/terrain/lod-stitch.d.ts +15 -0
- package/dist/terrain/lod-stitch.d.ts.map +1 -0
- package/dist/terrain/lod-stitch.js +64 -0
- package/dist/terrain/lod-stitch.js.map +1 -0
- package/dist/terrain/mesh-coverage.d.ts +35 -0
- package/dist/terrain/mesh-coverage.d.ts.map +1 -0
- package/dist/terrain/mesh-coverage.js +186 -0
- package/dist/terrain/mesh-coverage.js.map +1 -0
- 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-regions-data.d.ts +2 -2
- package/dist/terrain/mesh-regions-data.d.ts.map +1 -1
- package/dist/terrain/mesh-regions-data.js +20 -10
- package/dist/terrain/mesh-regions-data.js.map +1 -1
- 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 +138 -26
- package/dist/terrain/mixed-halo-update.js.map +1 -1
- package/dist/terrain/mixed-vertex-halos.d.ts +34 -1
- package/dist/terrain/mixed-vertex-halos.d.ts.map +1 -1
- package/dist/terrain/mixed-vertex-halos.js +98 -43
- 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/valid-domain-mesh.d.ts +29 -0
- package/dist/terrain/valid-domain-mesh.d.ts.map +1 -0
- package/dist/terrain/valid-domain-mesh.js +183 -0
- package/dist/terrain/valid-domain-mesh.js.map +1 -0
- package/dist/terrain/valid-domain-regions.d.ts +16 -0
- package/dist/terrain/valid-domain-regions.d.ts.map +1 -0
- package/dist/terrain/valid-domain-regions.js +19 -0
- package/dist/terrain/valid-domain-regions.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 +35 -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 +314 -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/index.ts +34 -0
- package/src/tasks/terrain-coverage-worker.ts +6 -0
- package/src/tasks/terrain-coverage.ts +25 -0
- package/src/tasks/terrain-residency-worker.ts +6 -0
- package/src/tasks/terrain-residency.ts +250 -0
- package/src/terrain/breakline-mesh.ts +164 -0
- package/src/terrain/breakline-preprocess.ts +106 -0
- package/src/terrain/cdt2d.d.ts +10 -0
- package/src/terrain/continuous-mesh-error.ts +321 -0
- 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/geographic-seam.ts +73 -0
- package/src/terrain/hydrology.ts +149 -0
- package/src/terrain/index.ts +160 -0
- package/src/terrain/lod-screen-error.ts +128 -0
- package/src/terrain/lod-select.ts +129 -0
- package/src/terrain/lod-stitch.ts +88 -0
- package/src/terrain/mesh-coverage.ts +215 -0
- package/src/terrain/mesh-cutout.ts +420 -0
- package/src/terrain/mesh-regions-data.ts +21 -13
- package/src/terrain/mesh-skirts.ts +10 -7
- package/src/terrain/mixed-halo-update.ts +147 -25
- package/src/terrain/mixed-vertex-halos.ts +125 -55
- 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/valid-domain-mesh.ts +221 -0
- package/src/terrain/valid-domain-regions.ts +41 -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,406 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
// View and Projection Matrix calculations for mapbox-js style map view properties
|
|
5
|
+
import {createMat4} from './math-utils';
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
zoomToScale,
|
|
9
|
+
pixelsToWorld,
|
|
10
|
+
lngLatToWorld,
|
|
11
|
+
worldToLngLat,
|
|
12
|
+
worldToPixels,
|
|
13
|
+
altitudeToFovy,
|
|
14
|
+
fovyToAltitude,
|
|
15
|
+
DEFAULT_ALTITUDE,
|
|
16
|
+
getProjectionMatrix,
|
|
17
|
+
getDistanceScales,
|
|
18
|
+
getViewMatrix,
|
|
19
|
+
DistanceScales
|
|
20
|
+
} from './web-mercator-utils';
|
|
21
|
+
import {fitBounds} from './fit-bounds';
|
|
22
|
+
import {getBounds} from './get-bounds';
|
|
23
|
+
import type {FitBoundsOptions} from './fit-bounds';
|
|
24
|
+
|
|
25
|
+
import {mat4} from '@math.gl/core/matrix';
|
|
26
|
+
import {vec2} from '@math.gl/core/matrix';
|
|
27
|
+
import {vec3} from '@math.gl/core/matrix';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param width=1 - Width of "viewport" or window
|
|
31
|
+
* @param height=1 - Height of "viewport" or window
|
|
32
|
+
* @param scale=1 - Either use scale or zoom
|
|
33
|
+
* @param pitch=0 - Camera angle in degrees (0 is straight down)
|
|
34
|
+
* @param bearing=0 - Map rotation in degrees (0 means north is up)
|
|
35
|
+
* @param fovy= - Field of view of camera in degrees
|
|
36
|
+
* @param altitude= - Altitude of camera in screen units
|
|
37
|
+
*
|
|
38
|
+
* Web mercator projection short-hand parameters
|
|
39
|
+
* @param latitude - Center of viewport on map
|
|
40
|
+
* @param longitude - Center of viewport on map
|
|
41
|
+
* @param zoom - Scale = Math.pow(2,zoom) on map
|
|
42
|
+
|
|
43
|
+
* Notes:
|
|
44
|
+
* - Only one of center or [latitude, longitude] can be specified
|
|
45
|
+
* - [latitude, longitude] can only be specified when "mercator" is true
|
|
46
|
+
* - Altitude has a default value that matches assumptions in mapbox-gl
|
|
47
|
+
* - Field of view is independent from altitude, provide `altitudeToFovy(1.5)` (default value) to match assumptions in mapbox-gl
|
|
48
|
+
* - width and height are forced to 1 if supplied as 0, to avoid
|
|
49
|
+
* division by zero. This is intended to reduce the burden of apps to
|
|
50
|
+
* to check values before instantiating a Viewport.
|
|
51
|
+
*/
|
|
52
|
+
export type WebMercatorViewportProps = {
|
|
53
|
+
// Map state
|
|
54
|
+
width: number;
|
|
55
|
+
height: number;
|
|
56
|
+
latitude?: number;
|
|
57
|
+
longitude?: number;
|
|
58
|
+
position?: number[];
|
|
59
|
+
zoom?: number;
|
|
60
|
+
pitch?: number;
|
|
61
|
+
bearing?: number;
|
|
62
|
+
altitude?: number;
|
|
63
|
+
fovy?: number;
|
|
64
|
+
nearZMultiplier?: number;
|
|
65
|
+
farZMultiplier?: number;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The WebMercatorViewport class creates
|
|
70
|
+
* - view/projection matrices
|
|
71
|
+
* - "uniform values" (for shaders) from mercator params
|
|
72
|
+
*
|
|
73
|
+
* Note: Instances are immutable in the sense that they only have accessors.
|
|
74
|
+
* A new viewport instance should be created if any parameters have changed.
|
|
75
|
+
*/
|
|
76
|
+
export class WebMercatorViewport {
|
|
77
|
+
readonly latitude: number;
|
|
78
|
+
readonly longitude: number;
|
|
79
|
+
readonly zoom: number;
|
|
80
|
+
readonly pitch: number;
|
|
81
|
+
readonly bearing: number;
|
|
82
|
+
readonly altitude: number;
|
|
83
|
+
readonly fovy: number;
|
|
84
|
+
|
|
85
|
+
readonly meterOffset: number[];
|
|
86
|
+
readonly center: number[];
|
|
87
|
+
|
|
88
|
+
readonly width: number;
|
|
89
|
+
readonly height: number;
|
|
90
|
+
readonly scale: number;
|
|
91
|
+
readonly distanceScales: DistanceScales;
|
|
92
|
+
|
|
93
|
+
readonly viewMatrix: number[];
|
|
94
|
+
readonly projectionMatrix: number[];
|
|
95
|
+
|
|
96
|
+
viewProjectionMatrix: number[];
|
|
97
|
+
pixelProjectionMatrix: number[];
|
|
98
|
+
pixelUnprojectionMatrix: number[];
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @classdesc
|
|
102
|
+
* Creates view/projection matrices from mercator params
|
|
103
|
+
* Note: The Viewport is immutable in the sense that it only has accessors.
|
|
104
|
+
* A new viewport instance should be created if any parameters have changed.
|
|
105
|
+
*/
|
|
106
|
+
// eslint-disable-next-line max-statements
|
|
107
|
+
constructor(props: WebMercatorViewportProps = {width: 1, height: 1}) {
|
|
108
|
+
let {
|
|
109
|
+
// Map state
|
|
110
|
+
width,
|
|
111
|
+
height,
|
|
112
|
+
altitude = null,
|
|
113
|
+
fovy = null
|
|
114
|
+
} = props;
|
|
115
|
+
const {
|
|
116
|
+
latitude = 0,
|
|
117
|
+
longitude = 0,
|
|
118
|
+
zoom = 0,
|
|
119
|
+
pitch = 0,
|
|
120
|
+
bearing = 0,
|
|
121
|
+
position = null,
|
|
122
|
+
nearZMultiplier = 0.02,
|
|
123
|
+
farZMultiplier = 1.01
|
|
124
|
+
} = props;
|
|
125
|
+
|
|
126
|
+
// Silently allow apps to send in 0,0 to facilitate isomorphic render etc
|
|
127
|
+
width = width || 1;
|
|
128
|
+
height = height || 1;
|
|
129
|
+
|
|
130
|
+
// `fovy` & `altitude` are independent parameters, one for the
|
|
131
|
+
// projection and the latter for the view matrix. In the past,
|
|
132
|
+
// the `fovy` was always derived from the `altitude`
|
|
133
|
+
if (fovy === null && altitude === null) {
|
|
134
|
+
altitude = DEFAULT_ALTITUDE;
|
|
135
|
+
fovy = altitudeToFovy(altitude);
|
|
136
|
+
} else if (fovy === null) {
|
|
137
|
+
fovy = altitudeToFovy(altitude);
|
|
138
|
+
} else if (altitude === null) {
|
|
139
|
+
altitude = fovyToAltitude(fovy);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const scale = zoomToScale(zoom);
|
|
143
|
+
// Altitude - prevent division by 0
|
|
144
|
+
// TODO - just throw an Error instead?
|
|
145
|
+
altitude = Math.max(0.75, altitude);
|
|
146
|
+
|
|
147
|
+
const distanceScales = getDistanceScales({longitude, latitude});
|
|
148
|
+
|
|
149
|
+
const center: number[] = lngLatToWorld([longitude, latitude]);
|
|
150
|
+
center.push(0);
|
|
151
|
+
|
|
152
|
+
if (position) {
|
|
153
|
+
vec3.add(center, center, vec3.mul([], position, distanceScales.unitsPerMeter));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
this.projectionMatrix = getProjectionMatrix({
|
|
157
|
+
width,
|
|
158
|
+
height,
|
|
159
|
+
scale,
|
|
160
|
+
center,
|
|
161
|
+
pitch,
|
|
162
|
+
fovy,
|
|
163
|
+
nearZMultiplier,
|
|
164
|
+
farZMultiplier
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
this.viewMatrix = getViewMatrix({
|
|
168
|
+
height,
|
|
169
|
+
scale,
|
|
170
|
+
center,
|
|
171
|
+
pitch,
|
|
172
|
+
bearing,
|
|
173
|
+
altitude
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// Save parameters
|
|
177
|
+
this.width = width;
|
|
178
|
+
this.height = height;
|
|
179
|
+
this.scale = scale;
|
|
180
|
+
|
|
181
|
+
this.latitude = latitude;
|
|
182
|
+
this.longitude = longitude;
|
|
183
|
+
this.zoom = zoom;
|
|
184
|
+
this.pitch = pitch;
|
|
185
|
+
this.bearing = bearing;
|
|
186
|
+
this.altitude = altitude;
|
|
187
|
+
this.fovy = fovy;
|
|
188
|
+
this.center = center;
|
|
189
|
+
this.meterOffset = position || [0, 0, 0];
|
|
190
|
+
|
|
191
|
+
this.distanceScales = distanceScales;
|
|
192
|
+
|
|
193
|
+
this._initMatrices();
|
|
194
|
+
|
|
195
|
+
Object.freeze(this);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
_initMatrices(): void {
|
|
199
|
+
const {width, height, projectionMatrix, viewMatrix} = this;
|
|
200
|
+
|
|
201
|
+
// Note: As usual, matrix operations should be applied in "reverse" order
|
|
202
|
+
// since vectors will be multiplied in from the right during transformation
|
|
203
|
+
const vpm = createMat4();
|
|
204
|
+
mat4.multiply(vpm, vpm, projectionMatrix);
|
|
205
|
+
mat4.multiply(vpm, vpm, viewMatrix);
|
|
206
|
+
this.viewProjectionMatrix = vpm;
|
|
207
|
+
|
|
208
|
+
// Calculate matrices and scales needed for projection
|
|
209
|
+
/**
|
|
210
|
+
* Builds matrices that converts preprojected lngLats to screen pixels
|
|
211
|
+
* and vice versa.
|
|
212
|
+
* Note: Currently returns bottom-left coordinates!
|
|
213
|
+
* Note: Starts with the GL projection matrix and adds steps to the
|
|
214
|
+
* scale and translate that matrix onto the window.
|
|
215
|
+
* Note: WebGL controls clip space to screen projection with gl.viewport
|
|
216
|
+
* and does not need this step.
|
|
217
|
+
*/
|
|
218
|
+
const m = createMat4();
|
|
219
|
+
|
|
220
|
+
// matrix for conversion from location to screen coordinates
|
|
221
|
+
mat4.scale(m, m, [width / 2, -height / 2, 1]);
|
|
222
|
+
mat4.translate(m, m, [1, -1, 0]);
|
|
223
|
+
mat4.multiply(m, m, vpm);
|
|
224
|
+
|
|
225
|
+
const mInverse = mat4.invert(createMat4(), m);
|
|
226
|
+
if (!mInverse) {
|
|
227
|
+
throw new Error('Pixel project matrix not invertible');
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
this.pixelProjectionMatrix = m;
|
|
231
|
+
this.pixelUnprojectionMatrix = mInverse;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** Two viewports are equal if width and height are identical, and if
|
|
235
|
+
* their view and projection matrices are (approximately) equal.
|
|
236
|
+
*/
|
|
237
|
+
equals = (viewport: WebMercatorViewport | null): boolean => {
|
|
238
|
+
if (!(viewport instanceof WebMercatorViewport)) {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return (
|
|
243
|
+
viewport.width === this.width &&
|
|
244
|
+
viewport.height === this.height &&
|
|
245
|
+
mat4.equals(viewport.projectionMatrix, this.projectionMatrix) &&
|
|
246
|
+
mat4.equals(viewport.viewMatrix, this.viewMatrix)
|
|
247
|
+
);
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Projects xyz (possibly latitude and longitude) to pixel coordinates in window
|
|
252
|
+
* using viewport projection parameters
|
|
253
|
+
* - [longitude, latitude] to [x, y]
|
|
254
|
+
* - [longitude, latitude, Z] => [x, y, z]
|
|
255
|
+
* Note: By default, returns top-left coordinates for canvas/SVG type render
|
|
256
|
+
*
|
|
257
|
+
* @param lngLatZ - [lng, lat] or [lng, lat, Z]
|
|
258
|
+
* @param options - options
|
|
259
|
+
* @param options.topLeft=true - Whether projected coords are top left
|
|
260
|
+
* @return - screen coordinates [x, y] or [x, y, z], z as pixel depth
|
|
261
|
+
*/
|
|
262
|
+
project = (lngLatZ: number[], options: {topLeft?: boolean} = {}): number[] => {
|
|
263
|
+
const {topLeft = true} = options;
|
|
264
|
+
const worldPosition = this.projectPosition(lngLatZ);
|
|
265
|
+
const coord = worldToPixels(worldPosition, this.pixelProjectionMatrix);
|
|
266
|
+
|
|
267
|
+
const [x, y] = coord;
|
|
268
|
+
const y2 = topLeft ? y : this.height - y;
|
|
269
|
+
return lngLatZ.length === 2 ? [x, y2] : [x, y2, coord[2]];
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Unproject pixel coordinates on screen onto world coordinates, possibly `[lon, lat]` on map.
|
|
274
|
+
*
|
|
275
|
+
* - [x, y] => [lng, lat]
|
|
276
|
+
* - [x, y, z] => [lng, lat, Z]
|
|
277
|
+
*
|
|
278
|
+
* @param xyz - screen coordinates, z as pixel depth
|
|
279
|
+
* @param options - options
|
|
280
|
+
* @param options.topLeft=true - Whether projected coords are top left
|
|
281
|
+
* @param options.targetZ=0 - If pixel depth is unknown, targetZ is used as
|
|
282
|
+
* the elevation plane to unproject onto
|
|
283
|
+
* @return - [lng, lat, Z] or [X, Y, Z]
|
|
284
|
+
*/
|
|
285
|
+
unproject = (xyz: number[], options: {topLeft?: boolean; targetZ?: number} = {}): number[] => {
|
|
286
|
+
const {topLeft = true, targetZ = undefined} = options;
|
|
287
|
+
const [x, y, z] = xyz;
|
|
288
|
+
|
|
289
|
+
const y2 = topLeft ? y : this.height - y;
|
|
290
|
+
const targetZWorld = targetZ && targetZ * this.distanceScales.unitsPerMeter[2];
|
|
291
|
+
const coord = pixelsToWorld([x, y2, z], this.pixelUnprojectionMatrix, targetZWorld);
|
|
292
|
+
const [X, Y, Z] = this.unprojectPosition(coord);
|
|
293
|
+
|
|
294
|
+
if (Number.isFinite(z)) {
|
|
295
|
+
return [X, Y, Z];
|
|
296
|
+
}
|
|
297
|
+
return Number.isFinite(targetZ) ? [X, Y, targetZ] : [X, Y];
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
// NON_LINEAR PROJECTION HOOKS
|
|
301
|
+
// Used for web meractor projection
|
|
302
|
+
|
|
303
|
+
projectPosition = (xyz: number[]): [number, number, number] => {
|
|
304
|
+
const [X, Y] = lngLatToWorld(xyz);
|
|
305
|
+
const Z = (xyz[2] || 0) * this.distanceScales.unitsPerMeter[2];
|
|
306
|
+
return [X, Y, Z];
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
unprojectPosition = (xyz: number[]): [number, number, number] => {
|
|
310
|
+
const [X, Y] = worldToLngLat(xyz);
|
|
311
|
+
const Z = (xyz[2] || 0) * this.distanceScales.metersPerUnit[2];
|
|
312
|
+
return [X, Y, Z];
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Project [lng,lat] on sphere onto [x,y] on 512*512 Mercator Zoom 0 tile.
|
|
317
|
+
* Performs the nonlinear part of the web mercator projection.
|
|
318
|
+
* Remaining projection is done with 4x4 matrices which also handles
|
|
319
|
+
* perspective.
|
|
320
|
+
*
|
|
321
|
+
* @param lngLat - [lng, lat] coordinates
|
|
322
|
+
* Specifies a point on the sphere to project onto the map.
|
|
323
|
+
* @return [x,y] coordinates.
|
|
324
|
+
*/
|
|
325
|
+
projectFlat(lngLat: number[]): number[] {
|
|
326
|
+
return lngLatToWorld(lngLat);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Unproject world point [x,y] on map onto {lat, lon} on sphere
|
|
331
|
+
*
|
|
332
|
+
* @param xy - array with [x,y] members
|
|
333
|
+
* representing point on projected map plane
|
|
334
|
+
* @return - array with [lat,lon] of point on sphere.
|
|
335
|
+
* Has toArray method if you need a GeoJSON Array.
|
|
336
|
+
* Per cartographic tradition, lat and lon are specified as degrees.
|
|
337
|
+
*/
|
|
338
|
+
unprojectFlat(xy: number[]): number[] {
|
|
339
|
+
return worldToLngLat(xy);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Get the map center that place a given [lng, lat] coordinate at screen point [x, y]
|
|
344
|
+
* @param opt
|
|
345
|
+
* @param opt.lngLat - [lng,lat] coordinates
|
|
346
|
+
* Specifies a point on the sphere.
|
|
347
|
+
* @param opt.pos - [x,y] coordinates
|
|
348
|
+
* Specifies a point on the screen.
|
|
349
|
+
* @return [lng,lat] new map center.
|
|
350
|
+
*/
|
|
351
|
+
getMapCenterByLngLatPosition({lngLat, pos}: {lngLat: number[]; pos: number[]}): number[] {
|
|
352
|
+
const fromLocation = pixelsToWorld(pos, this.pixelUnprojectionMatrix);
|
|
353
|
+
const toLocation = lngLatToWorld(lngLat);
|
|
354
|
+
const translate = vec2.add([], toLocation, vec2.negate([], fromLocation));
|
|
355
|
+
const newCenter = vec2.add([], this.center, translate);
|
|
356
|
+
return worldToLngLat(newCenter);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Returns a new viewport that fit around the given rectangle.
|
|
361
|
+
* Only supports non-perspective mode.
|
|
362
|
+
* @param bounds - [[lon, lat], [lon, lat]]
|
|
363
|
+
* @param [options]
|
|
364
|
+
* @param [options.padding] - The amount of padding in pixels to add to the given bounds.
|
|
365
|
+
* @param [options.offset] - The center of the given bounds relative to the map's center,
|
|
366
|
+
* [x, y] measured in pixels.
|
|
367
|
+
* @returns {WebMercatorViewport}
|
|
368
|
+
*/
|
|
369
|
+
fitBounds(
|
|
370
|
+
bounds: [[number, number], [number, number]],
|
|
371
|
+
options: Omit<FitBoundsOptions, 'width' | 'height' | 'bounds'> = {}
|
|
372
|
+
): WebMercatorViewport {
|
|
373
|
+
const {width, height} = this;
|
|
374
|
+
const {longitude, latitude, zoom} = fitBounds(Object.assign({width, height, bounds}, options));
|
|
375
|
+
return new WebMercatorViewport({width, height, longitude, latitude, zoom});
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Returns the bounding box of the viewport.
|
|
380
|
+
* @param [options]
|
|
381
|
+
* @param [options.z] - The altitude at which the bounds should be calculated.
|
|
382
|
+
* @returns {Array} bounds - [[lon, lat], [lon, lat]]
|
|
383
|
+
*/
|
|
384
|
+
getBounds(options?: {z?: number}): number[][] {
|
|
385
|
+
const corners = this.getBoundingRegion(options);
|
|
386
|
+
|
|
387
|
+
const west = Math.min(...corners.map(p => p[0]));
|
|
388
|
+
const east = Math.max(...corners.map(p => p[0]));
|
|
389
|
+
const south = Math.min(...corners.map(p => p[1]));
|
|
390
|
+
const north = Math.max(...corners.map(p => p[1]));
|
|
391
|
+
return [
|
|
392
|
+
[west, south],
|
|
393
|
+
[east, north]
|
|
394
|
+
];
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Returns the bounding box of the viewport.
|
|
399
|
+
* @param [options]
|
|
400
|
+
* @param [options.z] - The altitude at which the bounds should be calculated.
|
|
401
|
+
* @returns {Array} an array of 4 points that define the visible region
|
|
402
|
+
*/
|
|
403
|
+
getBoundingRegion(options: {z?: number} = {}): number[][] {
|
|
404
|
+
return getBounds(this, options.z || 0);
|
|
405
|
+
}
|
|
406
|
+
}
|
package/src/web-mercator.ts
CHANGED