@math.gl/geospatial 5.0.0-beta.3 → 5.0.0-beta.5
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 +192 -2
- package/THIRD-PARTY-NOTICES.md +192 -20
- package/dist/expressions.d.ts +1 -1
- package/dist/expressions.d.ts.map +1 -1
- package/dist/index.cjs +456 -4614
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +9 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/projection/experimental/common/adjust_lat.js +1 -1
- package/dist/projection/experimental/common/adjust_lat.js.map +1 -1
- package/dist/projection/experimental/common/adjust_lon.js +1 -1
- package/dist/projection/experimental/common/adjust_lon.js.map +1 -1
- package/dist/projection/experimental/common/asinhy.js +1 -1
- package/dist/projection/experimental/common/asinhy.js.map +1 -1
- package/dist/projection/experimental/common/asinz.js +1 -1
- package/dist/projection/experimental/common/asinz.js.map +1 -1
- package/dist/projection/experimental/common/authlat.js +1 -1
- package/dist/projection/experimental/common/authlat.js.map +1 -1
- package/dist/projection/experimental/common/authset.js +1 -1
- package/dist/projection/experimental/common/authset.js.map +1 -1
- package/dist/projection/experimental/common/clens.js +1 -1
- package/dist/projection/experimental/common/clens.js.map +1 -1
- package/dist/projection/experimental/common/clens_cmplx.js +1 -1
- package/dist/projection/experimental/common/clens_cmplx.js.map +1 -1
- package/dist/projection/experimental/common/constants.js +1 -1
- package/dist/projection/experimental/common/constants.js.map +1 -1
- package/dist/projection/experimental/common/cosh.js +1 -1
- package/dist/projection/experimental/common/cosh.js.map +1 -1
- package/dist/projection/experimental/common/e0fn.js +1 -1
- package/dist/projection/experimental/common/e0fn.js.map +1 -1
- package/dist/projection/experimental/common/e1fn.js +1 -1
- package/dist/projection/experimental/common/e1fn.js.map +1 -1
- package/dist/projection/experimental/common/e2fn.js +1 -1
- package/dist/projection/experimental/common/e2fn.js.map +1 -1
- package/dist/projection/experimental/common/e3fn.js +1 -1
- package/dist/projection/experimental/common/e3fn.js.map +1 -1
- package/dist/projection/experimental/common/fL.js +1 -1
- package/dist/projection/experimental/common/fL.js.map +1 -1
- package/dist/projection/experimental/common/gN.js +1 -1
- package/dist/projection/experimental/common/gN.js.map +1 -1
- package/dist/projection/experimental/common/gatg.js +1 -1
- package/dist/projection/experimental/common/gatg.js.map +1 -1
- package/dist/projection/experimental/common/hypot.js +1 -1
- package/dist/projection/experimental/common/hypot.js.map +1 -1
- package/dist/projection/experimental/common/imlfn.js +1 -1
- package/dist/projection/experimental/common/imlfn.js.map +1 -1
- package/dist/projection/experimental/common/invlatiso.js +1 -1
- package/dist/projection/experimental/common/invlatiso.js.map +1 -1
- package/dist/projection/experimental/common/iqsfnz.js +1 -1
- package/dist/projection/experimental/common/iqsfnz.js.map +1 -1
- package/dist/projection/experimental/common/latiso.js +1 -1
- package/dist/projection/experimental/common/latiso.js.map +1 -1
- package/dist/projection/experimental/common/log1py.js +1 -1
- package/dist/projection/experimental/common/log1py.js.map +1 -1
- package/dist/projection/experimental/common/mlfn.js +1 -1
- package/dist/projection/experimental/common/mlfn.js.map +1 -1
- package/dist/projection/experimental/common/msfnz.js +1 -1
- package/dist/projection/experimental/common/msfnz.js.map +1 -1
- package/dist/projection/experimental/common/phi2z.js +1 -1
- package/dist/projection/experimental/common/phi2z.js.map +1 -1
- package/dist/projection/experimental/common/pj_enfn.js +1 -1
- package/dist/projection/experimental/common/pj_enfn.js.map +1 -1
- package/dist/projection/experimental/common/pj_inv_mlfn.js +1 -1
- package/dist/projection/experimental/common/pj_inv_mlfn.js.map +1 -1
- package/dist/projection/experimental/common/pj_mlfn.js +1 -1
- package/dist/projection/experimental/common/pj_mlfn.js.map +1 -1
- package/dist/projection/experimental/common/qsfnz.js +1 -1
- package/dist/projection/experimental/common/qsfnz.js.map +1 -1
- package/dist/projection/experimental/common/sign.js +1 -1
- package/dist/projection/experimental/common/sign.js.map +1 -1
- package/dist/projection/experimental/common/sinh.js +1 -1
- package/dist/projection/experimental/common/sinh.js.map +1 -1
- package/dist/projection/experimental/common/srat.js +1 -1
- package/dist/projection/experimental/common/srat.js.map +1 -1
- package/dist/projection/experimental/common/tsfnz.js +1 -1
- package/dist/projection/experimental/common/tsfnz.js.map +1 -1
- package/dist/projection/experimental/common/vincenty.js +1 -1
- package/dist/projection/experimental/common/vincenty.js.map +1 -1
- package/dist/projection/experimental/core.cjs +100 -2
- package/dist/projection/experimental/core.cjs.map +2 -2
- package/dist/projection/experimental/core.d.ts +1 -0
- package/dist/projection/experimental/core.d.ts.map +1 -1
- package/dist/projection/experimental/crs/datum-table.js +1 -1
- package/dist/projection/experimental/crs/datum-table.js.map +1 -1
- package/dist/projection/experimental/crs/ellipsoid-table.js +1 -1
- package/dist/projection/experimental/crs/ellipsoid-table.js.map +1 -1
- package/dist/projection/experimental/crs/primemeridian-table.js +1 -1
- package/dist/projection/experimental/crs/primemeridian-table.js.map +1 -1
- package/dist/projection/experimental/crs/structured.js +1 -1
- package/dist/projection/experimental/crs/structured.js.map +1 -1
- package/dist/projection/experimental/crs/wkt.js +1 -1
- package/dist/projection/experimental/crs/wkt.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/ellipsoidal-gnomonic.js +1 -1
- package/dist/projection/experimental/ellipsoidal-gnomonic.js.map +1 -1
- package/dist/projection/experimental/entries/projections/eqc.cjs +1 -0
- package/dist/projection/experimental/entries/projections/eqc.cjs.map +1 -1
- package/dist/projection/experimental/entries/projections/merc.cjs +1 -0
- package/dist/projection/experimental/entries/projections/merc.cjs.map +1 -1
- package/dist/projection/experimental/grids/geotiff.js +1 -1
- package/dist/projection/experimental/grids/geotiff.js.map +1 -1
- package/dist/projection/experimental/grids/ntv2.js +1 -1
- package/dist/projection/experimental/grids/ntv2.js.map +1 -1
- package/dist/projection/experimental/index.cjs +102 -2
- package/dist/projection/experimental/index.cjs.map +3 -3
- package/dist/projection/experimental/kernels/aea.js +1 -1
- package/dist/projection/experimental/kernels/aea.js.map +1 -1
- package/dist/projection/experimental/kernels/aeqd.js +1 -1
- package/dist/projection/experimental/kernels/aeqd.js.map +1 -1
- package/dist/projection/experimental/kernels/bonne.js +1 -1
- package/dist/projection/experimental/kernels/bonne.js.map +1 -1
- package/dist/projection/experimental/kernels/cass.js +1 -1
- package/dist/projection/experimental/kernels/cass.js.map +1 -1
- package/dist/projection/experimental/kernels/cea.js +1 -1
- package/dist/projection/experimental/kernels/cea.js.map +1 -1
- package/dist/projection/experimental/kernels/eck6.js +1 -1
- package/dist/projection/experimental/kernels/eck6.js.map +1 -1
- package/dist/projection/experimental/kernels/eqdc.js +1 -1
- package/dist/projection/experimental/kernels/eqdc.js.map +1 -1
- package/dist/projection/experimental/kernels/eqearth.js +1 -1
- package/dist/projection/experimental/kernels/eqearth.js.map +1 -1
- package/dist/projection/experimental/kernels/equi.js +1 -1
- package/dist/projection/experimental/kernels/equi.js.map +1 -1
- package/dist/projection/experimental/kernels/etmerc.js +1 -1
- package/dist/projection/experimental/kernels/etmerc.js.map +1 -1
- package/dist/projection/experimental/kernels/gauss.js +1 -1
- package/dist/projection/experimental/kernels/gauss.js.map +1 -1
- package/dist/projection/experimental/kernels/geos.js +1 -1
- package/dist/projection/experimental/kernels/geos.js.map +1 -1
- package/dist/projection/experimental/kernels/gnom.js +1 -1
- package/dist/projection/experimental/kernels/gnom.js.map +1 -1
- package/dist/projection/experimental/kernels/gstmerc.js +1 -1
- package/dist/projection/experimental/kernels/gstmerc.js.map +1 -1
- package/dist/projection/experimental/kernels/krovak.js +1 -1
- package/dist/projection/experimental/kernels/krovak.js.map +1 -1
- package/dist/projection/experimental/kernels/laea.js +1 -1
- package/dist/projection/experimental/kernels/laea.js.map +1 -1
- package/dist/projection/experimental/kernels/lcc.js +1 -1
- package/dist/projection/experimental/kernels/lcc.js.map +1 -1
- package/dist/projection/experimental/kernels/mill.js +1 -1
- package/dist/projection/experimental/kernels/mill.js.map +1 -1
- package/dist/projection/experimental/kernels/moll.js +1 -1
- package/dist/projection/experimental/kernels/moll.js.map +1 -1
- package/dist/projection/experimental/kernels/nzmg.js +1 -1
- package/dist/projection/experimental/kernels/nzmg.js.map +1 -1
- package/dist/projection/experimental/kernels/omerc.js +1 -1
- package/dist/projection/experimental/kernels/omerc.js.map +1 -1
- package/dist/projection/experimental/kernels/poly.js +1 -1
- package/dist/projection/experimental/kernels/poly.js.map +1 -1
- package/dist/projection/experimental/kernels/qsc.js +1 -1
- package/dist/projection/experimental/kernels/qsc.js.map +1 -1
- package/dist/projection/experimental/kernels/robin.js +1 -1
- package/dist/projection/experimental/kernels/robin.js.map +1 -1
- package/dist/projection/experimental/kernels/sinu.js +1 -1
- package/dist/projection/experimental/kernels/sinu.js.map +1 -1
- package/dist/projection/experimental/kernels/somerc.js +1 -1
- package/dist/projection/experimental/kernels/somerc.js.map +1 -1
- package/dist/projection/experimental/kernels/stere.js +1 -1
- package/dist/projection/experimental/kernels/stere.js.map +1 -1
- package/dist/projection/experimental/kernels/sterea.js +1 -1
- package/dist/projection/experimental/kernels/sterea.js.map +1 -1
- package/dist/projection/experimental/kernels/tmerc.js +1 -1
- package/dist/projection/experimental/kernels/tmerc.js.map +1 -1
- package/dist/projection/experimental/kernels/tpers.js +1 -1
- package/dist/projection/experimental/kernels/tpers.js.map +1 -1
- package/dist/projection/experimental/kernels/vandg.js +1 -1
- package/dist/projection/experimental/kernels/vandg.js.map +1 -1
- package/dist/projection/experimental/kinematic-helmert.js +1 -1
- package/dist/projection/experimental/kinematic-helmert.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/index.cjs +100 -2
- package/dist/projection/experimental/lazy-projections/index.cjs.map +2 -2
- package/dist/projection/experimental/projections/equidistant-cylindrical.d.ts.map +1 -1
- package/dist/projection/experimental/projections/equidistant-cylindrical.js +1 -0
- package/dist/projection/experimental/projections/equidistant-cylindrical.js.map +1 -1
- package/dist/projection/experimental/projections/mercator.d.ts.map +1 -1
- package/dist/projection/experimental/projections/mercator.js +1 -0
- package/dist/projection/experimental/projections/mercator.js.map +1 -1
- package/dist/projection/experimental/transform-description.d.ts +8 -0
- package/dist/projection/experimental/transform-description.d.ts.map +1 -0
- package/dist/projection/experimental/transform-description.js +57 -0
- package/dist/projection/experimental/transform-description.js.map +1 -0
- package/dist/projection/experimental/types.d.ts +5 -0
- package/dist/projection/experimental/types.d.ts.map +1 -1
- package/dist/projection/experimental/typescript-projection.d.ts +4 -0
- package/dist/projection/experimental/typescript-projection.d.ts.map +1 -1
- package/dist/projection/experimental/typescript-projection.js +54 -5
- package/dist/projection/experimental/typescript-projection.js.map +1 -1
- package/dist/projection/index.cjs +102 -2
- package/dist/projection/index.cjs.map +3 -3
- package/dist/projection/transform-analysis.cjs +100 -2
- package/dist/projection/transform-analysis.cjs.map +2 -2
- package/dist/projection/transform-description.d.ts +44 -0
- package/dist/projection/transform-description.d.ts.map +1 -0
- package/dist/projection/transform-description.js +5 -0
- package/dist/projection/transform-description.js.map +1 -0
- package/dist/projection/types.d.ts +4 -0
- package/dist/projection/types.d.ts.map +1 -1
- package/dist/tasks/definitions.d.ts +3 -3
- package/dist/tasks/index.cjs +107 -2
- package/dist/tasks/index.cjs.map +3 -3
- package/dist/tasks/index.d.ts +1 -1
- package/dist/tasks/index.d.ts.map +1 -1
- package/dist/tasks/map-worker.js +1 -1
- package/dist/tasks/map-worker.js.map +1 -1
- package/dist/tasks/operations.d.ts +1 -1
- package/dist/tasks/operations.d.ts.map +1 -1
- package/dist/tasks/projection-worker.js +1 -1
- package/dist/tasks/projection-worker.js.map +1 -1
- package/dist/terrain/contour-boundary-diagnostics.d.ts +23 -0
- package/dist/terrain/contour-boundary-diagnostics.d.ts.map +1 -0
- package/dist/terrain/contour-boundary-diagnostics.js +62 -0
- package/dist/terrain/contour-boundary-diagnostics.js.map +1 -0
- package/dist/terrain/contour-mixed-weld.d.ts +25 -0
- package/dist/terrain/contour-mixed-weld.d.ts.map +1 -0
- package/dist/terrain/contour-mixed-weld.js +194 -0
- package/dist/terrain/contour-mixed-weld.js.map +1 -0
- package/dist/terrain/contour-tile-paths.d.ts +7 -0
- package/dist/terrain/contour-tile-paths.d.ts.map +1 -0
- package/dist/terrain/contour-tile-paths.js +12 -0
- package/dist/terrain/contour-tile-paths.js.map +1 -0
- package/dist/terrain/contour-tile-weld.d.ts +24 -0
- package/dist/terrain/contour-tile-weld.d.ts.map +1 -0
- package/dist/terrain/contour-tile-weld.js +147 -0
- package/dist/terrain/contour-tile-weld.js.map +1 -0
- package/dist/terrain/gradient-pyramid.d.ts +29 -0
- package/dist/terrain/gradient-pyramid.d.ts.map +1 -0
- package/dist/terrain/gradient-pyramid.js +94 -0
- package/dist/terrain/gradient-pyramid.js.map +1 -0
- package/dist/terrain/height-field.d.ts.map +1 -1
- package/dist/terrain/height-field.js +48 -5
- package/dist/terrain/height-field.js.map +1 -1
- package/dist/terrain/index.cjs +448 -4
- package/dist/terrain/index.cjs.map +3 -3
- package/dist/terrain/index.d.ts +9 -0
- package/dist/terrain/index.d.ts.map +1 -1
- package/dist/terrain/index.js +5 -0
- package/dist/terrain/index.js.map +1 -1
- package/dist/terrain/tiled.d.ts +10 -2
- package/dist/terrain/tiled.d.ts.map +1 -1
- package/dist/terrain/tiled.js +5 -1
- package/dist/terrain/tiled.js.map +1 -1
- package/dist/terrain/types.d.ts +6 -0
- package/dist/terrain/types.d.ts.map +1 -1
- package/dist/turf.cjs +25 -671
- package/dist/turf.cjs.map +3 -3
- 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/package.json +15 -19
- package/src/expressions.ts +1 -1
- package/src/index.ts +15 -123
- package/src/projection/experimental/common/adjust_lat.ts +1 -1
- package/src/projection/experimental/common/adjust_lon.ts +1 -1
- package/src/projection/experimental/common/asinhy.ts +1 -1
- package/src/projection/experimental/common/asinz.ts +1 -1
- package/src/projection/experimental/common/authlat.ts +1 -1
- package/src/projection/experimental/common/authset.ts +1 -1
- package/src/projection/experimental/common/clens.ts +1 -1
- package/src/projection/experimental/common/clens_cmplx.ts +1 -1
- package/src/projection/experimental/common/constants.ts +1 -1
- package/src/projection/experimental/common/cosh.ts +1 -1
- package/src/projection/experimental/common/e0fn.ts +1 -1
- package/src/projection/experimental/common/e1fn.ts +1 -1
- package/src/projection/experimental/common/e2fn.ts +1 -1
- package/src/projection/experimental/common/e3fn.ts +1 -1
- package/src/projection/experimental/common/fL.ts +1 -1
- package/src/projection/experimental/common/gN.ts +1 -1
- package/src/projection/experimental/common/gatg.ts +1 -1
- package/src/projection/experimental/common/hypot.ts +1 -1
- package/src/projection/experimental/common/imlfn.ts +1 -1
- package/src/projection/experimental/common/invlatiso.ts +1 -1
- package/src/projection/experimental/common/iqsfnz.ts +1 -1
- package/src/projection/experimental/common/latiso.ts +1 -1
- package/src/projection/experimental/common/log1py.ts +1 -1
- package/src/projection/experimental/common/mlfn.ts +1 -1
- package/src/projection/experimental/common/msfnz.ts +1 -1
- package/src/projection/experimental/common/phi2z.ts +1 -1
- package/src/projection/experimental/common/pj_enfn.ts +1 -1
- package/src/projection/experimental/common/pj_inv_mlfn.ts +1 -1
- package/src/projection/experimental/common/pj_mlfn.ts +1 -1
- package/src/projection/experimental/common/qsfnz.ts +1 -1
- package/src/projection/experimental/common/sign.ts +1 -1
- package/src/projection/experimental/common/sinh.ts +1 -1
- package/src/projection/experimental/common/srat.ts +1 -1
- package/src/projection/experimental/common/tsfnz.ts +1 -1
- package/src/projection/experimental/common/vincenty.ts +1 -1
- package/src/projection/experimental/core.ts +8 -0
- package/src/projection/experimental/crs/datum-table.ts +1 -1
- package/src/projection/experimental/crs/ellipsoid-table.ts +1 -1
- package/src/projection/experimental/crs/primemeridian-table.ts +1 -1
- package/src/projection/experimental/crs/structured.ts +1 -1
- package/src/projection/experimental/crs/wkt.ts +1 -1
- package/src/projection/experimental/datum.ts +1 -1
- package/src/projection/experimental/ellipsoidal-gnomonic.ts +1 -1
- package/src/projection/experimental/exact-helmert.ts +1 -1
- package/src/projection/experimental/grids/geotiff.ts +1 -1
- package/src/projection/experimental/grids/grid.ts +1 -1
- package/src/projection/experimental/grids/ntv2.ts +1 -1
- package/src/projection/experimental/helmert-flat.ts +1 -1
- package/src/projection/experimental/kernels/aea.ts +1 -1
- package/src/projection/experimental/kernels/aeqd.ts +1 -1
- package/src/projection/experimental/kernels/bonne.ts +1 -1
- package/src/projection/experimental/kernels/cass.ts +1 -1
- package/src/projection/experimental/kernels/cea.ts +1 -1
- package/src/projection/experimental/kernels/eck6.ts +1 -1
- package/src/projection/experimental/kernels/eqdc.ts +1 -1
- package/src/projection/experimental/kernels/eqearth.ts +1 -1
- package/src/projection/experimental/kernels/equi.ts +1 -1
- package/src/projection/experimental/kernels/etmerc.ts +1 -1
- package/src/projection/experimental/kernels/gauss.ts +1 -1
- package/src/projection/experimental/kernels/geos.ts +1 -1
- package/src/projection/experimental/kernels/gnom.ts +1 -1
- package/src/projection/experimental/kernels/gstmerc.ts +1 -1
- package/src/projection/experimental/kernels/krovak.ts +1 -1
- package/src/projection/experimental/kernels/laea.ts +1 -1
- package/src/projection/experimental/kernels/lcc.ts +1 -1
- package/src/projection/experimental/kernels/mill.ts +1 -1
- package/src/projection/experimental/kernels/moll.ts +1 -1
- package/src/projection/experimental/kernels/nzmg.ts +1 -1
- package/src/projection/experimental/kernels/omerc.ts +1 -1
- package/src/projection/experimental/kernels/ortho.ts +1 -1
- package/src/projection/experimental/kernels/poly.ts +1 -1
- package/src/projection/experimental/kernels/qsc.ts +1 -1
- package/src/projection/experimental/kernels/robin.ts +1 -1
- package/src/projection/experimental/kernels/sinu.ts +1 -1
- package/src/projection/experimental/kernels/somerc.ts +1 -1
- package/src/projection/experimental/kernels/stere.ts +1 -1
- package/src/projection/experimental/kernels/sterea.ts +1 -1
- package/src/projection/experimental/kernels/tmerc.ts +1 -1
- package/src/projection/experimental/kernels/tpers.ts +1 -1
- package/src/projection/experimental/kernels/vandg.ts +1 -1
- package/src/projection/experimental/kinematic-helmert-flat.ts +1 -1
- package/src/projection/experimental/kinematic-helmert.ts +1 -1
- package/src/projection/experimental/projection-pipeline.ts +1 -1
- package/src/projection/experimental/projections/equidistant-cylindrical.ts +1 -0
- package/src/projection/experimental/projections/mercator.ts +1 -0
- package/src/projection/experimental/projections/ob-tran.ts +1 -1
- package/src/projection/experimental/transform-description.ts +82 -0
- package/src/projection/experimental/types.ts +5 -0
- package/src/projection/experimental/typescript-projection.ts +54 -6
- package/src/projection/transform-description.ts +69 -0
- package/src/projection/types.ts +11 -0
- package/src/tasks/definitions.ts +1 -1
- package/src/tasks/index.ts +1 -1
- package/src/tasks/map-worker.ts +1 -1
- package/src/tasks/operations.ts +1 -1
- package/src/tasks/projection-worker.ts +1 -1
- package/src/terrain/contour-boundary-diagnostics.ts +90 -0
- package/src/terrain/contour-mixed-weld.ts +254 -0
- package/src/terrain/contour-tile-paths.ts +20 -0
- package/src/terrain/contour-tile-weld.ts +182 -0
- package/src/terrain/gradient-pyramid.ts +129 -0
- package/src/terrain/height-field.ts +45 -5
- package/src/terrain/index.ts +12 -0
- package/src/terrain/tiled.ts +16 -3
- package/src/terrain/types.ts +9 -1
- package/src/turf.ts +7 -3
- package/crs/README.md +0 -84
- package/crs/schemas/README.md +0 -9
- package/dist/geoarrow/builder-entry.d.ts +0 -4
- package/dist/geoarrow/builder-entry.d.ts.map +0 -1
- package/dist/geoarrow/builder-entry.js +0 -5
- package/dist/geoarrow/builder-entry.js.map +0 -1
- package/dist/geoarrow/builder.d.ts +0 -106
- package/dist/geoarrow/builder.d.ts.map +0 -1
- package/dist/geoarrow/builder.js +0 -668
- package/dist/geoarrow/builder.js.map +0 -1
- package/dist/geoarrow/codecs.d.ts +0 -24
- package/dist/geoarrow/codecs.d.ts.map +0 -1
- package/dist/geoarrow/codecs.js +0 -916
- package/dist/geoarrow/codecs.js.map +0 -1
- package/dist/geoarrow/index.cjs +0 -4352
- package/dist/geoarrow/index.cjs.map +0 -6
- package/dist/geoarrow/index.d.ts +0 -21
- package/dist/geoarrow/index.d.ts.map +0 -1
- package/dist/geoarrow/index.js +0 -15
- package/dist/geoarrow/index.js.map +0 -1
- package/dist/geoarrow/kernels.d.ts +0 -56
- package/dist/geoarrow/kernels.d.ts.map +0 -1
- package/dist/geoarrow/kernels.js +0 -982
- package/dist/geoarrow/kernels.js.map +0 -1
- package/dist/geoarrow/layout.d.ts +0 -66
- package/dist/geoarrow/layout.d.ts.map +0 -1
- package/dist/geoarrow/layout.js +0 -723
- package/dist/geoarrow/layout.js.map +0 -1
- package/dist/geoarrow/stream-tessellate.d.ts +0 -34
- package/dist/geoarrow/stream-tessellate.d.ts.map +0 -1
- package/dist/geoarrow/stream-tessellate.js +0 -171
- package/dist/geoarrow/stream-tessellate.js.map +0 -1
- package/dist/geoarrow/stream.d.ts +0 -29
- package/dist/geoarrow/stream.d.ts.map +0 -1
- package/dist/geoarrow/stream.js +0 -100
- package/dist/geoarrow/stream.js.map +0 -1
- package/dist/geoarrow/tessellate.d.ts +0 -31
- package/dist/geoarrow/tessellate.d.ts.map +0 -1
- package/dist/geoarrow/tessellate.js +0 -102
- package/dist/geoarrow/tessellate.js.map +0 -1
- package/dist/geoarrow/tessellation-entry.d.ts +0 -4
- package/dist/geoarrow/tessellation-entry.d.ts.map +0 -1
- package/dist/geoarrow/tessellation-entry.js +0 -5
- package/dist/geoarrow/tessellation-entry.js.map +0 -1
- package/dist/geoarrow/types.d.ts +0 -155
- package/dist/geoarrow/types.d.ts.map +0 -1
- package/dist/geoarrow/types.js +0 -71
- package/dist/geoarrow/types.js.map +0 -1
- package/dist/geoarrow/views.d.ts +0 -45
- package/dist/geoarrow/views.d.ts.map +0 -1
- package/dist/geoarrow/views.js +0 -114
- package/dist/geoarrow/views.js.map +0 -1
- package/dist/geoarrow/wkb-entry.d.ts +0 -4
- package/dist/geoarrow/wkb-entry.d.ts.map +0 -1
- package/dist/geoarrow/wkb-entry.js +0 -6
- package/dist/geoarrow/wkb-entry.js.map +0 -1
- package/dist/geoarrow/worker.d.ts +0 -11
- package/dist/geoarrow/worker.d.ts.map +0 -1
- package/dist/geoarrow/worker.js +0 -10
- package/dist/geoarrow/worker.js.map +0 -1
- package/dist/wkb/index.d.ts +0 -11
- package/dist/wkb/index.d.ts.map +0 -1
- package/dist/wkb/index.js +0 -9
- package/dist/wkb/index.js.map +0 -1
- package/dist/wkb/types.d.ts +0 -30
- package/dist/wkb/types.d.ts.map +0 -1
- package/dist/wkb/types.js +0 -34
- package/dist/wkb/types.js.map +0 -1
- package/dist/wkb/wkb-builder.d.ts +0 -91
- package/dist/wkb/wkb-builder.d.ts.map +0 -1
- package/dist/wkb/wkb-builder.js +0 -283
- package/dist/wkb/wkb-builder.js.map +0 -1
- package/dist/wkb/wkb-reader.d.ts +0 -74
- package/dist/wkb/wkb-reader.d.ts.map +0 -1
- package/dist/wkb/wkb-reader.js +0 -251
- package/dist/wkb/wkb-reader.js.map +0 -1
- package/dist/wkb/wkb.d.ts +0 -21
- package/dist/wkb/wkb.d.ts.map +0 -1
- package/dist/wkb/wkb.js +0 -204
- package/dist/wkb/wkb.js.map +0 -1
- package/dist/wkb/wkt.d.ts +0 -19
- package/dist/wkb/wkt.d.ts.map +0 -1
- package/dist/wkb/wkt.js +0 -321
- package/dist/wkb/wkt.js.map +0 -1
- package/projection/THIRD-PARTY-NOTICES.md +0 -210
- package/src/discontinuous/elastic/README.md +0 -20
- package/src/discontinuous/spherical-clip/README.md +0 -16
- package/src/discontinuous/world-kernels/README.md +0 -24
- package/src/geoarrow/builder-entry.ts +0 -18
- package/src/geoarrow/builder.ts +0 -860
- package/src/geoarrow/codecs.ts +0 -1268
- package/src/geoarrow/index.ts +0 -111
- package/src/geoarrow/kernels.ts +0 -1290
- package/src/geoarrow/layout.ts +0 -900
- package/src/geoarrow/stream-tessellate.ts +0 -205
- package/src/geoarrow/stream.ts +0 -130
- package/src/geoarrow/tessellate.ts +0 -133
- package/src/geoarrow/tessellation-entry.ts +0 -7
- package/src/geoarrow/types.ts +0 -259
- package/src/geoarrow/views.ts +0 -150
- package/src/geoarrow/wkb-entry.ts +0 -13
- package/src/geoarrow/worker.ts +0 -20
- package/src/terrain/vendor/README.md +0 -20
- package/src/vendor/geographiclib-geodesic/README.md +0 -26
- package/src/wkb/index.ts +0 -38
- package/src/wkb/types.ts +0 -54
- package/src/wkb/wkb-builder.ts +0 -395
- package/src/wkb/wkb-reader.ts +0 -401
- package/src/wkb/wkb.ts +0 -255
- package/src/wkb/wkt.ts +0 -375
- /package/{projection/APACHE-2.0-LICENSE.txt → APACHE-2.0-LICENSE.txt} +0 -0
- /package/{projection/PROJ-LICENSE.txt → PROJ-LICENSE.txt} +0 -0
- /package/{projection/PROJ4-LICENSE.md → PROJ4-LICENSE.md} +0 -0
- /package/{crs/schemas → src/crs}/projjson.schema.json +0 -0
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
// math.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
import {earcut} from '@math.gl/geometry';
|
|
6
|
-
import type {GeoArrowColumn} from './types';
|
|
7
|
-
import {streamGeoArrow, type GeoArrowGeometryStream, type StreamGeoArrowOptions} from './stream';
|
|
8
|
-
|
|
9
|
-
/** Resource-bounded planar tessellation after a synchronous external geometry stream. */
|
|
10
|
-
export type TessellateGeoArrowStreamOptions = StreamGeoArrowOptions & {
|
|
11
|
-
/** Construct a clipping/resampling stream around the supplied sink. Closures stay in the
|
|
12
|
-
* executing thread; worker requests should carry serializable factory names/parameters.
|
|
13
|
-
*/
|
|
14
|
-
createStream?: (sink: GeoArrowGeometryStream) => GeoArrowGeometryStream;
|
|
15
|
-
/** Default 65536, counting all emitted polygon coordinates, including discarded rings. */
|
|
16
|
-
maxVertices?: number;
|
|
17
|
-
/** Default 131072. */
|
|
18
|
-
maxTriangles?: number;
|
|
19
|
-
/** Default 1000000; bounds ring containment classification work. */
|
|
20
|
-
maxRingComparisons?: number;
|
|
21
|
-
};
|
|
22
|
-
/** Flat XY geometry and source-row attribution, ready for rendering or explicit transfer. */
|
|
23
|
-
export type GeoArrowStreamMesh = {
|
|
24
|
-
positions: Float64Array;
|
|
25
|
-
indices: Uint32Array;
|
|
26
|
-
/** Vertex offsets with terminal sentinel, one per output polygon. */
|
|
27
|
-
polygonStarts: Uint32Array;
|
|
28
|
-
/** Source row per output polygon; split components retain the original row. */
|
|
29
|
-
polygonSourceRows: Uint32Array;
|
|
30
|
-
/** Source row per output vertex. */
|
|
31
|
-
sourceRowIndices: Uint32Array;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/** Tessellate polygon output from a geometry stream; points and standalone lines are ignored.
|
|
35
|
-
* The transform must emit finite planar simple rings with disjoint or nested interiors.
|
|
36
|
-
* Ring containment distinguishes split exteriors from holes independently of winding. No
|
|
37
|
-
* spherical clipping, rewinding or CRS inference is performed here. All work is synchronous;
|
|
38
|
-
* run this function in a task worker for expensive transforms. Partial results are never returned.
|
|
39
|
-
*/
|
|
40
|
-
export function tessellateGeoArrowStream(
|
|
41
|
-
column: GeoArrowColumn,
|
|
42
|
-
options: TessellateGeoArrowStreamOptions = {}
|
|
43
|
-
): GeoArrowStreamMesh {
|
|
44
|
-
const {maxVertices = 65536, maxTriangles = 131072, maxRingComparisons = 1000000} = options;
|
|
45
|
-
if (
|
|
46
|
-
![maxVertices, maxTriangles, maxRingComparisons].every(
|
|
47
|
-
v => Number.isSafeInteger(v) && v >= 0 && v <= 0xffffffff
|
|
48
|
-
)
|
|
49
|
-
)
|
|
50
|
-
throw new RangeError('Invalid stream limits');
|
|
51
|
-
const positions: number[] = [],
|
|
52
|
-
indices: number[] = [],
|
|
53
|
-
polygonStarts = [0],
|
|
54
|
-
polygonSourceRows: number[] = [],
|
|
55
|
-
sourceRowIndices: number[] = [];
|
|
56
|
-
let row = 0,
|
|
57
|
-
vertices = 0,
|
|
58
|
-
comparisons = 0,
|
|
59
|
-
inPolygon = false;
|
|
60
|
-
let rings: number[][] = [],
|
|
61
|
-
ring: number[] | null = null;
|
|
62
|
-
const sink: GeoArrowGeometryStream = {
|
|
63
|
-
polygonStart() {
|
|
64
|
-
if (inPolygon) throw new Error('Nested stream polygon');
|
|
65
|
-
inPolygon = true;
|
|
66
|
-
rings = [];
|
|
67
|
-
},
|
|
68
|
-
lineStart() {
|
|
69
|
-
if (inPolygon) {
|
|
70
|
-
if (ring) throw new Error('Nested stream ring');
|
|
71
|
-
ring = [];
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
point(x, y) {
|
|
75
|
-
if (!inPolygon) return;
|
|
76
|
-
if (!ring || !Number.isFinite(x) || !Number.isFinite(y))
|
|
77
|
-
throw new Error('Invalid polygon stream point');
|
|
78
|
-
if (++vertices > maxVertices) throw new RangeError('Stream exceeded maxVertices');
|
|
79
|
-
ring.push(x, y);
|
|
80
|
-
},
|
|
81
|
-
lineEnd() {
|
|
82
|
-
if (!inPolygon) return;
|
|
83
|
-
if (!ring) throw new Error('Missing stream ring');
|
|
84
|
-
if (
|
|
85
|
-
ring.length >= 4 &&
|
|
86
|
-
ring[0] === ring[ring.length - 2] &&
|
|
87
|
-
ring[1] === ring[ring.length - 1]
|
|
88
|
-
)
|
|
89
|
-
ring.splice(-2);
|
|
90
|
-
if (ring.length >= 6) rings.push(ring);
|
|
91
|
-
ring = null;
|
|
92
|
-
},
|
|
93
|
-
polygonEnd() {
|
|
94
|
-
if (!inPolygon || ring) throw new Error('Incomplete stream polygon');
|
|
95
|
-
const areas = rings.map(signedArea);
|
|
96
|
-
const parents = rings.map((r, i) => {
|
|
97
|
-
let parent = -1;
|
|
98
|
-
for (let j = 0; j < rings.length; j++) {
|
|
99
|
-
if (++comparisons > maxRingComparisons)
|
|
100
|
-
throw new RangeError('Stream exceeded maxRingComparisons');
|
|
101
|
-
if (
|
|
102
|
-
Math.abs(areas[j]) > Math.abs(areas[i]) &&
|
|
103
|
-
(parent < 0 || Math.abs(areas[j]) < Math.abs(areas[parent])) &&
|
|
104
|
-
containsRing(rings[j], r)
|
|
105
|
-
)
|
|
106
|
-
parent = j;
|
|
107
|
-
}
|
|
108
|
-
return parent;
|
|
109
|
-
});
|
|
110
|
-
const depths = parents.map(parent => {
|
|
111
|
-
let depth = 0;
|
|
112
|
-
while (parent >= 0) {
|
|
113
|
-
depth++;
|
|
114
|
-
parent = parents[parent];
|
|
115
|
-
}
|
|
116
|
-
return depth;
|
|
117
|
-
});
|
|
118
|
-
for (let i = 0; i < rings.length; i++) {
|
|
119
|
-
if (depths[i] % 2 || areas[i] === 0) continue;
|
|
120
|
-
const flat = [...rings[i]],
|
|
121
|
-
holes: number[] = [];
|
|
122
|
-
for (let j = 0; j < rings.length; j++)
|
|
123
|
-
if (parents[j] === i) {
|
|
124
|
-
holes.push(flat.length / 2);
|
|
125
|
-
for (const value of rings[j]) flat.push(value);
|
|
126
|
-
}
|
|
127
|
-
const triangles = earcut(flat, holes, 2);
|
|
128
|
-
if (indices.length / 3 + triangles.length / 3 > maxTriangles)
|
|
129
|
-
throw new RangeError('Stream exceeded maxTriangles');
|
|
130
|
-
const start = positions.length / 2;
|
|
131
|
-
for (const value of flat) positions.push(value);
|
|
132
|
-
for (let j = 0; j < flat.length / 2; j++) sourceRowIndices.push(row);
|
|
133
|
-
for (const index of triangles) indices.push(start + index);
|
|
134
|
-
polygonSourceRows.push(row);
|
|
135
|
-
polygonStarts.push(positions.length / 2);
|
|
136
|
-
}
|
|
137
|
-
rings = [];
|
|
138
|
-
inPolygon = false;
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
const stream = options.createStream?.(sink) ?? sink;
|
|
142
|
-
streamGeoArrow(column, stream, {
|
|
143
|
-
...options,
|
|
144
|
-
onRowStart(index) {
|
|
145
|
-
if (index > 0xffffffff) throw new RangeError('Source row exceeds Uint32');
|
|
146
|
-
row = index;
|
|
147
|
-
options.onRowStart?.(index);
|
|
148
|
-
},
|
|
149
|
-
onRowEnd(index) {
|
|
150
|
-
if (inPolygon || ring) throw new Error('Stream must flush each source row synchronously');
|
|
151
|
-
options.onRowEnd?.(index);
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
return {
|
|
155
|
-
positions: new Float64Array(positions),
|
|
156
|
-
indices: new Uint32Array(indices),
|
|
157
|
-
polygonStarts: new Uint32Array(polygonStarts),
|
|
158
|
-
polygonSourceRows: new Uint32Array(polygonSourceRows),
|
|
159
|
-
sourceRowIndices: new Uint32Array(sourceRowIndices)
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
function signedArea(ring: number[]): number {
|
|
163
|
-
let result = 0;
|
|
164
|
-
for (let i = 2; i + 3 < ring.length; i += 2)
|
|
165
|
-
result +=
|
|
166
|
-
(ring[i] - ring[0]) * (ring[i + 3] - ring[1]) -
|
|
167
|
-
(ring[i + 1] - ring[1]) * (ring[i + 2] - ring[0]);
|
|
168
|
-
if (!Number.isFinite(result)) throw new RangeError('Unrepresentable stream ring area');
|
|
169
|
-
return result;
|
|
170
|
-
}
|
|
171
|
-
function containsRing(outer: number[], inner: number[]): boolean {
|
|
172
|
-
// Ignore shared boundary points. Testing edge midpoints also handles an inscribed
|
|
173
|
-
// ring whose vertices all lie on the exterior boundary.
|
|
174
|
-
for (let i = 0; i < inner.length; i += 2) {
|
|
175
|
-
const j = (i + 2) % inner.length;
|
|
176
|
-
for (const [x, y] of [
|
|
177
|
-
[inner[i], inner[i + 1]],
|
|
178
|
-
[inner[i] / 2 + inner[j] / 2, inner[i + 1] / 2 + inner[j + 1] / 2]
|
|
179
|
-
]) {
|
|
180
|
-
const location = locate(outer, x, y);
|
|
181
|
-
if (location !== 0) return location > 0;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
return true;
|
|
185
|
-
}
|
|
186
|
-
// -1 outside, 0 on the boundary, 1 inside.
|
|
187
|
-
function locate(ring: number[], x: number, y: number): number {
|
|
188
|
-
let inside = false;
|
|
189
|
-
for (let i = 0, j = ring.length - 2; i < ring.length; j = i, i += 2) {
|
|
190
|
-
const ax = ring[i],
|
|
191
|
-
ay = ring[i + 1],
|
|
192
|
-
bx = ring[j],
|
|
193
|
-
by = ring[j + 1];
|
|
194
|
-
if (
|
|
195
|
-
(bx - ax) * (y - ay) === (by - ay) * (x - ax) &&
|
|
196
|
-
x >= Math.min(ax, bx) &&
|
|
197
|
-
x <= Math.max(ax, bx) &&
|
|
198
|
-
y >= Math.min(ay, by) &&
|
|
199
|
-
y <= Math.max(ay, by)
|
|
200
|
-
)
|
|
201
|
-
return 0;
|
|
202
|
-
if (ay > y !== by > y && x < ((bx - ax) * (y - ay)) / (by - ay) + ax) inside = !inside;
|
|
203
|
-
}
|
|
204
|
-
return inside ? 1 : -1;
|
|
205
|
-
}
|
package/src/geoarrow/stream.ts
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
// math.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
import type {GeoArrowArray, GeoArrowColumn, GeoArrowEncoding, GeoArrowDimension} from './types';
|
|
6
|
-
import {
|
|
7
|
-
getEncodingFromChildName,
|
|
8
|
-
getListRange,
|
|
9
|
-
isGeoArrowValueValid,
|
|
10
|
-
readCoordinate,
|
|
11
|
-
validateGeoArrowColumn
|
|
12
|
-
} from './layout';
|
|
13
|
-
import {assertGeoArrowResourceLimits, type GeoArrowResourceLimitOptions} from './kernels';
|
|
14
|
-
|
|
15
|
-
/** Synchronous XY geometry events, structurally compatible with a D3 geometry stream. */
|
|
16
|
-
export type GeoArrowGeometryStream = {
|
|
17
|
-
point(x: number, y: number): void;
|
|
18
|
-
lineStart(): void;
|
|
19
|
-
lineEnd(): void;
|
|
20
|
-
polygonStart(): void;
|
|
21
|
-
polygonEnd(): void;
|
|
22
|
-
};
|
|
23
|
-
/** Streaming resource and source-row controls. */
|
|
24
|
-
export type StreamGeoArrowOptions = {
|
|
25
|
-
/** Added to logical row indices, including null rows. Default 0. */
|
|
26
|
-
sourceRowOffset?: number;
|
|
27
|
-
/** Called before/after all geometry events for each row, including null rows. */
|
|
28
|
-
onRowStart?: (rowIndex: number) => void;
|
|
29
|
-
onRowEnd?: (rowIndex: number) => void;
|
|
30
|
-
limits?: GeoArrowResourceLimitOptions;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
/** Emit native XY GeoArrow geometry directly from physical buffers, without materializing
|
|
34
|
-
* GeoJSON rows. Ring closing coordinates are omitted, as in D3's stream protocol. Null rows
|
|
35
|
-
* emit no geometry. Mixed geometries/collections preserve source-row identity. Winding, CRS
|
|
36
|
-
* conversion and spherical/planar edge semantics remain the caller's responsibility.
|
|
37
|
-
* XY only: higher-dimensional input is rejected rather than silently dropping Z/M. Serialized
|
|
38
|
-
* encodings and boxes must be decoded/converted first. Callbacks run synchronously and errors
|
|
39
|
-
* propagate; an external sink may contain partial output after an error.
|
|
40
|
-
*/
|
|
41
|
-
export function streamGeoArrow(
|
|
42
|
-
column: GeoArrowColumn,
|
|
43
|
-
stream: GeoArrowGeometryStream,
|
|
44
|
-
options: StreamGeoArrowOptions = {}
|
|
45
|
-
): void {
|
|
46
|
-
const offset = options.sourceRowOffset ?? 0;
|
|
47
|
-
if (
|
|
48
|
-
!Number.isSafeInteger(offset) ||
|
|
49
|
-
offset < 0 ||
|
|
50
|
-
!Number.isSafeInteger(offset + column.chunks.reduce((n, c) => n + c.length, 0))
|
|
51
|
-
)
|
|
52
|
-
throw new RangeError('Invalid source row offset');
|
|
53
|
-
if (!validateGeoArrowColumn(column).valid)
|
|
54
|
-
throw new RangeError('Invalid GeoArrow physical layout');
|
|
55
|
-
assertGeoArrowResourceLimits(column, options.limits);
|
|
56
|
-
function check(array: GeoArrowArray, encoding: GeoArrowEncoding, dimension: GeoArrowDimension) {
|
|
57
|
-
if (dimension !== 'xy' || ['geoarrow.wkb', 'geoarrow.wkt', 'geoarrow.box'].includes(encoding))
|
|
58
|
-
throw new RangeError('Geometry streams require native XY input');
|
|
59
|
-
if (array.kind === 'dense-union')
|
|
60
|
-
for (const child of array.children)
|
|
61
|
-
check(
|
|
62
|
-
child.data,
|
|
63
|
-
child.encoding || getEncodingFromChildName(child.name),
|
|
64
|
-
child.dimension ?? dimension
|
|
65
|
-
);
|
|
66
|
-
if (array.kind === 'list') check(array.child, encoding, dimension);
|
|
67
|
-
}
|
|
68
|
-
if (
|
|
69
|
-
column.dimension !== 'xy' ||
|
|
70
|
-
['geoarrow.wkb', 'geoarrow.wkt', 'geoarrow.box'].includes(column.encoding)
|
|
71
|
-
)
|
|
72
|
-
throw new RangeError('Geometry streams require native XY input');
|
|
73
|
-
for (const chunk of column.chunks) check(chunk, column.encoding, column.dimension);
|
|
74
|
-
function point(array: GeoArrowArray, index: number) {
|
|
75
|
-
const xy = readCoordinate(array, index);
|
|
76
|
-
if (xy === null || xy.every(Number.isNaN)) return;
|
|
77
|
-
if (!xy.every(Number.isFinite)) throw new RangeError('Nonfinite stream coordinate');
|
|
78
|
-
stream.point(xy[0], xy[1]);
|
|
79
|
-
}
|
|
80
|
-
function line(array: GeoArrowArray, index: number, closed: boolean) {
|
|
81
|
-
if (array.kind !== 'list' || !isGeoArrowValueValid(array.validity, index)) return;
|
|
82
|
-
let [start, end] = getListRange(array, index);
|
|
83
|
-
if (closed && end > start) {
|
|
84
|
-
const a = readCoordinate(array.child, start),
|
|
85
|
-
b = readCoordinate(array.child, end - 1);
|
|
86
|
-
if (a && b && a[0] === b[0] && a[1] === b[1]) end--;
|
|
87
|
-
}
|
|
88
|
-
stream.lineStart();
|
|
89
|
-
for (let i = start; i < end; i++) point(array.child, i);
|
|
90
|
-
stream.lineEnd();
|
|
91
|
-
}
|
|
92
|
-
function geometry(array: GeoArrowArray, index: number, encoding: GeoArrowEncoding) {
|
|
93
|
-
if (!isGeoArrowValueValid(array.validity, index)) return;
|
|
94
|
-
if (array.kind === 'dense-union') {
|
|
95
|
-
const physical = (array.offset || 0) + index;
|
|
96
|
-
const child = array.children.find(c => c.typeId === array.typeIds[physical])!;
|
|
97
|
-
geometry(
|
|
98
|
-
child.data,
|
|
99
|
-
array.valueOffsets[physical],
|
|
100
|
-
child.encoding || getEncodingFromChildName(child.name)
|
|
101
|
-
);
|
|
102
|
-
} else if (encoding === 'geoarrow.point') point(array, index);
|
|
103
|
-
else if (encoding === 'geoarrow.linestring') line(array, index, false);
|
|
104
|
-
else if (array.kind === 'list') {
|
|
105
|
-
const [start, end] = getListRange(array, index);
|
|
106
|
-
if (encoding === 'geoarrow.polygon') {
|
|
107
|
-
stream.polygonStart();
|
|
108
|
-
for (let i = start; i < end; i++) line(array.child, i, true);
|
|
109
|
-
stream.polygonEnd();
|
|
110
|
-
} else {
|
|
111
|
-
const childEncoding: GeoArrowEncoding =
|
|
112
|
-
encoding === 'geoarrow.multipoint'
|
|
113
|
-
? 'geoarrow.point'
|
|
114
|
-
: encoding === 'geoarrow.multilinestring'
|
|
115
|
-
? 'geoarrow.linestring'
|
|
116
|
-
: encoding === 'geoarrow.multipolygon'
|
|
117
|
-
? 'geoarrow.polygon'
|
|
118
|
-
: 'geoarrow.geometry';
|
|
119
|
-
for (let i = start; i < end; i++) geometry(array.child, i, childEncoding);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
let row = offset;
|
|
124
|
-
for (const chunk of column.chunks)
|
|
125
|
-
for (let i = 0; i < chunk.length; i++, row++) {
|
|
126
|
-
options.onRowStart?.(row);
|
|
127
|
-
geometry(chunk, i, column.encoding);
|
|
128
|
-
options.onRowEnd?.(row);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
// math.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
import {earcut} from '@math.gl/geometry';
|
|
6
|
-
import type {GeoArrowColumn, GeoArrowGeometryValue} from './types';
|
|
7
|
-
import {getGeoArrowDimensionSize} from './types';
|
|
8
|
-
import {materializeGeoArrowRows} from './layout';
|
|
9
|
-
import {assertGeoArrowResourceLimits, type GeoArrowResourceLimitOptions} from './kernels';
|
|
10
|
-
|
|
11
|
-
/** Options for polygon tessellation. */
|
|
12
|
-
export type TessellateGeoArrowPolygonsOptions = Readonly<{
|
|
13
|
-
/** Number of values emitted for each output vertex. Defaults to the input dimension. */
|
|
14
|
-
positionSize?: 2 | 3 | 4;
|
|
15
|
-
/** Value added to every source row index. */
|
|
16
|
-
sourceRowOffset?: number;
|
|
17
|
-
limits?: GeoArrowResourceLimitOptions;
|
|
18
|
-
}>;
|
|
19
|
-
|
|
20
|
-
/** Flat, renderer-ready output for polygon and multipolygon rows. */
|
|
21
|
-
export type GeoArrowTessellation = Readonly<{
|
|
22
|
-
positions: Float32Array;
|
|
23
|
-
/** Source column row for every emitted vertex. */
|
|
24
|
-
sourceRowIndices: Uint32Array;
|
|
25
|
-
indices: Uint16Array | Uint32Array;
|
|
26
|
-
sourceDimension: 2 | 3 | 4;
|
|
27
|
-
positionSize: 2 | 3 | 4;
|
|
28
|
-
rowCount: number;
|
|
29
|
-
polygonCount: number;
|
|
30
|
-
vertexCount: number;
|
|
31
|
-
triangleCount: number;
|
|
32
|
-
}>;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Tessellates Polygon and MultiPolygon values with stable source-row attribution.
|
|
36
|
-
*
|
|
37
|
-
* Non-polygon members of mixed columns and geometry collections are skipped. Closing coordinates
|
|
38
|
-
* are removed before triangulation and all input descriptors remain borrowed and untouched.
|
|
39
|
-
*/
|
|
40
|
-
export function tessellateGeoArrowPolygons(
|
|
41
|
-
column: GeoArrowColumn,
|
|
42
|
-
options: TessellateGeoArrowPolygonsOptions = {}
|
|
43
|
-
): GeoArrowTessellation {
|
|
44
|
-
assertGeoArrowResourceLimits(column, options.limits);
|
|
45
|
-
const rows = materializeGeoArrowRows(column);
|
|
46
|
-
const sourceDimension = getGeoArrowDimensionSize(column.dimension);
|
|
47
|
-
const positionSize = options.positionSize || sourceDimension;
|
|
48
|
-
const sourceRowOffset = options.sourceRowOffset || 0;
|
|
49
|
-
const positions: number[] = [];
|
|
50
|
-
const sourceRowIndices: number[] = [];
|
|
51
|
-
const indices: number[] = [];
|
|
52
|
-
let polygonCount = 0;
|
|
53
|
-
|
|
54
|
-
for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
|
|
55
|
-
const row = rows[rowIndex];
|
|
56
|
-
if (row) {
|
|
57
|
-
visitPolygons(row, polygon => {
|
|
58
|
-
const vertexOffset = positions.length / positionSize;
|
|
59
|
-
const flatCoordinates: number[] = [];
|
|
60
|
-
const holeIndices: number[] = [];
|
|
61
|
-
let localVertexCount = 0;
|
|
62
|
-
|
|
63
|
-
for (let ringIndex = 0; ringIndex < polygon.length; ringIndex++) {
|
|
64
|
-
const ring = removeClosingCoordinate(polygon[ringIndex]);
|
|
65
|
-
if (ring.length < 3) continue;
|
|
66
|
-
if (localVertexCount > 0) holeIndices.push(localVertexCount);
|
|
67
|
-
for (const coordinate of ring) {
|
|
68
|
-
for (let component = 0; component < sourceDimension; component++) {
|
|
69
|
-
flatCoordinates.push(coordinate[component] ?? 0);
|
|
70
|
-
}
|
|
71
|
-
for (let component = 0; component < positionSize; component++) {
|
|
72
|
-
positions.push(coordinate[component] ?? 0);
|
|
73
|
-
}
|
|
74
|
-
sourceRowIndices.push(sourceRowOffset + rowIndex);
|
|
75
|
-
localVertexCount++;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (localVertexCount >= 3) {
|
|
80
|
-
const localIndices = earcut(flatCoordinates, holeIndices, sourceDimension);
|
|
81
|
-
for (const index of localIndices) indices.push(vertexOffset + index);
|
|
82
|
-
polygonCount++;
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const vertexCount = positions.length / positionSize;
|
|
89
|
-
const IndexArray = vertexCount <= 65535 ? Uint16Array : Uint32Array;
|
|
90
|
-
return {
|
|
91
|
-
positions: Float32Array.from(positions),
|
|
92
|
-
sourceRowIndices: Uint32Array.from(sourceRowIndices),
|
|
93
|
-
indices: IndexArray.from(indices),
|
|
94
|
-
sourceDimension,
|
|
95
|
-
positionSize,
|
|
96
|
-
rowCount: rows.length,
|
|
97
|
-
polygonCount,
|
|
98
|
-
vertexCount,
|
|
99
|
-
triangleCount: indices.length / 3
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function visitPolygons(
|
|
104
|
-
geometry: GeoArrowGeometryValue,
|
|
105
|
-
visitor: (polygon: readonly (readonly (readonly number[])[])[]) => void
|
|
106
|
-
): void {
|
|
107
|
-
switch (geometry.type) {
|
|
108
|
-
case 'Polygon':
|
|
109
|
-
visitor(geometry.coordinates);
|
|
110
|
-
break;
|
|
111
|
-
case 'MultiPolygon':
|
|
112
|
-
for (const polygon of geometry.coordinates) visitor(polygon);
|
|
113
|
-
break;
|
|
114
|
-
case 'GeometryCollection':
|
|
115
|
-
for (const child of geometry.geometries) visitPolygons(child, visitor);
|
|
116
|
-
break;
|
|
117
|
-
default:
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function removeClosingCoordinate(
|
|
123
|
-
ring: readonly (readonly number[])[]
|
|
124
|
-
): readonly (readonly number[])[] {
|
|
125
|
-
if (ring.length < 2) return ring;
|
|
126
|
-
const first = ring[0];
|
|
127
|
-
const last = ring[ring.length - 1];
|
|
128
|
-
if (first.length !== last.length) return ring;
|
|
129
|
-
for (let index = 0; index < first.length; index++) {
|
|
130
|
-
if (first[index] !== last[index]) return ring;
|
|
131
|
-
}
|
|
132
|
-
return ring.slice(0, -1);
|
|
133
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// math.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
/** Optional polygon tessellation subpath. */
|
|
6
|
-
export type {GeoArrowTessellation, TessellateGeoArrowPolygonsOptions} from './tessellate';
|
|
7
|
-
export {tessellateGeoArrowPolygons} from './tessellate';
|