@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
@@ -27,6 +27,14 @@ import {createGeographicProfile} from './rendering-profile/geographic-rendering-
27
27
  import {compileVerticalGrid} from './vertical-datum';
28
28
  import type {DatumGridCollection, VerticalGridCollection} from './grids/types';
29
29
 
30
+ import type {
31
+ ProjectionTransformDescription,
32
+ ProjectionDirectionDescription,
33
+ ProjectionTransformStage,
34
+ ProjectionAlgorithmIdentity
35
+ } from '../transform-description';
36
+ import {describeCRS, describeTransform} from './transform-description';
37
+
30
38
  type ProjectionRegistration = ProjectionPlugin | ProjectionDescriptor;
31
39
  type ProjectionResult<P, Result> =
32
40
  Extract<P, ProjectionDescriptor> extends never ? Result : Promise<Result>;
@@ -46,12 +54,14 @@ export type ProjectionTransformOptions<P extends ProjectionRegistration = Projec
46
54
  export type ProjectionTransformCreateOptions = ProjectionTransformOptions<ProjectionRegistration>;
47
55
  export type ProjectionArray = Float32Array | Float64Array;
48
56
  type CoordinateTransform = {
57
+ description: ProjectionDirectionDescription;
49
58
  flat?: ProjectionFlatOperation;
50
59
  run(point: ProjectionPoint): void;
51
60
  requiresInputZ: boolean;
52
61
  geocentricOutput: boolean;
53
62
  };
54
63
  type CompiledCRS = NormalizedCRS & {
64
+ algorithm?: ProjectionAlgorithmIdentity;
55
65
  implementation?: ProjectionImplementation;
56
66
  verticalGrid?: (longitude: number, latitude: number) => number;
57
67
  };
@@ -89,6 +99,11 @@ export class ProjectionTransform<P extends ProjectionRegistration = ProjectionPl
89
99
  }
90
100
  /** Effective target central meridian in native radians. @internal */
91
101
  readonly targetLongitudeOrigin: number = 0;
102
+ private readonly resolvedDescription?: ProjectionTransformDescription;
103
+ /** Deferred transforms expose metadata only once their implementations are prepared. */
104
+ get description(): ProjectionTransformDescription | undefined {
105
+ return this.deferred?.implementation?.description ?? this.resolvedDescription;
106
+ }
92
107
  readonly lossy: boolean;
93
108
  constructor(options: ProjectionTransformOptions<P> = {}) {
94
109
  const registrations = options.projections || [];
@@ -125,6 +140,12 @@ export class ProjectionTransform<P extends ProjectionRegistration = ProjectionPl
125
140
  unsupportedStage('Horizontal extraction cannot be combined with vertical grids');
126
141
  this.forwardTransform = compileTransform(from, to, Boolean(options.enforceAxis));
127
142
  this.inverseTransform = compileTransform(to, from, Boolean(options.enforceAxis));
143
+ this.resolvedDescription = describeTransform(
144
+ describeCRS(from),
145
+ describeCRS(to),
146
+ this.forwardTransform.description,
147
+ this.inverseTransform.description
148
+ );
128
149
  }
129
150
  this.project = this.project.bind(this);
130
151
  this.unproject = this.unproject.bind(this);
@@ -393,7 +414,8 @@ function compileCRS(
393
414
  const verticalGrid = compileVerticalGrid(crs.parameters['geoidgrids'], options.verticalGrids);
394
415
  if (verticalGrid && (crs.kind === 'geocentric' || crs.kind === 'identity' || crs.lossy))
395
416
  unsupportedStage('Vertical grids require a non-lossy geographic or projected CRS');
396
- return {...crs, datum, implementation, verticalGrid};
417
+ const algorithm = plugin ? plugin.semantics : {id: '@math.gl/geospatial/' + crs.kind, version: 1};
418
+ return {...crs, datum, implementation, verticalGrid, algorithm};
397
419
  }
398
420
 
399
421
  function finite(point: ProjectionPoint): boolean {
@@ -466,13 +488,39 @@ function compileTransform(
466
488
  if (from.kind === 'projected' && to.kind === 'geographic')
467
489
  flat = from.implementation?.createInverseFlat?.(context);
468
490
  }
491
+ const requiresInputZ =
492
+ Boolean(from.verticalGrid || to.verticalGrid) ||
493
+ from.kind === 'geocentric' ||
494
+ /[ud]/.test(fromAxis.slice(0, 2)) ||
495
+ /[ud]/.test(toAxis.slice(0, 2));
496
+ const stages: ProjectionTransformStage[] = [];
497
+ if (inputAxis) stages.push('input-axis');
498
+ if (horizontalOnly) stages.push('discard-height');
499
+ if (inputScale !== 1) stages.push('input-scale');
500
+ if (source) stages.push('source-inverse');
501
+ if (inputVerticalScale !== 1) stages.push('input-height-scale');
502
+ stages.push('geographic-domain-check');
503
+ if (fromPrime) stages.push('source-prime-meridian');
504
+ if (from.verticalGrid) stages.push('source-vertical-grid');
505
+ if (datum) stages.push('datum');
506
+ if (to.verticalGrid) stages.push('target-vertical-grid');
507
+ if (toPrime) stages.push('target-prime-meridian');
508
+ if (longitudeWrap !== undefined) stages.push('longitude-wrap');
509
+ if (target) stages.push('target-forward');
510
+ if (outputScale !== 1) stages.push('output-scale');
511
+ if (outputVerticalScale !== 1) stages.push('output-height-scale');
512
+ if (horizontalOnly) stages.push('restore-height');
513
+ if (outputAxis) stages.push('output-axis');
469
514
  return {
515
+ description: Object.freeze({
516
+ inputAxis: fromAxis,
517
+ outputAxis: toAxis,
518
+ requiresInputZ,
519
+ geocentricOutput: to.kind === 'geocentric',
520
+ stages: Object.freeze(stages)
521
+ }),
470
522
  flat,
471
- requiresInputZ:
472
- Boolean(from.verticalGrid || to.verticalGrid) ||
473
- from.kind === 'geocentric' ||
474
- /[ud]/.test(fromAxis.slice(0, 2)) ||
475
- /[ud]/.test(toAxis.slice(0, 2)),
523
+ requiresInputZ,
476
524
  geocentricOutput: to.kind === 'geocentric',
477
525
  run(point) {
478
526
  if (!finite(point))
@@ -0,0 +1,69 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+
5
+ import type {NormalizedCRS} from './experimental/crs/types';
6
+
7
+ /** Publisher-owned identity for an algorithm's coordinate semantics, not its display name. */
8
+ export type ProjectionAlgorithmIdentity = {
9
+ readonly id: string;
10
+ /** Increment when equations, defaults, wrapping, domain or height behavior change. */
11
+ readonly version: number;
12
+ };
13
+
14
+ /** Resolved execution metadata without callbacks or borrowed grid payloads. */
15
+ export type ProjectionCRSDescription = Omit<NormalizedCRS, 'datum' | 'parameters'> & {
16
+ /** PROJ flags have null values, preserving presence through JSON serialization. */
17
+ readonly parameters: Readonly<Record<string, string | null>>;
18
+ readonly algorithm?: ProjectionAlgorithmIdentity;
19
+ readonly datum: {
20
+ readonly ellipsoid: NormalizedCRS['ellipsoid'];
21
+ readonly towgs84?: readonly number[];
22
+ readonly grids?: readonly {
23
+ readonly name: string;
24
+ readonly optional: boolean;
25
+ readonly loaded: boolean;
26
+ }[];
27
+ };
28
+ };
29
+
30
+ /** Ordered scalar stages. Parameters and units are resolved in source/target CRS metadata. */
31
+ export type ProjectionTransformStage =
32
+ | 'input-axis'
33
+ | 'discard-height'
34
+ | 'input-scale'
35
+ | 'source-inverse'
36
+ | 'input-height-scale'
37
+ | 'geographic-domain-check'
38
+ | 'source-prime-meridian'
39
+ | 'source-vertical-grid'
40
+ | 'datum'
41
+ | 'target-vertical-grid'
42
+ | 'target-prime-meridian'
43
+ | 'longitude-wrap'
44
+ | 'target-forward'
45
+ | 'output-scale'
46
+ | 'output-height-scale'
47
+ | 'restore-height'
48
+ | 'output-axis';
49
+
50
+ export type ProjectionDirectionDescription = {
51
+ readonly inputAxis: string;
52
+ readonly outputAxis: string;
53
+ readonly requiresInputZ: boolean;
54
+ readonly geocentricOutput: boolean;
55
+ readonly stages: readonly ProjectionTransformStage[];
56
+ };
57
+
58
+ /** Versioned math.gl pipeline semantics; a capability description, not an accuracy guarantee. */
59
+ export type ProjectionTransformDescription = {
60
+ readonly version: 1;
61
+ readonly source: ProjectionCRSDescription;
62
+ readonly target: ProjectionCRSDescription;
63
+ readonly forward: ProjectionDirectionDescription;
64
+ readonly inverse: ProjectionDirectionDescription;
65
+ readonly lossy: boolean;
66
+ /** False when algorithm or resource semantics are not fully identified. */
67
+ readonly complete: boolean;
68
+ readonly opaqueReasons: readonly ('source-algorithm' | 'target-algorithm' | 'grid-resource')[];
69
+ };
@@ -8,6 +8,7 @@ import type {ProjectionDescriptor} from './experimental/projection-descriptor';
8
8
  import type {ProjectionCoordinate, ProjectionOutput} from './experimental/scalar-output';
9
9
  import type {ProjectionArray} from './experimental/typescript-projection';
10
10
  import type {CRSResolver} from '../crs/resolver';
11
+ import type {ProjectionTransformDescription} from './transform-description';
11
12
 
12
13
  type Registration = ProjectionPlugin | ProjectionDescriptor;
13
14
 
@@ -35,6 +36,8 @@ export interface ProjectionEngine {
35
36
  /** A CRS-pair transform. Sync methods never load algorithms; preload deferred transforms first. */
36
37
  export interface Projection {
37
38
  readonly lossy?: boolean;
39
+ /** Available after preparation when the backend can describe its resolved execution. */
40
+ readonly description?: ProjectionTransformDescription;
38
41
  preload(): Promise<unknown>;
39
42
  project(coordinate: readonly number[]): number[] | Promise<number[]>;
40
43
  unproject(coordinate: readonly number[]): number[] | Promise<number[]>;
@@ -81,3 +84,11 @@ export type {
81
84
  CRSRenderingScaleCallback,
82
85
  GetCRSOptions
83
86
  } from './experimental/types';
87
+
88
+ export type {
89
+ ProjectionAlgorithmIdentity,
90
+ ProjectionCRSDescription,
91
+ ProjectionTransformStage,
92
+ ProjectionDirectionDescription,
93
+ ProjectionTransformDescription
94
+ } from './transform-description';
@@ -1,7 +1,7 @@
1
1
  // math.gl
2
2
  // SPDX-License-Identifier: MIT
3
3
  // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
- import type {Task} from '@math.gl/core/tasks';
4
+ import type {Task} from '@math.gl/tasks';
5
5
  import type {CreateProjectionOptions, Projection, ProjectionArray} from '../projection/types';
6
6
  import type {MapDescription, PreparedMap} from '../discontinuous/map-engine';
7
7
  export type ProjectCoordinatesTypes = {
@@ -1,7 +1,7 @@
1
1
  // math.gl
2
2
  // SPDX-License-Identifier: MIT
3
3
  // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
- import type {TaskWorker} from '@math.gl/core/tasks';
4
+ import type {TaskWorker} from '@math.gl/tasks';
5
5
  import {ProjectCoordinatesTask as projectionTask, PrepareMapTask as mapTask} from './definitions';
6
6
  export type {ProjectCoordinatesTypes, PrepareMapTypes} from './definitions';
7
7
  declare const __filename: string;
@@ -1,6 +1,6 @@
1
1
  // math.gl
2
2
  // SPDX-License-Identifier: MIT
3
3
  // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
- import {initializeTaskWorker} from '@math.gl/core/tasks';
4
+ import {initializeTaskWorker} from '@math.gl/tasks';
5
5
  import {PrepareMapTask} from './definitions';
6
6
  void initializeTaskWorker(PrepareMapTask);
@@ -3,7 +3,7 @@
3
3
  // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
  import {MapEngine, type MapDescription, type MapEngineOptions} from '../discontinuous/map-engine';
5
5
  import type {CreateProjectionOptions, ProjectionArray, Projection} from '../projection/types';
6
- import type {TaskContext} from '@math.gl/core/tasks';
6
+ import type {TaskContext} from '@math.gl/tasks';
7
7
  type OperationContext = Partial<Omit<TaskContext<unknown>, 'state'>>;
8
8
 
9
9
  export type BulkProjectionTask = {
@@ -1,6 +1,6 @@
1
1
  // math.gl
2
2
  // SPDX-License-Identifier: MIT
3
3
  // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
- import {initializeTaskWorker} from '@math.gl/core/tasks';
4
+ import {initializeTaskWorker} from '@math.gl/tasks';
5
5
  import {ProjectCoordinatesTask} from './definitions';
6
6
  void initializeTaskWorker(ProjectCoordinatesTask);
@@ -0,0 +1,90 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+
5
+ import type {TerrainContours} from './contours';
6
+ import {
7
+ contourPathLimits,
8
+ validateContourData,
9
+ validateContourVertex,
10
+ type TerrainContourPathLimits
11
+ } from './contour-path-data';
12
+
13
+ export const TerrainContourBoundaryAxis = {COLUMN: 1, ROW: 2} as const;
14
+ export type TerrainContourBoundaryDiagnostics = {
15
+ /** Boundary vertices with degree one (open) or greater than two (junction). */
16
+ vertexIndices: Uint32Array;
17
+ degrees: Uint32Array;
18
+ levelIndices: Uint32Array;
19
+ /** Bitmask of TerrainContourBoundaryAxis values; corners have both bits. */
20
+ boundaryAxes: Uint8Array;
21
+ };
22
+
23
+ /** Inspect a welded contour graph at same-level tile lattice lines. An open
24
+ * endpoint can indicate a dataset edge, missing tile, nodata or another break;
25
+ * this function does not infer the cause or alter the graph.
26
+ */
27
+ export function diagnoseTerrainContourBoundaries(
28
+ contours: TerrainContours,
29
+ options: TerrainContourPathLimits & {width: number; height: number}
30
+ ): TerrainContourBoundaryDiagnostics {
31
+ const {width, height} = options;
32
+ if (!Number.isSafeInteger(width) || width < 2 || !Number.isSafeInteger(height) || height < 2)
33
+ throw new Error('Invalid terrain contour boundary tile dimensions');
34
+ const limits = contourPathLimits(options);
35
+ const count = validateContourData(contours, limits);
36
+ if (
37
+ !(contours.segments instanceof Uint32Array) ||
38
+ contours.segments.length % 2 ||
39
+ !(contours.levelIndices instanceof Uint32Array) ||
40
+ contours.levelIndices.length !== contours.segments.length / 2 ||
41
+ contours.levelIndices.length > limits.maxSegments
42
+ )
43
+ throw new Error('Invalid terrain contour boundary segments or capacity');
44
+ const degrees = new Uint32Array(count),
45
+ assignments = new Uint32Array(count).fill(0xffffffff);
46
+ const seen = new Set<string>();
47
+ for (let i = 0; i < contours.levelIndices.length; i++) {
48
+ const a = contours.segments[2 * i],
49
+ b = contours.segments[2 * i + 1],
50
+ level = contours.levelIndices[i];
51
+ validateContourVertex(contours, a, level, assignments);
52
+ validateContourVertex(contours, b, level, assignments);
53
+ if (
54
+ a === b ||
55
+ (contours.positions[3 * a] === contours.positions[3 * b] &&
56
+ contours.positions[3 * a + 1] === contours.positions[3 * b + 1])
57
+ )
58
+ throw new Error('Degenerate terrain contour segment');
59
+ const key = a < b ? `${a}/${b}` : `${b}/${a}`;
60
+ if (seen.has(key)) throw new Error('Duplicate terrain contour segment');
61
+ seen.add(key);
62
+ degrees[a]++;
63
+ degrees[b]++;
64
+ }
65
+ const vertices: number[] = [],
66
+ resultDegrees: number[] = [],
67
+ levels: number[] = [],
68
+ axes: number[] = [];
69
+ for (let i = 0; i < count; i++) {
70
+ if (degrees[i] !== 1 && degrees[i] <= 2) continue;
71
+ const x = contours.gridCoordinates[2 * i],
72
+ y = contours.gridCoordinates[2 * i + 1];
73
+ if (Math.abs(x) > Number.MAX_SAFE_INTEGER || Math.abs(y) > Number.MAX_SAFE_INTEGER)
74
+ throw new Error('Terrain contour boundary lattice exceeds safe integer range');
75
+ const axis =
76
+ (Number.isSafeInteger(x) && x % (width - 1) === 0 ? TerrainContourBoundaryAxis.COLUMN : 0) |
77
+ (Number.isSafeInteger(y) && y % (height - 1) === 0 ? TerrainContourBoundaryAxis.ROW : 0);
78
+ if (!axis) continue;
79
+ vertices.push(i);
80
+ resultDegrees.push(degrees[i]);
81
+ levels.push(assignments[i]);
82
+ axes.push(axis);
83
+ }
84
+ return {
85
+ vertexIndices: Uint32Array.from(vertices),
86
+ degrees: Uint32Array.from(resultDegrees),
87
+ levelIndices: Uint32Array.from(levels),
88
+ boundaryAxes: Uint8Array.from(axes)
89
+ };
90
+ }
@@ -0,0 +1,254 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+
5
+ import type {TerrainContours} from './contours';
6
+ import {
7
+ contourPathLimits,
8
+ validateContourData,
9
+ validateContourVertex,
10
+ type TerrainContourPathLimits
11
+ } from './contour-path-data';
12
+
13
+ export type TerrainMixedContourTile = {
14
+ contours: TerrainContours;
15
+ /** Tile minimum in the common finest lattice; integer coordinates. */
16
+ column: number;
17
+ row: number;
18
+ width: number;
19
+ height: number;
20
+ /** Positive power-of-two spacing in the common lattice. */
21
+ spacing: number;
22
+ };
23
+ export type TerrainMixedContourWeldOptions = TerrainContourPathLimits & {
24
+ maxTiles?: number;
25
+ maxBoundaryTests?: number;
26
+ maxPositionDifference?: number;
27
+ };
28
+
29
+ /** Weld contour graphs from nonoverlapping vertex tiles in a shared affine lattice.
30
+ * Subdivides coincident axis-aligned boundary segments at finer boundary vertices.
31
+ * Only exact lattice intersections at the same level are joined. Differing source
32
+ * surfaces remain open; callers must reconcile elevations before contouring.
33
+ * Coordinates must retain their fractional precision in the common lattice.
34
+ */
35
+ export function weldTerrainMixedContourTiles(
36
+ tiles: readonly TerrainMixedContourTile[],
37
+ options: TerrainMixedContourWeldOptions = {}
38
+ ): TerrainContours {
39
+ const limits = contourPathLimits(options);
40
+ const maxTiles = options.maxTiles ?? 4096;
41
+ const budget = options.maxBoundaryTests ?? 10_000_000;
42
+ const tolerance = options.maxPositionDifference ?? 0;
43
+ if (
44
+ !Number.isSafeInteger(maxTiles) ||
45
+ maxTiles < 1 ||
46
+ !tiles.length ||
47
+ tiles.length > maxTiles ||
48
+ !Number.isSafeInteger(budget) ||
49
+ budget < 0 ||
50
+ !Number.isFinite(tolerance) ||
51
+ tolerance < 0
52
+ )
53
+ throw new Error('Invalid mixed contour capacity or tolerance');
54
+ let tests = 0;
55
+ const charge = () => {
56
+ if (++tests > budget) throw new Error('Mixed contour boundary-test budget exceeded');
57
+ };
58
+ const sorted = [...tiles].sort(
59
+ (a, b) => a.column - b.column || a.row - b.row || a.spacing - b.spacing
60
+ );
61
+ const bounds = sorted.map(t => {
62
+ if (
63
+ ![t.column, t.row, t.width, t.height, t.spacing].every(Number.isSafeInteger) ||
64
+ t.width < 2 ||
65
+ t.height < 2 ||
66
+ t.spacing < 1 ||
67
+ 2 ** Math.round(Math.log2(t.spacing)) !== t.spacing
68
+ )
69
+ throw new Error('Invalid mixed contour tile lattice');
70
+ const x1 = t.column + (t.width - 1) * t.spacing,
71
+ y1 = t.row + (t.height - 1) * t.spacing;
72
+ if (
73
+ ![(t.width - 1) * t.spacing, (t.height - 1) * t.spacing, x1, y1].every(Number.isSafeInteger)
74
+ )
75
+ throw new Error('Mixed contour lattice overflow');
76
+ return [t.column, t.row, x1, y1];
77
+ });
78
+ for (let i = 0; i < bounds.length; i++)
79
+ for (let j = 0; j < i; j++) {
80
+ charge();
81
+ const a = bounds[i],
82
+ b = bounds[j];
83
+ if (
84
+ Math.max(a[0], b[0]) < Math.min(a[2], b[2]) &&
85
+ Math.max(a[1], b[1]) < Math.min(a[3], b[3])
86
+ )
87
+ throw new Error('Mixed contour tile interiors overlap');
88
+ }
89
+ const first = sorted[0].contours,
90
+ origin: [number, number, number] = [...first.origin];
91
+ const positions: number[] = [],
92
+ grid: number[] = [],
93
+ vertexLevels: number[] = [];
94
+ const roundedBoundary = new Map<string, string>();
95
+ const boundary = new Set<number>(),
96
+ shared = new Map<string, number>();
97
+ const edges: {a: number; b: number; level: number; tile: number; seam: boolean}[] = [];
98
+ let inputVertices = 0,
99
+ inputSegments = 0;
100
+ for (let ti = 0; ti < sorted.length; ti++) {
101
+ const tile = sorted[ti],
102
+ data = tile.contours;
103
+ const count = validateContourData(data, limits);
104
+ inputVertices += count;
105
+ if (inputVertices > limits.maxVertices)
106
+ throw new Error('Mixed contour input vertex capacity exceeded');
107
+ if (
108
+ data.heightReference !== first.heightReference ||
109
+ data.levels.length !== first.levels.length ||
110
+ !data.levels.every((v, i) => v === first.levels[i])
111
+ )
112
+ throw new Error('Mixed contour levels or height reference differ');
113
+ if (
114
+ !(data.segments instanceof Uint32Array) ||
115
+ data.segments.length % 2 ||
116
+ !(data.levelIndices instanceof Uint32Array) ||
117
+ data.levelIndices.length !== data.segments.length / 2
118
+ )
119
+ throw new Error('Invalid mixed contour segments');
120
+ inputSegments += data.levelIndices.length;
121
+ if (inputSegments > limits.maxSegments)
122
+ throw new Error('Mixed contour input segment capacity exceeded');
123
+ const assigned = new Uint32Array(count).fill(0xffffffff),
124
+ remap = new Map<number, number>();
125
+ const local = new Set<string>();
126
+ const vertex = (v: number, level: number) => {
127
+ validateContourVertex(data, v, level, assigned);
128
+ const existing = remap.get(v);
129
+ if (existing !== undefined) return existing;
130
+ const x = data.gridCoordinates[2 * v],
131
+ y = data.gridCoordinates[2 * v + 1];
132
+ if (x < 0 || x > tile.width - 1 || y < 0 || y > tile.height - 1)
133
+ throw new Error('Mixed contour vertex outside tile');
134
+ const sx = x * tile.spacing,
135
+ sy = y * tile.spacing;
136
+ const gx = tile.column + sx,
137
+ gy = tile.row + sy;
138
+ // Reject coordinates whose local fraction cannot survive common-frame rebasing.
139
+ if (
140
+ Math.abs(gx - tile.column - sx) > 8 * Number.EPSILON * Math.max(1, Math.abs(sx)) ||
141
+ Math.abs(gy - tile.row - sy) > 8 * Number.EPSILON * Math.max(1, Math.abs(sy))
142
+ )
143
+ throw new Error('Mixed contour lattice loses precision');
144
+ const px = data.positions[3 * v] + (data.origin[0] - origin[0]),
145
+ py = data.positions[3 * v + 1] + (data.origin[1] - origin[1]);
146
+ const pz = data.levels[level] - origin[2];
147
+ if (![gx, gy, px, py, pz].every(Number.isFinite))
148
+ throw new Error('Mixed contour frame overflow');
149
+ const onEdge = x === 0 || y === 0 || x === tile.width - 1 || y === tile.height - 1;
150
+ const xi = Math.floor(sx),
151
+ yi = Math.floor(sy);
152
+ const key = `${level}/${tile.column + xi}/${sx - xi}/${tile.row + yi}/${sy - yi}`;
153
+ if (onEdge) {
154
+ const rounded = `${level}/${gx}/${gy}`;
155
+ const identity = roundedBoundary.get(rounded);
156
+ if (identity !== undefined && identity !== key)
157
+ throw new Error('Mixed contour lattice loses precision');
158
+ roundedBoundary.set(rounded, key);
159
+ }
160
+ if (onEdge && local.has(key)) throw new Error('Duplicate mixed contour boundary vertex');
161
+ if (onEdge) local.add(key);
162
+ let id = onEdge ? shared.get(key) : undefined;
163
+ if (id !== undefined) {
164
+ if (Math.hypot(px - positions[3 * id], py - positions[3 * id + 1]) > tolerance)
165
+ throw new Error('Mixed contour boundary positions disagree');
166
+ } else {
167
+ id = positions.length / 3;
168
+ if (id >= limits.maxVertices) throw new Error('Mixed contour vertex capacity exceeded');
169
+ positions.push(px, py, pz);
170
+ grid.push(gx, gy);
171
+ vertexLevels.push(level);
172
+ if (onEdge) {
173
+ shared.set(key, id);
174
+ boundary.add(id);
175
+ }
176
+ }
177
+ remap.set(v, id);
178
+ return id;
179
+ };
180
+ const localEdges = new Set<string>();
181
+ for (let i = 0; i < data.levelIndices.length; i++) {
182
+ const level = data.levelIndices[i],
183
+ a = vertex(data.segments[2 * i], level),
184
+ b = vertex(data.segments[2 * i + 1], level);
185
+ if (
186
+ a === b ||
187
+ (positions[3 * a] === positions[3 * b] && positions[3 * a + 1] === positions[3 * b + 1])
188
+ )
189
+ throw new Error('Degenerate mixed contour segment');
190
+ const key = a < b ? `${a}/${b}` : `${b}/${a}`;
191
+ if (localEdges.has(key)) throw new Error('Duplicate mixed contour segment');
192
+ localEdges.add(key);
193
+ const box = bounds[ti];
194
+ const seam =
195
+ (grid[2 * a] === grid[2 * b] && (grid[2 * a] === box[0] || grid[2 * a] === box[2])) ||
196
+ (grid[2 * a + 1] === grid[2 * b + 1] &&
197
+ (grid[2 * a + 1] === box[1] || grid[2 * a + 1] === box[3]));
198
+ edges.push({a, b, level, tile: ti, seam});
199
+ }
200
+ }
201
+ const segments: number[] = [],
202
+ levels: number[] = [],
203
+ emitted = new Map<string, number>();
204
+ for (const edge of edges) {
205
+ const {a, b, level} = edge;
206
+ const axis = grid[2 * a] === grid[2 * b] ? 1 : 0;
207
+ const start = grid[2 * a + axis],
208
+ end = grid[2 * b + axis];
209
+ const cuts = [a, b];
210
+ if (edge.seam)
211
+ for (const v of boundary) {
212
+ charge();
213
+ const value = grid[2 * v + axis];
214
+ if (
215
+ vertexLevels[v] !== level ||
216
+ grid[2 * v + 1 - axis] !== grid[2 * a + 1 - axis] ||
217
+ value <= Math.min(start, end) ||
218
+ value >= Math.max(start, end)
219
+ )
220
+ continue;
221
+ const f = (value - start) / (end - start);
222
+ const px = positions[3 * a] + f * (positions[3 * b] - positions[3 * a]);
223
+ const py = positions[3 * a + 1] + f * (positions[3 * b + 1] - positions[3 * a + 1]);
224
+ if (Math.hypot(px - positions[3 * v], py - positions[3 * v + 1]) > tolerance)
225
+ throw new Error('Mixed contour boundary positions disagree');
226
+ cuts.push(v);
227
+ }
228
+ cuts.sort((u, v) => grid[2 * u + axis] - grid[2 * v + axis]);
229
+ for (let i = 1; i < cuts.length; i++) {
230
+ const u = cuts[i - 1],
231
+ v = cuts[i],
232
+ key = u < v ? `${u}/${v}` : `${v}/${u}`;
233
+ const prior = emitted.get(key);
234
+ if (prior !== undefined) {
235
+ if (prior === edge.tile) throw new Error('Overlapping mixed contour segments within tile');
236
+ continue;
237
+ }
238
+ if (levels.length >= limits.maxSegments)
239
+ throw new Error('Mixed contour output segment capacity exceeded');
240
+ emitted.set(key, edge.tile);
241
+ segments.push(u, v);
242
+ levels.push(level);
243
+ }
244
+ }
245
+ return {
246
+ positions: Float64Array.from(positions),
247
+ gridCoordinates: Float64Array.from(grid),
248
+ segments: Uint32Array.from(segments),
249
+ levelIndices: Uint32Array.from(levels),
250
+ levels: first.levels.slice(),
251
+ origin,
252
+ heightReference: first.heightReference
253
+ };
254
+ }
@@ -0,0 +1,20 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
+
5
+ import {
6
+ weldTerrainContourTiles,
7
+ type TerrainContourTile,
8
+ type TerrainContourTileWeldOptions
9
+ } from './contour-tile-weld';
10
+ import {stitchTerrainContours, type TerrainContourPaths} from './contour-paths';
11
+
12
+ /** Weld a same-level tile snapshot and trace its maximal contour paths.
13
+ * Missing tiles and source gaps remain open. This does not simplify paths.
14
+ */
15
+ export function stitchTerrainContourTiles(
16
+ tiles: readonly TerrainContourTile[],
17
+ options: TerrainContourTileWeldOptions
18
+ ): TerrainContourPaths {
19
+ return stitchTerrainContours(weldTerrainContourTiles(tiles, options), options);
20
+ }