@math.gl/geospatial 5.0.0-beta.3 → 5.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (475) hide show
  1. package/README.md +192 -2
  2. package/THIRD-PARTY-NOTICES.md +192 -20
  3. package/dist/expressions.d.ts +1 -1
  4. package/dist/expressions.d.ts.map +1 -1
  5. package/dist/index.cjs +456 -4614
  6. package/dist/index.cjs.map +3 -3
  7. package/dist/index.d.ts +9 -8
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +5 -4
  10. package/dist/index.js.map +1 -1
  11. package/dist/projection/experimental/common/adjust_lat.js +1 -1
  12. package/dist/projection/experimental/common/adjust_lat.js.map +1 -1
  13. package/dist/projection/experimental/common/adjust_lon.js +1 -1
  14. package/dist/projection/experimental/common/adjust_lon.js.map +1 -1
  15. package/dist/projection/experimental/common/asinhy.js +1 -1
  16. package/dist/projection/experimental/common/asinhy.js.map +1 -1
  17. package/dist/projection/experimental/common/asinz.js +1 -1
  18. package/dist/projection/experimental/common/asinz.js.map +1 -1
  19. package/dist/projection/experimental/common/authlat.js +1 -1
  20. package/dist/projection/experimental/common/authlat.js.map +1 -1
  21. package/dist/projection/experimental/common/authset.js +1 -1
  22. package/dist/projection/experimental/common/authset.js.map +1 -1
  23. package/dist/projection/experimental/common/clens.js +1 -1
  24. package/dist/projection/experimental/common/clens.js.map +1 -1
  25. package/dist/projection/experimental/common/clens_cmplx.js +1 -1
  26. package/dist/projection/experimental/common/clens_cmplx.js.map +1 -1
  27. package/dist/projection/experimental/common/constants.js +1 -1
  28. package/dist/projection/experimental/common/constants.js.map +1 -1
  29. package/dist/projection/experimental/common/cosh.js +1 -1
  30. package/dist/projection/experimental/common/cosh.js.map +1 -1
  31. package/dist/projection/experimental/common/e0fn.js +1 -1
  32. package/dist/projection/experimental/common/e0fn.js.map +1 -1
  33. package/dist/projection/experimental/common/e1fn.js +1 -1
  34. package/dist/projection/experimental/common/e1fn.js.map +1 -1
  35. package/dist/projection/experimental/common/e2fn.js +1 -1
  36. package/dist/projection/experimental/common/e2fn.js.map +1 -1
  37. package/dist/projection/experimental/common/e3fn.js +1 -1
  38. package/dist/projection/experimental/common/e3fn.js.map +1 -1
  39. package/dist/projection/experimental/common/fL.js +1 -1
  40. package/dist/projection/experimental/common/fL.js.map +1 -1
  41. package/dist/projection/experimental/common/gN.js +1 -1
  42. package/dist/projection/experimental/common/gN.js.map +1 -1
  43. package/dist/projection/experimental/common/gatg.js +1 -1
  44. package/dist/projection/experimental/common/gatg.js.map +1 -1
  45. package/dist/projection/experimental/common/hypot.js +1 -1
  46. package/dist/projection/experimental/common/hypot.js.map +1 -1
  47. package/dist/projection/experimental/common/imlfn.js +1 -1
  48. package/dist/projection/experimental/common/imlfn.js.map +1 -1
  49. package/dist/projection/experimental/common/invlatiso.js +1 -1
  50. package/dist/projection/experimental/common/invlatiso.js.map +1 -1
  51. package/dist/projection/experimental/common/iqsfnz.js +1 -1
  52. package/dist/projection/experimental/common/iqsfnz.js.map +1 -1
  53. package/dist/projection/experimental/common/latiso.js +1 -1
  54. package/dist/projection/experimental/common/latiso.js.map +1 -1
  55. package/dist/projection/experimental/common/log1py.js +1 -1
  56. package/dist/projection/experimental/common/log1py.js.map +1 -1
  57. package/dist/projection/experimental/common/mlfn.js +1 -1
  58. package/dist/projection/experimental/common/mlfn.js.map +1 -1
  59. package/dist/projection/experimental/common/msfnz.js +1 -1
  60. package/dist/projection/experimental/common/msfnz.js.map +1 -1
  61. package/dist/projection/experimental/common/phi2z.js +1 -1
  62. package/dist/projection/experimental/common/phi2z.js.map +1 -1
  63. package/dist/projection/experimental/common/pj_enfn.js +1 -1
  64. package/dist/projection/experimental/common/pj_enfn.js.map +1 -1
  65. package/dist/projection/experimental/common/pj_inv_mlfn.js +1 -1
  66. package/dist/projection/experimental/common/pj_inv_mlfn.js.map +1 -1
  67. package/dist/projection/experimental/common/pj_mlfn.js +1 -1
  68. package/dist/projection/experimental/common/pj_mlfn.js.map +1 -1
  69. package/dist/projection/experimental/common/qsfnz.js +1 -1
  70. package/dist/projection/experimental/common/qsfnz.js.map +1 -1
  71. package/dist/projection/experimental/common/sign.js +1 -1
  72. package/dist/projection/experimental/common/sign.js.map +1 -1
  73. package/dist/projection/experimental/common/sinh.js +1 -1
  74. package/dist/projection/experimental/common/sinh.js.map +1 -1
  75. package/dist/projection/experimental/common/srat.js +1 -1
  76. package/dist/projection/experimental/common/srat.js.map +1 -1
  77. package/dist/projection/experimental/common/tsfnz.js +1 -1
  78. package/dist/projection/experimental/common/tsfnz.js.map +1 -1
  79. package/dist/projection/experimental/common/vincenty.js +1 -1
  80. package/dist/projection/experimental/common/vincenty.js.map +1 -1
  81. package/dist/projection/experimental/core.cjs +100 -2
  82. package/dist/projection/experimental/core.cjs.map +2 -2
  83. package/dist/projection/experimental/core.d.ts +1 -0
  84. package/dist/projection/experimental/core.d.ts.map +1 -1
  85. package/dist/projection/experimental/crs/datum-table.js +1 -1
  86. package/dist/projection/experimental/crs/datum-table.js.map +1 -1
  87. package/dist/projection/experimental/crs/ellipsoid-table.js +1 -1
  88. package/dist/projection/experimental/crs/ellipsoid-table.js.map +1 -1
  89. package/dist/projection/experimental/crs/primemeridian-table.js +1 -1
  90. package/dist/projection/experimental/crs/primemeridian-table.js.map +1 -1
  91. package/dist/projection/experimental/crs/structured.js +1 -1
  92. package/dist/projection/experimental/crs/structured.js.map +1 -1
  93. package/dist/projection/experimental/crs/wkt.js +1 -1
  94. package/dist/projection/experimental/crs/wkt.js.map +1 -1
  95. package/dist/projection/experimental/datum.js +1 -1
  96. package/dist/projection/experimental/datum.js.map +1 -1
  97. package/dist/projection/experimental/ellipsoidal-gnomonic.js +1 -1
  98. package/dist/projection/experimental/ellipsoidal-gnomonic.js.map +1 -1
  99. package/dist/projection/experimental/entries/projections/eqc.cjs +1 -0
  100. package/dist/projection/experimental/entries/projections/eqc.cjs.map +1 -1
  101. package/dist/projection/experimental/entries/projections/merc.cjs +1 -0
  102. package/dist/projection/experimental/entries/projections/merc.cjs.map +1 -1
  103. package/dist/projection/experimental/grids/geotiff.js +1 -1
  104. package/dist/projection/experimental/grids/geotiff.js.map +1 -1
  105. package/dist/projection/experimental/grids/ntv2.js +1 -1
  106. package/dist/projection/experimental/grids/ntv2.js.map +1 -1
  107. package/dist/projection/experimental/index.cjs +102 -2
  108. package/dist/projection/experimental/index.cjs.map +3 -3
  109. package/dist/projection/experimental/kernels/aea.js +1 -1
  110. package/dist/projection/experimental/kernels/aea.js.map +1 -1
  111. package/dist/projection/experimental/kernels/aeqd.js +1 -1
  112. package/dist/projection/experimental/kernels/aeqd.js.map +1 -1
  113. package/dist/projection/experimental/kernels/bonne.js +1 -1
  114. package/dist/projection/experimental/kernels/bonne.js.map +1 -1
  115. package/dist/projection/experimental/kernels/cass.js +1 -1
  116. package/dist/projection/experimental/kernels/cass.js.map +1 -1
  117. package/dist/projection/experimental/kernels/cea.js +1 -1
  118. package/dist/projection/experimental/kernels/cea.js.map +1 -1
  119. package/dist/projection/experimental/kernels/eck6.js +1 -1
  120. package/dist/projection/experimental/kernels/eck6.js.map +1 -1
  121. package/dist/projection/experimental/kernels/eqdc.js +1 -1
  122. package/dist/projection/experimental/kernels/eqdc.js.map +1 -1
  123. package/dist/projection/experimental/kernels/eqearth.js +1 -1
  124. package/dist/projection/experimental/kernels/eqearth.js.map +1 -1
  125. package/dist/projection/experimental/kernels/equi.js +1 -1
  126. package/dist/projection/experimental/kernels/equi.js.map +1 -1
  127. package/dist/projection/experimental/kernels/etmerc.js +1 -1
  128. package/dist/projection/experimental/kernels/etmerc.js.map +1 -1
  129. package/dist/projection/experimental/kernels/gauss.js +1 -1
  130. package/dist/projection/experimental/kernels/gauss.js.map +1 -1
  131. package/dist/projection/experimental/kernels/geos.js +1 -1
  132. package/dist/projection/experimental/kernels/geos.js.map +1 -1
  133. package/dist/projection/experimental/kernels/gnom.js +1 -1
  134. package/dist/projection/experimental/kernels/gnom.js.map +1 -1
  135. package/dist/projection/experimental/kernels/gstmerc.js +1 -1
  136. package/dist/projection/experimental/kernels/gstmerc.js.map +1 -1
  137. package/dist/projection/experimental/kernels/krovak.js +1 -1
  138. package/dist/projection/experimental/kernels/krovak.js.map +1 -1
  139. package/dist/projection/experimental/kernels/laea.js +1 -1
  140. package/dist/projection/experimental/kernels/laea.js.map +1 -1
  141. package/dist/projection/experimental/kernels/lcc.js +1 -1
  142. package/dist/projection/experimental/kernels/lcc.js.map +1 -1
  143. package/dist/projection/experimental/kernels/mill.js +1 -1
  144. package/dist/projection/experimental/kernels/mill.js.map +1 -1
  145. package/dist/projection/experimental/kernels/moll.js +1 -1
  146. package/dist/projection/experimental/kernels/moll.js.map +1 -1
  147. package/dist/projection/experimental/kernels/nzmg.js +1 -1
  148. package/dist/projection/experimental/kernels/nzmg.js.map +1 -1
  149. package/dist/projection/experimental/kernels/omerc.js +1 -1
  150. package/dist/projection/experimental/kernels/omerc.js.map +1 -1
  151. package/dist/projection/experimental/kernels/poly.js +1 -1
  152. package/dist/projection/experimental/kernels/poly.js.map +1 -1
  153. package/dist/projection/experimental/kernels/qsc.js +1 -1
  154. package/dist/projection/experimental/kernels/qsc.js.map +1 -1
  155. package/dist/projection/experimental/kernels/robin.js +1 -1
  156. package/dist/projection/experimental/kernels/robin.js.map +1 -1
  157. package/dist/projection/experimental/kernels/sinu.js +1 -1
  158. package/dist/projection/experimental/kernels/sinu.js.map +1 -1
  159. package/dist/projection/experimental/kernels/somerc.js +1 -1
  160. package/dist/projection/experimental/kernels/somerc.js.map +1 -1
  161. package/dist/projection/experimental/kernels/stere.js +1 -1
  162. package/dist/projection/experimental/kernels/stere.js.map +1 -1
  163. package/dist/projection/experimental/kernels/sterea.js +1 -1
  164. package/dist/projection/experimental/kernels/sterea.js.map +1 -1
  165. package/dist/projection/experimental/kernels/tmerc.js +1 -1
  166. package/dist/projection/experimental/kernels/tmerc.js.map +1 -1
  167. package/dist/projection/experimental/kernels/tpers.js +1 -1
  168. package/dist/projection/experimental/kernels/tpers.js.map +1 -1
  169. package/dist/projection/experimental/kernels/vandg.js +1 -1
  170. package/dist/projection/experimental/kernels/vandg.js.map +1 -1
  171. package/dist/projection/experimental/kinematic-helmert.js +1 -1
  172. package/dist/projection/experimental/kinematic-helmert.js.map +1 -1
  173. package/dist/projection/experimental/lazy-projections/index.cjs +100 -2
  174. package/dist/projection/experimental/lazy-projections/index.cjs.map +2 -2
  175. package/dist/projection/experimental/projections/equidistant-cylindrical.d.ts.map +1 -1
  176. package/dist/projection/experimental/projections/equidistant-cylindrical.js +1 -0
  177. package/dist/projection/experimental/projections/equidistant-cylindrical.js.map +1 -1
  178. package/dist/projection/experimental/projections/mercator.d.ts.map +1 -1
  179. package/dist/projection/experimental/projections/mercator.js +1 -0
  180. package/dist/projection/experimental/projections/mercator.js.map +1 -1
  181. package/dist/projection/experimental/transform-description.d.ts +8 -0
  182. package/dist/projection/experimental/transform-description.d.ts.map +1 -0
  183. package/dist/projection/experimental/transform-description.js +57 -0
  184. package/dist/projection/experimental/transform-description.js.map +1 -0
  185. package/dist/projection/experimental/types.d.ts +5 -0
  186. package/dist/projection/experimental/types.d.ts.map +1 -1
  187. package/dist/projection/experimental/typescript-projection.d.ts +4 -0
  188. package/dist/projection/experimental/typescript-projection.d.ts.map +1 -1
  189. package/dist/projection/experimental/typescript-projection.js +54 -5
  190. package/dist/projection/experimental/typescript-projection.js.map +1 -1
  191. package/dist/projection/index.cjs +102 -2
  192. package/dist/projection/index.cjs.map +3 -3
  193. package/dist/projection/transform-analysis.cjs +100 -2
  194. package/dist/projection/transform-analysis.cjs.map +2 -2
  195. package/dist/projection/transform-description.d.ts +44 -0
  196. package/dist/projection/transform-description.d.ts.map +1 -0
  197. package/dist/projection/transform-description.js +5 -0
  198. package/dist/projection/transform-description.js.map +1 -0
  199. package/dist/projection/types.d.ts +4 -0
  200. package/dist/projection/types.d.ts.map +1 -1
  201. package/dist/tasks/definitions.d.ts +3 -3
  202. package/dist/tasks/index.cjs +107 -2
  203. package/dist/tasks/index.cjs.map +3 -3
  204. package/dist/tasks/index.d.ts +1 -1
  205. package/dist/tasks/index.d.ts.map +1 -1
  206. package/dist/tasks/map-worker.js +1 -1
  207. package/dist/tasks/map-worker.js.map +1 -1
  208. package/dist/tasks/operations.d.ts +1 -1
  209. package/dist/tasks/operations.d.ts.map +1 -1
  210. package/dist/tasks/projection-worker.js +1 -1
  211. package/dist/tasks/projection-worker.js.map +1 -1
  212. package/dist/terrain/contour-boundary-diagnostics.d.ts +23 -0
  213. package/dist/terrain/contour-boundary-diagnostics.d.ts.map +1 -0
  214. package/dist/terrain/contour-boundary-diagnostics.js +62 -0
  215. package/dist/terrain/contour-boundary-diagnostics.js.map +1 -0
  216. package/dist/terrain/contour-mixed-weld.d.ts +25 -0
  217. package/dist/terrain/contour-mixed-weld.d.ts.map +1 -0
  218. package/dist/terrain/contour-mixed-weld.js +194 -0
  219. package/dist/terrain/contour-mixed-weld.js.map +1 -0
  220. package/dist/terrain/contour-tile-paths.d.ts +7 -0
  221. package/dist/terrain/contour-tile-paths.d.ts.map +1 -0
  222. package/dist/terrain/contour-tile-paths.js +12 -0
  223. package/dist/terrain/contour-tile-paths.js.map +1 -0
  224. package/dist/terrain/contour-tile-weld.d.ts +24 -0
  225. package/dist/terrain/contour-tile-weld.d.ts.map +1 -0
  226. package/dist/terrain/contour-tile-weld.js +147 -0
  227. package/dist/terrain/contour-tile-weld.js.map +1 -0
  228. package/dist/terrain/gradient-pyramid.d.ts +29 -0
  229. package/dist/terrain/gradient-pyramid.d.ts.map +1 -0
  230. package/dist/terrain/gradient-pyramid.js +94 -0
  231. package/dist/terrain/gradient-pyramid.js.map +1 -0
  232. package/dist/terrain/height-field.d.ts.map +1 -1
  233. package/dist/terrain/height-field.js +48 -5
  234. package/dist/terrain/height-field.js.map +1 -1
  235. package/dist/terrain/index.cjs +448 -4
  236. package/dist/terrain/index.cjs.map +3 -3
  237. package/dist/terrain/index.d.ts +9 -0
  238. package/dist/terrain/index.d.ts.map +1 -1
  239. package/dist/terrain/index.js +5 -0
  240. package/dist/terrain/index.js.map +1 -1
  241. package/dist/terrain/tiled.d.ts +10 -2
  242. package/dist/terrain/tiled.d.ts.map +1 -1
  243. package/dist/terrain/tiled.js +5 -1
  244. package/dist/terrain/tiled.js.map +1 -1
  245. package/dist/terrain/types.d.ts +6 -0
  246. package/dist/terrain/types.d.ts.map +1 -1
  247. package/dist/turf.cjs +25 -671
  248. package/dist/turf.cjs.map +3 -3
  249. package/dist/turf.d.ts +1 -1
  250. package/dist/turf.d.ts.map +1 -1
  251. package/dist/turf.js +2 -2
  252. package/dist/turf.js.map +1 -1
  253. package/package.json +15 -19
  254. package/src/expressions.ts +1 -1
  255. package/src/index.ts +15 -123
  256. package/src/projection/experimental/common/adjust_lat.ts +1 -1
  257. package/src/projection/experimental/common/adjust_lon.ts +1 -1
  258. package/src/projection/experimental/common/asinhy.ts +1 -1
  259. package/src/projection/experimental/common/asinz.ts +1 -1
  260. package/src/projection/experimental/common/authlat.ts +1 -1
  261. package/src/projection/experimental/common/authset.ts +1 -1
  262. package/src/projection/experimental/common/clens.ts +1 -1
  263. package/src/projection/experimental/common/clens_cmplx.ts +1 -1
  264. package/src/projection/experimental/common/constants.ts +1 -1
  265. package/src/projection/experimental/common/cosh.ts +1 -1
  266. package/src/projection/experimental/common/e0fn.ts +1 -1
  267. package/src/projection/experimental/common/e1fn.ts +1 -1
  268. package/src/projection/experimental/common/e2fn.ts +1 -1
  269. package/src/projection/experimental/common/e3fn.ts +1 -1
  270. package/src/projection/experimental/common/fL.ts +1 -1
  271. package/src/projection/experimental/common/gN.ts +1 -1
  272. package/src/projection/experimental/common/gatg.ts +1 -1
  273. package/src/projection/experimental/common/hypot.ts +1 -1
  274. package/src/projection/experimental/common/imlfn.ts +1 -1
  275. package/src/projection/experimental/common/invlatiso.ts +1 -1
  276. package/src/projection/experimental/common/iqsfnz.ts +1 -1
  277. package/src/projection/experimental/common/latiso.ts +1 -1
  278. package/src/projection/experimental/common/log1py.ts +1 -1
  279. package/src/projection/experimental/common/mlfn.ts +1 -1
  280. package/src/projection/experimental/common/msfnz.ts +1 -1
  281. package/src/projection/experimental/common/phi2z.ts +1 -1
  282. package/src/projection/experimental/common/pj_enfn.ts +1 -1
  283. package/src/projection/experimental/common/pj_inv_mlfn.ts +1 -1
  284. package/src/projection/experimental/common/pj_mlfn.ts +1 -1
  285. package/src/projection/experimental/common/qsfnz.ts +1 -1
  286. package/src/projection/experimental/common/sign.ts +1 -1
  287. package/src/projection/experimental/common/sinh.ts +1 -1
  288. package/src/projection/experimental/common/srat.ts +1 -1
  289. package/src/projection/experimental/common/tsfnz.ts +1 -1
  290. package/src/projection/experimental/common/vincenty.ts +1 -1
  291. package/src/projection/experimental/core.ts +8 -0
  292. package/src/projection/experimental/crs/datum-table.ts +1 -1
  293. package/src/projection/experimental/crs/ellipsoid-table.ts +1 -1
  294. package/src/projection/experimental/crs/primemeridian-table.ts +1 -1
  295. package/src/projection/experimental/crs/structured.ts +1 -1
  296. package/src/projection/experimental/crs/wkt.ts +1 -1
  297. package/src/projection/experimental/datum.ts +1 -1
  298. package/src/projection/experimental/ellipsoidal-gnomonic.ts +1 -1
  299. package/src/projection/experimental/exact-helmert.ts +1 -1
  300. package/src/projection/experimental/grids/geotiff.ts +1 -1
  301. package/src/projection/experimental/grids/grid.ts +1 -1
  302. package/src/projection/experimental/grids/ntv2.ts +1 -1
  303. package/src/projection/experimental/helmert-flat.ts +1 -1
  304. package/src/projection/experimental/kernels/aea.ts +1 -1
  305. package/src/projection/experimental/kernels/aeqd.ts +1 -1
  306. package/src/projection/experimental/kernels/bonne.ts +1 -1
  307. package/src/projection/experimental/kernels/cass.ts +1 -1
  308. package/src/projection/experimental/kernels/cea.ts +1 -1
  309. package/src/projection/experimental/kernels/eck6.ts +1 -1
  310. package/src/projection/experimental/kernels/eqdc.ts +1 -1
  311. package/src/projection/experimental/kernels/eqearth.ts +1 -1
  312. package/src/projection/experimental/kernels/equi.ts +1 -1
  313. package/src/projection/experimental/kernels/etmerc.ts +1 -1
  314. package/src/projection/experimental/kernels/gauss.ts +1 -1
  315. package/src/projection/experimental/kernels/geos.ts +1 -1
  316. package/src/projection/experimental/kernels/gnom.ts +1 -1
  317. package/src/projection/experimental/kernels/gstmerc.ts +1 -1
  318. package/src/projection/experimental/kernels/krovak.ts +1 -1
  319. package/src/projection/experimental/kernels/laea.ts +1 -1
  320. package/src/projection/experimental/kernels/lcc.ts +1 -1
  321. package/src/projection/experimental/kernels/mill.ts +1 -1
  322. package/src/projection/experimental/kernels/moll.ts +1 -1
  323. package/src/projection/experimental/kernels/nzmg.ts +1 -1
  324. package/src/projection/experimental/kernels/omerc.ts +1 -1
  325. package/src/projection/experimental/kernels/ortho.ts +1 -1
  326. package/src/projection/experimental/kernels/poly.ts +1 -1
  327. package/src/projection/experimental/kernels/qsc.ts +1 -1
  328. package/src/projection/experimental/kernels/robin.ts +1 -1
  329. package/src/projection/experimental/kernels/sinu.ts +1 -1
  330. package/src/projection/experimental/kernels/somerc.ts +1 -1
  331. package/src/projection/experimental/kernels/stere.ts +1 -1
  332. package/src/projection/experimental/kernels/sterea.ts +1 -1
  333. package/src/projection/experimental/kernels/tmerc.ts +1 -1
  334. package/src/projection/experimental/kernels/tpers.ts +1 -1
  335. package/src/projection/experimental/kernels/vandg.ts +1 -1
  336. package/src/projection/experimental/kinematic-helmert-flat.ts +1 -1
  337. package/src/projection/experimental/kinematic-helmert.ts +1 -1
  338. package/src/projection/experimental/projection-pipeline.ts +1 -1
  339. package/src/projection/experimental/projections/equidistant-cylindrical.ts +1 -0
  340. package/src/projection/experimental/projections/mercator.ts +1 -0
  341. package/src/projection/experimental/projections/ob-tran.ts +1 -1
  342. package/src/projection/experimental/transform-description.ts +82 -0
  343. package/src/projection/experimental/types.ts +5 -0
  344. package/src/projection/experimental/typescript-projection.ts +54 -6
  345. package/src/projection/transform-description.ts +69 -0
  346. package/src/projection/types.ts +11 -0
  347. package/src/tasks/definitions.ts +1 -1
  348. package/src/tasks/index.ts +1 -1
  349. package/src/tasks/map-worker.ts +1 -1
  350. package/src/tasks/operations.ts +1 -1
  351. package/src/tasks/projection-worker.ts +1 -1
  352. package/src/terrain/contour-boundary-diagnostics.ts +90 -0
  353. package/src/terrain/contour-mixed-weld.ts +254 -0
  354. package/src/terrain/contour-tile-paths.ts +20 -0
  355. package/src/terrain/contour-tile-weld.ts +182 -0
  356. package/src/terrain/gradient-pyramid.ts +129 -0
  357. package/src/terrain/height-field.ts +45 -5
  358. package/src/terrain/index.ts +12 -0
  359. package/src/terrain/tiled.ts +16 -3
  360. package/src/terrain/types.ts +9 -1
  361. package/src/turf.ts +7 -3
  362. package/crs/README.md +0 -84
  363. package/crs/schemas/README.md +0 -9
  364. package/dist/geoarrow/builder-entry.d.ts +0 -4
  365. package/dist/geoarrow/builder-entry.d.ts.map +0 -1
  366. package/dist/geoarrow/builder-entry.js +0 -5
  367. package/dist/geoarrow/builder-entry.js.map +0 -1
  368. package/dist/geoarrow/builder.d.ts +0 -106
  369. package/dist/geoarrow/builder.d.ts.map +0 -1
  370. package/dist/geoarrow/builder.js +0 -668
  371. package/dist/geoarrow/builder.js.map +0 -1
  372. package/dist/geoarrow/codecs.d.ts +0 -24
  373. package/dist/geoarrow/codecs.d.ts.map +0 -1
  374. package/dist/geoarrow/codecs.js +0 -916
  375. package/dist/geoarrow/codecs.js.map +0 -1
  376. package/dist/geoarrow/index.cjs +0 -4352
  377. package/dist/geoarrow/index.cjs.map +0 -6
  378. package/dist/geoarrow/index.d.ts +0 -21
  379. package/dist/geoarrow/index.d.ts.map +0 -1
  380. package/dist/geoarrow/index.js +0 -15
  381. package/dist/geoarrow/index.js.map +0 -1
  382. package/dist/geoarrow/kernels.d.ts +0 -56
  383. package/dist/geoarrow/kernels.d.ts.map +0 -1
  384. package/dist/geoarrow/kernels.js +0 -982
  385. package/dist/geoarrow/kernels.js.map +0 -1
  386. package/dist/geoarrow/layout.d.ts +0 -66
  387. package/dist/geoarrow/layout.d.ts.map +0 -1
  388. package/dist/geoarrow/layout.js +0 -723
  389. package/dist/geoarrow/layout.js.map +0 -1
  390. package/dist/geoarrow/stream-tessellate.d.ts +0 -34
  391. package/dist/geoarrow/stream-tessellate.d.ts.map +0 -1
  392. package/dist/geoarrow/stream-tessellate.js +0 -171
  393. package/dist/geoarrow/stream-tessellate.js.map +0 -1
  394. package/dist/geoarrow/stream.d.ts +0 -29
  395. package/dist/geoarrow/stream.d.ts.map +0 -1
  396. package/dist/geoarrow/stream.js +0 -100
  397. package/dist/geoarrow/stream.js.map +0 -1
  398. package/dist/geoarrow/tessellate.d.ts +0 -31
  399. package/dist/geoarrow/tessellate.d.ts.map +0 -1
  400. package/dist/geoarrow/tessellate.js +0 -102
  401. package/dist/geoarrow/tessellate.js.map +0 -1
  402. package/dist/geoarrow/tessellation-entry.d.ts +0 -4
  403. package/dist/geoarrow/tessellation-entry.d.ts.map +0 -1
  404. package/dist/geoarrow/tessellation-entry.js +0 -5
  405. package/dist/geoarrow/tessellation-entry.js.map +0 -1
  406. package/dist/geoarrow/types.d.ts +0 -155
  407. package/dist/geoarrow/types.d.ts.map +0 -1
  408. package/dist/geoarrow/types.js +0 -71
  409. package/dist/geoarrow/types.js.map +0 -1
  410. package/dist/geoarrow/views.d.ts +0 -45
  411. package/dist/geoarrow/views.d.ts.map +0 -1
  412. package/dist/geoarrow/views.js +0 -114
  413. package/dist/geoarrow/views.js.map +0 -1
  414. package/dist/geoarrow/wkb-entry.d.ts +0 -4
  415. package/dist/geoarrow/wkb-entry.d.ts.map +0 -1
  416. package/dist/geoarrow/wkb-entry.js +0 -6
  417. package/dist/geoarrow/wkb-entry.js.map +0 -1
  418. package/dist/geoarrow/worker.d.ts +0 -11
  419. package/dist/geoarrow/worker.d.ts.map +0 -1
  420. package/dist/geoarrow/worker.js +0 -10
  421. package/dist/geoarrow/worker.js.map +0 -1
  422. package/dist/wkb/index.d.ts +0 -11
  423. package/dist/wkb/index.d.ts.map +0 -1
  424. package/dist/wkb/index.js +0 -9
  425. package/dist/wkb/index.js.map +0 -1
  426. package/dist/wkb/types.d.ts +0 -30
  427. package/dist/wkb/types.d.ts.map +0 -1
  428. package/dist/wkb/types.js +0 -34
  429. package/dist/wkb/types.js.map +0 -1
  430. package/dist/wkb/wkb-builder.d.ts +0 -91
  431. package/dist/wkb/wkb-builder.d.ts.map +0 -1
  432. package/dist/wkb/wkb-builder.js +0 -283
  433. package/dist/wkb/wkb-builder.js.map +0 -1
  434. package/dist/wkb/wkb-reader.d.ts +0 -74
  435. package/dist/wkb/wkb-reader.d.ts.map +0 -1
  436. package/dist/wkb/wkb-reader.js +0 -251
  437. package/dist/wkb/wkb-reader.js.map +0 -1
  438. package/dist/wkb/wkb.d.ts +0 -21
  439. package/dist/wkb/wkb.d.ts.map +0 -1
  440. package/dist/wkb/wkb.js +0 -204
  441. package/dist/wkb/wkb.js.map +0 -1
  442. package/dist/wkb/wkt.d.ts +0 -19
  443. package/dist/wkb/wkt.d.ts.map +0 -1
  444. package/dist/wkb/wkt.js +0 -321
  445. package/dist/wkb/wkt.js.map +0 -1
  446. package/projection/THIRD-PARTY-NOTICES.md +0 -210
  447. package/src/discontinuous/elastic/README.md +0 -20
  448. package/src/discontinuous/spherical-clip/README.md +0 -16
  449. package/src/discontinuous/world-kernels/README.md +0 -24
  450. package/src/geoarrow/builder-entry.ts +0 -18
  451. package/src/geoarrow/builder.ts +0 -860
  452. package/src/geoarrow/codecs.ts +0 -1268
  453. package/src/geoarrow/index.ts +0 -111
  454. package/src/geoarrow/kernels.ts +0 -1290
  455. package/src/geoarrow/layout.ts +0 -900
  456. package/src/geoarrow/stream-tessellate.ts +0 -205
  457. package/src/geoarrow/stream.ts +0 -130
  458. package/src/geoarrow/tessellate.ts +0 -133
  459. package/src/geoarrow/tessellation-entry.ts +0 -7
  460. package/src/geoarrow/types.ts +0 -259
  461. package/src/geoarrow/views.ts +0 -150
  462. package/src/geoarrow/wkb-entry.ts +0 -13
  463. package/src/geoarrow/worker.ts +0 -20
  464. package/src/terrain/vendor/README.md +0 -20
  465. package/src/vendor/geographiclib-geodesic/README.md +0 -26
  466. package/src/wkb/index.ts +0 -38
  467. package/src/wkb/types.ts +0 -54
  468. package/src/wkb/wkb-builder.ts +0 -395
  469. package/src/wkb/wkb-reader.ts +0 -401
  470. package/src/wkb/wkb.ts +0 -255
  471. package/src/wkb/wkt.ts +0 -375
  472. /package/{projection/APACHE-2.0-LICENSE.txt → APACHE-2.0-LICENSE.txt} +0 -0
  473. /package/{projection/PROJ-LICENSE.txt → PROJ-LICENSE.txt} +0 -0
  474. /package/{projection/PROJ4-LICENSE.md → PROJ4-LICENSE.md} +0 -0
  475. /package/{crs/schemas → src/crs}/projjson.schema.json +0 -0
@@ -34,6 +34,7 @@ __export(index_exports, {
34
34
  HeightFieldGeometry: () => HeightFieldGeometry,
35
35
  HeightFieldMinMax: () => HeightFieldMinMax,
36
36
  TERRAIN_BUFFER_VERSION: () => TERRAIN_BUFFER_VERSION,
37
+ TerrainContourBoundaryAxis: () => TerrainContourBoundaryAxis,
37
38
  TerrainProfileViewStatus: () => TerrainProfileViewStatus,
38
39
  TerrainSampleStatus: () => TerrainSampleStatus,
39
40
  TerrainSurface: () => TerrainSurface,
@@ -44,11 +45,13 @@ __export(index_exports, {
44
45
  createTerrainContours: () => createTerrainContours,
45
46
  createTerrainFilteredPyramid: () => createTerrainFilteredPyramid,
46
47
  createTerrainGradientGrid: () => createTerrainGradientGrid,
48
+ createTerrainGradientPyramid: () => createTerrainGradientPyramid,
47
49
  createTerrainMesh: () => createTerrainMesh,
48
50
  createTerrainSkirt: () => createTerrainSkirt,
49
51
  createTerrainSlopeAspectGrid: () => createTerrainSlopeAspectGrid,
50
52
  createTerrainSurface: () => createTerrainSurface,
51
53
  createTerrainVertexTileHalos: () => createTerrainVertexTileHalos,
54
+ diagnoseTerrainContourBoundaries: () => diagnoseTerrainContourBoundaries,
52
55
  getTerrainMeshEdge: () => getTerrainMeshEdge,
53
56
  getTerrainProfileHorizon: () => getTerrainProfileHorizon,
54
57
  getTerrainProfileViewshed: () => getTerrainProfileViewshed,
@@ -61,10 +64,13 @@ __export(index_exports, {
61
64
  reconcileTerrainVertexTiles: () => reconcileTerrainVertexTiles,
62
65
  sampleTerrainProfile: () => sampleTerrainProfile,
63
66
  simplifyTerrainContourPaths: () => simplifyTerrainContourPaths,
67
+ stitchTerrainContourTiles: () => stitchTerrainContourTiles,
64
68
  stitchTerrainContours: () => stitchTerrainContours,
65
69
  stitchTerrainMeshEdges: () => stitchTerrainMeshEdges,
66
70
  unpackTerrainHeightField: () => unpackTerrainHeightField,
67
- updateTerrainVertexTileHalos: () => updateTerrainVertexTileHalos
71
+ updateTerrainVertexTileHalos: () => updateTerrainVertexTileHalos,
72
+ weldTerrainContourTiles: () => weldTerrainContourTiles,
73
+ weldTerrainMixedContourTiles: () => weldTerrainMixedContourTiles
68
74
  });
69
75
  module.exports = __toCommonJS(index_exports);
70
76
 
@@ -165,6 +171,12 @@ var HeightField = class {
165
171
  if (interpolation !== "nearest" && interpolation !== "bilinear" && interpolation !== "triangle") {
166
172
  throw new Error("Unknown terrain interpolation");
167
173
  }
174
+ const domain = (options == null ? void 0 : options.domain) ?? "samples";
175
+ const noData = (options == null ? void 0 : options.noData) ?? "cell";
176
+ if (domain !== "samples" && domain !== "footprint")
177
+ throw new Error("Unknown terrain sample domain");
178
+ if (noData !== "cell" && noData !== "support")
179
+ throw new Error("Unknown terrain nodata policy");
168
180
  if (!Number.isFinite(x) || !Number.isFinite(y))
169
181
  return result;
170
182
  const dx = x - this.origin[0];
@@ -179,11 +191,23 @@ var HeightField = class {
179
191
  const errorY = 4 * Number.EPSILON * Math.abs(y) + 4 * Number.EPSILON * Math.abs(this.origin[1]);
180
192
  const toleranceU = tolerance + Math.abs(this.inverse[0]) * errorX + Math.abs(this.inverse[1]) * errorY;
181
193
  const toleranceV = tolerance + Math.abs(this.inverse[2]) * errorX + Math.abs(this.inverse[3]) * errorY;
182
- if (u < -toleranceU || v < -toleranceV || u > this.width - 1 + toleranceU || v > this.height - 1 + toleranceV) {
194
+ const margin = domain === "footprint" && this.registration === "cell" ? 0.5 : 0;
195
+ if (u < -margin - toleranceU || v < -margin - toleranceV || u > this.width - 1 + margin + toleranceU || v > this.height - 1 + margin + toleranceV) {
183
196
  return resetSample(result, TerrainSampleStatus.OUTSIDE_DOMAIN);
184
197
  }
198
+ const edgeToleranceU = Math.min(1e-6, toleranceU);
199
+ const edgeToleranceV = Math.min(1e-6, toleranceV);
200
+ const clampedColumn = margin > 0 && (u < -edgeToleranceU || u > this.width - 1 + edgeToleranceU);
201
+ const clampedRow = margin > 0 && (v < -edgeToleranceV || v > this.height - 1 + edgeToleranceV);
185
202
  u = Math.max(0, Math.min(this.width - 1, u));
186
203
  v = Math.max(0, Math.min(this.height - 1, v));
204
+ if (noData === "support" && interpolation === "bilinear") {
205
+ const column2 = Math.round(u), row2 = Math.round(v);
206
+ if (Math.abs(u - column2) <= Math.min(1e-6, toleranceU))
207
+ u = column2;
208
+ if (Math.abs(v - row2) <= Math.min(1e-6, toleranceV))
209
+ v = row2;
210
+ }
187
211
  if (interpolation === "nearest") {
188
212
  const value = this.getHeight(Math.floor(u + 0.5), Math.floor(v + 0.5));
189
213
  if (value === void 0)
@@ -209,7 +233,21 @@ var HeightField = class {
209
233
  let dv;
210
234
  if (interpolation === "bilinear") {
211
235
  if (!this.validity[a] || !this.validity[b] || !this.validity[c] || !this.validity[d]) {
212
- return resetSample(result, TerrainSampleStatus.NO_DATA);
236
+ if (noData === "cell")
237
+ return resetSample(result, TerrainSampleStatus.NO_DATA);
238
+ const weightA = (1 - u) * (1 - v);
239
+ const weightB = u * (1 - v);
240
+ const weightC = (1 - u) * v;
241
+ const weightD = u * v;
242
+ if (weightA > 0 && !this.validity[a] || weightB > 0 && !this.validity[b] || weightC > 0 && !this.validity[c] || weightD > 0 && !this.validity[d])
243
+ return resetSample(result, TerrainSampleStatus.NO_DATA);
244
+ const height = weightA * za + weightB * zb + weightC * zc + weightD * zd;
245
+ if (!Number.isFinite(height))
246
+ return resetSample(result, TerrainSampleStatus.NUMERIC_ERROR);
247
+ result.status = TerrainSampleStatus.VALID;
248
+ result.height = height;
249
+ result.gradientStatus = TerrainSampleStatus.NO_DATA;
250
+ return result;
213
251
  }
214
252
  result.height = (1 - v) * ((1 - u) * za + u * zb) + v * ((1 - u) * zc + u * zd);
215
253
  du = (1 - v) * (zb - za) + v * (zd - zc);
@@ -234,6 +272,10 @@ var HeightField = class {
234
272
  if (!Number.isFinite(result.height))
235
273
  return resetSample(result, TerrainSampleStatus.NUMERIC_ERROR);
236
274
  result.status = TerrainSampleStatus.VALID;
275
+ if (clampedColumn)
276
+ du = 0;
277
+ if (clampedRow)
278
+ dv = 0;
237
279
  const gx = du * this.inverse[0] + dv * this.inverse[2];
238
280
  const gy = du * this.inverse[1] + dv * this.inverse[3];
239
281
  if (!Number.isFinite(gx) || !Number.isFinite(gy)) {
@@ -771,8 +813,12 @@ var TiledHeightField = class _TiledHeightField {
771
813
  heightReference: this.heightReference
772
814
  };
773
815
  }
774
- /** Queries never mix resolutions. Only absent residency permits coarser fallback. */
816
+ /** Queries never mix resolutions. Only absent residency permits coarser fallback.
817
+ * Raster footprint/masked-support policies are specific to HeightField, not tiled halos.
818
+ */
775
819
  sample(x, y, options) {
820
+ if ("domain" in options || "noData" in options)
821
+ throw new Error("Raster sampling policies require a HeightField");
776
822
  const requested = this.getMatrix(options.matrixId);
777
823
  if (options.fallback !== void 0 && options.fallback !== "none" && options.fallback !== "coarser")
778
824
  throw new Error("Unknown terrain fallback");
@@ -2575,6 +2621,245 @@ function stitchTerrainContours(contours, options = {}) {
2575
2621
  };
2576
2622
  }
2577
2623
 
2624
+ // dist/terrain/contour-tile-weld.js
2625
+ function weldTerrainContourTiles(tiles, options) {
2626
+ const { width, height } = options;
2627
+ const limits = contourPathLimits(options);
2628
+ const tolerance = options.maxPositionDifference ?? 0;
2629
+ const maxTiles = options.maxTiles ?? 4096;
2630
+ if (!Number.isSafeInteger(width) || width < 2 || !Number.isSafeInteger(height) || height < 2 || !Number.isFinite(tolerance) || tolerance < 0 || !Number.isSafeInteger(maxTiles) || maxTiles < 1 || tiles.length > maxTiles || !tiles.length)
2631
+ throw new Error("Invalid terrain contour tile dimensions or tolerance");
2632
+ const sorted = [...tiles].sort((a, b) => a.column - b.column || a.row - b.row);
2633
+ const first = sorted[0].contours;
2634
+ const origin = [...first.origin];
2635
+ const levels = first.levels.slice();
2636
+ const positions = [], grid = [], segments = [], levelIndices = [];
2637
+ const vertices = /* @__PURE__ */ new Map();
2638
+ const edges = /* @__PURE__ */ new Map();
2639
+ const addresses = /* @__PURE__ */ new Set();
2640
+ let inputVertices = 0;
2641
+ let inputSegments = 0;
2642
+ for (let tileIndex = 0; tileIndex < sorted.length; tileIndex++) {
2643
+ const tile = sorted[tileIndex], data = tile.contours;
2644
+ const id = `${tile.column},${tile.row}`;
2645
+ if (!Number.isSafeInteger(tile.column) || !Number.isSafeInteger(tile.row) || addresses.has(id))
2646
+ throw new Error("Invalid or duplicate terrain contour tile address");
2647
+ addresses.add(id);
2648
+ const x0 = tile.column * (width - 1), y0 = tile.row * (height - 1);
2649
+ if (![x0, y0, x0 + width - 1, y0 + height - 1].every(Number.isSafeInteger))
2650
+ throw new Error("Terrain contour tile lattice overflow");
2651
+ const count = validateContourData(data, limits);
2652
+ inputVertices += count;
2653
+ if (inputVertices > limits.maxVertices)
2654
+ throw new Error("Terrain contour input vertex capacity exceeded");
2655
+ if (data.heightReference !== first.heightReference || data.levels.length !== levels.length || !data.levels.every((level, i) => level === levels[i]))
2656
+ throw new Error("Terrain contour tile levels or height reference differ");
2657
+ if (!(data.segments instanceof Uint32Array) || data.segments.length % 2 || !(data.levelIndices instanceof Uint32Array) || data.levelIndices.length !== data.segments.length / 2 || data.levelIndices.length > limits.maxSegments)
2658
+ throw new Error("Invalid terrain contour tile segments");
2659
+ inputSegments += data.levelIndices.length;
2660
+ if (inputSegments > limits.maxSegments)
2661
+ throw new Error("Terrain contour input segment capacity exceeded");
2662
+ const assigned = new Uint32Array(count).fill(4294967295);
2663
+ const remap = new Uint32Array(count).fill(4294967295);
2664
+ const localBoundary = /* @__PURE__ */ new Set();
2665
+ const mapVertex = (source, level) => {
2666
+ validateContourVertex(data, source, level, assigned);
2667
+ if (remap[source] !== 4294967295)
2668
+ return remap[source];
2669
+ const x = data.gridCoordinates[2 * source], y = data.gridCoordinates[2 * source + 1];
2670
+ if (x < 0 || x > width - 1 || y < 0 || y > height - 1)
2671
+ throw new Error("Terrain contour vertex outside tile lattice");
2672
+ const gx = x0 + x, gy = y0 + y;
2673
+ if (!Number.isFinite(gx) || !Number.isFinite(gy) || x % 1 !== 0 && Number.isInteger(gx) || y % 1 !== 0 && Number.isInteger(gy))
2674
+ throw new Error("Terrain contour tile lattice loses precision");
2675
+ const px = data.positions[3 * source] + (data.origin[0] - origin[0]);
2676
+ const py = data.positions[3 * source + 1] + (data.origin[1] - origin[1]);
2677
+ if (!Number.isFinite(px) || !Number.isFinite(py))
2678
+ throw new Error("Terrain contour frame overflow");
2679
+ const boundary = x === 0 || y === 0 || x === width - 1 || y === height - 1;
2680
+ const xi = Math.floor(x), yi = Math.floor(y);
2681
+ const vertexKey = `${level}/${x0 + xi}/${x - xi}/${y0 + yi}/${y - yi}`;
2682
+ if (boundary) {
2683
+ if (localBoundary.has(vertexKey))
2684
+ throw new Error("Duplicate terrain contour boundary vertex");
2685
+ localBoundary.add(vertexKey);
2686
+ }
2687
+ const found = boundary ? vertices.get(vertexKey) : void 0;
2688
+ if (found) {
2689
+ if (found.tile === tileIndex)
2690
+ throw new Error("Duplicate terrain contour boundary vertex");
2691
+ const delta = Math.hypot(px - positions[3 * found.id], py - positions[3 * found.id + 1]);
2692
+ if (!Number.isFinite(delta) || delta > tolerance)
2693
+ throw new Error("Terrain contour boundary positions disagree");
2694
+ remap[source] = found.id;
2695
+ return found.id;
2696
+ }
2697
+ if (positions.length / 3 >= limits.maxVertices)
2698
+ throw new Error("Terrain contour vertex capacity exceeded");
2699
+ const output = positions.length / 3;
2700
+ const pz = levels[level] - origin[2];
2701
+ if (!Number.isFinite(pz))
2702
+ throw new Error("Terrain contour frame overflow");
2703
+ positions.push(px, py, pz);
2704
+ grid.push(gx, gy);
2705
+ if (boundary)
2706
+ vertices.set(vertexKey, { id: output, tile: tileIndex });
2707
+ remap[source] = output;
2708
+ return output;
2709
+ };
2710
+ for (let i = 0; i < data.levelIndices.length; i++) {
2711
+ const level = data.levelIndices[i], a = mapVertex(data.segments[2 * i], level), b = mapVertex(data.segments[2 * i + 1], level);
2712
+ if (a === b || positions[3 * a] === positions[3 * b] && positions[3 * a + 1] === positions[3 * b + 1])
2713
+ throw new Error("Degenerate terrain contour segment after rebasing");
2714
+ const edge = a < b ? `${a}/${b}` : `${b}/${a}`;
2715
+ const previous = edges.get(edge);
2716
+ if (previous !== void 0) {
2717
+ if (previous === tileIndex)
2718
+ throw new Error("Duplicate terrain contour segment");
2719
+ continue;
2720
+ }
2721
+ if (levelIndices.length >= limits.maxSegments)
2722
+ throw new Error("Terrain contour segment capacity exceeded");
2723
+ edges.set(edge, tileIndex);
2724
+ segments.push(a, b);
2725
+ levelIndices.push(level);
2726
+ }
2727
+ }
2728
+ return {
2729
+ positions: Float64Array.from(positions),
2730
+ gridCoordinates: Float64Array.from(grid),
2731
+ segments: Uint32Array.from(segments),
2732
+ levelIndices: Uint32Array.from(levelIndices),
2733
+ levels,
2734
+ origin,
2735
+ heightReference: first.heightReference
2736
+ };
2737
+ }
2738
+
2739
+ // dist/terrain/contour-boundary-diagnostics.js
2740
+ var TerrainContourBoundaryAxis = { COLUMN: 1, ROW: 2 };
2741
+ function diagnoseTerrainContourBoundaries(contours, options) {
2742
+ const { width, height } = options;
2743
+ if (!Number.isSafeInteger(width) || width < 2 || !Number.isSafeInteger(height) || height < 2)
2744
+ throw new Error("Invalid terrain contour boundary tile dimensions");
2745
+ const limits = contourPathLimits(options);
2746
+ const count = validateContourData(contours, limits);
2747
+ if (!(contours.segments instanceof Uint32Array) || contours.segments.length % 2 || !(contours.levelIndices instanceof Uint32Array) || contours.levelIndices.length !== contours.segments.length / 2 || contours.levelIndices.length > limits.maxSegments)
2748
+ throw new Error("Invalid terrain contour boundary segments or capacity");
2749
+ const degrees = new Uint32Array(count), assignments = new Uint32Array(count).fill(4294967295);
2750
+ const seen = /* @__PURE__ */ new Set();
2751
+ for (let i = 0; i < contours.levelIndices.length; i++) {
2752
+ const a = contours.segments[2 * i], b = contours.segments[2 * i + 1], level = contours.levelIndices[i];
2753
+ validateContourVertex(contours, a, level, assignments);
2754
+ validateContourVertex(contours, b, level, assignments);
2755
+ if (a === b || contours.positions[3 * a] === contours.positions[3 * b] && contours.positions[3 * a + 1] === contours.positions[3 * b + 1])
2756
+ throw new Error("Degenerate terrain contour segment");
2757
+ const key = a < b ? `${a}/${b}` : `${b}/${a}`;
2758
+ if (seen.has(key))
2759
+ throw new Error("Duplicate terrain contour segment");
2760
+ seen.add(key);
2761
+ degrees[a]++;
2762
+ degrees[b]++;
2763
+ }
2764
+ const vertices = [], resultDegrees = [], levels = [], axes = [];
2765
+ for (let i = 0; i < count; i++) {
2766
+ if (degrees[i] !== 1 && degrees[i] <= 2)
2767
+ continue;
2768
+ const x = contours.gridCoordinates[2 * i], y = contours.gridCoordinates[2 * i + 1];
2769
+ if (Math.abs(x) > Number.MAX_SAFE_INTEGER || Math.abs(y) > Number.MAX_SAFE_INTEGER)
2770
+ throw new Error("Terrain contour boundary lattice exceeds safe integer range");
2771
+ const axis = (Number.isSafeInteger(x) && x % (width - 1) === 0 ? TerrainContourBoundaryAxis.COLUMN : 0) | (Number.isSafeInteger(y) && y % (height - 1) === 0 ? TerrainContourBoundaryAxis.ROW : 0);
2772
+ if (!axis)
2773
+ continue;
2774
+ vertices.push(i);
2775
+ resultDegrees.push(degrees[i]);
2776
+ levels.push(assignments[i]);
2777
+ axes.push(axis);
2778
+ }
2779
+ return {
2780
+ vertexIndices: Uint32Array.from(vertices),
2781
+ degrees: Uint32Array.from(resultDegrees),
2782
+ levelIndices: Uint32Array.from(levels),
2783
+ boundaryAxes: Uint8Array.from(axes)
2784
+ };
2785
+ }
2786
+
2787
+ // dist/terrain/contour-tile-paths.js
2788
+ function stitchTerrainContourTiles(tiles, options) {
2789
+ return stitchTerrainContours(weldTerrainContourTiles(tiles, options), options);
2790
+ }
2791
+
2792
+ // dist/terrain/gradient-pyramid.js
2793
+ function createTerrainGradientPyramid(grid, options = {}) {
2794
+ const { width, height, gradients, statuses } = grid;
2795
+ const count = width * height, limit = options.maxSamples ?? 4e6;
2796
+ if (!Number.isSafeInteger(width) || width < 1 || !Number.isSafeInteger(height) || height < 1 || !Number.isSafeInteger(count) || count > 4294967295 || !Number.isSafeInteger(limit) || limit < count || !(gradients instanceof Float64Array) || gradients.length !== 2 * count || !(statuses instanceof Uint8Array) || statuses.length !== count || grid.method !== "horn" && grid.method !== "zevenbergen-thorne" || grid.registration !== "cell" && grid.registration !== "vertex" || typeof grid.heightReference !== "string" || ![grid.origin, grid.columnStep, grid.rowStep].every((v) => v.length === 2 && v.every(Number.isFinite)))
2797
+ throw new Error("Invalid terrain gradient pyramid input or capacity");
2798
+ const base = {
2799
+ width,
2800
+ height,
2801
+ blockSize: 1,
2802
+ gradients: new Float64Array(2 * count),
2803
+ validCounts: new Uint32Array(count),
2804
+ sampleCounts: new Uint32Array(count).fill(1)
2805
+ };
2806
+ for (let i = 0; i < count; i++) {
2807
+ if (statuses[i] > TerrainSampleStatus.NOT_RESIDENT)
2808
+ throw new Error("Invalid terrain gradient status");
2809
+ if (statuses[i] === TerrainSampleStatus.VALID) {
2810
+ if (!Number.isFinite(gradients[2 * i]) || !Number.isFinite(gradients[2 * i + 1]))
2811
+ throw new Error("Invalid terrain gradient value");
2812
+ base.gradients[2 * i] = gradients[2 * i];
2813
+ base.gradients[2 * i + 1] = gradients[2 * i + 1];
2814
+ base.validCounts[i] = 1;
2815
+ }
2816
+ }
2817
+ const levels = [base];
2818
+ let source = base;
2819
+ while (source.width > 1 || source.height > 1) {
2820
+ const w = Math.ceil(source.width / 2), h = Math.ceil(source.height / 2);
2821
+ const next = {
2822
+ width: w,
2823
+ height: h,
2824
+ blockSize: source.blockSize * 2,
2825
+ gradients: new Float64Array(2 * w * h),
2826
+ validCounts: new Uint32Array(w * h),
2827
+ sampleCounts: new Uint32Array(w * h)
2828
+ };
2829
+ for (let y = 0; y < h; y++)
2830
+ for (let x = 0; x < w; x++) {
2831
+ const out = y * w + x;
2832
+ for (let dy = 0; dy < 2; dy++)
2833
+ for (let dx = 0; dx < 2; dx++) {
2834
+ const sx = 2 * x + dx, sy = 2 * y + dy;
2835
+ if (sx >= source.width || sy >= source.height)
2836
+ continue;
2837
+ const index = sy * source.width + sx, n = source.validCounts[index], old = next.validCounts[out];
2838
+ next.sampleCounts[out] += source.sampleCounts[index];
2839
+ if (n) {
2840
+ const total = old + n;
2841
+ for (let axis = 0; axis < 2; axis++) {
2842
+ const a = next.gradients[2 * out + axis], b = source.gradients[2 * index + axis];
2843
+ next.gradients[2 * out + axis] = old ? a * (old / total) + b * (n / total) : b;
2844
+ }
2845
+ next.validCounts[out] = total;
2846
+ }
2847
+ }
2848
+ }
2849
+ levels.push(next);
2850
+ source = next;
2851
+ }
2852
+ return {
2853
+ levels,
2854
+ method: grid.method,
2855
+ origin: [...grid.origin],
2856
+ columnStep: [...grid.columnStep],
2857
+ rowStep: [...grid.rowStep],
2858
+ registration: grid.registration,
2859
+ heightReference: grid.heightReference
2860
+ };
2861
+ }
2862
+
2578
2863
  // dist/terrain/contour-simplify.js
2579
2864
  function simplifyTerrainContourPaths(paths, options) {
2580
2865
  const limits = contourPathLimits(options), count = validateContourData(paths, limits);
@@ -3470,4 +3755,163 @@ function stitchTerrainMeshEdges(a, edgeA, b, edgeB, options = {}) {
3470
3755
  function pair(a, b) {
3471
3756
  return a < b ? `${a},${b}` : `${b},${a}`;
3472
3757
  }
3758
+
3759
+ // dist/terrain/contour-mixed-weld.js
3760
+ function weldTerrainMixedContourTiles(tiles, options = {}) {
3761
+ const limits = contourPathLimits(options);
3762
+ const maxTiles = options.maxTiles ?? 4096;
3763
+ const budget = options.maxBoundaryTests ?? 1e7;
3764
+ const tolerance = options.maxPositionDifference ?? 0;
3765
+ if (!Number.isSafeInteger(maxTiles) || maxTiles < 1 || !tiles.length || tiles.length > maxTiles || !Number.isSafeInteger(budget) || budget < 0 || !Number.isFinite(tolerance) || tolerance < 0)
3766
+ throw new Error("Invalid mixed contour capacity or tolerance");
3767
+ let tests = 0;
3768
+ const charge = () => {
3769
+ if (++tests > budget)
3770
+ throw new Error("Mixed contour boundary-test budget exceeded");
3771
+ };
3772
+ const sorted = [...tiles].sort((a, b) => a.column - b.column || a.row - b.row || a.spacing - b.spacing);
3773
+ const bounds = sorted.map((t) => {
3774
+ if (![t.column, t.row, t.width, t.height, t.spacing].every(Number.isSafeInteger) || t.width < 2 || t.height < 2 || t.spacing < 1 || 2 ** Math.round(Math.log2(t.spacing)) !== t.spacing)
3775
+ throw new Error("Invalid mixed contour tile lattice");
3776
+ const x1 = t.column + (t.width - 1) * t.spacing, y1 = t.row + (t.height - 1) * t.spacing;
3777
+ if (![(t.width - 1) * t.spacing, (t.height - 1) * t.spacing, x1, y1].every(Number.isSafeInteger))
3778
+ throw new Error("Mixed contour lattice overflow");
3779
+ return [t.column, t.row, x1, y1];
3780
+ });
3781
+ for (let i = 0; i < bounds.length; i++)
3782
+ for (let j = 0; j < i; j++) {
3783
+ charge();
3784
+ const a = bounds[i], b = bounds[j];
3785
+ if (Math.max(a[0], b[0]) < Math.min(a[2], b[2]) && Math.max(a[1], b[1]) < Math.min(a[3], b[3]))
3786
+ throw new Error("Mixed contour tile interiors overlap");
3787
+ }
3788
+ const first = sorted[0].contours, origin = [...first.origin];
3789
+ const positions = [], grid = [], vertexLevels = [];
3790
+ const roundedBoundary = /* @__PURE__ */ new Map();
3791
+ const boundary = /* @__PURE__ */ new Set(), shared = /* @__PURE__ */ new Map();
3792
+ const edges = [];
3793
+ let inputVertices = 0, inputSegments = 0;
3794
+ for (let ti = 0; ti < sorted.length; ti++) {
3795
+ const tile = sorted[ti], data = tile.contours;
3796
+ const count = validateContourData(data, limits);
3797
+ inputVertices += count;
3798
+ if (inputVertices > limits.maxVertices)
3799
+ throw new Error("Mixed contour input vertex capacity exceeded");
3800
+ if (data.heightReference !== first.heightReference || data.levels.length !== first.levels.length || !data.levels.every((v, i) => v === first.levels[i]))
3801
+ throw new Error("Mixed contour levels or height reference differ");
3802
+ if (!(data.segments instanceof Uint32Array) || data.segments.length % 2 || !(data.levelIndices instanceof Uint32Array) || data.levelIndices.length !== data.segments.length / 2)
3803
+ throw new Error("Invalid mixed contour segments");
3804
+ inputSegments += data.levelIndices.length;
3805
+ if (inputSegments > limits.maxSegments)
3806
+ throw new Error("Mixed contour input segment capacity exceeded");
3807
+ const assigned = new Uint32Array(count).fill(4294967295), remap = /* @__PURE__ */ new Map();
3808
+ const local = /* @__PURE__ */ new Set();
3809
+ const vertex = (v, level) => {
3810
+ validateContourVertex(data, v, level, assigned);
3811
+ const existing = remap.get(v);
3812
+ if (existing !== void 0)
3813
+ return existing;
3814
+ const x = data.gridCoordinates[2 * v], y = data.gridCoordinates[2 * v + 1];
3815
+ if (x < 0 || x > tile.width - 1 || y < 0 || y > tile.height - 1)
3816
+ throw new Error("Mixed contour vertex outside tile");
3817
+ const sx = x * tile.spacing, sy = y * tile.spacing;
3818
+ const gx = tile.column + sx, gy = tile.row + sy;
3819
+ if (Math.abs(gx - tile.column - sx) > 8 * Number.EPSILON * Math.max(1, Math.abs(sx)) || Math.abs(gy - tile.row - sy) > 8 * Number.EPSILON * Math.max(1, Math.abs(sy)))
3820
+ throw new Error("Mixed contour lattice loses precision");
3821
+ const px = data.positions[3 * v] + (data.origin[0] - origin[0]), py = data.positions[3 * v + 1] + (data.origin[1] - origin[1]);
3822
+ const pz = data.levels[level] - origin[2];
3823
+ if (![gx, gy, px, py, pz].every(Number.isFinite))
3824
+ throw new Error("Mixed contour frame overflow");
3825
+ const onEdge = x === 0 || y === 0 || x === tile.width - 1 || y === tile.height - 1;
3826
+ const xi = Math.floor(sx), yi = Math.floor(sy);
3827
+ const key = `${level}/${tile.column + xi}/${sx - xi}/${tile.row + yi}/${sy - yi}`;
3828
+ if (onEdge) {
3829
+ const rounded = `${level}/${gx}/${gy}`;
3830
+ const identity = roundedBoundary.get(rounded);
3831
+ if (identity !== void 0 && identity !== key)
3832
+ throw new Error("Mixed contour lattice loses precision");
3833
+ roundedBoundary.set(rounded, key);
3834
+ }
3835
+ if (onEdge && local.has(key))
3836
+ throw new Error("Duplicate mixed contour boundary vertex");
3837
+ if (onEdge)
3838
+ local.add(key);
3839
+ let id = onEdge ? shared.get(key) : void 0;
3840
+ if (id !== void 0) {
3841
+ if (Math.hypot(px - positions[3 * id], py - positions[3 * id + 1]) > tolerance)
3842
+ throw new Error("Mixed contour boundary positions disagree");
3843
+ } else {
3844
+ id = positions.length / 3;
3845
+ if (id >= limits.maxVertices)
3846
+ throw new Error("Mixed contour vertex capacity exceeded");
3847
+ positions.push(px, py, pz);
3848
+ grid.push(gx, gy);
3849
+ vertexLevels.push(level);
3850
+ if (onEdge) {
3851
+ shared.set(key, id);
3852
+ boundary.add(id);
3853
+ }
3854
+ }
3855
+ remap.set(v, id);
3856
+ return id;
3857
+ };
3858
+ const localEdges = /* @__PURE__ */ new Set();
3859
+ for (let i = 0; i < data.levelIndices.length; i++) {
3860
+ const level = data.levelIndices[i], a = vertex(data.segments[2 * i], level), b = vertex(data.segments[2 * i + 1], level);
3861
+ if (a === b || positions[3 * a] === positions[3 * b] && positions[3 * a + 1] === positions[3 * b + 1])
3862
+ throw new Error("Degenerate mixed contour segment");
3863
+ const key = a < b ? `${a}/${b}` : `${b}/${a}`;
3864
+ if (localEdges.has(key))
3865
+ throw new Error("Duplicate mixed contour segment");
3866
+ localEdges.add(key);
3867
+ const box = bounds[ti];
3868
+ const seam = grid[2 * a] === grid[2 * b] && (grid[2 * a] === box[0] || grid[2 * a] === box[2]) || grid[2 * a + 1] === grid[2 * b + 1] && (grid[2 * a + 1] === box[1] || grid[2 * a + 1] === box[3]);
3869
+ edges.push({ a, b, level, tile: ti, seam });
3870
+ }
3871
+ }
3872
+ const segments = [], levels = [], emitted = /* @__PURE__ */ new Map();
3873
+ for (const edge of edges) {
3874
+ const { a, b, level } = edge;
3875
+ const axis = grid[2 * a] === grid[2 * b] ? 1 : 0;
3876
+ const start = grid[2 * a + axis], end = grid[2 * b + axis];
3877
+ const cuts = [a, b];
3878
+ if (edge.seam)
3879
+ for (const v of boundary) {
3880
+ charge();
3881
+ const value = grid[2 * v + axis];
3882
+ if (vertexLevels[v] !== level || grid[2 * v + 1 - axis] !== grid[2 * a + 1 - axis] || value <= Math.min(start, end) || value >= Math.max(start, end))
3883
+ continue;
3884
+ const f = (value - start) / (end - start);
3885
+ const px = positions[3 * a] + f * (positions[3 * b] - positions[3 * a]);
3886
+ const py = positions[3 * a + 1] + f * (positions[3 * b + 1] - positions[3 * a + 1]);
3887
+ if (Math.hypot(px - positions[3 * v], py - positions[3 * v + 1]) > tolerance)
3888
+ throw new Error("Mixed contour boundary positions disagree");
3889
+ cuts.push(v);
3890
+ }
3891
+ cuts.sort((u, v) => grid[2 * u + axis] - grid[2 * v + axis]);
3892
+ for (let i = 1; i < cuts.length; i++) {
3893
+ const u = cuts[i - 1], v = cuts[i], key = u < v ? `${u}/${v}` : `${v}/${u}`;
3894
+ const prior = emitted.get(key);
3895
+ if (prior !== void 0) {
3896
+ if (prior === edge.tile)
3897
+ throw new Error("Overlapping mixed contour segments within tile");
3898
+ continue;
3899
+ }
3900
+ if (levels.length >= limits.maxSegments)
3901
+ throw new Error("Mixed contour output segment capacity exceeded");
3902
+ emitted.set(key, edge.tile);
3903
+ segments.push(u, v);
3904
+ levels.push(level);
3905
+ }
3906
+ }
3907
+ return {
3908
+ positions: Float64Array.from(positions),
3909
+ gridCoordinates: Float64Array.from(grid),
3910
+ segments: Uint32Array.from(segments),
3911
+ levelIndices: Uint32Array.from(levels),
3912
+ levels: first.levels.slice(),
3913
+ origin,
3914
+ heightReference: first.heightReference
3915
+ };
3916
+ }
3473
3917
  //# sourceMappingURL=index.cjs.map