@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.
Files changed (356) hide show
  1. package/README.md +6 -6
  2. package/dist/coordinates.cjs +2523 -0
  3. package/dist/coordinates.cjs.map +6 -0
  4. package/dist/coordinates.d.ts +4 -0
  5. package/dist/coordinates.d.ts.map +1 -1
  6. package/dist/coordinates.js +2 -0
  7. package/dist/coordinates.js.map +1 -1
  8. package/dist/entries/ellipsoid.cjs +1209 -0
  9. package/dist/entries/ellipsoid.cjs.map +6 -0
  10. package/dist/entries/ellipsoid.d.ts +3 -19
  11. package/dist/entries/ellipsoid.d.ts.map +1 -1
  12. package/dist/entries/ellipsoid.js +1 -9
  13. package/dist/entries/ellipsoid.js.map +1 -1
  14. package/dist/expressions.cjs +726 -0
  15. package/dist/expressions.cjs.map +6 -0
  16. package/dist/geodesics.cjs +3195 -0
  17. package/dist/geodesics.cjs.map +6 -0
  18. package/dist/geodesics.d.ts +18 -0
  19. package/dist/geodesics.d.ts.map +1 -0
  20. package/dist/geodesics.js +13 -0
  21. package/dist/geodesics.js.map +1 -0
  22. package/dist/geographic-atlas/sampling.d.ts +1 -1
  23. package/dist/geographic-atlas/sampling.d.ts.map +1 -1
  24. package/dist/geographic-atlas/sampling.js +1 -1
  25. package/dist/geographic-atlas/sampling.js.map +1 -1
  26. package/dist/geographic-cuts.cjs +4160 -0
  27. package/dist/geographic-cuts.cjs.map +6 -0
  28. package/dist/geographic-cuts.d.ts +2 -0
  29. package/dist/geographic-cuts.d.ts.map +1 -1
  30. package/dist/geographic-cuts.js +1 -0
  31. package/dist/geographic-cuts.js.map +1 -1
  32. package/dist/geographic-seams/subdivide-cut.d.ts +1 -1
  33. package/dist/geographic-seams/subdivide-cut.d.ts.map +1 -1
  34. package/dist/geographic-seams/subdivide-cut.js +1 -1
  35. package/dist/geographic-seams/subdivide-cut.js.map +1 -1
  36. package/dist/geographic-seams/types.shared.cjs +32 -0
  37. package/dist/geographic-seams/types.shared.cjs.map +6 -0
  38. package/dist/globe.cjs +4223 -0
  39. package/dist/globe.cjs.map +6 -0
  40. package/dist/index.d.ts +2 -0
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +2 -0
  43. package/dist/index.js.map +1 -1
  44. package/dist/line-simplification.d.ts +7 -0
  45. package/dist/line-simplification.d.ts.map +1 -1
  46. package/dist/line-simplification.js +4 -13
  47. package/dist/line-simplification.js.map +1 -1
  48. package/dist/linear-referencing.d.ts +13 -1
  49. package/dist/linear-referencing.d.ts.map +1 -1
  50. package/dist/linear-referencing.js +29 -9
  51. package/dist/linear-referencing.js.map +1 -1
  52. package/dist/maps/map-transition.shared.cjs +364 -0
  53. package/dist/maps/map-transition.shared.cjs.map +6 -0
  54. package/dist/maps/myriahedral/unfold.d.ts +1 -1
  55. package/dist/maps/myriahedral/unfold.d.ts.map +1 -1
  56. package/dist/maps/myriahedral/unfold.js +1 -1
  57. package/dist/maps/myriahedral/unfold.js.map +1 -1
  58. package/dist/maps/presets.cjs +2 -2
  59. package/dist/maps/presets.cjs.map +2 -2
  60. package/dist/maps/transitions.cjs +3 -342
  61. package/dist/maps/transitions.cjs.map +3 -3
  62. package/dist/maps.cjs +15 -319
  63. package/dist/maps.cjs.map +3 -3
  64. package/dist/measure-referencing.d.ts +16 -0
  65. package/dist/measure-referencing.d.ts.map +1 -0
  66. package/dist/measure-referencing.js +143 -0
  67. package/dist/measure-referencing.js.map +1 -0
  68. package/dist/polygon-simplification.d.ts +6 -0
  69. package/dist/polygon-simplification.d.ts.map +1 -0
  70. package/dist/polygon-simplification.js +141 -0
  71. package/dist/polygon-simplification.js.map +1 -0
  72. package/dist/projection/experimental/core.cjs +63 -1317
  73. package/dist/projection/experimental/core.cjs.map +3 -3
  74. package/dist/projection/experimental/core.d.ts +1 -1
  75. package/dist/projection/experimental/core.d.ts.map +1 -1
  76. package/dist/projection/experimental/crs/projjson.cjs +26 -45
  77. package/dist/projection/experimental/crs/projjson.cjs.map +3 -3
  78. package/dist/projection/experimental/crs/types.shared.cjs +44 -0
  79. package/dist/projection/experimental/crs/types.shared.cjs.map +6 -0
  80. package/dist/projection/experimental/crs/wkt.cjs +36 -52
  81. package/dist/projection/experimental/crs/wkt.cjs.map +3 -3
  82. package/dist/projection/experimental/entries/projections/ob_tran.cjs +9 -23
  83. package/dist/projection/experimental/entries/projections/ob_tran.cjs.map +3 -3
  84. package/dist/projection/experimental/lazy-projections/aea.cjs +1 -1
  85. package/dist/projection/experimental/lazy-projections/aea.js +1 -1
  86. package/dist/projection/experimental/lazy-projections/aeqd.cjs +1 -1
  87. package/dist/projection/experimental/lazy-projections/aeqd.js +1 -1
  88. package/dist/projection/experimental/lazy-projections/bonne.cjs +1 -1
  89. package/dist/projection/experimental/lazy-projections/bonne.js +1 -1
  90. package/dist/projection/experimental/lazy-projections/cass.cjs +1 -1
  91. package/dist/projection/experimental/lazy-projections/cass.js +1 -1
  92. package/dist/projection/experimental/lazy-projections/cea.cjs +1 -1
  93. package/dist/projection/experimental/lazy-projections/cea.js +1 -1
  94. package/dist/projection/experimental/lazy-projections/eck6.cjs +1 -1
  95. package/dist/projection/experimental/lazy-projections/eck6.js +1 -1
  96. package/dist/projection/experimental/lazy-projections/eqc.cjs +1 -1
  97. package/dist/projection/experimental/lazy-projections/eqc.js +1 -1
  98. package/dist/projection/experimental/lazy-projections/eqdc.cjs +1 -1
  99. package/dist/projection/experimental/lazy-projections/eqdc.js +1 -1
  100. package/dist/projection/experimental/lazy-projections/eqearth.cjs +1 -1
  101. package/dist/projection/experimental/lazy-projections/eqearth.js +1 -1
  102. package/dist/projection/experimental/lazy-projections/equi.cjs +1 -1
  103. package/dist/projection/experimental/lazy-projections/equi.js +1 -1
  104. package/dist/projection/experimental/lazy-projections/etmerc.cjs +1 -1
  105. package/dist/projection/experimental/lazy-projections/etmerc.js +1 -1
  106. package/dist/projection/experimental/lazy-projections/geocent.cjs +1 -1
  107. package/dist/projection/experimental/lazy-projections/geocent.js +1 -1
  108. package/dist/projection/experimental/lazy-projections/geos.cjs +1 -1
  109. package/dist/projection/experimental/lazy-projections/geos.js +1 -1
  110. package/dist/projection/experimental/lazy-projections/gnom.cjs +1 -1
  111. package/dist/projection/experimental/lazy-projections/gnom.js +1 -1
  112. package/dist/projection/experimental/lazy-projections/gstmerc.cjs +1 -1
  113. package/dist/projection/experimental/lazy-projections/gstmerc.js +1 -1
  114. package/dist/projection/experimental/lazy-projections/index.cjs +60 -903
  115. package/dist/projection/experimental/lazy-projections/index.cjs.map +3 -3
  116. package/dist/projection/experimental/lazy-projections/krovak.cjs +1 -1
  117. package/dist/projection/experimental/lazy-projections/krovak.js +1 -1
  118. package/dist/projection/experimental/lazy-projections/laea.cjs +1 -1
  119. package/dist/projection/experimental/lazy-projections/laea.js +1 -1
  120. package/dist/projection/experimental/lazy-projections/lcc.cjs +1 -1
  121. package/dist/projection/experimental/lazy-projections/lcc.js +1 -1
  122. package/dist/projection/experimental/lazy-projections/merc.cjs +1 -1
  123. package/dist/projection/experimental/lazy-projections/merc.js +1 -1
  124. package/dist/projection/experimental/lazy-projections/mill.cjs +1 -1
  125. package/dist/projection/experimental/lazy-projections/mill.js +1 -1
  126. package/dist/projection/experimental/lazy-projections/moll.cjs +1 -1
  127. package/dist/projection/experimental/lazy-projections/moll.js +1 -1
  128. package/dist/projection/experimental/lazy-projections/nzmg.cjs +1 -1
  129. package/dist/projection/experimental/lazy-projections/nzmg.js +1 -1
  130. package/dist/projection/experimental/lazy-projections/ob_tran.cjs +1 -1
  131. package/dist/projection/experimental/lazy-projections/ob_tran.js +1 -1
  132. package/dist/projection/experimental/lazy-projections/omerc.cjs +1 -1
  133. package/dist/projection/experimental/lazy-projections/omerc.js +1 -1
  134. package/dist/projection/experimental/lazy-projections/ortho.cjs +1 -1
  135. package/dist/projection/experimental/lazy-projections/ortho.js +1 -1
  136. package/dist/projection/experimental/lazy-projections/poly.cjs +1 -1
  137. package/dist/projection/experimental/lazy-projections/poly.js +1 -1
  138. package/dist/projection/experimental/lazy-projections/qsc.cjs +1 -1
  139. package/dist/projection/experimental/lazy-projections/qsc.js +1 -1
  140. package/dist/projection/experimental/lazy-projections/robin.cjs +1 -1
  141. package/dist/projection/experimental/lazy-projections/robin.js +1 -1
  142. package/dist/projection/experimental/lazy-projections/sinu.cjs +1 -1
  143. package/dist/projection/experimental/lazy-projections/sinu.js +1 -1
  144. package/dist/projection/experimental/lazy-projections/somerc.cjs +1 -1
  145. package/dist/projection/experimental/lazy-projections/somerc.js +1 -1
  146. package/dist/projection/experimental/lazy-projections/stere.cjs +1 -1
  147. package/dist/projection/experimental/lazy-projections/stere.js +1 -1
  148. package/dist/projection/experimental/lazy-projections/sterea.cjs +1 -1
  149. package/dist/projection/experimental/lazy-projections/sterea.js +1 -1
  150. package/dist/projection/experimental/lazy-projections/tmerc.cjs +1 -1
  151. package/dist/projection/experimental/lazy-projections/tmerc.js +1 -1
  152. package/dist/projection/experimental/lazy-projections/tpers.cjs +1 -1
  153. package/dist/projection/experimental/lazy-projections/tpers.js +1 -1
  154. package/dist/projection/experimental/lazy-projections/utm.cjs +1 -1
  155. package/dist/projection/experimental/lazy-projections/utm.js +1 -1
  156. package/dist/projection/experimental/lazy-projections/vandg.cjs +1 -1
  157. package/dist/projection/experimental/lazy-projections/vandg.js +1 -1
  158. package/dist/projection/experimental/projection-engine.shared.cjs +1184 -0
  159. package/dist/projection/experimental/projection-engine.shared.cjs.map +6 -0
  160. package/dist/projection/experimental/typescript-projection.shared.cjs +1703 -0
  161. package/dist/projection/experimental/typescript-projection.shared.cjs.map +6 -0
  162. package/dist/projection/index.cjs +622 -1535
  163. package/dist/projection/index.cjs.map +3 -3
  164. package/dist/projection/pipeline.cjs +44 -58
  165. package/dist/projection/pipeline.cjs.map +3 -3
  166. package/dist/projection/transform-analysis.cjs +20 -936
  167. package/dist/projection/transform-analysis.cjs.map +3 -3
  168. package/dist/spatial-box-clipping.d.ts +9 -0
  169. package/dist/spatial-box-clipping.d.ts.map +1 -0
  170. package/dist/spatial-box-clipping.js +123 -0
  171. package/dist/spatial-box-clipping.js.map +1 -0
  172. package/dist/spatial-dwithin.d.ts +19 -0
  173. package/dist/spatial-dwithin.d.ts.map +1 -0
  174. package/dist/spatial-dwithin.js +107 -0
  175. package/dist/spatial-dwithin.js.map +1 -0
  176. package/dist/spatial-hulls.d.ts +6 -0
  177. package/dist/spatial-hulls.d.ts.map +1 -0
  178. package/dist/spatial-hulls.js +176 -0
  179. package/dist/spatial-hulls.js.map +1 -0
  180. package/dist/spatial-line-intersection-result.d.ts +4 -0
  181. package/dist/spatial-line-intersection-result.d.ts.map +1 -0
  182. package/dist/spatial-line-intersection-result.js +79 -0
  183. package/dist/spatial-line-intersection-result.js.map +1 -0
  184. package/dist/spatial-line-polygon-intersection.d.ts +4 -0
  185. package/dist/spatial-line-polygon-intersection.d.ts.map +1 -0
  186. package/dist/spatial-line-polygon-intersection.js +130 -0
  187. package/dist/spatial-line-polygon-intersection.js.map +1 -0
  188. package/dist/spatial-planar-intersects.d.ts +11 -0
  189. package/dist/spatial-planar-intersects.d.ts.map +1 -1
  190. package/dist/spatial-planar-intersects.js +20 -12
  191. package/dist/spatial-planar-intersects.js.map +1 -1
  192. package/dist/spatial-planar.d.ts +9 -0
  193. package/dist/spatial-planar.d.ts.map +1 -1
  194. package/dist/spatial-planar.js +13 -1
  195. package/dist/spatial-planar.js.map +1 -1
  196. package/dist/spatial-polygon-overlay.d.ts +5 -0
  197. package/dist/spatial-polygon-overlay.d.ts.map +1 -0
  198. package/dist/spatial-polygon-overlay.js +23 -0
  199. package/dist/spatial-polygon-overlay.js.map +1 -0
  200. package/dist/spatial-sql.d.ts +13 -2
  201. package/dist/spatial-sql.d.ts.map +1 -1
  202. package/dist/spatial-sql.js +30 -12
  203. package/dist/spatial-sql.js.map +1 -1
  204. package/dist/spatial-subdivision.d.ts +9 -0
  205. package/dist/spatial-subdivision.d.ts.map +1 -0
  206. package/dist/spatial-subdivision.js +61 -0
  207. package/dist/spatial-subdivision.js.map +1 -0
  208. package/dist/spatial-touches.d.ts +13 -0
  209. package/dist/spatial-touches.d.ts.map +1 -0
  210. package/dist/spatial-touches.js +192 -0
  211. package/dist/spatial-touches.js.map +1 -0
  212. package/dist/st-functions.cjs +2411 -112
  213. package/dist/st-functions.cjs.map +3 -3
  214. package/dist/st-functions.d.ts +67 -2
  215. package/dist/st-functions.d.ts.map +1 -1
  216. package/dist/st-functions.js +195 -12
  217. package/dist/st-functions.js.map +1 -1
  218. package/dist/st-geodesic-functions.d.ts +33 -0
  219. package/dist/st-geodesic-functions.d.ts.map +1 -0
  220. package/dist/st-geodesic-functions.js +84 -0
  221. package/dist/st-geodesic-functions.js.map +1 -0
  222. package/dist/st-hull-functions.cjs +386 -0
  223. package/dist/st-hull-functions.cjs.map +6 -0
  224. package/dist/st-hull-functions.d.ts +17 -0
  225. package/dist/st-hull-functions.d.ts.map +1 -0
  226. package/dist/st-hull-functions.js +14 -0
  227. package/dist/st-hull-functions.js.map +1 -0
  228. package/dist/st-overlay-functions.cjs +621 -0
  229. package/dist/st-overlay-functions.cjs.map +6 -0
  230. package/dist/st-overlay-functions.d.ts +36 -0
  231. package/dist/st-overlay-functions.d.ts.map +1 -0
  232. package/dist/st-overlay-functions.js +183 -0
  233. package/dist/st-overlay-functions.js.map +1 -0
  234. package/dist/st-viewport-functions.cjs +481 -0
  235. package/dist/st-viewport-functions.cjs.map +6 -0
  236. package/dist/st-viewport-functions.d.ts +13 -0
  237. package/dist/st-viewport-functions.d.ts.map +1 -0
  238. package/dist/st-viewport-functions.js +81 -0
  239. package/dist/st-viewport-functions.js.map +1 -0
  240. package/dist/subdivide-geodesic-polyline.d.ts +1 -1
  241. package/dist/subdivide-geodesic-polyline.d.ts.map +1 -1
  242. package/dist/subdivide-geodesic-polyline.js +1 -1
  243. package/dist/subdivide-geodesic-polyline.js.map +1 -1
  244. package/dist/subdivide-globe-mesh.d.ts +1 -1
  245. package/dist/subdivide-globe-mesh.d.ts.map +1 -1
  246. package/dist/subdivide-globe-mesh.js +1 -1
  247. package/dist/subdivide-globe-mesh.js.map +1 -1
  248. package/dist/subdivide-rhumb-polyline.d.ts +1 -1
  249. package/dist/subdivide-rhumb-polyline.d.ts.map +1 -1
  250. package/dist/subdivide-rhumb-polyline.js +1 -1
  251. package/dist/subdivide-rhumb-polyline.js.map +1 -1
  252. package/dist/tasks/index.cjs +808 -2993
  253. package/dist/tasks/index.cjs.map +3 -3
  254. package/dist/terrain/geometry.d.ts +1 -1
  255. package/dist/terrain/geometry.d.ts.map +1 -1
  256. package/dist/terrain/geometry.js +1 -1
  257. package/dist/terrain/geometry.js.map +1 -1
  258. package/dist/terrain/index.cjs +95 -22
  259. package/dist/terrain/index.cjs.map +3 -3
  260. package/dist/terrain/index.d.ts +1 -0
  261. package/dist/terrain/index.d.ts.map +1 -1
  262. package/dist/terrain/index.js +1 -0
  263. package/dist/terrain/index.js.map +1 -1
  264. package/dist/terrain/regional-watersheds.d.ts +44 -0
  265. package/dist/terrain/regional-watersheds.d.ts.map +1 -0
  266. package/dist/terrain/regional-watersheds.js +108 -0
  267. package/dist/terrain/regional-watersheds.js.map +1 -0
  268. package/dist/terrain/tile-cutout-update.d.ts.map +1 -1
  269. package/dist/terrain/tile-cutout-update.js +28 -22
  270. package/dist/terrain/tile-cutout-update.js.map +1 -1
  271. package/dist/tiles.cjs +354 -0
  272. package/dist/tiles.cjs.map +6 -0
  273. package/dist/turf-functions.cjs +16 -9
  274. package/dist/turf-functions.cjs.map +1 -1
  275. package/package.json +154 -117
  276. package/src/coordinates.ts +5 -0
  277. package/src/entries/ellipsoid.ts +7 -32
  278. package/src/geodesics.ts +40 -0
  279. package/src/geographic-atlas/sampling.ts +1 -1
  280. package/src/geographic-cuts.ts +21 -0
  281. package/src/geographic-seams/subdivide-cut.ts +1 -1
  282. package/src/index.ts +2 -0
  283. package/src/line-simplification.ts +4 -16
  284. package/src/linear-referencing.ts +44 -16
  285. package/src/maps/myriahedral/unfold.ts +1 -1
  286. package/src/measure-referencing.ts +165 -0
  287. package/src/polygon-simplification.ts +185 -0
  288. package/src/projection/experimental/core.ts +1 -1
  289. package/src/projection/experimental/lazy-projections/aea.ts +1 -1
  290. package/src/projection/experimental/lazy-projections/aeqd.ts +1 -1
  291. package/src/projection/experimental/lazy-projections/bonne.ts +1 -1
  292. package/src/projection/experimental/lazy-projections/cass.ts +1 -1
  293. package/src/projection/experimental/lazy-projections/cea.ts +1 -1
  294. package/src/projection/experimental/lazy-projections/eck6.ts +1 -1
  295. package/src/projection/experimental/lazy-projections/eqc.ts +1 -1
  296. package/src/projection/experimental/lazy-projections/eqdc.ts +1 -1
  297. package/src/projection/experimental/lazy-projections/eqearth.ts +1 -1
  298. package/src/projection/experimental/lazy-projections/equi.ts +1 -1
  299. package/src/projection/experimental/lazy-projections/etmerc.ts +1 -1
  300. package/src/projection/experimental/lazy-projections/geocent.ts +1 -1
  301. package/src/projection/experimental/lazy-projections/geos.ts +1 -1
  302. package/src/projection/experimental/lazy-projections/gnom.ts +1 -1
  303. package/src/projection/experimental/lazy-projections/gstmerc.ts +1 -1
  304. package/src/projection/experimental/lazy-projections/krovak.ts +1 -1
  305. package/src/projection/experimental/lazy-projections/laea.ts +1 -1
  306. package/src/projection/experimental/lazy-projections/lcc.ts +1 -1
  307. package/src/projection/experimental/lazy-projections/merc.ts +1 -1
  308. package/src/projection/experimental/lazy-projections/mill.ts +1 -1
  309. package/src/projection/experimental/lazy-projections/moll.ts +1 -1
  310. package/src/projection/experimental/lazy-projections/nzmg.ts +1 -1
  311. package/src/projection/experimental/lazy-projections/ob_tran.ts +1 -1
  312. package/src/projection/experimental/lazy-projections/omerc.ts +1 -1
  313. package/src/projection/experimental/lazy-projections/ortho.ts +1 -1
  314. package/src/projection/experimental/lazy-projections/poly.ts +1 -1
  315. package/src/projection/experimental/lazy-projections/qsc.ts +1 -1
  316. package/src/projection/experimental/lazy-projections/robin.ts +1 -1
  317. package/src/projection/experimental/lazy-projections/sinu.ts +1 -1
  318. package/src/projection/experimental/lazy-projections/somerc.ts +1 -1
  319. package/src/projection/experimental/lazy-projections/stere.ts +1 -1
  320. package/src/projection/experimental/lazy-projections/sterea.ts +1 -1
  321. package/src/projection/experimental/lazy-projections/tmerc.ts +1 -1
  322. package/src/projection/experimental/lazy-projections/tpers.ts +1 -1
  323. package/src/projection/experimental/lazy-projections/utm.ts +1 -1
  324. package/src/projection/experimental/lazy-projections/vandg.ts +1 -1
  325. package/src/spatial-box-clipping.ts +140 -0
  326. package/src/spatial-dwithin.ts +135 -0
  327. package/src/spatial-hulls.ts +203 -0
  328. package/src/spatial-line-intersection-result.ts +93 -0
  329. package/src/spatial-line-polygon-intersection.ts +147 -0
  330. package/src/spatial-planar-intersects.ts +21 -15
  331. package/src/spatial-planar.ts +20 -1
  332. package/src/spatial-polygon-overlay.ts +30 -0
  333. package/src/spatial-sql.ts +47 -12
  334. package/src/spatial-subdivision.ts +75 -0
  335. package/src/spatial-touches.ts +218 -0
  336. package/src/st-functions.ts +283 -15
  337. package/src/st-geodesic-functions.ts +121 -0
  338. package/src/st-hull-functions.ts +25 -0
  339. package/src/st-overlay-functions.ts +244 -0
  340. package/src/st-viewport-functions.ts +98 -0
  341. package/src/subdivide-geodesic-polyline.ts +2 -2
  342. package/src/subdivide-globe-mesh.ts +2 -2
  343. package/src/subdivide-rhumb-polyline.ts +2 -2
  344. package/src/terrain/geometry.ts +1 -1
  345. package/src/terrain/index.ts +7 -0
  346. package/src/terrain/regional-watersheds.ts +153 -0
  347. package/src/terrain/tile-cutout-update.ts +32 -26
  348. package/dist/index.cjs +0 -18674
  349. package/dist/index.cjs.map +0 -6
  350. package/dist/turf-expressions.cjs +0 -1997
  351. package/dist/turf-expressions.cjs.map +0 -6
  352. package/dist/turf-expressions.d.ts +0 -3
  353. package/dist/turf-expressions.d.ts.map +0 -1
  354. package/dist/turf-expressions.js +0 -7
  355. package/dist/turf-expressions.js.map +0 -1
  356. package/src/turf-expressions.ts +0 -7
@@ -0,0 +1,621 @@
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-overlay-functions.js
30
+ var st_overlay_functions_exports = {};
31
+ __export(st_overlay_functions_exports, {
32
+ ST_BUFFER: () => ST_BUFFER,
33
+ ST_DIFFERENCE: () => ST_DIFFERENCE,
34
+ ST_INTERSECTION: () => ST_INTERSECTION,
35
+ ST_SYMDIFFERENCE: () => ST_SYMDIFFERENCE,
36
+ ST_UNION: () => ST_UNION
37
+ });
38
+ module.exports = __toCommonJS(st_overlay_functions_exports);
39
+
40
+ // dist/spatial-line-intersection-result.js
41
+ var import_arrow = require("@math.gl/core/arrow");
42
+ var concrete = [
43
+ { type: "Point", encoding: "geoarrow.point", id: 1 },
44
+ { type: "LineString", encoding: "geoarrow.linestring", id: 2 },
45
+ { type: "MultiPoint", encoding: "geoarrow.multipoint", id: 4 },
46
+ { type: "MultiLineString", encoding: "geoarrow.multilinestring", id: 5 }
47
+ ];
48
+ function lineIntersectionResult() {
49
+ const build = (rows) => (0, import_arrow.makeArrowVectorFromGeoArrowColumn)({
50
+ encoding: "geoarrow.geometry",
51
+ dimension: "xy",
52
+ coordinateLayout: "interleaved",
53
+ chunks: [union(rows, true)]
54
+ });
55
+ return { encoding: "geoarrow.geometry", type: build([]).type, build };
56
+ }
57
+ function union(rows, collections) {
58
+ const groups = concrete.map(() => []);
59
+ const mixed = [];
60
+ const typeIds = new Int8Array(rows.length);
61
+ const valueOffsets = new Int32Array(rows.length);
62
+ for (let row = 0; row < rows.length; row++) {
63
+ const geometry = rows[row] ?? null;
64
+ if (collections && (geometry == null ? void 0 : geometry.type) === "GeometryCollection") {
65
+ typeIds[row] = 7;
66
+ valueOffsets[row] = mixed.length;
67
+ mixed.push(geometry);
68
+ } else {
69
+ const index = geometry ? concrete.findIndex((child) => child.type === geometry.type) : 0;
70
+ const group = groups[index];
71
+ if (!group)
72
+ throw new Error("Unexpected line intersection result geometry");
73
+ typeIds[row] = concrete[index].id;
74
+ valueOffsets[row] = group.length;
75
+ group.push(geometry);
76
+ }
77
+ }
78
+ const children = concrete.map(({ type, encoding, id }, index) => ({
79
+ name: type,
80
+ encoding,
81
+ typeId: id,
82
+ dimension: "xy",
83
+ coordinateLayout: "interleaved",
84
+ data: import_arrow.GeoArrowBuilder.build(groups[index], { encoding, dimension: "xy" }).chunks[0]
85
+ }));
86
+ if (collections) {
87
+ children.push({
88
+ name: "GeometryCollection",
89
+ encoding: "geoarrow.geometrycollection",
90
+ typeId: 7,
91
+ dimension: "xy",
92
+ coordinateLayout: "interleaved",
93
+ data: collection(mixed)
94
+ });
95
+ }
96
+ return { kind: "dense-union", length: rows.length, typeIds, valueOffsets, children };
97
+ }
98
+ function collection(rows) {
99
+ const members = [];
100
+ const offsets = new Int32Array(rows.length + 1);
101
+ for (let row = 0; row < rows.length; row++) {
102
+ const geometry = rows[row];
103
+ if (geometry.type === "GeometryCollection")
104
+ for (const child of geometry.geometries)
105
+ members.push(child);
106
+ offsets[row + 1] = members.length;
107
+ }
108
+ return { kind: "list", length: rows.length, offsets, child: union(members, false) };
109
+ }
110
+
111
+ // dist/spatial-planar-intersects.js
112
+ var import_robust_predicates = require("robust-predicates");
113
+ function side(a, b, c) {
114
+ return Math.sign((0, import_robust_predicates.orient2d)(a[0], a[1], b[0], b[1], c[0], c[1]));
115
+ }
116
+ function inBounds(p, a, b) {
117
+ return p[0] >= Math.min(a[0], b[0]) && p[0] <= Math.max(a[0], b[0]) && p[1] >= Math.min(a[1], b[1]) && p[1] <= Math.max(a[1], b[1]);
118
+ }
119
+ function segmentsMeet(a, b, c, d) {
120
+ const cSide = side(a, b, c), dSide = side(a, b, d);
121
+ const aSide = side(c, d, a), bSide = side(c, d, b);
122
+ return cSide * dSide < 0 && aSide * bSide < 0 || !cSide && inBounds(c, a, b) || !dSide && inBounds(d, a, b) || !aSide && inBounds(a, c, d) || !bSide && inBounds(b, c, d);
123
+ }
124
+ function anyEdge(path, closed, match) {
125
+ for (let i = closed ? 0 : 1; i < path.length; i++) {
126
+ if (match(path[i ? i - 1 : path.length - 1], path[i]))
127
+ return true;
128
+ }
129
+ return false;
130
+ }
131
+ function pointOnSegment(point, a, b) {
132
+ return inBounds(point, a, b) && side(a, b, point) === 0;
133
+ }
134
+ function locatePointInPolygon(point, rings) {
135
+ let inside = false;
136
+ for (const ring of rings) {
137
+ if (anyEdge(ring, true, (a, b) => {
138
+ const orientation = side(a, b, point);
139
+ if (!orientation && inBounds(point, a, b))
140
+ return true;
141
+ if (a[1] > point[1] !== b[1] > point[1] && orientation < 0 === b[1] > a[1])
142
+ inside = !inside;
143
+ return false;
144
+ }))
145
+ return 0;
146
+ }
147
+ return inside ? 1 : -1;
148
+ }
149
+
150
+ // dist/spatial-touches.js
151
+ var import_polygon_clipping = __toESM(require("polygon-clipping"), 1);
152
+
153
+ // dist/spatial-polygon-overlay.js
154
+ function polygonSet(geometry) {
155
+ const polygons = geometry.type === "Polygon" ? [geometry.coordinates] : geometry.type === "MultiPolygon" ? geometry.coordinates : void 0;
156
+ if (!polygons)
157
+ throw new Error("Polygon overlay requires Polygon or MultiPolygon input");
158
+ return polygons.filter((polygon) => {
159
+ var _a;
160
+ return (_a = polygon[0]) == null ? void 0 : _a.length;
161
+ }).map((polygon) => polygon.filter((ring) => ring.length).map((ring) => ring.map(([x, y]) => {
162
+ if (!Number.isFinite(x) || !Number.isFinite(y))
163
+ throw new Error("Polygon overlay requires finite coordinates");
164
+ return [x, y];
165
+ })));
166
+ }
167
+
168
+ // dist/spatial-touches.js
169
+ function samePoint(a, b) {
170
+ return a[0] === b[0] && a[1] === b[1];
171
+ }
172
+ function endpointContacts(a, b) {
173
+ const contacts = [];
174
+ for (const [endpoints, other] of [
175
+ [a, b],
176
+ [b, a]
177
+ ]) {
178
+ for (const point of endpoints) {
179
+ if (pointOnSegment(point, ...other) && !contacts.some((value) => samePoint(value, point)))
180
+ contacts.push(point);
181
+ }
182
+ }
183
+ return contacts;
184
+ }
185
+ function parameter(point, [a, b]) {
186
+ const dx = b[0] - a[0];
187
+ const dy = b[1] - a[1];
188
+ return Math.abs(dx) >= Math.abs(dy) ? (point[0] - a[0]) / dx : (point[1] - a[1]) / dy;
189
+ }
190
+
191
+ // dist/spatial-line-polygon-intersection.js
192
+ function same(a, b) {
193
+ return a[0] === b[0] && a[1] === b[1];
194
+ }
195
+ function interpolate(a, b, t) {
196
+ if (t === 0)
197
+ return a;
198
+ if (t === 1)
199
+ return b;
200
+ return [(1 - t) * a[0] + t * b[0], (1 - t) * a[1] + t * b[1]];
201
+ }
202
+ function crossingParameter([a, b], [c, d]) {
203
+ const dx = b[0] - a[0];
204
+ const dy = b[1] - a[1];
205
+ const ux = d[0] - c[0];
206
+ const uy = d[1] - c[1];
207
+ const x = c[0] - a[0];
208
+ const y = c[1] - a[1];
209
+ const scale = Math.max(Math.abs(dx), Math.abs(dy), Math.abs(ux), Math.abs(uy), Math.abs(x), Math.abs(y));
210
+ return (x / scale * (uy / scale) - y / scale * (ux / scale)) / (dx / scale * (uy / scale) - dy / scale * (ux / scale));
211
+ }
212
+ function intersectLinePolygon(line, area) {
213
+ if (line.type !== "LineString" && line.type !== "MultiLineString")
214
+ throw new Error("Line\u2013polygon intersection requires a linear geometry");
215
+ if (area.type !== "Polygon" && area.type !== "MultiPolygon")
216
+ throw new Error("Line\u2013polygon intersection requires a polygonal geometry");
217
+ const polygons = area.type === "Polygon" ? [area.coordinates] : area.coordinates;
218
+ const boundaries = [];
219
+ for (const ring of polygons.flat()) {
220
+ for (let i = 0; i < ring.length; i++) {
221
+ const a = ring[(i + ring.length - 1) % ring.length];
222
+ const b = ring[i];
223
+ if (!same(a, b))
224
+ boundaries.push([a, b]);
225
+ }
226
+ }
227
+ const covered = (point) => polygons.some((rings) => locatePointInPolygon(point, rings) >= 0);
228
+ const lines = [];
229
+ const contacts = /* @__PURE__ */ new Map();
230
+ const addPoint = (point) => contacts.set(`${point[0]}/${point[1]}`, point);
231
+ for (const path of line.type === "LineString" ? [line.coordinates] : line.coordinates) {
232
+ if (!path.length)
233
+ continue;
234
+ let current;
235
+ if (covered(path[0]))
236
+ addPoint(path[0]);
237
+ for (let index = 1; index < path.length; index++) {
238
+ const a = path[index - 1];
239
+ const b = path[index];
240
+ if (same(a, b))
241
+ continue;
242
+ const segment = [a, b];
243
+ const cuts = /* @__PURE__ */ new Map([
244
+ [0, a],
245
+ [1, b]
246
+ ]);
247
+ const overlap = [];
248
+ for (const boundary of boundaries) {
249
+ if (!segmentsMeet(...segment, ...boundary))
250
+ continue;
251
+ const endpoints = endpointContacts(segment, boundary);
252
+ if (!endpoints.length) {
253
+ const t = crossingParameter(segment, boundary);
254
+ if (!(t >= 0 && t <= 1))
255
+ throw new Error("Unable to locate polygon boundary crossing");
256
+ const [x, y] = interpolate(a, b, t);
257
+ const [c, d] = boundary;
258
+ cuts.set(t, [c[0] === d[0] ? c[0] : x, c[1] === d[1] ? c[1] : y]);
259
+ continue;
260
+ }
261
+ const parameters = endpoints.map((point) => parameter(point, segment));
262
+ for (let contact = 0; contact < endpoints.length; contact++) {
263
+ cuts.set(parameters[contact], endpoints[contact]);
264
+ addPoint(endpoints[contact]);
265
+ }
266
+ if (parameters.length === 2)
267
+ overlap.push([Math.min(...parameters), Math.max(...parameters)]);
268
+ }
269
+ const entries = [...cuts].sort(([x], [y]) => x - y);
270
+ for (let i = 1; i < entries.length; i++) {
271
+ const [from, first] = entries[i - 1];
272
+ const [to, last] = entries[i];
273
+ if (!overlap.some(([start, end]) => start <= from && to <= end) && !covered(interpolate(a, b, (from + to) / 2))) {
274
+ current = void 0;
275
+ continue;
276
+ }
277
+ if (same(first, last))
278
+ continue;
279
+ if (current && same(current[current.length - 1], first))
280
+ current.push(last);
281
+ else {
282
+ current = [first, last];
283
+ lines.push(current);
284
+ }
285
+ }
286
+ }
287
+ }
288
+ const retainedEdges = [...lineEdges(lines)];
289
+ const points = [...contacts.values()].filter((point) => !retainedEdges.some(([a, b]) => pointOnSegment(point, a, b)));
290
+ const parts = [];
291
+ if (lines.length === 1)
292
+ parts.push({ type: "LineString", coordinates: lines[0] });
293
+ else if (lines.length)
294
+ parts.push({ type: "MultiLineString", coordinates: lines });
295
+ if (points.length === 1)
296
+ parts.push({ type: "Point", coordinates: points[0] });
297
+ else if (points.length)
298
+ parts.push({ type: "MultiPoint", coordinates: points });
299
+ return parts.length === 1 ? parts[0] : { type: "GeometryCollection", geometries: parts };
300
+ }
301
+ function* lineEdges(paths) {
302
+ for (const path of paths) {
303
+ for (let i = 1; i < path.length; i++)
304
+ yield [path[i - 1], path[i]];
305
+ }
306
+ }
307
+
308
+ // dist/st-overlay-functions.js
309
+ var import_polygon_clipping2 = __toESM(require("polygon-clipping"), 1);
310
+
311
+ // dist/spatial-sql.js
312
+ var import_apache_arrow = require("apache-arrow");
313
+ var import_arrow2 = require("@math.gl/core/arrow");
314
+ var EXTENSION_NAME = "ARROW:extension:name";
315
+ var EXTENSION_METADATA = "ARROW:extension:metadata";
316
+ var pointKinds = ["Point"];
317
+ var lineKinds = ["LineString", "MultiLineString"];
318
+ var polygonKinds = ["Polygon", "MultiPolygon"];
319
+ function nativePolygonResult(encoding) {
320
+ const options = { encoding, dimension: "xy", coordinateLayout: "interleaved" };
321
+ const build = (rows) => (0, import_arrow2.makeArrowVectorFromGeoArrowColumn)(import_arrow2.GeoArrowBuilder.build(rows, options));
322
+ return { encoding, type: build([]).type, build };
323
+ }
324
+ function readGeometryValue(vector, field, active, value, captureMembers = false) {
325
+ if (import_apache_arrow.DataType.isBinary(field.type) || import_apache_arrow.DataType.isLargeBinary(field.type)) {
326
+ return (row) => {
327
+ const { geometry, dimension, srid, members } = (0, import_arrow2.parseWKB)(vector.get(row), {
328
+ captureMembers
329
+ });
330
+ if (srid)
331
+ throw new Error("Use GeoArrow field metadata for CRS information instead of EWKB SRIDs");
332
+ return value(geometry.type === "Point" && geometry.coordinates.every(Number.isNaN) ? { type: "Point", coordinates: [] } : geometry, dimension, members);
333
+ };
334
+ }
335
+ const column = readActiveGeoArrowColumn(vector, field, active);
336
+ const geometries = (0, import_arrow2.materializeGeoArrowRows)(column);
337
+ return (row) => value(geometries[row], column.dimension);
338
+ }
339
+ function readActiveGeoArrowColumn(vector, field, active) {
340
+ const column = (0, import_arrow2.makeGeoArrowColumnFromArrowVector)(vector, { field });
341
+ let offset = 0;
342
+ const chunks = column.chunks.map((chunk) => {
343
+ const start = offset;
344
+ offset += chunk.length;
345
+ let needsMask = false;
346
+ for (let row = 0; row < chunk.length; row++) {
347
+ if (!active[start + row] && (0, import_arrow2.isGeoArrowValueValid)(chunk.validity, row)) {
348
+ needsMask = true;
349
+ break;
350
+ }
351
+ }
352
+ if (!needsMask)
353
+ return chunk;
354
+ const values = new Uint8Array(Math.ceil(chunk.length / 8));
355
+ for (let row = 0; row < chunk.length; row++) {
356
+ if (active[start + row] && (0, import_arrow2.isGeoArrowValueValid)(chunk.validity, row)) {
357
+ values[row >> 3] |= 1 << (row & 7);
358
+ }
359
+ }
360
+ return { ...chunk, validity: { values } };
361
+ });
362
+ return { ...column, chunks };
363
+ }
364
+ function planarGeometry(geometry, dimension) {
365
+ if (dimension !== "xy")
366
+ throw new Error("Spatial SQL functions require 2D geometry");
367
+ return geometry;
368
+ }
369
+ function spatialFunction(name, signatures, output, evaluate, numericArguments = 0, allDimensions = false, skipNullGeometries = false, validateCRS) {
370
+ const type = "encoding" in output ? output.type : output;
371
+ return {
372
+ kind: "scalar",
373
+ name,
374
+ prototypes: [],
375
+ /** Binds the allowed geometry types and result metadata to a call. */
376
+ resolvePrototype(fields) {
377
+ var _a;
378
+ if (fields.length !== signatures.length + numericArguments)
379
+ return void 0;
380
+ const geometryFields = fields.slice(0, signatures.length);
381
+ const numberFields = fields.slice(signatures.length).map((field) => {
382
+ if (field && !import_apache_arrow.DataType.isInt(field.type) && !import_apache_arrow.DataType.isFloat(field.type))
383
+ throw new Error(`${name} requires numeric arguments`);
384
+ return field ?? new import_apache_arrow.Field("number", new import_apache_arrow.Float64(), true);
385
+ });
386
+ const extensions = geometryFields.map((field, index) => {
387
+ if (!field)
388
+ return void 0;
389
+ const extension = (0, import_arrow2.getGeoArrowFieldInfo)(field);
390
+ const encoding = extension == null ? void 0 : extension.encoding;
391
+ const kinds = signatures[index];
392
+ if (encoding === "geoarrow.wkb" && (import_apache_arrow.DataType.isBinary(field.type) || import_apache_arrow.DataType.isLargeBinary(field.type))) {
393
+ } else if (encoding === "geoarrow.geometry" && extension.dimension === "xy") {
394
+ } else if (kinds.some((kind) => encoding === "geoarrow." + kind.toLowerCase())) {
395
+ if (!allDimensions && (extension == null ? void 0 : extension.dimension) !== "xy")
396
+ throw new Error(`${name} requires 2D geometry`);
397
+ } else {
398
+ throw new Error(`${name} argument ${index + 1} requires GeoArrow ${kinds.join(" or ")}`);
399
+ }
400
+ validateCRS == null ? void 0 : validateCRS(extension == null ? void 0 : extension.metadata["crs"], name);
401
+ if (!validateCRS && name.startsWith("ST_") && name !== "ST_SRID" && name !== "ST_SetSRID" && (extension == null ? void 0 : extension.metadata["edges"]) === "spherical")
402
+ throw new Error(`${name} requires planar geometry`);
403
+ return extension;
404
+ });
405
+ const crsValues = extensions.map((extension) => extension == null ? void 0 : extension.metadata["crs"]).filter((crs) => crs !== void 0 && crs !== null);
406
+ if (!validateCRS && name.startsWith("ST_") && crsValues.some((crs) => JSON.stringify(crs) !== JSON.stringify(crsValues[0]))) {
407
+ throw new Error(`${name} requires arguments in the same CRS`);
408
+ }
409
+ const metadata = /* @__PURE__ */ new Map();
410
+ if ("encoding" in output || import_apache_arrow.DataType.isBinary(type)) {
411
+ metadata.set(EXTENSION_NAME, "encoding" in output ? output.encoding : "geoarrow.wkb");
412
+ const inputMetadata = (_a = extensions[0]) == null ? void 0 : _a.metadata;
413
+ const crs = inputMetadata == null ? void 0 : inputMetadata["crs"];
414
+ const crsType = crs === void 0 ? void 0 : inputMetadata == null ? void 0 : inputMetadata["crs_type"];
415
+ const edges = inputMetadata == null ? void 0 : inputMetadata["edges"];
416
+ if (crs !== void 0 || edges !== void 0) {
417
+ metadata.set(EXTENSION_METADATA, JSON.stringify({ crs, crs_type: crsType, edges }));
418
+ }
419
+ }
420
+ const arguments_ = [
421
+ ...geometryFields.map((field) => field ?? new import_apache_arrow.Field("geometry", new import_apache_arrow.Binary(), true)),
422
+ ...numberFields
423
+ ];
424
+ return {
425
+ arguments: arguments_,
426
+ nullHandling: skipNullGeometries ? "call" : "propagate",
427
+ result: new import_apache_arrow.Field(name, type, true, metadata),
428
+ /** Evaluates active rows and retains their positions in the output batch. */
429
+ evaluate(vectors, { activeRows, length: rowCount }) {
430
+ const numbers = vectors.slice(signatures.length);
431
+ 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"));
432
+ const values = new Array(rowCount).fill(null);
433
+ for (let row = 0; row < rowCount; row++) {
434
+ if (!activeRows[row])
435
+ continue;
436
+ const geometries = [];
437
+ for (let index = 0; index < readers.length; index++) {
438
+ if (skipNullGeometries && !vectors[index].isValid(row))
439
+ continue;
440
+ const geometry = readers[index](row);
441
+ if (!signatures[index].includes(geometry.type))
442
+ throw new Error(`${name} argument ${index + 1} does not support ${geometry.type} at row ${row}`);
443
+ geometries.push(geometry);
444
+ }
445
+ values[row] = evaluate(geometries, ...numbers.map((vector) => Number(vector.get(row))));
446
+ }
447
+ return "encoding" in output ? output.build(values) : (0, import_apache_arrow.vectorFromArray)(values, output);
448
+ }
449
+ };
450
+ }
451
+ };
452
+ }
453
+ function pointCoordinates(geometry) {
454
+ return geometry.type === "Point" && Number.isFinite(geometry.coordinates[0]) && Number.isFinite(geometry.coordinates[1]) ? geometry.coordinates : null;
455
+ }
456
+
457
+ // dist/st-overlay-functions.js
458
+ var unitCircle = /* @__PURE__ */ Array.from({ length: 32 }, (_, index) => {
459
+ const angle = index % 8 * Math.PI / 16;
460
+ const x = Math.cos(angle);
461
+ const y = Math.sin(angle);
462
+ switch (index >>> 3) {
463
+ case 0:
464
+ return [x, y];
465
+ case 1:
466
+ return [-y, x];
467
+ case 2:
468
+ return [-x, -y];
469
+ default:
470
+ return [y, -x];
471
+ }
472
+ });
473
+ var corridorUnionFanout = 64;
474
+ function checkBufferRadius(radius) {
475
+ if (!Number.isFinite(radius))
476
+ throw new Error("ST_Buffer requires a finite radius");
477
+ }
478
+ function checkedRing(ring) {
479
+ if (ring.some((point) => !point.every(Number.isFinite))) {
480
+ throw new Error("ST_Buffer produced a nonfinite coordinate");
481
+ }
482
+ return ring;
483
+ }
484
+ function circleRing(x, y, radius) {
485
+ const ring = unitCircle.map(([dx, dy]) => [
486
+ x + radius * dx,
487
+ y + radius * dy
488
+ ]);
489
+ ring.push(ring[0]);
490
+ return checkedRing(ring);
491
+ }
492
+ function bufferPoint(point, radius) {
493
+ checkBufferRadius(radius);
494
+ const location = pointCoordinates(point);
495
+ if (!location || radius <= 0)
496
+ return { type: "Polygon", coordinates: [] };
497
+ return { type: "Polygon", coordinates: [circleRing(location[0], location[1], radius)] };
498
+ }
499
+ function unionCorridorPieces(pieces) {
500
+ if (!pieces.length)
501
+ return [];
502
+ while (pieces.length > 1) {
503
+ const groups = [];
504
+ for (let first = 0; first < pieces.length; first += corridorUnionFanout) {
505
+ groups.push(import_polygon_clipping2.default.union(pieces[first], ...pieces.slice(first + 1, first + corridorUnionFanout)));
506
+ }
507
+ pieces = groups;
508
+ }
509
+ return pieces[0];
510
+ }
511
+ function bufferLine(geometry, radius) {
512
+ checkBufferRadius(radius);
513
+ if (radius <= 0)
514
+ return { type: "MultiPolygon", coordinates: [] };
515
+ const lines = geometry.type === "MultiLineString" ? geometry.coordinates : geometry.type === "LineString" ? [geometry.coordinates] : [];
516
+ const pieces = [];
517
+ for (const line of lines) {
518
+ let previous;
519
+ for (const coordinate of line) {
520
+ const [x, y] = coordinate;
521
+ if (previous && x === previous[0] && y === previous[1])
522
+ continue;
523
+ pieces.push([[circleRing(x, y, radius)]]);
524
+ if (previous) {
525
+ const x0 = previous[0];
526
+ const y0 = previous[1];
527
+ const dx = x - x0;
528
+ const dy = y - y0;
529
+ const length = Math.hypot(dx, dy);
530
+ if (!Number.isFinite(length))
531
+ throw new Error("ST_Buffer produced a nonfinite segment length");
532
+ const nx = -dy / length * radius;
533
+ const ny = dx / length * radius;
534
+ pieces.push([
535
+ [
536
+ checkedRing([
537
+ [x0 + nx, y0 + ny],
538
+ [x + nx, y + ny],
539
+ [x - nx, y - ny],
540
+ [x0 - nx, y0 - ny],
541
+ [x0 + nx, y0 + ny]
542
+ ])
543
+ ]
544
+ ]);
545
+ }
546
+ previous = coordinate;
547
+ }
548
+ }
549
+ return { type: "MultiPolygon", coordinates: unionCorridorPieces(pieces) };
550
+ }
551
+ var pointBuffer = /* @__PURE__ */ spatialFunction(
552
+ "ST_Buffer",
553
+ [pointKinds],
554
+ /* @__PURE__ */ nativePolygonResult("geoarrow.polygon"),
555
+ ([geometry], radius) => bufferPoint(geometry, radius),
556
+ 1
557
+ );
558
+ var lineBuffer = /* @__PURE__ */ spatialFunction(
559
+ "ST_Buffer",
560
+ [lineKinds],
561
+ /* @__PURE__ */ nativePolygonResult("geoarrow.multipolygon"),
562
+ ([geometry], radius) => bufferLine(geometry, radius),
563
+ 1
564
+ );
565
+ var ST_BUFFER = {
566
+ ...pointBuffer,
567
+ /** Selects the result schema from the input column's GeoArrow encoding. */
568
+ resolvePrototype(fields) {
569
+ var _a;
570
+ const encoding = (_a = fields[0]) == null ? void 0 : _a.metadata.get(EXTENSION_NAME);
571
+ const buffer = encoding === "geoarrow.linestring" || encoding === "geoarrow.multilinestring" ? lineBuffer : pointBuffer;
572
+ return buffer.resolvePrototype(fields);
573
+ }
574
+ };
575
+ function polygonOverlay(name, operation) {
576
+ const spatial = spatialFunction(name, [polygonKinds, polygonKinds], nativePolygonResult("geoarrow.multipolygon"), ([left, right]) => {
577
+ const a = polygonSet(left);
578
+ const b = polygonSet(right);
579
+ return { type: "MultiPolygon", coordinates: operation(a, b) };
580
+ });
581
+ return withFirstInputMetadata(spatial);
582
+ }
583
+ function withFirstInputMetadata(spatial) {
584
+ return {
585
+ ...spatial,
586
+ /** Preserves the first input's metadata. Overlay does not assign a missing CRS. */
587
+ resolvePrototype(fields) {
588
+ var _a;
589
+ const result = spatial.resolvePrototype(fields);
590
+ if (!((_a = fields[0]) == null ? void 0 : _a.metadata.has(EXTENSION_METADATA))) {
591
+ result == null ? void 0 : result.result.metadata.delete(EXTENSION_METADATA);
592
+ }
593
+ return result;
594
+ }
595
+ };
596
+ }
597
+ function intersection() {
598
+ const polygons = polygonOverlay("ST_Intersection", import_polygon_clipping2.default.intersection);
599
+ const output = lineIntersectionResult();
600
+ const linearFirst = spatialFunction("ST_Intersection", [lineKinds, polygonKinds], output, ([line, area]) => intersectLinePolygon(line, area));
601
+ const linearSecond = spatialFunction("ST_Intersection", [polygonKinds, lineKinds], output, ([area, line]) => intersectLinePolygon(line, area));
602
+ return withFirstInputMetadata({
603
+ ...polygons,
604
+ /** A specialized line argument selects a mixed native GeoArrow result before evaluation. */
605
+ resolvePrototype(fields) {
606
+ var _a, _b;
607
+ const a = (_a = fields[0]) == null ? void 0 : _a.metadata.get(EXTENSION_NAME);
608
+ const b = (_b = fields[1]) == null ? void 0 : _b.metadata.get(EXTENSION_NAME);
609
+ if (a === "geoarrow.linestring" || a === "geoarrow.multilinestring")
610
+ return linearFirst.resolvePrototype(fields);
611
+ if (b === "geoarrow.linestring" || b === "geoarrow.multilinestring")
612
+ return linearSecond.resolvePrototype(fields);
613
+ return polygons.resolvePrototype(fields);
614
+ }
615
+ });
616
+ }
617
+ var ST_INTERSECTION = /* @__PURE__ */ intersection();
618
+ var ST_DIFFERENCE = /* @__PURE__ */ polygonOverlay("ST_Difference", import_polygon_clipping2.default.difference);
619
+ var ST_UNION = /* @__PURE__ */ polygonOverlay("ST_Union", import_polygon_clipping2.default.union);
620
+ var ST_SYMDIFFERENCE = /* @__PURE__ */ polygonOverlay("ST_SymDifference", import_polygon_clipping2.default.xor);
621
+ //# sourceMappingURL=st-overlay-functions.cjs.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/st-overlay-functions.ts", "../src/spatial-line-intersection-result.ts", "../src/spatial-planar-intersects.ts", "../src/spatial-touches.ts", "../src/spatial-polygon-overlay.ts", "../src/spatial-line-polygon-intersection.ts", "../src/spatial-sql.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;ACIA,mBAMO;AAIP,IAAM,WAAW;EACf,EAAC,MAAM,SAAS,UAAU,kBAAkB,IAAI,EAAC;EACjD,EAAC,MAAM,cAAc,UAAU,uBAAuB,IAAI,EA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