@math.gl/geospatial 5.0.0-beta.4 → 5.0.0-beta.6

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 (579) 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 +6953 -10021
  6. package/dist/index.cjs.map +3 -3
  7. package/dist/index.d.ts +40 -8
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +20 -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/bounds-regions.d.ts +15 -0
  213. package/dist/terrain/bounds-regions.d.ts.map +1 -0
  214. package/dist/terrain/bounds-regions.js +84 -0
  215. package/dist/terrain/bounds-regions.js.map +1 -0
  216. package/dist/terrain/bounds-update.d.ts +11 -0
  217. package/dist/terrain/bounds-update.d.ts.map +1 -0
  218. package/dist/terrain/bounds-update.js +10 -0
  219. package/dist/terrain/bounds-update.js.map +1 -0
  220. package/dist/terrain/box-index.d.ts +9 -0
  221. package/dist/terrain/box-index.d.ts.map +1 -0
  222. package/dist/terrain/box-index.js +43 -0
  223. package/dist/terrain/box-index.js.map +1 -0
  224. package/dist/terrain/contour-mixed-weld.d.ts +25 -0
  225. package/dist/terrain/contour-mixed-weld.d.ts.map +1 -0
  226. package/dist/terrain/contour-mixed-weld.js +194 -0
  227. package/dist/terrain/contour-mixed-weld.js.map +1 -0
  228. package/dist/terrain/contour-simplify.d.ts +1 -0
  229. package/dist/terrain/contour-simplify.d.ts.map +1 -1
  230. package/dist/terrain/contour-simplify.js +5 -1
  231. package/dist/terrain/contour-simplify.js.map +1 -1
  232. package/dist/terrain/contour-topology.d.ts +30 -0
  233. package/dist/terrain/contour-topology.d.ts.map +1 -0
  234. package/dist/terrain/contour-topology.js +236 -0
  235. package/dist/terrain/contour-topology.js.map +1 -0
  236. package/dist/terrain/delatin-regions.d.ts +14 -0
  237. package/dist/terrain/delatin-regions.d.ts.map +1 -0
  238. package/dist/terrain/delatin-regions.js +15 -0
  239. package/dist/terrain/delatin-regions.js.map +1 -0
  240. package/dist/terrain/dirty-regions.d.ts +11 -0
  241. package/dist/terrain/dirty-regions.d.ts.map +1 -0
  242. package/dist/terrain/dirty-regions.js +34 -0
  243. package/dist/terrain/dirty-regions.js.map +1 -0
  244. package/dist/terrain/gradient-pyramid-regions.d.ts +15 -0
  245. package/dist/terrain/gradient-pyramid-regions.d.ts.map +1 -0
  246. package/dist/terrain/gradient-pyramid-regions.js +112 -0
  247. package/dist/terrain/gradient-pyramid-regions.js.map +1 -0
  248. package/dist/terrain/gradient-pyramid-update.d.ts +11 -0
  249. package/dist/terrain/gradient-pyramid-update.d.ts.map +1 -0
  250. package/dist/terrain/gradient-pyramid-update.js +17 -0
  251. package/dist/terrain/gradient-pyramid-update.js.map +1 -0
  252. package/dist/terrain/height-field.d.ts.map +1 -1
  253. package/dist/terrain/height-field.js +48 -5
  254. package/dist/terrain/height-field.js.map +1 -1
  255. package/dist/terrain/index.cjs +1613 -79
  256. package/dist/terrain/index.cjs.map +3 -3
  257. package/dist/terrain/index.d.ts +40 -0
  258. package/dist/terrain/index.d.ts.map +1 -1
  259. package/dist/terrain/index.js +20 -0
  260. package/dist/terrain/index.js.map +1 -1
  261. package/dist/terrain/isobands.d.ts +24 -0
  262. package/dist/terrain/isobands.d.ts.map +1 -0
  263. package/dist/terrain/isobands.js +281 -0
  264. package/dist/terrain/isobands.js.map +1 -0
  265. package/dist/terrain/lod-morph-evaluate.d.ts +8 -0
  266. package/dist/terrain/lod-morph-evaluate.d.ts.map +1 -0
  267. package/dist/terrain/lod-morph-evaluate.js +30 -0
  268. package/dist/terrain/lod-morph-evaluate.js.map +1 -0
  269. package/dist/terrain/lod-morph.d.ts +35 -0
  270. package/dist/terrain/lod-morph.d.ts.map +1 -0
  271. package/dist/terrain/lod-morph.js +87 -0
  272. package/dist/terrain/lod-morph.js.map +1 -0
  273. package/dist/terrain/martini-regions.d.ts +14 -0
  274. package/dist/terrain/martini-regions.d.ts.map +1 -0
  275. package/dist/terrain/martini-regions.js +26 -0
  276. package/dist/terrain/martini-regions.js.map +1 -0
  277. package/dist/terrain/mesh-error.d.ts.map +1 -1
  278. package/dist/terrain/mesh-error.js +9 -1
  279. package/dist/terrain/mesh-error.js.map +1 -1
  280. package/dist/terrain/mesh-regions-data.d.ts +24 -0
  281. package/dist/terrain/mesh-regions-data.d.ts.map +1 -0
  282. package/dist/terrain/mesh-regions-data.js +80 -0
  283. package/dist/terrain/mesh-regions-data.js.map +1 -0
  284. package/dist/terrain/mesh-regions.d.ts +12 -0
  285. package/dist/terrain/mesh-regions.d.ts.map +1 -0
  286. package/dist/terrain/mesh-regions.js +10 -0
  287. package/dist/terrain/mesh-regions.js.map +1 -0
  288. package/dist/terrain/mesh-update.d.ts +11 -0
  289. package/dist/terrain/mesh-update.d.ts.map +1 -0
  290. package/dist/terrain/mesh-update.js +10 -0
  291. package/dist/terrain/mesh-update.js.map +1 -0
  292. package/dist/terrain/mixed-gradient-update.d.ts +15 -0
  293. package/dist/terrain/mixed-gradient-update.d.ts.map +1 -0
  294. package/dist/terrain/mixed-gradient-update.js +24 -0
  295. package/dist/terrain/mixed-gradient-update.js.map +1 -0
  296. package/dist/terrain/mixed-halo-update.d.ts +16 -0
  297. package/dist/terrain/mixed-halo-update.d.ts.map +1 -0
  298. package/dist/terrain/mixed-halo-update.js +46 -0
  299. package/dist/terrain/mixed-halo-update.js.map +1 -0
  300. package/dist/terrain/mixed-vertex-halos.d.ts +32 -0
  301. package/dist/terrain/mixed-vertex-halos.d.ts.map +1 -0
  302. package/dist/terrain/mixed-vertex-halos.js +125 -0
  303. package/dist/terrain/mixed-vertex-halos.js.map +1 -0
  304. package/dist/terrain/persistent-bounds.d.ts +16 -0
  305. package/dist/terrain/persistent-bounds.d.ts.map +1 -0
  306. package/dist/terrain/persistent-bounds.js +51 -0
  307. package/dist/terrain/persistent-bounds.js.map +1 -0
  308. package/dist/terrain/persistent-gradients.d.ts +16 -0
  309. package/dist/terrain/persistent-gradients.d.ts.map +1 -0
  310. package/dist/terrain/persistent-gradients.js +69 -0
  311. package/dist/terrain/persistent-gradients.js.map +1 -0
  312. package/dist/terrain/persistent-hierarchy-data.d.ts +41 -0
  313. package/dist/terrain/persistent-hierarchy-data.d.ts.map +1 -0
  314. package/dist/terrain/persistent-hierarchy-data.js +130 -0
  315. package/dist/terrain/persistent-hierarchy-data.js.map +1 -0
  316. package/dist/terrain/sample-triangle-height.d.ts +4 -0
  317. package/dist/terrain/sample-triangle-height.d.ts.map +1 -0
  318. package/dist/terrain/sample-triangle-height.js +46 -0
  319. package/dist/terrain/sample-triangle-height.js.map +1 -0
  320. package/dist/terrain/tile-update-data.d.ts +14 -0
  321. package/dist/terrain/tile-update-data.d.ts.map +1 -0
  322. package/dist/terrain/tile-update-data.js +23 -0
  323. package/dist/terrain/tile-update-data.js.map +1 -0
  324. package/dist/terrain/tiled.d.ts +10 -2
  325. package/dist/terrain/tiled.d.ts.map +1 -1
  326. package/dist/terrain/tiled.js +5 -1
  327. package/dist/terrain/tiled.js.map +1 -1
  328. package/dist/terrain/types.d.ts +6 -0
  329. package/dist/terrain/types.d.ts.map +1 -1
  330. package/dist/turf.cjs +25 -671
  331. package/dist/turf.cjs.map +3 -3
  332. package/dist/turf.d.ts +1 -1
  333. package/dist/turf.d.ts.map +1 -1
  334. package/dist/turf.js +2 -2
  335. package/dist/turf.js.map +1 -1
  336. package/package.json +15 -19
  337. package/src/expressions.ts +1 -1
  338. package/src/index.ts +64 -123
  339. package/src/projection/experimental/common/adjust_lat.ts +1 -1
  340. package/src/projection/experimental/common/adjust_lon.ts +1 -1
  341. package/src/projection/experimental/common/asinhy.ts +1 -1
  342. package/src/projection/experimental/common/asinz.ts +1 -1
  343. package/src/projection/experimental/common/authlat.ts +1 -1
  344. package/src/projection/experimental/common/authset.ts +1 -1
  345. package/src/projection/experimental/common/clens.ts +1 -1
  346. package/src/projection/experimental/common/clens_cmplx.ts +1 -1
  347. package/src/projection/experimental/common/constants.ts +1 -1
  348. package/src/projection/experimental/common/cosh.ts +1 -1
  349. package/src/projection/experimental/common/e0fn.ts +1 -1
  350. package/src/projection/experimental/common/e1fn.ts +1 -1
  351. package/src/projection/experimental/common/e2fn.ts +1 -1
  352. package/src/projection/experimental/common/e3fn.ts +1 -1
  353. package/src/projection/experimental/common/fL.ts +1 -1
  354. package/src/projection/experimental/common/gN.ts +1 -1
  355. package/src/projection/experimental/common/gatg.ts +1 -1
  356. package/src/projection/experimental/common/hypot.ts +1 -1
  357. package/src/projection/experimental/common/imlfn.ts +1 -1
  358. package/src/projection/experimental/common/invlatiso.ts +1 -1
  359. package/src/projection/experimental/common/iqsfnz.ts +1 -1
  360. package/src/projection/experimental/common/latiso.ts +1 -1
  361. package/src/projection/experimental/common/log1py.ts +1 -1
  362. package/src/projection/experimental/common/mlfn.ts +1 -1
  363. package/src/projection/experimental/common/msfnz.ts +1 -1
  364. package/src/projection/experimental/common/phi2z.ts +1 -1
  365. package/src/projection/experimental/common/pj_enfn.ts +1 -1
  366. package/src/projection/experimental/common/pj_inv_mlfn.ts +1 -1
  367. package/src/projection/experimental/common/pj_mlfn.ts +1 -1
  368. package/src/projection/experimental/common/qsfnz.ts +1 -1
  369. package/src/projection/experimental/common/sign.ts +1 -1
  370. package/src/projection/experimental/common/sinh.ts +1 -1
  371. package/src/projection/experimental/common/srat.ts +1 -1
  372. package/src/projection/experimental/common/tsfnz.ts +1 -1
  373. package/src/projection/experimental/common/vincenty.ts +1 -1
  374. package/src/projection/experimental/core.ts +8 -0
  375. package/src/projection/experimental/crs/datum-table.ts +1 -1
  376. package/src/projection/experimental/crs/ellipsoid-table.ts +1 -1
  377. package/src/projection/experimental/crs/primemeridian-table.ts +1 -1
  378. package/src/projection/experimental/crs/structured.ts +1 -1
  379. package/src/projection/experimental/crs/wkt.ts +1 -1
  380. package/src/projection/experimental/datum.ts +1 -1
  381. package/src/projection/experimental/ellipsoidal-gnomonic.ts +1 -1
  382. package/src/projection/experimental/exact-helmert.ts +1 -1
  383. package/src/projection/experimental/grids/geotiff.ts +1 -1
  384. package/src/projection/experimental/grids/grid.ts +1 -1
  385. package/src/projection/experimental/grids/ntv2.ts +1 -1
  386. package/src/projection/experimental/helmert-flat.ts +1 -1
  387. package/src/projection/experimental/kernels/aea.ts +1 -1
  388. package/src/projection/experimental/kernels/aeqd.ts +1 -1
  389. package/src/projection/experimental/kernels/bonne.ts +1 -1
  390. package/src/projection/experimental/kernels/cass.ts +1 -1
  391. package/src/projection/experimental/kernels/cea.ts +1 -1
  392. package/src/projection/experimental/kernels/eck6.ts +1 -1
  393. package/src/projection/experimental/kernels/eqdc.ts +1 -1
  394. package/src/projection/experimental/kernels/eqearth.ts +1 -1
  395. package/src/projection/experimental/kernels/equi.ts +1 -1
  396. package/src/projection/experimental/kernels/etmerc.ts +1 -1
  397. package/src/projection/experimental/kernels/gauss.ts +1 -1
  398. package/src/projection/experimental/kernels/geos.ts +1 -1
  399. package/src/projection/experimental/kernels/gnom.ts +1 -1
  400. package/src/projection/experimental/kernels/gstmerc.ts +1 -1
  401. package/src/projection/experimental/kernels/krovak.ts +1 -1
  402. package/src/projection/experimental/kernels/laea.ts +1 -1
  403. package/src/projection/experimental/kernels/lcc.ts +1 -1
  404. package/src/projection/experimental/kernels/mill.ts +1 -1
  405. package/src/projection/experimental/kernels/moll.ts +1 -1
  406. package/src/projection/experimental/kernels/nzmg.ts +1 -1
  407. package/src/projection/experimental/kernels/omerc.ts +1 -1
  408. package/src/projection/experimental/kernels/ortho.ts +1 -1
  409. package/src/projection/experimental/kernels/poly.ts +1 -1
  410. package/src/projection/experimental/kernels/qsc.ts +1 -1
  411. package/src/projection/experimental/kernels/robin.ts +1 -1
  412. package/src/projection/experimental/kernels/sinu.ts +1 -1
  413. package/src/projection/experimental/kernels/somerc.ts +1 -1
  414. package/src/projection/experimental/kernels/stere.ts +1 -1
  415. package/src/projection/experimental/kernels/sterea.ts +1 -1
  416. package/src/projection/experimental/kernels/tmerc.ts +1 -1
  417. package/src/projection/experimental/kernels/tpers.ts +1 -1
  418. package/src/projection/experimental/kernels/vandg.ts +1 -1
  419. package/src/projection/experimental/kinematic-helmert-flat.ts +1 -1
  420. package/src/projection/experimental/kinematic-helmert.ts +1 -1
  421. package/src/projection/experimental/projection-pipeline.ts +1 -1
  422. package/src/projection/experimental/projections/equidistant-cylindrical.ts +1 -0
  423. package/src/projection/experimental/projections/mercator.ts +1 -0
  424. package/src/projection/experimental/projections/ob-tran.ts +1 -1
  425. package/src/projection/experimental/transform-description.ts +82 -0
  426. package/src/projection/experimental/types.ts +5 -0
  427. package/src/projection/experimental/typescript-projection.ts +54 -6
  428. package/src/projection/transform-description.ts +69 -0
  429. package/src/projection/types.ts +11 -0
  430. package/src/tasks/definitions.ts +1 -1
  431. package/src/tasks/index.ts +1 -1
  432. package/src/tasks/map-worker.ts +1 -1
  433. package/src/tasks/operations.ts +1 -1
  434. package/src/tasks/projection-worker.ts +1 -1
  435. package/src/terrain/bounds-regions.ts +106 -0
  436. package/src/terrain/bounds-update.ts +19 -0
  437. package/src/terrain/box-index.ts +47 -0
  438. package/src/terrain/contour-mixed-weld.ts +254 -0
  439. package/src/terrain/contour-simplify.ts +10 -2
  440. package/src/terrain/contour-topology.ts +263 -0
  441. package/src/terrain/delatin-regions.ts +25 -0
  442. package/src/terrain/dirty-regions.ts +61 -0
  443. package/src/terrain/gradient-pyramid-regions.ts +140 -0
  444. package/src/terrain/gradient-pyramid-update.ts +25 -0
  445. package/src/terrain/height-field.ts +45 -5
  446. package/src/terrain/index.ts +58 -0
  447. package/src/terrain/isobands.ts +348 -0
  448. package/src/terrain/lod-morph-evaluate.ts +36 -0
  449. package/src/terrain/lod-morph.ts +138 -0
  450. package/src/terrain/martini-regions.ts +38 -0
  451. package/src/terrain/mesh-error.ts +14 -1
  452. package/src/terrain/mesh-regions-data.ts +113 -0
  453. package/src/terrain/mesh-regions.ts +18 -0
  454. package/src/terrain/mesh-update.ts +15 -0
  455. package/src/terrain/mixed-gradient-update.ts +40 -0
  456. package/src/terrain/mixed-halo-update.ts +56 -0
  457. package/src/terrain/mixed-vertex-halos.ts +170 -0
  458. package/src/terrain/persistent-bounds.ts +95 -0
  459. package/src/terrain/persistent-gradients.ts +117 -0
  460. package/src/terrain/persistent-hierarchy-data.ts +196 -0
  461. package/src/terrain/sample-triangle-height.ts +50 -0
  462. package/src/terrain/tile-update-data.ts +32 -0
  463. package/src/terrain/tiled.ts +16 -3
  464. package/src/terrain/types.ts +9 -1
  465. package/src/turf.ts +7 -3
  466. package/crs/README.md +0 -84
  467. package/crs/schemas/README.md +0 -9
  468. package/dist/geoarrow/builder-entry.d.ts +0 -4
  469. package/dist/geoarrow/builder-entry.d.ts.map +0 -1
  470. package/dist/geoarrow/builder-entry.js +0 -5
  471. package/dist/geoarrow/builder-entry.js.map +0 -1
  472. package/dist/geoarrow/builder.d.ts +0 -106
  473. package/dist/geoarrow/builder.d.ts.map +0 -1
  474. package/dist/geoarrow/builder.js +0 -668
  475. package/dist/geoarrow/builder.js.map +0 -1
  476. package/dist/geoarrow/codecs.d.ts +0 -24
  477. package/dist/geoarrow/codecs.d.ts.map +0 -1
  478. package/dist/geoarrow/codecs.js +0 -916
  479. package/dist/geoarrow/codecs.js.map +0 -1
  480. package/dist/geoarrow/index.cjs +0 -4352
  481. package/dist/geoarrow/index.cjs.map +0 -6
  482. package/dist/geoarrow/index.d.ts +0 -21
  483. package/dist/geoarrow/index.d.ts.map +0 -1
  484. package/dist/geoarrow/index.js +0 -15
  485. package/dist/geoarrow/index.js.map +0 -1
  486. package/dist/geoarrow/kernels.d.ts +0 -56
  487. package/dist/geoarrow/kernels.d.ts.map +0 -1
  488. package/dist/geoarrow/kernels.js +0 -982
  489. package/dist/geoarrow/kernels.js.map +0 -1
  490. package/dist/geoarrow/layout.d.ts +0 -66
  491. package/dist/geoarrow/layout.d.ts.map +0 -1
  492. package/dist/geoarrow/layout.js +0 -723
  493. package/dist/geoarrow/layout.js.map +0 -1
  494. package/dist/geoarrow/stream-tessellate.d.ts +0 -34
  495. package/dist/geoarrow/stream-tessellate.d.ts.map +0 -1
  496. package/dist/geoarrow/stream-tessellate.js +0 -171
  497. package/dist/geoarrow/stream-tessellate.js.map +0 -1
  498. package/dist/geoarrow/stream.d.ts +0 -29
  499. package/dist/geoarrow/stream.d.ts.map +0 -1
  500. package/dist/geoarrow/stream.js +0 -100
  501. package/dist/geoarrow/stream.js.map +0 -1
  502. package/dist/geoarrow/tessellate.d.ts +0 -31
  503. package/dist/geoarrow/tessellate.d.ts.map +0 -1
  504. package/dist/geoarrow/tessellate.js +0 -102
  505. package/dist/geoarrow/tessellate.js.map +0 -1
  506. package/dist/geoarrow/tessellation-entry.d.ts +0 -4
  507. package/dist/geoarrow/tessellation-entry.d.ts.map +0 -1
  508. package/dist/geoarrow/tessellation-entry.js +0 -5
  509. package/dist/geoarrow/tessellation-entry.js.map +0 -1
  510. package/dist/geoarrow/types.d.ts +0 -155
  511. package/dist/geoarrow/types.d.ts.map +0 -1
  512. package/dist/geoarrow/types.js +0 -71
  513. package/dist/geoarrow/types.js.map +0 -1
  514. package/dist/geoarrow/views.d.ts +0 -45
  515. package/dist/geoarrow/views.d.ts.map +0 -1
  516. package/dist/geoarrow/views.js +0 -114
  517. package/dist/geoarrow/views.js.map +0 -1
  518. package/dist/geoarrow/wkb-entry.d.ts +0 -4
  519. package/dist/geoarrow/wkb-entry.d.ts.map +0 -1
  520. package/dist/geoarrow/wkb-entry.js +0 -6
  521. package/dist/geoarrow/wkb-entry.js.map +0 -1
  522. package/dist/geoarrow/worker.d.ts +0 -11
  523. package/dist/geoarrow/worker.d.ts.map +0 -1
  524. package/dist/geoarrow/worker.js +0 -10
  525. package/dist/geoarrow/worker.js.map +0 -1
  526. package/dist/wkb/index.d.ts +0 -11
  527. package/dist/wkb/index.d.ts.map +0 -1
  528. package/dist/wkb/index.js +0 -9
  529. package/dist/wkb/index.js.map +0 -1
  530. package/dist/wkb/types.d.ts +0 -30
  531. package/dist/wkb/types.d.ts.map +0 -1
  532. package/dist/wkb/types.js +0 -34
  533. package/dist/wkb/types.js.map +0 -1
  534. package/dist/wkb/wkb-builder.d.ts +0 -91
  535. package/dist/wkb/wkb-builder.d.ts.map +0 -1
  536. package/dist/wkb/wkb-builder.js +0 -283
  537. package/dist/wkb/wkb-builder.js.map +0 -1
  538. package/dist/wkb/wkb-reader.d.ts +0 -74
  539. package/dist/wkb/wkb-reader.d.ts.map +0 -1
  540. package/dist/wkb/wkb-reader.js +0 -251
  541. package/dist/wkb/wkb-reader.js.map +0 -1
  542. package/dist/wkb/wkb.d.ts +0 -21
  543. package/dist/wkb/wkb.d.ts.map +0 -1
  544. package/dist/wkb/wkb.js +0 -204
  545. package/dist/wkb/wkb.js.map +0 -1
  546. package/dist/wkb/wkt.d.ts +0 -19
  547. package/dist/wkb/wkt.d.ts.map +0 -1
  548. package/dist/wkb/wkt.js +0 -321
  549. package/dist/wkb/wkt.js.map +0 -1
  550. package/projection/THIRD-PARTY-NOTICES.md +0 -210
  551. package/src/discontinuous/elastic/README.md +0 -20
  552. package/src/discontinuous/spherical-clip/README.md +0 -16
  553. package/src/discontinuous/world-kernels/README.md +0 -24
  554. package/src/geoarrow/builder-entry.ts +0 -18
  555. package/src/geoarrow/builder.ts +0 -860
  556. package/src/geoarrow/codecs.ts +0 -1268
  557. package/src/geoarrow/index.ts +0 -111
  558. package/src/geoarrow/kernels.ts +0 -1290
  559. package/src/geoarrow/layout.ts +0 -900
  560. package/src/geoarrow/stream-tessellate.ts +0 -205
  561. package/src/geoarrow/stream.ts +0 -130
  562. package/src/geoarrow/tessellate.ts +0 -133
  563. package/src/geoarrow/tessellation-entry.ts +0 -7
  564. package/src/geoarrow/types.ts +0 -259
  565. package/src/geoarrow/views.ts +0 -150
  566. package/src/geoarrow/wkb-entry.ts +0 -13
  567. package/src/geoarrow/worker.ts +0 -20
  568. package/src/terrain/vendor/README.md +0 -20
  569. package/src/vendor/geographiclib-geodesic/README.md +0 -26
  570. package/src/wkb/index.ts +0 -38
  571. package/src/wkb/types.ts +0 -54
  572. package/src/wkb/wkb-builder.ts +0 -395
  573. package/src/wkb/wkb-reader.ts +0 -401
  574. package/src/wkb/wkb.ts +0 -255
  575. package/src/wkb/wkt.ts +0 -375
  576. /package/{projection/APACHE-2.0-LICENSE.txt → APACHE-2.0-LICENSE.txt} +0 -0
  577. /package/{projection/PROJ-LICENSE.txt → PROJ-LICENSE.txt} +0 -0
  578. /package/{projection/PROJ4-LICENSE.md → PROJ4-LICENSE.md} +0 -0
  579. /package/{crs/schemas → src/crs}/projjson.schema.json +0 -0
@@ -1,668 +0,0 @@
1
- // math.gl
2
- // SPDX-License-Identifier: MIT
3
- // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
- import { getGeoArrowDimensionSize, getGeoArrowEncodingForGeometry, getGeoArrowGeometryType } from "./types.js";
5
- /**
6
- * Two-pass writer for homogeneous native GeoArrow geometry columns.
7
- *
8
- * Feed the same rows to a measure builder, allocate its target, and then feed them to a write
9
- * builder. The write result borrows the supplied target buffers.
10
- */
11
- export class GeoArrowBuilder {
12
- constructor(options) {
13
- this.length = 0;
14
- this.nullCount = 0;
15
- this.coordinateCount = 0;
16
- this.partCount = 0;
17
- this.ringCount = 0;
18
- this.eventStack = [];
19
- this.mode = options.mode;
20
- this.encoding = options.encoding;
21
- this.dimension = options.dimension || 'xy';
22
- this.coordinateLayout = options.coordinateLayout || 'interleaved';
23
- this.offsetType = options.offsetType || 'int32';
24
- this.coordinateType = options.coordinateType || 'float64';
25
- this.target = options.mode === 'write' ? options.target : undefined;
26
- if (this.target)
27
- this.initializeTargetOffsets(this.target);
28
- }
29
- /** Appends one geometry row or null. */
30
- append(geometry) {
31
- const rowIndex = this.length++;
32
- if (!geometry) {
33
- this.nullCount++;
34
- this.appendNull(rowIndex);
35
- return this;
36
- }
37
- const expectedType = getGeoArrowGeometryType(this.encoding);
38
- if (geometry.type !== expectedType) {
39
- throw new Error(`GeoArrowBuilder for ${this.encoding} cannot append ${geometry.type}`);
40
- }
41
- if (geometry.type === 'GeometryCollection') {
42
- throw new Error('GeoArrowBuilder only accepts concrete geometry families');
43
- }
44
- if (this.target)
45
- setValidityBit(this.target.validity, rowIndex);
46
- const depth = getBuilderDepth(this.encoding);
47
- const coordinates = geometry.coordinates;
48
- if (depth === 0) {
49
- this.writeCoordinateValues(coordinates);
50
- }
51
- else if (depth === 1) {
52
- this.writeCoordinateList(coordinates);
53
- this.writeOffset(this.target?.geometryOffsets, rowIndex + 1, this.coordinateCount);
54
- }
55
- else if (depth === 2) {
56
- for (const part of coordinates) {
57
- this.writeCoordinateList(part);
58
- this.partCount++;
59
- this.writeOffset(this.target?.partOffsets, this.partCount, this.coordinateCount);
60
- }
61
- this.writeOffset(this.target?.geometryOffsets, rowIndex + 1, this.partCount);
62
- }
63
- else {
64
- for (const polygon of coordinates) {
65
- for (const ring of polygon) {
66
- this.writeCoordinateList(ring);
67
- this.ringCount++;
68
- this.writeOffset(this.target?.ringOffsets, this.ringCount, this.coordinateCount);
69
- }
70
- this.partCount++;
71
- this.writeOffset(this.target?.partOffsets, this.partCount, this.ringCount);
72
- }
73
- this.writeOffset(this.target?.geometryOffsets, rowIndex + 1, this.partCount);
74
- }
75
- return this;
76
- }
77
- /** Returns current exact allocation counts. */
78
- getMeasurement() {
79
- const depth = getBuilderDepth(this.encoding);
80
- return {
81
- length: this.length,
82
- nullCount: this.nullCount,
83
- coordinateCount: this.coordinateCount,
84
- geometryOffsetCount: depth >= 1 ? this.length + 1 : 0,
85
- partOffsetCount: depth >= 2 ? this.partCount + 1 : 0,
86
- ringOffsetCount: depth >= 3 ? this.ringCount + 1 : 0
87
- };
88
- }
89
- /** Allocates a write target from the current measure pass. */
90
- allocateTarget() {
91
- if (this.mode !== 'measure')
92
- throw new Error('Only a measure builder can allocate a target');
93
- return allocateGeoArrowBuilderTarget(this.getMeasurement(), {
94
- encoding: this.encoding,
95
- dimension: this.dimension,
96
- coordinateLayout: this.coordinateLayout,
97
- offsetType: this.offsetType,
98
- coordinateType: this.coordinateType
99
- });
100
- }
101
- /** Finishes a write pass and returns a one-chunk borrowed column. */
102
- finish() {
103
- if (!this.target)
104
- throw new Error('A measure builder has no finished column');
105
- const measurement = this.getMeasurement();
106
- assertTargetCapacity(this.target, measurement, getGeoArrowDimensionSize(this.dimension));
107
- const coordinates = makeCoordinateArray(this.target.coordinates, measurement.coordinateCount, this.dimension, this.coordinateLayout);
108
- const depth = getBuilderDepth(this.encoding);
109
- let chunk = coordinates;
110
- if (depth >= 3) {
111
- chunk = {
112
- kind: 'list',
113
- length: this.ringCount,
114
- offsets: this.target.ringOffsets,
115
- child: chunk
116
- };
117
- }
118
- if (depth >= 2) {
119
- chunk = {
120
- kind: 'list',
121
- length: this.partCount,
122
- offsets: this.target.partOffsets,
123
- child: chunk
124
- };
125
- }
126
- if (depth >= 1) {
127
- chunk = {
128
- kind: 'list',
129
- length: this.length,
130
- offsets: this.target.geometryOffsets,
131
- child: chunk,
132
- validity: { values: this.target.validity }
133
- };
134
- }
135
- else {
136
- chunk = { ...chunk, validity: { values: this.target.validity } };
137
- }
138
- return {
139
- encoding: this.encoding,
140
- dimension: this.dimension,
141
- coordinateLayout: this.coordinateLayout,
142
- chunks: [chunk]
143
- };
144
- }
145
- /** Builds a homogeneous column using an internal measure/write pair. */
146
- static build(rows, options) {
147
- const measure = new GeoArrowBuilder({ ...options, mode: 'measure' });
148
- for (const row of rows)
149
- measure.append(row);
150
- const write = new GeoArrowBuilder({
151
- ...options,
152
- mode: 'write',
153
- target: measure.allocateTarget()
154
- });
155
- for (const row of rows)
156
- write.append(row);
157
- return write.finish();
158
- }
159
- appendNull(rowIndex) {
160
- const depth = getBuilderDepth(this.encoding);
161
- if (depth === 0) {
162
- this.writeCoordinateValues(new Array(getGeoArrowDimensionSize(this.dimension)).fill(0));
163
- }
164
- else {
165
- this.writeOffset(this.target?.geometryOffsets, rowIndex + 1, depth === 1 ? this.coordinateCount : this.partCount);
166
- }
167
- }
168
- writeCoordinateList(coordinates) {
169
- for (const coordinate of coordinates)
170
- this.writeCoordinateValues(coordinate);
171
- }
172
- writeCoordinateValues(coordinate) {
173
- const size = getGeoArrowDimensionSize(this.dimension);
174
- if (coordinate.length === 0 &&
175
- (this.encoding === 'geoarrow.point' || this.encoding === 'geoarrow.multipoint')) {
176
- coordinate = new Array(size).fill(Number.NaN);
177
- }
178
- if (coordinate.length !== size) {
179
- throw new Error(`Expected ${size} coordinate values for ${this.dimension}`);
180
- }
181
- if (this.target)
182
- writeCoordinate(this.target.coordinates, this.coordinateCount, coordinate, this.dimension);
183
- this.coordinateCount++;
184
- }
185
- writeCoordinateComponents(x, y, z, m, sourceDimension) {
186
- const targetZ = sourceDimension === 'xyz' || sourceDimension === 'xyzm' ? (z ?? 0) : 0;
187
- const targetM = sourceDimension === 'xym' || sourceDimension === 'xyzm' ? (m ?? 0) : 0;
188
- if (this.target) {
189
- writeCoordinateComponents(this.target.coordinates, this.coordinateCount, x, y, targetZ, targetM, this.dimension);
190
- }
191
- this.coordinateCount++;
192
- }
193
- /** Begins an event-driven geometry. Events are accepted by both measure and write builders. */
194
- beginGeometry(type, dimension = this.dimension, _count) {
195
- const direct = getGeoArrowGeometryType(this.encoding) === type;
196
- const rowIndex = direct ? this.length++ : -1;
197
- this.eventStack.push({
198
- type,
199
- dimension,
200
- direct,
201
- rowIndex,
202
- ringStarted: false,
203
- polygonStarted: false,
204
- ...(direct ? {} : { rings: [], polygons: [] }),
205
- ...(direct ? {} : { children: [] })
206
- });
207
- return this;
208
- }
209
- /** Begins a polygon part inside an event-built MultiPolygon. */
210
- beginPolygon() {
211
- const state = this.eventStack[this.eventStack.length - 1];
212
- if (!state || state.type !== 'MultiPolygon') {
213
- throw new Error("beginPolygon must follow beginGeometry('MultiPolygon')");
214
- }
215
- if (state.direct) {
216
- this.finishEventRing(state);
217
- this.finishEventPolygon(state);
218
- state.polygonStarted = true;
219
- return this;
220
- }
221
- state.currentPolygon = [];
222
- state.polygons.push(state.currentPolygon);
223
- state.currentRing = undefined;
224
- return this;
225
- }
226
- /** Begins a ring/part in the current event geometry. */
227
- beginRing(_count) {
228
- const state = this.eventStack[this.eventStack.length - 1];
229
- if (!state)
230
- throw new Error('beginRing must follow beginGeometry');
231
- if (state.direct) {
232
- this.finishEventRing(state);
233
- state.ringStarted = true;
234
- return this;
235
- }
236
- state.currentRing = [];
237
- if (state.type === 'MultiPolygon') {
238
- if (!state.currentPolygon)
239
- this.beginPolygon();
240
- state.currentPolygon.push(state.currentRing);
241
- }
242
- else {
243
- state.rings.push(state.currentRing);
244
- }
245
- return this;
246
- }
247
- /** Writes one coordinate into the current event ring or point. */
248
- writeCoordinate(x, y, z, m) {
249
- const state = this.eventStack[this.eventStack.length - 1];
250
- if (!state)
251
- throw new Error('writeCoordinate must follow beginGeometry');
252
- if (typeof x === 'number' && state.direct) {
253
- this.writeCoordinateComponents(x, y, z, m, state.dimension);
254
- return this;
255
- }
256
- const coordinate = Array.isArray(x)
257
- ? [...x]
258
- : [x, y, ...(z === undefined ? [] : [z]), ...(m === undefined ? [] : [m])];
259
- const size = getGeoArrowDimensionSize(state.dimension);
260
- if (coordinate.length !== size)
261
- throw new Error(`Expected ${size} coordinate values for ${state.dimension}`);
262
- if (state.direct) {
263
- this.writeCoordinateValues(resizeEventCoordinate(coordinate, state.dimension, this.dimension));
264
- return this;
265
- }
266
- if (state.type === 'Point') {
267
- state.rings = [[coordinate]];
268
- return this;
269
- }
270
- if (!state.currentRing)
271
- this.beginRing();
272
- state.currentRing.push(coordinate);
273
- return this;
274
- }
275
- /** Writes scalar ordinates tagged with their source dimension without allocating a tuple. */
276
- writeCoordinateFromDimension(x, y, z, m, sourceDimension) {
277
- const state = this.eventStack[this.eventStack.length - 1];
278
- if (!state)
279
- throw new Error('writeCoordinateFromDimension must follow beginGeometry');
280
- if (state.direct) {
281
- this.writeCoordinateComponents(x, y, z, m, sourceDimension);
282
- return this;
283
- }
284
- const coordinate = getDimensionNames(state.dimension).map(name => {
285
- if (name === 'x')
286
- return x;
287
- if (name === 'y')
288
- return y;
289
- if (name === 'z')
290
- return sourceDimension === 'xyz' || sourceDimension === 'xyzm' ? (z ?? 0) : 0;
291
- return sourceDimension === 'xym' || sourceDimension === 'xyzm' ? (m ?? 0) : 0;
292
- });
293
- return this.writeCoordinate(coordinate);
294
- }
295
- /** Ends the current event geometry and appends it to the builder/parent. */
296
- endGeometry() {
297
- const state = this.eventStack.pop();
298
- if (!state)
299
- throw new Error('endGeometry without beginGeometry');
300
- if (state.direct) {
301
- this.finishEventRing(state);
302
- this.finishEventPolygon(state);
303
- const depth = getBuilderDepth(this.encoding);
304
- if (depth >= 1) {
305
- this.writeOffset(this.target?.geometryOffsets, state.rowIndex + 1, depth === 1 ? this.coordinateCount : this.partCount);
306
- }
307
- if (this.target)
308
- setValidityBit(this.target.validity, state.rowIndex);
309
- return this;
310
- }
311
- const coordinates = state.rings || [];
312
- let geometry;
313
- switch (state.type) {
314
- case 'Point':
315
- geometry = { type: 'Point', coordinates: coordinates[0]?.[0] || [] };
316
- break;
317
- case 'LineString':
318
- geometry = { type: 'LineString', coordinates: coordinates[0] || [] };
319
- break;
320
- case 'MultiPoint':
321
- geometry = { type: 'MultiPoint', coordinates: coordinates.flat() };
322
- break;
323
- case 'Polygon':
324
- geometry = { type: 'Polygon', coordinates };
325
- break;
326
- case 'MultiLineString':
327
- geometry = { type: 'MultiLineString', coordinates };
328
- break;
329
- case 'MultiPolygon':
330
- geometry = {
331
- type: 'MultiPolygon',
332
- coordinates: state.polygons?.length ? state.polygons : [coordinates]
333
- };
334
- break;
335
- case 'GeometryCollection':
336
- geometry = { type: 'GeometryCollection', geometries: state.children || [] };
337
- break;
338
- }
339
- const parent = this.eventStack[this.eventStack.length - 1];
340
- if (parent?.type === 'GeometryCollection')
341
- parent.children.push(geometry);
342
- else
343
- this.append(geometry);
344
- return this;
345
- }
346
- writeOffset(target, index, value) {
347
- if (!target)
348
- return;
349
- if (target instanceof BigInt64Array)
350
- target[index] = BigInt(value);
351
- else
352
- target[index] = value;
353
- }
354
- finishEventRing(state) {
355
- if (!state.direct || !state.ringStarted)
356
- return;
357
- if (this.encoding === 'geoarrow.multipolygon') {
358
- this.ringCount++;
359
- this.writeOffset(this.target?.ringOffsets, this.ringCount, this.coordinateCount);
360
- }
361
- else if (getBuilderDepth(this.encoding) >= 2) {
362
- this.partCount++;
363
- this.writeOffset(this.target?.partOffsets, this.partCount, this.coordinateCount);
364
- }
365
- state.ringStarted = false;
366
- }
367
- finishEventPolygon(state) {
368
- if (!state.direct || !state.polygonStarted)
369
- return;
370
- if (this.encoding === 'geoarrow.multipolygon') {
371
- this.partCount++;
372
- this.writeOffset(this.target?.partOffsets, this.partCount, this.ringCount);
373
- }
374
- state.polygonStarted = false;
375
- }
376
- initializeTargetOffsets(target) {
377
- this.writeOffset(target.geometryOffsets, 0, 0);
378
- this.writeOffset(target.partOffsets, 0, 0);
379
- this.writeOffset(target.ringOffsets, 0, 0);
380
- }
381
- }
382
- /** Allocates exact buffers for one measured builder pass. */
383
- export function allocateGeoArrowBuilderTarget(measurement, options) {
384
- const dimension = options.dimension || 'xy';
385
- const size = getGeoArrowDimensionSize(dimension);
386
- const FloatArray = options.coordinateType === 'float32' ? Float32Array : Float64Array;
387
- const coordinateLayout = options.coordinateLayout || 'interleaved';
388
- const coordinates = coordinateLayout === 'interleaved'
389
- ? new FloatArray(measurement.coordinateCount * size)
390
- : makeSeparatedCoordinateTarget(FloatArray, measurement.coordinateCount, dimension);
391
- const OffsetArray = options.offsetType === 'int64' ? BigInt64Array : Int32Array;
392
- return {
393
- validity: new Uint8Array(Math.ceil(measurement.length / 8)),
394
- coordinates,
395
- geometryOffsets: measurement.geometryOffsetCount
396
- ? new OffsetArray(measurement.geometryOffsetCount)
397
- : undefined,
398
- partOffsets: measurement.partOffsetCount
399
- ? new OffsetArray(measurement.partOffsetCount)
400
- : undefined,
401
- ringOffsets: measurement.ringOffsetCount
402
- ? new OffsetArray(measurement.ringOffsetCount)
403
- : undefined
404
- };
405
- }
406
- /** Builds a concrete or dense-union column from materialized rows. */
407
- export function makeGeoArrowColumnFromGeometryRows(rows, options = {}) {
408
- const geometryTypes = [...new Set(rows.filter(Boolean).map(row => row.type))];
409
- const dimension = options.dimension || inferRowsDimension(rows);
410
- if (options.encoding === 'geoarrow.geometry') {
411
- return {
412
- encoding: 'geoarrow.geometry',
413
- dimension,
414
- coordinateLayout: options.coordinateLayout || 'interleaved',
415
- chunks: [makeDenseUnionArray(rows, options, dimension)]
416
- };
417
- }
418
- if (geometryTypes.length === 0) {
419
- return GeoArrowBuilder.build(rows, { ...options, dimension, encoding: 'geoarrow.point' });
420
- }
421
- if (geometryTypes.length === 1 && geometryTypes[0] !== 'GeometryCollection') {
422
- return GeoArrowBuilder.build(rows, {
423
- ...options,
424
- dimension,
425
- encoding: getGeoArrowEncodingForGeometry(geometryTypes[0])
426
- });
427
- }
428
- if (geometryTypes.length === 1 && geometryTypes[0] === 'GeometryCollection') {
429
- return {
430
- encoding: 'geoarrow.geometrycollection',
431
- dimension,
432
- coordinateLayout: options.coordinateLayout || 'interleaved',
433
- chunks: [makeGeometryCollectionArray(rows, options, dimension)]
434
- };
435
- }
436
- return {
437
- encoding: 'geoarrow.geometry',
438
- dimension,
439
- coordinateLayout: options.coordinateLayout || 'interleaved',
440
- chunks: [makeDenseUnionArray(rows, options, dimension)]
441
- };
442
- }
443
- function makeDenseUnionArray(rows, options, dimension) {
444
- const nonNullTypes = [...new Set(rows.filter(Boolean).map(row => row.type))];
445
- const fallbackType = nonNullTypes[0] || 'Point';
446
- const childRows = new Map();
447
- for (const type of nonNullTypes.length ? nonNullTypes : [fallbackType])
448
- childRows.set(type, []);
449
- const typeIds = new Int8Array(rows.length);
450
- const valueOffsets = new Int32Array(rows.length);
451
- for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
452
- const geometry = rows[rowIndex];
453
- const type = geometry?.type || fallbackType;
454
- const values = childRows.get(type) || [];
455
- typeIds[rowIndex] = getGeometryTypeId(type, dimension);
456
- valueOffsets[rowIndex] = values.length;
457
- values.push(geometry);
458
- childRows.set(type, values);
459
- }
460
- const children = [...childRows.entries()]
461
- .sort(([left], [right]) => getGeometryTypeId(left, dimension) - getGeometryTypeId(right, dimension))
462
- .map(([type, values]) => {
463
- const data = type === 'GeometryCollection'
464
- ? makeGeometryCollectionArray(values, options, dimension)
465
- : GeoArrowBuilder.build(values, {
466
- ...options,
467
- dimension,
468
- encoding: getGeoArrowEncodingForGeometry(type)
469
- }).chunks[0];
470
- return {
471
- name: type,
472
- typeId: getGeometryTypeId(type, dimension),
473
- encoding: getGeoArrowEncodingForGeometry(type),
474
- dimension,
475
- coordinateLayout: options.coordinateLayout || 'interleaved',
476
- data
477
- };
478
- });
479
- return {
480
- kind: 'dense-union',
481
- length: rows.length,
482
- typeIds,
483
- valueOffsets,
484
- children
485
- };
486
- }
487
- function makeGeometryCollectionArray(rows, options, dimension) {
488
- const offsets = new Int32Array(rows.length + 1);
489
- const validity = new Uint8Array(Math.ceil(rows.length / 8));
490
- const flattened = [];
491
- for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
492
- const row = rows[rowIndex];
493
- if (row?.type === 'GeometryCollection') {
494
- flattened.push(...row.geometries);
495
- setValidityBit(validity, rowIndex);
496
- }
497
- offsets[rowIndex + 1] = flattened.length;
498
- }
499
- return {
500
- kind: 'list',
501
- length: rows.length,
502
- offsets,
503
- child: makeDenseUnionArray(flattened, options, dimension),
504
- validity: { values: validity }
505
- };
506
- }
507
- function makeCoordinateArray(coordinates, coordinateCount, dimension, layout) {
508
- const size = getGeoArrowDimensionSize(dimension);
509
- if (layout === 'interleaved') {
510
- const values = coordinates;
511
- return {
512
- kind: 'fixed-size-list',
513
- length: coordinateCount,
514
- size,
515
- child: { kind: 'primitive', length: coordinateCount * size, values }
516
- };
517
- }
518
- const separated = coordinates;
519
- const children = {
520
- x: { kind: 'primitive', length: coordinateCount, values: separated.x },
521
- y: { kind: 'primitive', length: coordinateCount, values: separated.y }
522
- };
523
- if (separated.z) {
524
- children['z'] = { kind: 'primitive', length: coordinateCount, values: separated.z };
525
- }
526
- if (separated.m) {
527
- children['m'] = { kind: 'primitive', length: coordinateCount, values: separated.m };
528
- }
529
- return { kind: 'struct', length: coordinateCount, children };
530
- }
531
- function makeSeparatedCoordinateTarget(FloatArray, count, dimension) {
532
- return {
533
- x: new FloatArray(count),
534
- y: new FloatArray(count),
535
- z: dimension === 'xyz' || dimension === 'xyzm' ? new FloatArray(count) : undefined,
536
- m: dimension === 'xym' || dimension === 'xyzm' ? new FloatArray(count) : undefined
537
- };
538
- }
539
- function writeCoordinate(target, coordinateIndex, coordinate, dimension) {
540
- if (target instanceof Float32Array || target instanceof Float64Array) {
541
- target.set(coordinate, coordinateIndex * coordinate.length);
542
- return;
543
- }
544
- target.x[coordinateIndex] = coordinate[0];
545
- target.y[coordinateIndex] = coordinate[1];
546
- if (dimension === 'xyz')
547
- target.z[coordinateIndex] = coordinate[2];
548
- else if (dimension === 'xym')
549
- target.m[coordinateIndex] = coordinate[2];
550
- else if (dimension === 'xyzm') {
551
- target.z[coordinateIndex] = coordinate[2];
552
- target.m[coordinateIndex] = coordinate[3];
553
- }
554
- }
555
- function writeCoordinateComponents(target, coordinateIndex, x, y, z, m, dimension) {
556
- if (target instanceof Float32Array || target instanceof Float64Array) {
557
- const size = getGeoArrowDimensionSize(dimension);
558
- const offset = coordinateIndex * size;
559
- target[offset] = x;
560
- target[offset + 1] = y;
561
- if (dimension === 'xyz')
562
- target[offset + 2] = z;
563
- else if (dimension === 'xym')
564
- target[offset + 2] = m;
565
- else if (dimension === 'xyzm') {
566
- target[offset + 2] = z;
567
- target[offset + 3] = m;
568
- }
569
- return;
570
- }
571
- target.x[coordinateIndex] = x;
572
- target.y[coordinateIndex] = y;
573
- if (dimension === 'xyz')
574
- target.z[coordinateIndex] = z;
575
- else if (dimension === 'xym')
576
- target.m[coordinateIndex] = m;
577
- else if (dimension === 'xyzm') {
578
- target.z[coordinateIndex] = z;
579
- target.m[coordinateIndex] = m;
580
- }
581
- }
582
- function resizeEventCoordinate(coordinate, sourceDimension, targetDimension) {
583
- if (sourceDimension === targetDimension)
584
- return [...coordinate];
585
- const sourceNames = getDimensionNames(sourceDimension);
586
- return getDimensionNames(targetDimension).map(name => {
587
- const index = sourceNames.indexOf(name);
588
- return index >= 0 ? (coordinate[index] ?? 0) : 0;
589
- });
590
- }
591
- function getDimensionNames(dimension) {
592
- switch (dimension) {
593
- case 'xy':
594
- return ['x', 'y'];
595
- case 'xyz':
596
- return ['x', 'y', 'z'];
597
- case 'xym':
598
- return ['x', 'y', 'm'];
599
- case 'xyzm':
600
- return ['x', 'y', 'z', 'm'];
601
- }
602
- }
603
- function setValidityBit(validity, index) {
604
- validity[index >> 3] |= 1 << (index & 7);
605
- }
606
- function getBuilderDepth(encoding) {
607
- switch (encoding) {
608
- case 'geoarrow.point':
609
- return 0;
610
- case 'geoarrow.linestring':
611
- case 'geoarrow.multipoint':
612
- return 1;
613
- case 'geoarrow.polygon':
614
- case 'geoarrow.multilinestring':
615
- return 2;
616
- case 'geoarrow.multipolygon':
617
- return 3;
618
- }
619
- }
620
- function getGeometryTypeId(type, dimension = 'xy') {
621
- const family = [
622
- 'Point',
623
- 'LineString',
624
- 'Polygon',
625
- 'MultiPoint',
626
- 'MultiLineString',
627
- 'MultiPolygon',
628
- 'GeometryCollection'
629
- ].indexOf(type);
630
- const dimensionIndex = ['xy', 'xyz', 'xym', 'xyzm'].indexOf(dimension);
631
- return family < 0 || dimensionIndex < 0 ? 1 : family * 4 + dimensionIndex + 1;
632
- }
633
- function inferRowsDimension(rows) {
634
- let size = 2;
635
- const visit = (value) => {
636
- if (!Array.isArray(value) || value.length === 0)
637
- return;
638
- if (typeof value[0] === 'number')
639
- size = Math.max(size, value.length);
640
- else
641
- for (const child of value)
642
- visit(child);
643
- };
644
- const visitGeometry = (geometry) => {
645
- if (geometry.type === 'GeometryCollection') {
646
- for (const child of geometry.geometries)
647
- visitGeometry(child);
648
- }
649
- else {
650
- visit(geometry.coordinates);
651
- }
652
- };
653
- for (const row of rows) {
654
- if (row)
655
- visitGeometry(row);
656
- }
657
- return size >= 4 ? 'xyzm' : size === 3 ? 'xyz' : 'xy';
658
- }
659
- function assertTargetCapacity(target, measurement, size) {
660
- const coordinateLength = target.coordinates instanceof Float32Array || target.coordinates instanceof Float64Array
661
- ? target.coordinates.length / size
662
- : target.coordinates.x.length;
663
- if (coordinateLength < measurement.coordinateCount ||
664
- target.validity.length * 8 < measurement.length) {
665
- throw new Error('GeoArrowBuilder target is smaller than its measured output');
666
- }
667
- }
668
- //# sourceMappingURL=builder.js.map