@math.gl/geospatial 5.0.0-rc.2 → 5.0.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 +6 -6
- package/dist/coordinates.cjs +2523 -0
- package/dist/coordinates.cjs.map +6 -0
- package/dist/coordinates.d.ts +4 -0
- package/dist/coordinates.d.ts.map +1 -1
- package/dist/coordinates.js +2 -0
- package/dist/coordinates.js.map +1 -1
- package/dist/entries/ellipsoid.cjs +1209 -0
- package/dist/entries/ellipsoid.cjs.map +6 -0
- package/dist/entries/ellipsoid.d.ts +3 -19
- package/dist/entries/ellipsoid.d.ts.map +1 -1
- package/dist/entries/ellipsoid.js +1 -9
- package/dist/entries/ellipsoid.js.map +1 -1
- package/dist/expressions.cjs +726 -0
- package/dist/expressions.cjs.map +6 -0
- package/dist/geodesics.cjs +3195 -0
- package/dist/geodesics.cjs.map +6 -0
- package/dist/geodesics.d.ts +18 -0
- package/dist/geodesics.d.ts.map +1 -0
- package/dist/geodesics.js +13 -0
- package/dist/geodesics.js.map +1 -0
- package/dist/geographic-atlas/sampling.d.ts +1 -1
- package/dist/geographic-atlas/sampling.d.ts.map +1 -1
- package/dist/geographic-atlas/sampling.js +1 -1
- package/dist/geographic-atlas/sampling.js.map +1 -1
- package/dist/geographic-cuts.cjs +4160 -0
- package/dist/geographic-cuts.cjs.map +6 -0
- package/dist/geographic-cuts.d.ts +2 -0
- package/dist/geographic-cuts.d.ts.map +1 -1
- package/dist/geographic-cuts.js +1 -0
- package/dist/geographic-cuts.js.map +1 -1
- package/dist/geographic-seams/subdivide-cut.d.ts +1 -1
- package/dist/geographic-seams/subdivide-cut.d.ts.map +1 -1
- package/dist/geographic-seams/subdivide-cut.js +1 -1
- package/dist/geographic-seams/subdivide-cut.js.map +1 -1
- package/dist/geographic-seams/types.shared.cjs +32 -0
- package/dist/geographic-seams/types.shared.cjs.map +6 -0
- package/dist/globe.cjs +4223 -0
- package/dist/globe.cjs.map +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/line-simplification.d.ts +7 -0
- package/dist/line-simplification.d.ts.map +1 -1
- package/dist/line-simplification.js +4 -13
- package/dist/line-simplification.js.map +1 -1
- package/dist/linear-referencing.d.ts +13 -1
- package/dist/linear-referencing.d.ts.map +1 -1
- package/dist/linear-referencing.js +29 -9
- package/dist/linear-referencing.js.map +1 -1
- package/dist/maps/map-transition.shared.cjs +364 -0
- package/dist/maps/map-transition.shared.cjs.map +6 -0
- 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 +2 -2
- package/dist/maps/presets.cjs.map +2 -2
- package/dist/maps/transitions.cjs +3 -342
- package/dist/maps/transitions.cjs.map +3 -3
- package/dist/maps.cjs +15 -319
- package/dist/maps.cjs.map +3 -3
- package/dist/measure-referencing.d.ts +16 -0
- package/dist/measure-referencing.d.ts.map +1 -0
- package/dist/measure-referencing.js +143 -0
- package/dist/measure-referencing.js.map +1 -0
- package/dist/polygon-simplification.d.ts +6 -0
- package/dist/polygon-simplification.d.ts.map +1 -0
- package/dist/polygon-simplification.js +141 -0
- package/dist/polygon-simplification.js.map +1 -0
- package/dist/projection/experimental/core.cjs +63 -1317
- package/dist/projection/experimental/core.cjs.map +3 -3
- package/dist/projection/experimental/core.d.ts +1 -1
- package/dist/projection/experimental/core.d.ts.map +1 -1
- package/dist/projection/experimental/crs/projjson.cjs +26 -45
- package/dist/projection/experimental/crs/projjson.cjs.map +3 -3
- package/dist/projection/experimental/crs/types.shared.cjs +44 -0
- package/dist/projection/experimental/crs/types.shared.cjs.map +6 -0
- package/dist/projection/experimental/crs/wkt.cjs +36 -52
- package/dist/projection/experimental/crs/wkt.cjs.map +3 -3
- package/dist/projection/experimental/entries/projections/ob_tran.cjs +9 -23
- package/dist/projection/experimental/entries/projections/ob_tran.cjs.map +3 -3
- package/dist/projection/experimental/lazy-projections/aea.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/aea.js +1 -1
- package/dist/projection/experimental/lazy-projections/aeqd.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/aeqd.js +1 -1
- package/dist/projection/experimental/lazy-projections/bonne.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/bonne.js +1 -1
- package/dist/projection/experimental/lazy-projections/cass.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/cass.js +1 -1
- package/dist/projection/experimental/lazy-projections/cea.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/cea.js +1 -1
- package/dist/projection/experimental/lazy-projections/eck6.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/eck6.js +1 -1
- package/dist/projection/experimental/lazy-projections/eqc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/eqc.js +1 -1
- package/dist/projection/experimental/lazy-projections/eqdc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/eqdc.js +1 -1
- package/dist/projection/experimental/lazy-projections/eqearth.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/eqearth.js +1 -1
- package/dist/projection/experimental/lazy-projections/equi.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/equi.js +1 -1
- package/dist/projection/experimental/lazy-projections/etmerc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/etmerc.js +1 -1
- package/dist/projection/experimental/lazy-projections/geocent.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/geocent.js +1 -1
- package/dist/projection/experimental/lazy-projections/geos.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/geos.js +1 -1
- package/dist/projection/experimental/lazy-projections/gnom.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/gnom.js +1 -1
- package/dist/projection/experimental/lazy-projections/gstmerc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/gstmerc.js +1 -1
- package/dist/projection/experimental/lazy-projections/index.cjs +60 -903
- package/dist/projection/experimental/lazy-projections/index.cjs.map +3 -3
- package/dist/projection/experimental/lazy-projections/krovak.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/krovak.js +1 -1
- package/dist/projection/experimental/lazy-projections/laea.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/laea.js +1 -1
- package/dist/projection/experimental/lazy-projections/lcc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/lcc.js +1 -1
- package/dist/projection/experimental/lazy-projections/merc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/merc.js +1 -1
- package/dist/projection/experimental/lazy-projections/mill.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/mill.js +1 -1
- package/dist/projection/experimental/lazy-projections/moll.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/moll.js +1 -1
- package/dist/projection/experimental/lazy-projections/nzmg.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/nzmg.js +1 -1
- package/dist/projection/experimental/lazy-projections/ob_tran.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/ob_tran.js +1 -1
- package/dist/projection/experimental/lazy-projections/omerc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/omerc.js +1 -1
- package/dist/projection/experimental/lazy-projections/ortho.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/ortho.js +1 -1
- package/dist/projection/experimental/lazy-projections/poly.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/poly.js +1 -1
- package/dist/projection/experimental/lazy-projections/qsc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/qsc.js +1 -1
- package/dist/projection/experimental/lazy-projections/robin.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/robin.js +1 -1
- package/dist/projection/experimental/lazy-projections/sinu.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/sinu.js +1 -1
- package/dist/projection/experimental/lazy-projections/somerc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/somerc.js +1 -1
- package/dist/projection/experimental/lazy-projections/stere.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/stere.js +1 -1
- package/dist/projection/experimental/lazy-projections/sterea.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/sterea.js +1 -1
- package/dist/projection/experimental/lazy-projections/tmerc.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/tmerc.js +1 -1
- package/dist/projection/experimental/lazy-projections/tpers.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/tpers.js +1 -1
- package/dist/projection/experimental/lazy-projections/utm.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/utm.js +1 -1
- package/dist/projection/experimental/lazy-projections/vandg.cjs +1 -1
- package/dist/projection/experimental/lazy-projections/vandg.js +1 -1
- package/dist/projection/experimental/projection-engine.shared.cjs +1184 -0
- package/dist/projection/experimental/projection-engine.shared.cjs.map +6 -0
- package/dist/projection/experimental/typescript-projection.shared.cjs +1703 -0
- package/dist/projection/experimental/typescript-projection.shared.cjs.map +6 -0
- package/dist/projection/index.cjs +622 -1535
- package/dist/projection/index.cjs.map +3 -3
- package/dist/projection/pipeline.cjs +44 -58
- package/dist/projection/pipeline.cjs.map +3 -3
- package/dist/projection/transform-analysis.cjs +20 -936
- package/dist/projection/transform-analysis.cjs.map +3 -3
- package/dist/spatial-box-clipping.d.ts +9 -0
- package/dist/spatial-box-clipping.d.ts.map +1 -0
- package/dist/spatial-box-clipping.js +123 -0
- package/dist/spatial-box-clipping.js.map +1 -0
- package/dist/spatial-dwithin.d.ts +19 -0
- package/dist/spatial-dwithin.d.ts.map +1 -0
- package/dist/spatial-dwithin.js +107 -0
- package/dist/spatial-dwithin.js.map +1 -0
- package/dist/spatial-hulls.d.ts +6 -0
- package/dist/spatial-hulls.d.ts.map +1 -0
- package/dist/spatial-hulls.js +176 -0
- package/dist/spatial-hulls.js.map +1 -0
- package/dist/spatial-line-intersection-result.d.ts +4 -0
- package/dist/spatial-line-intersection-result.d.ts.map +1 -0
- package/dist/spatial-line-intersection-result.js +79 -0
- package/dist/spatial-line-intersection-result.js.map +1 -0
- package/dist/spatial-line-polygon-intersection.d.ts +4 -0
- package/dist/spatial-line-polygon-intersection.d.ts.map +1 -0
- package/dist/spatial-line-polygon-intersection.js +130 -0
- package/dist/spatial-line-polygon-intersection.js.map +1 -0
- package/dist/spatial-planar-intersects.d.ts +11 -0
- package/dist/spatial-planar-intersects.d.ts.map +1 -1
- package/dist/spatial-planar-intersects.js +20 -12
- package/dist/spatial-planar-intersects.js.map +1 -1
- package/dist/spatial-planar.d.ts +9 -0
- package/dist/spatial-planar.d.ts.map +1 -1
- package/dist/spatial-planar.js +13 -1
- package/dist/spatial-planar.js.map +1 -1
- package/dist/spatial-polygon-overlay.d.ts +5 -0
- package/dist/spatial-polygon-overlay.d.ts.map +1 -0
- package/dist/spatial-polygon-overlay.js +23 -0
- package/dist/spatial-polygon-overlay.js.map +1 -0
- package/dist/spatial-sql.d.ts +13 -2
- package/dist/spatial-sql.d.ts.map +1 -1
- package/dist/spatial-sql.js +30 -12
- package/dist/spatial-sql.js.map +1 -1
- package/dist/spatial-subdivision.d.ts +9 -0
- package/dist/spatial-subdivision.d.ts.map +1 -0
- package/dist/spatial-subdivision.js +61 -0
- package/dist/spatial-subdivision.js.map +1 -0
- package/dist/spatial-touches.d.ts +13 -0
- package/dist/spatial-touches.d.ts.map +1 -0
- package/dist/spatial-touches.js +192 -0
- package/dist/spatial-touches.js.map +1 -0
- package/dist/st-functions.cjs +2411 -112
- package/dist/st-functions.cjs.map +3 -3
- package/dist/st-functions.d.ts +67 -2
- package/dist/st-functions.d.ts.map +1 -1
- package/dist/st-functions.js +195 -12
- package/dist/st-functions.js.map +1 -1
- package/dist/st-geodesic-functions.d.ts +33 -0
- package/dist/st-geodesic-functions.d.ts.map +1 -0
- package/dist/st-geodesic-functions.js +84 -0
- package/dist/st-geodesic-functions.js.map +1 -0
- package/dist/st-hull-functions.cjs +386 -0
- package/dist/st-hull-functions.cjs.map +6 -0
- package/dist/st-hull-functions.d.ts +17 -0
- package/dist/st-hull-functions.d.ts.map +1 -0
- package/dist/st-hull-functions.js +14 -0
- package/dist/st-hull-functions.js.map +1 -0
- package/dist/st-overlay-functions.cjs +621 -0
- package/dist/st-overlay-functions.cjs.map +6 -0
- package/dist/st-overlay-functions.d.ts +36 -0
- package/dist/st-overlay-functions.d.ts.map +1 -0
- package/dist/st-overlay-functions.js +183 -0
- package/dist/st-overlay-functions.js.map +1 -0
- package/dist/st-viewport-functions.cjs +481 -0
- package/dist/st-viewport-functions.cjs.map +6 -0
- package/dist/st-viewport-functions.d.ts +13 -0
- package/dist/st-viewport-functions.d.ts.map +1 -0
- package/dist/st-viewport-functions.js +81 -0
- package/dist/st-viewport-functions.js.map +1 -0
- package/dist/subdivide-geodesic-polyline.d.ts +1 -1
- package/dist/subdivide-geodesic-polyline.d.ts.map +1 -1
- package/dist/subdivide-geodesic-polyline.js +1 -1
- package/dist/subdivide-geodesic-polyline.js.map +1 -1
- package/dist/subdivide-globe-mesh.d.ts +1 -1
- package/dist/subdivide-globe-mesh.d.ts.map +1 -1
- package/dist/subdivide-globe-mesh.js +1 -1
- package/dist/subdivide-globe-mesh.js.map +1 -1
- package/dist/subdivide-rhumb-polyline.d.ts +1 -1
- package/dist/subdivide-rhumb-polyline.d.ts.map +1 -1
- package/dist/subdivide-rhumb-polyline.js +1 -1
- package/dist/subdivide-rhumb-polyline.js.map +1 -1
- package/dist/tasks/index.cjs +808 -2993
- package/dist/tasks/index.cjs.map +3 -3
- package/dist/terrain/geometry.d.ts +1 -1
- package/dist/terrain/geometry.d.ts.map +1 -1
- package/dist/terrain/geometry.js +1 -1
- package/dist/terrain/geometry.js.map +1 -1
- package/dist/terrain/index.cjs +95 -22
- package/dist/terrain/index.cjs.map +3 -3
- package/dist/terrain/index.d.ts +1 -0
- package/dist/terrain/index.d.ts.map +1 -1
- package/dist/terrain/index.js +1 -0
- package/dist/terrain/index.js.map +1 -1
- package/dist/terrain/regional-watersheds.d.ts +44 -0
- package/dist/terrain/regional-watersheds.d.ts.map +1 -0
- package/dist/terrain/regional-watersheds.js +108 -0
- package/dist/terrain/regional-watersheds.js.map +1 -0
- package/dist/terrain/tile-cutout-update.d.ts.map +1 -1
- package/dist/terrain/tile-cutout-update.js +28 -22
- package/dist/terrain/tile-cutout-update.js.map +1 -1
- package/dist/tiles.cjs +354 -0
- package/dist/tiles.cjs.map +6 -0
- package/dist/turf-functions.cjs +16 -9
- package/dist/turf-functions.cjs.map +1 -1
- package/package.json +154 -117
- package/src/coordinates.ts +5 -0
- package/src/entries/ellipsoid.ts +7 -32
- package/src/geodesics.ts +40 -0
- package/src/geographic-atlas/sampling.ts +1 -1
- package/src/geographic-cuts.ts +21 -0
- package/src/geographic-seams/subdivide-cut.ts +1 -1
- package/src/index.ts +2 -0
- package/src/line-simplification.ts +4 -16
- package/src/linear-referencing.ts +44 -16
- package/src/maps/myriahedral/unfold.ts +1 -1
- package/src/measure-referencing.ts +165 -0
- package/src/polygon-simplification.ts +185 -0
- package/src/projection/experimental/core.ts +1 -1
- package/src/projection/experimental/lazy-projections/aea.ts +1 -1
- package/src/projection/experimental/lazy-projections/aeqd.ts +1 -1
- package/src/projection/experimental/lazy-projections/bonne.ts +1 -1
- package/src/projection/experimental/lazy-projections/cass.ts +1 -1
- package/src/projection/experimental/lazy-projections/cea.ts +1 -1
- package/src/projection/experimental/lazy-projections/eck6.ts +1 -1
- package/src/projection/experimental/lazy-projections/eqc.ts +1 -1
- package/src/projection/experimental/lazy-projections/eqdc.ts +1 -1
- package/src/projection/experimental/lazy-projections/eqearth.ts +1 -1
- package/src/projection/experimental/lazy-projections/equi.ts +1 -1
- package/src/projection/experimental/lazy-projections/etmerc.ts +1 -1
- package/src/projection/experimental/lazy-projections/geocent.ts +1 -1
- package/src/projection/experimental/lazy-projections/geos.ts +1 -1
- package/src/projection/experimental/lazy-projections/gnom.ts +1 -1
- package/src/projection/experimental/lazy-projections/gstmerc.ts +1 -1
- package/src/projection/experimental/lazy-projections/krovak.ts +1 -1
- package/src/projection/experimental/lazy-projections/laea.ts +1 -1
- package/src/projection/experimental/lazy-projections/lcc.ts +1 -1
- package/src/projection/experimental/lazy-projections/merc.ts +1 -1
- package/src/projection/experimental/lazy-projections/mill.ts +1 -1
- package/src/projection/experimental/lazy-projections/moll.ts +1 -1
- package/src/projection/experimental/lazy-projections/nzmg.ts +1 -1
- package/src/projection/experimental/lazy-projections/ob_tran.ts +1 -1
- package/src/projection/experimental/lazy-projections/omerc.ts +1 -1
- package/src/projection/experimental/lazy-projections/ortho.ts +1 -1
- package/src/projection/experimental/lazy-projections/poly.ts +1 -1
- package/src/projection/experimental/lazy-projections/qsc.ts +1 -1
- package/src/projection/experimental/lazy-projections/robin.ts +1 -1
- package/src/projection/experimental/lazy-projections/sinu.ts +1 -1
- package/src/projection/experimental/lazy-projections/somerc.ts +1 -1
- package/src/projection/experimental/lazy-projections/stere.ts +1 -1
- package/src/projection/experimental/lazy-projections/sterea.ts +1 -1
- package/src/projection/experimental/lazy-projections/tmerc.ts +1 -1
- package/src/projection/experimental/lazy-projections/tpers.ts +1 -1
- package/src/projection/experimental/lazy-projections/utm.ts +1 -1
- package/src/projection/experimental/lazy-projections/vandg.ts +1 -1
- package/src/spatial-box-clipping.ts +140 -0
- package/src/spatial-dwithin.ts +135 -0
- package/src/spatial-hulls.ts +203 -0
- package/src/spatial-line-intersection-result.ts +93 -0
- package/src/spatial-line-polygon-intersection.ts +147 -0
- package/src/spatial-planar-intersects.ts +21 -15
- package/src/spatial-planar.ts +20 -1
- package/src/spatial-polygon-overlay.ts +30 -0
- package/src/spatial-sql.ts +47 -12
- package/src/spatial-subdivision.ts +75 -0
- package/src/spatial-touches.ts +218 -0
- package/src/st-functions.ts +283 -15
- package/src/st-geodesic-functions.ts +121 -0
- package/src/st-hull-functions.ts +25 -0
- package/src/st-overlay-functions.ts +244 -0
- package/src/st-viewport-functions.ts +98 -0
- package/src/subdivide-geodesic-polyline.ts +2 -2
- package/src/subdivide-globe-mesh.ts +2 -2
- package/src/subdivide-rhumb-polyline.ts +2 -2
- package/src/terrain/geometry.ts +1 -1
- package/src/terrain/index.ts +7 -0
- package/src/terrain/regional-watersheds.ts +153 -0
- package/src/terrain/tile-cutout-update.ts +32 -26
- package/dist/index.cjs +0 -18674
- package/dist/index.cjs.map +0 -6
- package/dist/turf-expressions.cjs +0 -1997
- package/dist/turf-expressions.cjs.map +0 -6
- package/dist/turf-expressions.d.ts +0 -3
- package/dist/turf-expressions.d.ts.map +0 -1
- package/dist/turf-expressions.js +0 -7
- package/dist/turf-expressions.js.map +0 -1
- package/src/turf-expressions.ts +0 -7
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// dist/st-viewport-functions.js
|
|
30
|
+
var st_viewport_functions_exports = {};
|
|
31
|
+
__export(st_viewport_functions_exports, {
|
|
32
|
+
ST_CLIPBYBOX2D: () => ST_CLIPBYBOX2D,
|
|
33
|
+
ST_SUBDIVIDE: () => ST_SUBDIVIDE
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(st_viewport_functions_exports);
|
|
36
|
+
var import_apache_arrow2 = require("apache-arrow");
|
|
37
|
+
var import_arrow2 = require("@math.gl/core/arrow");
|
|
38
|
+
|
|
39
|
+
// dist/spatial-box-clipping.js
|
|
40
|
+
var import_polygon = require("@math.gl/geometry/polygon");
|
|
41
|
+
var import_polygon_clipping = __toESM(require("polygon-clipping"), 1);
|
|
42
|
+
|
|
43
|
+
// dist/geometry-inspection.js
|
|
44
|
+
function hasPosition(position) {
|
|
45
|
+
return position.length > 0 && !position.every(Number.isNaN);
|
|
46
|
+
}
|
|
47
|
+
function vertexCount(g) {
|
|
48
|
+
switch (g.type) {
|
|
49
|
+
case "Point":
|
|
50
|
+
return Number(hasPosition(g.coordinates));
|
|
51
|
+
case "MultiPoint":
|
|
52
|
+
return g.coordinates.reduce((sum, p) => sum + Number(hasPosition(p)), 0);
|
|
53
|
+
case "LineString":
|
|
54
|
+
return g.coordinates.length;
|
|
55
|
+
case "Polygon":
|
|
56
|
+
case "MultiLineString":
|
|
57
|
+
return g.coordinates.reduce((sum, path) => sum + path.length, 0);
|
|
58
|
+
case "MultiPolygon":
|
|
59
|
+
return g.coordinates.reduce((sum, polygon) => sum + polygon.reduce((count, ring) => count + ring.length, 0), 0);
|
|
60
|
+
case "GeometryCollection":
|
|
61
|
+
return g.geometries.reduce((sum, child) => sum + vertexCount(child), 0);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// dist/spatial-planar.js
|
|
66
|
+
function isPresentPoint(position) {
|
|
67
|
+
return Number.isFinite(position[0]) && Number.isFinite(position[1]);
|
|
68
|
+
}
|
|
69
|
+
function visitPaths(geometry, visit) {
|
|
70
|
+
switch (geometry.type) {
|
|
71
|
+
case "Point":
|
|
72
|
+
if (isPresentPoint(geometry.coordinates))
|
|
73
|
+
visit([geometry.coordinates]);
|
|
74
|
+
break;
|
|
75
|
+
case "MultiPoint":
|
|
76
|
+
visit(geometry.coordinates.filter(isPresentPoint));
|
|
77
|
+
break;
|
|
78
|
+
case "LineString":
|
|
79
|
+
visit(geometry.coordinates);
|
|
80
|
+
break;
|
|
81
|
+
case "MultiLineString":
|
|
82
|
+
case "Polygon":
|
|
83
|
+
geometry.coordinates.forEach(visit);
|
|
84
|
+
break;
|
|
85
|
+
case "MultiPolygon":
|
|
86
|
+
geometry.coordinates.forEach((polygon) => polygon.forEach(visit));
|
|
87
|
+
break;
|
|
88
|
+
case "GeometryCollection":
|
|
89
|
+
geometry.geometries.forEach((child) => visitPaths(child, visit));
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function planarBounds(geometry) {
|
|
94
|
+
let minX = Infinity;
|
|
95
|
+
let minY = Infinity;
|
|
96
|
+
let maxX = -Infinity;
|
|
97
|
+
let maxY = -Infinity;
|
|
98
|
+
visitPaths(geometry, (path) => {
|
|
99
|
+
for (const [x, y] of path) {
|
|
100
|
+
minX = Math.min(minX, x);
|
|
101
|
+
minY = Math.min(minY, y);
|
|
102
|
+
maxX = Math.max(maxX, x);
|
|
103
|
+
maxY = Math.max(maxY, y);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
return minX <= maxX ? [minX, minY, maxX, maxY] : null;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// dist/spatial-box-clipping.js
|
|
110
|
+
function containsPoint(point, [minX, minY, maxX, maxY]) {
|
|
111
|
+
const [x, y] = point;
|
|
112
|
+
return x > minX && x < maxX && y > minY && y < maxY;
|
|
113
|
+
}
|
|
114
|
+
function clipPath(path, box) {
|
|
115
|
+
if (path.some((point) => !Number.isFinite(point[0]) || !Number.isFinite(point[1]))) {
|
|
116
|
+
throw new Error("ST_ClipByBox2D requires finite line coordinates");
|
|
117
|
+
}
|
|
118
|
+
if (path.every((point) => containsPoint(point, box)))
|
|
119
|
+
return [path.map((point) => [...point])];
|
|
120
|
+
const [minX, minY, maxX, maxY] = box;
|
|
121
|
+
const paths = [];
|
|
122
|
+
for (const part of (0, import_polygon.clipPolyline)(path.flatMap((point) => [point[0], point[1]]), box)) {
|
|
123
|
+
let vertices = [];
|
|
124
|
+
for (let i = 2; i < part.length; i += 2) {
|
|
125
|
+
const ax = part[i - 2];
|
|
126
|
+
const ay = part[i - 1];
|
|
127
|
+
const bx = part[i];
|
|
128
|
+
const by = part[i + 1];
|
|
129
|
+
if (ax === bx && ay === by)
|
|
130
|
+
continue;
|
|
131
|
+
const boundary = ax === bx && (ax === minX || ax === maxX) || ay === by && (ay === minY || ay === maxY);
|
|
132
|
+
if (boundary) {
|
|
133
|
+
if (vertices.length)
|
|
134
|
+
paths.push(vertices);
|
|
135
|
+
vertices = [];
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
if (!vertices.length)
|
|
139
|
+
vertices.push([ax, ay]);
|
|
140
|
+
vertices.push([bx, by]);
|
|
141
|
+
}
|
|
142
|
+
if (vertices.length)
|
|
143
|
+
paths.push(vertices);
|
|
144
|
+
}
|
|
145
|
+
return paths;
|
|
146
|
+
}
|
|
147
|
+
function clipPolygons(polygons, [minX, minY, maxX, maxY]) {
|
|
148
|
+
const subject = polygons.filter((polygon) => {
|
|
149
|
+
var _a;
|
|
150
|
+
return (_a = polygon[0]) == null ? void 0 : _a.length;
|
|
151
|
+
}).map((rings) => rings.filter((ring) => ring.length).map((ring) => ring.map(([x, y]) => [x, y])));
|
|
152
|
+
if (!subject.length)
|
|
153
|
+
return [];
|
|
154
|
+
const rectangle = [
|
|
155
|
+
[
|
|
156
|
+
[minX, minY],
|
|
157
|
+
[maxX, minY],
|
|
158
|
+
[maxX, maxY],
|
|
159
|
+
[minX, maxY],
|
|
160
|
+
[minX, minY]
|
|
161
|
+
]
|
|
162
|
+
];
|
|
163
|
+
return import_polygon_clipping.default.intersection(subject, rectangle);
|
|
164
|
+
}
|
|
165
|
+
function clipParts(geometry, box) {
|
|
166
|
+
switch (geometry.type) {
|
|
167
|
+
case "Point":
|
|
168
|
+
return containsPoint(geometry.coordinates, box) ? [geometry] : [];
|
|
169
|
+
case "MultiPoint":
|
|
170
|
+
return geometry.coordinates.flatMap((coordinates) => containsPoint(coordinates, box) ? [{ type: "Point", coordinates }] : []);
|
|
171
|
+
case "LineString":
|
|
172
|
+
return geometry.coordinates.length ? clipPath(geometry.coordinates, box).map((coordinates) => ({
|
|
173
|
+
type: "LineString",
|
|
174
|
+
coordinates
|
|
175
|
+
})) : [];
|
|
176
|
+
case "MultiLineString":
|
|
177
|
+
return geometry.coordinates.flatMap((path) => path.length ? clipPath(path, box).map((coordinates) => ({ type: "LineString", coordinates })) : []);
|
|
178
|
+
case "Polygon":
|
|
179
|
+
case "MultiPolygon": {
|
|
180
|
+
const polygons = geometry.type === "Polygon" ? [geometry.coordinates] : geometry.coordinates;
|
|
181
|
+
return clipPolygons(polygons, box).map((coordinates) => ({ type: "Polygon", coordinates }));
|
|
182
|
+
}
|
|
183
|
+
case "GeometryCollection":
|
|
184
|
+
return geometry.geometries.flatMap((child) => clipParts(child, box));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function combineParts(parts) {
|
|
188
|
+
if (parts.length === 1)
|
|
189
|
+
return parts[0];
|
|
190
|
+
if (parts.length) {
|
|
191
|
+
if (parts.every((part) => part.type === "Point")) {
|
|
192
|
+
return { type: "MultiPoint", coordinates: parts.map((part) => part.coordinates) };
|
|
193
|
+
}
|
|
194
|
+
if (parts.every((part) => part.type === "LineString")) {
|
|
195
|
+
return { type: "MultiLineString", coordinates: parts.map((part) => part.coordinates) };
|
|
196
|
+
}
|
|
197
|
+
if (parts.every((part) => part.type === "Polygon")) {
|
|
198
|
+
return { type: "MultiPolygon", coordinates: parts.map((part) => part.coordinates) };
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return { type: "GeometryCollection", geometries: parts };
|
|
202
|
+
}
|
|
203
|
+
function clipGeometryByBox(geometry, boundsGeometry) {
|
|
204
|
+
const bounds = planarBounds(boundsGeometry);
|
|
205
|
+
if (!bounds)
|
|
206
|
+
return null;
|
|
207
|
+
if (!bounds.every(Number.isFinite))
|
|
208
|
+
throw new Error("ST_ClipByBox2D requires finite bounds");
|
|
209
|
+
if (!vertexCount(geometry))
|
|
210
|
+
return geometry;
|
|
211
|
+
if (bounds[0] === bounds[2] || bounds[1] === bounds[3]) {
|
|
212
|
+
throw new Error("ST_ClipByBox2D requires a rectangle with positive width and height");
|
|
213
|
+
}
|
|
214
|
+
return combineParts(clipParts(geometry, bounds));
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// dist/spatial-subdivision.js
|
|
218
|
+
var MAX_VERTICES = 256;
|
|
219
|
+
var MAX_DEPTH = 64;
|
|
220
|
+
function splitBox(box) {
|
|
221
|
+
const [minX, minY, maxX, maxY] = box;
|
|
222
|
+
if (maxX - minX >= maxY - minY) {
|
|
223
|
+
const mid2 = minX / 2 + maxX / 2;
|
|
224
|
+
if (mid2 > minX && mid2 < maxX)
|
|
225
|
+
return [
|
|
226
|
+
[minX, minY, mid2, maxY],
|
|
227
|
+
[mid2, minY, maxX, maxY]
|
|
228
|
+
];
|
|
229
|
+
}
|
|
230
|
+
const mid = minY / 2 + maxY / 2;
|
|
231
|
+
if (mid > minY && mid < maxY)
|
|
232
|
+
return [
|
|
233
|
+
[minX, minY, maxX, mid],
|
|
234
|
+
[minX, mid, maxX, maxY]
|
|
235
|
+
];
|
|
236
|
+
throw new Error("ST_Subdivide cannot bisect the polygon at the available coordinate precision");
|
|
237
|
+
}
|
|
238
|
+
function* subdividePolygons(geometry, signal) {
|
|
239
|
+
if (geometry.type !== "Polygon" && geometry.type !== "MultiPolygon") {
|
|
240
|
+
throw new Error("ST_Subdivide requires a Polygon or MultiPolygon");
|
|
241
|
+
}
|
|
242
|
+
const polygons = geometry.type === "Polygon" ? [geometry.coordinates] : geometry.coordinates;
|
|
243
|
+
for (const coordinates of polygons) {
|
|
244
|
+
yield* subdividePolygon({ type: "Polygon", coordinates }, 0, signal);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
function* subdividePolygon(polygon, depth, signal) {
|
|
248
|
+
signal == null ? void 0 : signal.throwIfAborted();
|
|
249
|
+
const count = vertexCount(polygon);
|
|
250
|
+
if (!count)
|
|
251
|
+
return;
|
|
252
|
+
if (count <= MAX_VERTICES) {
|
|
253
|
+
yield polygon;
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
if (depth >= MAX_DEPTH)
|
|
257
|
+
throw new Error("ST_Subdivide could not reach the vertex limit");
|
|
258
|
+
const bounds = planarBounds(polygon);
|
|
259
|
+
if (!(bounds == null ? void 0 : bounds.every(Number.isFinite)))
|
|
260
|
+
throw new Error("ST_Subdivide requires finite polygon bounds");
|
|
261
|
+
for (const box of splitBox(bounds)) {
|
|
262
|
+
for (const coordinates of clipPolygons([polygon.coordinates], box)) {
|
|
263
|
+
yield* subdividePolygon({ type: "Polygon", coordinates }, depth + 1, signal);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// dist/spatial-sql.js
|
|
269
|
+
var import_apache_arrow = require("apache-arrow");
|
|
270
|
+
var import_arrow = require("@math.gl/core/arrow");
|
|
271
|
+
var EXTENSION_NAME = "ARROW:extension:name";
|
|
272
|
+
var EXTENSION_METADATA = "ARROW:extension:metadata";
|
|
273
|
+
var geometryTypes = [
|
|
274
|
+
"Point",
|
|
275
|
+
"MultiPoint",
|
|
276
|
+
"LineString",
|
|
277
|
+
"MultiLineString",
|
|
278
|
+
"Polygon",
|
|
279
|
+
"MultiPolygon"
|
|
280
|
+
];
|
|
281
|
+
function readGeometryValue(vector, field, active, value, captureMembers = false) {
|
|
282
|
+
if (import_apache_arrow.DataType.isBinary(field.type) || import_apache_arrow.DataType.isLargeBinary(field.type)) {
|
|
283
|
+
return (row) => {
|
|
284
|
+
const { geometry, dimension, srid, members } = (0, import_arrow.parseWKB)(vector.get(row), {
|
|
285
|
+
captureMembers
|
|
286
|
+
});
|
|
287
|
+
if (srid)
|
|
288
|
+
throw new Error("Use GeoArrow field metadata for CRS information instead of EWKB SRIDs");
|
|
289
|
+
return value(geometry.type === "Point" && geometry.coordinates.every(Number.isNaN) ? { type: "Point", coordinates: [] } : geometry, dimension, members);
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
const column = readActiveGeoArrowColumn(vector, field, active);
|
|
293
|
+
const geometries = (0, import_arrow.materializeGeoArrowRows)(column);
|
|
294
|
+
return (row) => value(geometries[row], column.dimension);
|
|
295
|
+
}
|
|
296
|
+
function readActiveGeoArrowColumn(vector, field, active) {
|
|
297
|
+
const column = (0, import_arrow.makeGeoArrowColumnFromArrowVector)(vector, { field });
|
|
298
|
+
let offset = 0;
|
|
299
|
+
const chunks = column.chunks.map((chunk) => {
|
|
300
|
+
const start = offset;
|
|
301
|
+
offset += chunk.length;
|
|
302
|
+
let needsMask = false;
|
|
303
|
+
for (let row = 0; row < chunk.length; row++) {
|
|
304
|
+
if (!active[start + row] && (0, import_arrow.isGeoArrowValueValid)(chunk.validity, row)) {
|
|
305
|
+
needsMask = true;
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
if (!needsMask)
|
|
310
|
+
return chunk;
|
|
311
|
+
const values = new Uint8Array(Math.ceil(chunk.length / 8));
|
|
312
|
+
for (let row = 0; row < chunk.length; row++) {
|
|
313
|
+
if (active[start + row] && (0, import_arrow.isGeoArrowValueValid)(chunk.validity, row)) {
|
|
314
|
+
values[row >> 3] |= 1 << (row & 7);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return { ...chunk, validity: { values } };
|
|
318
|
+
});
|
|
319
|
+
return { ...column, chunks };
|
|
320
|
+
}
|
|
321
|
+
function planarGeometry(geometry, dimension) {
|
|
322
|
+
if (dimension !== "xy")
|
|
323
|
+
throw new Error("Spatial SQL functions require 2D geometry");
|
|
324
|
+
return geometry;
|
|
325
|
+
}
|
|
326
|
+
function spatialFunction(name, signatures, output, evaluate, numericArguments = 0, allDimensions = false, skipNullGeometries = false, validateCRS) {
|
|
327
|
+
const type = "encoding" in output ? output.type : output;
|
|
328
|
+
return {
|
|
329
|
+
kind: "scalar",
|
|
330
|
+
name,
|
|
331
|
+
prototypes: [],
|
|
332
|
+
/** Binds the allowed geometry types and result metadata to a call. */
|
|
333
|
+
resolvePrototype(fields) {
|
|
334
|
+
var _a;
|
|
335
|
+
if (fields.length !== signatures.length + numericArguments)
|
|
336
|
+
return void 0;
|
|
337
|
+
const geometryFields = fields.slice(0, signatures.length);
|
|
338
|
+
const numberFields = fields.slice(signatures.length).map((field) => {
|
|
339
|
+
if (field && !import_apache_arrow.DataType.isInt(field.type) && !import_apache_arrow.DataType.isFloat(field.type))
|
|
340
|
+
throw new Error(`${name} requires numeric arguments`);
|
|
341
|
+
return field ?? new import_apache_arrow.Field("number", new import_apache_arrow.Float64(), true);
|
|
342
|
+
});
|
|
343
|
+
const extensions = geometryFields.map((field, index) => {
|
|
344
|
+
if (!field)
|
|
345
|
+
return void 0;
|
|
346
|
+
const extension = (0, import_arrow.getGeoArrowFieldInfo)(field);
|
|
347
|
+
const encoding = extension == null ? void 0 : extension.encoding;
|
|
348
|
+
const kinds = signatures[index];
|
|
349
|
+
if (encoding === "geoarrow.wkb" && (import_apache_arrow.DataType.isBinary(field.type) || import_apache_arrow.DataType.isLargeBinary(field.type))) {
|
|
350
|
+
} else if (encoding === "geoarrow.geometry" && extension.dimension === "xy") {
|
|
351
|
+
} else if (kinds.some((kind) => encoding === "geoarrow." + kind.toLowerCase())) {
|
|
352
|
+
if (!allDimensions && (extension == null ? void 0 : extension.dimension) !== "xy")
|
|
353
|
+
throw new Error(`${name} requires 2D geometry`);
|
|
354
|
+
} else {
|
|
355
|
+
throw new Error(`${name} argument ${index + 1} requires GeoArrow ${kinds.join(" or ")}`);
|
|
356
|
+
}
|
|
357
|
+
validateCRS == null ? void 0 : validateCRS(extension == null ? void 0 : extension.metadata["crs"], name);
|
|
358
|
+
if (!validateCRS && name.startsWith("ST_") && name !== "ST_SRID" && name !== "ST_SetSRID" && (extension == null ? void 0 : extension.metadata["edges"]) === "spherical")
|
|
359
|
+
throw new Error(`${name} requires planar geometry`);
|
|
360
|
+
return extension;
|
|
361
|
+
});
|
|
362
|
+
const crsValues = extensions.map((extension) => extension == null ? void 0 : extension.metadata["crs"]).filter((crs) => crs !== void 0 && crs !== null);
|
|
363
|
+
if (!validateCRS && name.startsWith("ST_") && crsValues.some((crs) => JSON.stringify(crs) !== JSON.stringify(crsValues[0]))) {
|
|
364
|
+
throw new Error(`${name} requires arguments in the same CRS`);
|
|
365
|
+
}
|
|
366
|
+
const metadata = /* @__PURE__ */ new Map();
|
|
367
|
+
if ("encoding" in output || import_apache_arrow.DataType.isBinary(type)) {
|
|
368
|
+
metadata.set(EXTENSION_NAME, "encoding" in output ? output.encoding : "geoarrow.wkb");
|
|
369
|
+
const inputMetadata = (_a = extensions[0]) == null ? void 0 : _a.metadata;
|
|
370
|
+
const crs = inputMetadata == null ? void 0 : inputMetadata["crs"];
|
|
371
|
+
const crsType = crs === void 0 ? void 0 : inputMetadata == null ? void 0 : inputMetadata["crs_type"];
|
|
372
|
+
const edges = inputMetadata == null ? void 0 : inputMetadata["edges"];
|
|
373
|
+
if (crs !== void 0 || edges !== void 0) {
|
|
374
|
+
metadata.set(EXTENSION_METADATA, JSON.stringify({ crs, crs_type: crsType, edges }));
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
const arguments_ = [
|
|
378
|
+
...geometryFields.map((field) => field ?? new import_apache_arrow.Field("geometry", new import_apache_arrow.Binary(), true)),
|
|
379
|
+
...numberFields
|
|
380
|
+
];
|
|
381
|
+
return {
|
|
382
|
+
arguments: arguments_,
|
|
383
|
+
nullHandling: skipNullGeometries ? "call" : "propagate",
|
|
384
|
+
result: new import_apache_arrow.Field(name, type, true, metadata),
|
|
385
|
+
/** Evaluates active rows and retains their positions in the output batch. */
|
|
386
|
+
evaluate(vectors, { activeRows, length: rowCount }) {
|
|
387
|
+
const numbers = vectors.slice(signatures.length);
|
|
388
|
+
const readers = vectors.slice(0, signatures.length).map((vector, index) => readGeometryValue(vector, arguments_[index], activeRows, allDimensions ? (g, dimension, members) => ({ ...g, dimension, members }) : planarGeometry, name === "ST_GeometryN"));
|
|
389
|
+
const values = new Array(rowCount).fill(null);
|
|
390
|
+
for (let row = 0; row < rowCount; row++) {
|
|
391
|
+
if (!activeRows[row])
|
|
392
|
+
continue;
|
|
393
|
+
const geometries = [];
|
|
394
|
+
for (let index = 0; index < readers.length; index++) {
|
|
395
|
+
if (skipNullGeometries && !vectors[index].isValid(row))
|
|
396
|
+
continue;
|
|
397
|
+
const geometry = readers[index](row);
|
|
398
|
+
if (!signatures[index].includes(geometry.type))
|
|
399
|
+
throw new Error(`${name} argument ${index + 1} does not support ${geometry.type} at row ${row}`);
|
|
400
|
+
geometries.push(geometry);
|
|
401
|
+
}
|
|
402
|
+
values[row] = evaluate(geometries, ...numbers.map((vector) => Number(vector.get(row))));
|
|
403
|
+
}
|
|
404
|
+
return "encoding" in output ? output.build(values) : (0, import_apache_arrow.vectorFromArray)(values, output);
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
// dist/st-viewport-functions.js
|
|
412
|
+
function makeClipFunction() {
|
|
413
|
+
const clip = spatialFunction("ST_ClipByBox2D", [
|
|
414
|
+
[...geometryTypes, "GeometryCollection"],
|
|
415
|
+
[...geometryTypes, "GeometryCollection"]
|
|
416
|
+
], new import_apache_arrow2.Binary(), ([geometry, bounds]) => {
|
|
417
|
+
const clipped = clipGeometryByBox(geometry, bounds);
|
|
418
|
+
return clipped ? (0, import_arrow2.writeWKB)(clipped, "xy") : null;
|
|
419
|
+
});
|
|
420
|
+
return {
|
|
421
|
+
...clip,
|
|
422
|
+
/** Clips in place in coordinate space, so the bounds cannot supply a missing CRS. */
|
|
423
|
+
resolvePrototype(fields) {
|
|
424
|
+
var _a;
|
|
425
|
+
const prototype = clip.resolvePrototype(fields);
|
|
426
|
+
if (!((_a = fields[0]) == null ? void 0 : _a.metadata.has(EXTENSION_METADATA))) {
|
|
427
|
+
prototype == null ? void 0 : prototype.result.metadata.delete(EXTENSION_METADATA);
|
|
428
|
+
}
|
|
429
|
+
return prototype;
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
var ST_CLIPBYBOX2D = /* @__PURE__ */ makeClipFunction();
|
|
434
|
+
var ST_SUBDIVIDE = {
|
|
435
|
+
kind: "table",
|
|
436
|
+
name: "ST_Subdivide",
|
|
437
|
+
/** Binds one polygon column and declares a GeoArrow WKB output with its CRS. */
|
|
438
|
+
bindLateral({ argument, ordinality }) {
|
|
439
|
+
if (ordinality)
|
|
440
|
+
throw new Error("ST_Subdivide does not support WITH ORDINALITY");
|
|
441
|
+
const extension = (0, import_arrow2.getGeoArrowFieldInfo)(argument);
|
|
442
|
+
const encoding = extension == null ? void 0 : extension.encoding;
|
|
443
|
+
const isWKB = encoding === "geoarrow.wkb" && (import_apache_arrow2.DataType.isBinary(argument.type) || import_apache_arrow2.DataType.isLargeBinary(argument.type));
|
|
444
|
+
const isPolygon = encoding === "geoarrow.polygon" || encoding === "geoarrow.multipolygon";
|
|
445
|
+
if (!isWKB && !(isPolygon && (extension == null ? void 0 : extension.dimension) === "xy")) {
|
|
446
|
+
throw new Error("ST_Subdivide requires a 2D GeoArrow Polygon or MultiPolygon");
|
|
447
|
+
}
|
|
448
|
+
if ((extension == null ? void 0 : extension.metadata["edges"]) === "spherical") {
|
|
449
|
+
throw new Error("ST_Subdivide requires planar geometry");
|
|
450
|
+
}
|
|
451
|
+
const type = new import_apache_arrow2.Binary();
|
|
452
|
+
const metadata = new Map(argument.metadata);
|
|
453
|
+
metadata.set(EXTENSION_NAME, "geoarrow.wkb");
|
|
454
|
+
const outputSchema = new import_apache_arrow2.Schema([new import_apache_arrow2.Field("geometry", type, false, metadata)]);
|
|
455
|
+
return {
|
|
456
|
+
outputSchema,
|
|
457
|
+
/** Outputs polygon parts grouped by their original parent row indices. */
|
|
458
|
+
evaluate(input, { signal }) {
|
|
459
|
+
const values = input.getChild(argument.name);
|
|
460
|
+
const active = Uint8Array.from({ length: values.length }, (_, row) => Number(values.isValid(row)));
|
|
461
|
+
const read = readGeometryValue(values, argument, active, planarGeometry);
|
|
462
|
+
const parts = [];
|
|
463
|
+
const parentRows = [];
|
|
464
|
+
for (let row = 0; row < values.length; row++) {
|
|
465
|
+
signal == null ? void 0 : signal.throwIfAborted();
|
|
466
|
+
if (!active[row])
|
|
467
|
+
continue;
|
|
468
|
+
for (const part of subdividePolygons(read(row), signal)) {
|
|
469
|
+
parts.push((0, import_arrow2.writeWKB)(part, "xy"));
|
|
470
|
+
parentRows.push(row);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
return {
|
|
474
|
+
table: new import_apache_arrow2.Table(outputSchema, { geometry: (0, import_apache_arrow2.vectorFromArray)(parts, type) }),
|
|
475
|
+
parentRows: Int32Array.from(parentRows)
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
//# sourceMappingURL=st-viewport-functions.cjs.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/st-viewport-functions.ts", "../src/spatial-box-clipping.ts", "../src/geometry-inspection.ts", "../src/spatial-planar.ts", "../src/spatial-subdivision.ts", "../src/spatial-sql.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;AAIA,IAAAA,uBAAsE;AAEtE,IAAAC,gBAA6C;;;ACD7C,qBAA2B;AAC3B,8BAA4B;;;ACC5B,SAAS,YAAY,UAA2B;AAC9C,SAAO,SAAS,SAAS,KAAK,CAAC,SAAS,MAAM,OAAO,KAAK;AAC5D;AAGM,SAAU,YAAY,GAAoB;AAC9C,UAAQ,EAAE,MAAM;IACd,KAAK;AACH,aAAO,OAAO,YAAY,EAAE,WAAW,CAAC;IAC1C,KAAK;AACH,aAAO,EAAE,YAAY,OAAO,CAAC,KAAK,MAAM,MAAM,OAAO,YAAY,CAAC,CAAC,GAAG,CAAC;IACzE,KAAK;AACH,aAAO,EAAE,YAAY;IACvB,KAAK;IACL,KAAK;AACH,aAAO,EAAE,YAAY,OAAO,CAAC,KAAK,SAAS,MAAM,KAAK,QAAQ,CAAC;IACjE,KAAK;AACH,aAAO,EAAE,YAAY,OACnB,CAAC,KAAK,YAAY,MAAM,QAAQ,OAAO,CAAC,OAAO,SAAS,QAAQ,KAAK,QAAQ,CAAC,GAC9E,CAAC;IAEL,KAAK;AACH,aAAO,EAAE,WAAW,OAAO,CAAC,KAAK,UAAU,MAAM,YAAY,KAAK,GAAG,CAAC;EAC1E;AACF;;;ACmBA,SAAS,eAAe,UAAkB;AACxC,SAAO,OAAO,SAAS,SAAS,CAAC,CAAC,KAAK,OAAO,SAAS,SAAS,CAAC,CAAC;AACpE;AAGM,SAAU,WAAW,UAA6B,OAA2B;AACjF,UAAQ,SAAS,MAAM;IACrB,KAAK;AACH,UAAI,eAAe,SAAS,WAAW;AAAG,cAAM,CAAC,SAAS,WAAW,CAAC;AACtE;IACF,KAAK;AACH,YAAM,SAAS,YAAY,O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 'apache-arrow';
|
|
2
|
+
import type { TableFunction } from '@math.gl/sql/arrow';
|
|
3
|
+
/** Clips a geometry to the XY bounds of an envelope in the same coordinate system. */
|
|
4
|
+
export declare const ST_CLIPBYBOX2D: Readonly<{
|
|
5
|
+
name: string;
|
|
6
|
+
prototypes: readonly import("@math.gl/sql/arrow").ArrowTableFunctionPrototype[];
|
|
7
|
+
resolvePrototype?(fields: readonly (Field | undefined)[], numericLiterals?: readonly (number | undefined)[]): import("@math.gl/sql/arrow").ArrowTableFunctionPrototype | undefined;
|
|
8
|
+
}> & {
|
|
9
|
+
readonly kind: "scalar";
|
|
10
|
+
};
|
|
11
|
+
/** Emits polygon subdivisions through a lateral Arrow SQL join using the default vertex cap. */
|
|
12
|
+
export declare const ST_SUBDIVIDE: TableFunction;
|
|
13
|
+
//# sourceMappingURL=st-viewport-functions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"st-viewport-functions.d.ts","sourceRoot":"","sources":["../src/st-viewport-functions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,EAAiC,MAAM,cAAc,CAAC;AACrF,OAAO,KAAK,EAAiB,aAAa,EAAC,MAAM,oBAAoB,CAAC;AAwCtE,sFAAsF;AACtF,eAAO,MAAM,cAAc;;;;;;CAAqC,CAAC;AAEjE,gGAAgG;AAChG,eAAO,MAAM,YAAY,EAAE,aAgD1B,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
import { Binary, DataType, Field, Schema, Table, vectorFromArray } from 'apache-arrow';
|
|
5
|
+
import { getGeoArrowFieldInfo, writeWKB } from '@math.gl/core/arrow';
|
|
6
|
+
import { clipGeometryByBox } from "./spatial-box-clipping.js";
|
|
7
|
+
import { subdividePolygons } from "./spatial-subdivision.js";
|
|
8
|
+
import { EXTENSION_METADATA, EXTENSION_NAME, geometryTypes, planarGeometry, readGeometryValue, spatialFunction } from "./spatial-sql.js";
|
|
9
|
+
/** Binds the box clip while limiting output metadata to the geometry being clipped. */
|
|
10
|
+
function makeClipFunction() {
|
|
11
|
+
const clip = spatialFunction('ST_ClipByBox2D', [
|
|
12
|
+
[...geometryTypes, 'GeometryCollection'],
|
|
13
|
+
[...geometryTypes, 'GeometryCollection']
|
|
14
|
+
], new Binary(), ([geometry, bounds]) => {
|
|
15
|
+
const clipped = clipGeometryByBox(geometry, bounds);
|
|
16
|
+
return clipped ? writeWKB(clipped, 'xy') : null;
|
|
17
|
+
});
|
|
18
|
+
return {
|
|
19
|
+
...clip,
|
|
20
|
+
/** Clips in place in coordinate space, so the bounds cannot supply a missing CRS. */
|
|
21
|
+
resolvePrototype(fields) {
|
|
22
|
+
const prototype = clip.resolvePrototype(fields);
|
|
23
|
+
if (!fields[0]?.metadata.has(EXTENSION_METADATA)) {
|
|
24
|
+
prototype?.result.metadata.delete(EXTENSION_METADATA);
|
|
25
|
+
}
|
|
26
|
+
return prototype;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** Clips a geometry to the XY bounds of an envelope in the same coordinate system. */
|
|
31
|
+
export const ST_CLIPBYBOX2D = /* @__PURE__ */ makeClipFunction();
|
|
32
|
+
/** Emits polygon subdivisions through a lateral Arrow SQL join using the default vertex cap. */
|
|
33
|
+
export const ST_SUBDIVIDE = {
|
|
34
|
+
kind: 'table',
|
|
35
|
+
name: 'ST_Subdivide',
|
|
36
|
+
/** Binds one polygon column and declares a GeoArrow WKB output with its CRS. */
|
|
37
|
+
bindLateral({ argument, ordinality }) {
|
|
38
|
+
if (ordinality)
|
|
39
|
+
throw new Error('ST_Subdivide does not support WITH ORDINALITY');
|
|
40
|
+
const extension = getGeoArrowFieldInfo(argument);
|
|
41
|
+
const encoding = extension?.encoding;
|
|
42
|
+
const isWKB = encoding === 'geoarrow.wkb' &&
|
|
43
|
+
(DataType.isBinary(argument.type) || DataType.isLargeBinary(argument.type));
|
|
44
|
+
const isPolygon = encoding === 'geoarrow.polygon' || encoding === 'geoarrow.multipolygon';
|
|
45
|
+
if (!isWKB && !(isPolygon && extension?.dimension === 'xy')) {
|
|
46
|
+
throw new Error('ST_Subdivide requires a 2D GeoArrow Polygon or MultiPolygon');
|
|
47
|
+
}
|
|
48
|
+
if (extension?.metadata['edges'] === 'spherical') {
|
|
49
|
+
throw new Error('ST_Subdivide requires planar geometry');
|
|
50
|
+
}
|
|
51
|
+
const type = new Binary();
|
|
52
|
+
const metadata = new Map(argument.metadata);
|
|
53
|
+
metadata.set(EXTENSION_NAME, 'geoarrow.wkb');
|
|
54
|
+
const outputSchema = new Schema([new Field('geometry', type, false, metadata)]);
|
|
55
|
+
return {
|
|
56
|
+
outputSchema,
|
|
57
|
+
/** Outputs polygon parts grouped by their original parent row indices. */
|
|
58
|
+
evaluate(input, { signal }) {
|
|
59
|
+
const values = input.getChild(argument.name);
|
|
60
|
+
const active = Uint8Array.from({ length: values.length }, (_, row) => Number(values.isValid(row)));
|
|
61
|
+
const read = readGeometryValue(values, argument, active, planarGeometry);
|
|
62
|
+
const parts = [];
|
|
63
|
+
const parentRows = [];
|
|
64
|
+
for (let row = 0; row < values.length; row++) {
|
|
65
|
+
signal?.throwIfAborted();
|
|
66
|
+
if (!active[row])
|
|
67
|
+
continue;
|
|
68
|
+
for (const part of subdividePolygons(read(row), signal)) {
|
|
69
|
+
parts.push(writeWKB(part, 'xy'));
|
|
70
|
+
parentRows.push(row);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
table: new Table(outputSchema, { geometry: vectorFromArray(parts, type) }),
|
|
75
|
+
parentRows: Int32Array.from(parentRows)
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=st-viewport-functions.js.map
|
|
@@ -0,0 +1 @@
|
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AQ,EAAE,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,EAAC,CAAC;oBACxE,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC;iBACxC,CAAC;YACJ,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SubdividePolylineOptions, SubdividedPolyline } from '@math.gl/geometry';
|
|
1
|
+
import type { SubdividePolylineOptions, SubdividedPolyline } from '@math.gl/geometry/polygon';
|
|
2
2
|
import { type GeodesicPathOptions } from "./geodesic-path.js";
|
|
3
3
|
export type SubdivideGeodesicPolylineOptions = Omit<SubdividePolylineOptions, 'createEdgeSampler' | 'maxSegmentLength'> & GeodesicPathOptions & {
|
|
4
4
|
/** Positive maximum surface distance per output edge, in solver axis units.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subdivide-geodesic-polyline.d.ts","sourceRoot":"","sources":["../src/subdivide-geodesic-polyline.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,wBAAwB,EAAE,kBAAkB,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"subdivide-geodesic-polyline.d.ts","sourceRoot":"","sources":["../src/subdivide-geodesic-polyline.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,wBAAwB,EAAE,kBAAkB,EAAC,MAAM,2BAA2B,CAAC;AAC5F,OAAO,EAA2C,KAAK,mBAAmB,EAAC,2BAAwB;AAEnG,MAAM,MAAM,gCAAgC,GAAG,IAAI,CACjD,wBAAwB,EACxB,mBAAmB,GAAG,kBAAkB,CACzC,GACC,mBAAmB,GAAG;IACpB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEJ;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,EACxB,OAAO,EAAE,gCAAgC,GACxC,kBAAkB,CA6CpB"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
// SPDX-FileComment: Original geodesic edge adapter over the shared adaptive polyline subdivision engine.
|
|
5
|
-
import { subdividePolyline } from '@math.gl/geometry';
|
|
5
|
+
import { subdividePolyline } from '@math.gl/geometry/polygon';
|
|
6
6
|
import { GeodesicPath, validateGeographicPosition } from "./geodesic-path.js";
|
|
7
7
|
/** Adaptively sample shortest endpoint geodesics through a supplied continuous transform.
|
|
8
8
|
* Geographic source angles are degrees; heights interpolate by surface-distance fraction.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subdivide-geodesic-polyline.js","sourceRoot":"","sources":["../src/subdivide-geodesic-polyline.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAC5D,yGAAyG;AAEzG,OAAO,EAAC,iBAAiB,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"subdivide-geodesic-polyline.js","sourceRoot":"","sources":["../src/subdivide-geodesic-polyline.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAC5D,yGAAyG;AAEzG,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAC,YAAY,EAAE,0BAA0B,EAA2B,2BAAwB;AAanG;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CACvC,KAAwB,EACxB,OAAyC;IAEzC,MAAM,EAAC,QAAQ,EAAE,IAAI,GAAG,CAAC,EAAE,kBAAkB,GAAG,QAAQ,EAAE,GAAG,WAAW,EAAC,GAAG,OAAO,CAAC;IACpF,IACE,CAAC,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC;QAC1B,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC;QACnC,KAAK,CAAC,MAAM,GAAG,CAAC;QAChB,KA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H,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACrB,KAAK,IAAI,SAAS,GAAG,CAAC,EAAE,SAAS,GAAG,IAAI,EAAE,SAAS,EAAE;YACnD,SAAS,CAAC,CAAC,GAAG,SAAS,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,iBAAiB,CAAC,SAAS,EAAE;QAClC,GAAG,WAAW;QACd,IAAI;QACJ,gBAAgB,EAAE,kBAAkB;QACpC,iBAAiB,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;KACzD,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type TriangleMesh, type SubdivideTriangleMeshOptions, type SubdividedTriangleMesh } from '@math.gl/geometry';
|
|
1
|
+
import { type TriangleMesh, type SubdivideTriangleMeshOptions, type SubdividedTriangleMesh } from '@math.gl/geometry/polygon';
|
|
2
2
|
/** Preserve the refinement discriminant when removing the globe adapter's fixed transform. */
|
|
3
3
|
type GlobeSubdivisionOptions<Options> = Options extends unknown ? Omit<Options, 'transform' | 'targetSize'> : never;
|
|
4
4
|
/** Globe axes and either sampled-error or source-edge refinement options. */
|