@math.gl/geospatial 5.0.0-alpha.17 → 5.0.0-alpha.19

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 (1666) hide show
  1. package/README.md +12 -0
  2. package/crs/README.md +84 -0
  3. package/crs/schemas/README.md +9 -0
  4. package/crs/schemas/projjson.schema.json +1174 -0
  5. package/dist/crs/crs-metadata.cjs +67 -0
  6. package/dist/crs/crs-metadata.cjs.map +6 -0
  7. package/dist/crs/crs-metadata.d.ts +43 -0
  8. package/dist/crs/crs-metadata.d.ts.map +1 -0
  9. package/dist/crs/crs-metadata.js +26 -0
  10. package/dist/crs/crs-metadata.js.map +1 -0
  11. package/dist/crs/crs.d.ts +22 -0
  12. package/dist/crs/crs.d.ts.map +1 -0
  13. package/dist/crs/crs.js +5 -0
  14. package/dist/crs/crs.js.map +1 -0
  15. package/dist/crs/index.cjs +916 -0
  16. package/dist/crs/index.cjs.map +6 -0
  17. package/dist/crs/index.d.ts +12 -0
  18. package/dist/crs/index.d.ts.map +1 -0
  19. package/dist/crs/index.js +10 -0
  20. package/dist/crs/index.js.map +1 -0
  21. package/dist/crs/proj-string.cjs +219 -0
  22. package/dist/crs/proj-string.cjs.map +6 -0
  23. package/dist/crs/proj-string.d.ts +32 -0
  24. package/dist/crs/proj-string.d.ts.map +1 -0
  25. package/dist/crs/proj-string.js +204 -0
  26. package/dist/crs/proj-string.js.map +1 -0
  27. package/dist/crs/projjson-schema-constants.d.ts +5 -0
  28. package/dist/crs/projjson-schema-constants.d.ts.map +1 -0
  29. package/dist/crs/projjson-schema-constants.js +8 -0
  30. package/dist/crs/projjson-schema-constants.js.map +1 -0
  31. package/dist/crs/projjson-types.d.ts +557 -0
  32. package/dist/crs/projjson-types.d.ts.map +1 -0
  33. package/dist/crs/projjson-types.js +5 -0
  34. package/dist/crs/projjson-types.js.map +1 -0
  35. package/dist/crs/spatial-reference.cjs +80 -0
  36. package/dist/crs/spatial-reference.cjs.map +6 -0
  37. package/dist/crs/spatial-reference.d.ts +104 -0
  38. package/dist/crs/spatial-reference.d.ts.map +1 -0
  39. package/dist/crs/spatial-reference.js +86 -0
  40. package/dist/crs/spatial-reference.js.map +1 -0
  41. package/dist/crs/units-table.d.ts +4 -0
  42. package/dist/crs/units-table.d.ts.map +1 -0
  43. package/dist/crs/units-table.js +29 -0
  44. package/dist/crs/units-table.js.map +1 -0
  45. package/dist/crs/wkt-crs.cjs +610 -0
  46. package/dist/crs/wkt-crs.cjs.map +6 -0
  47. package/dist/crs/wkt-crs.d.ts +86 -0
  48. package/dist/crs/wkt-crs.d.ts.map +1 -0
  49. package/dist/crs/wkt-crs.js +613 -0
  50. package/dist/crs/wkt-crs.js.map +1 -0
  51. package/dist/ellipsoid-helpers/ellipsoid-transform.d.ts +1 -1
  52. package/dist/ellipsoid-helpers/ellipsoid-transform.d.ts.map +1 -1
  53. package/dist/ellipsoid-tangent-plane.d.ts +1 -1
  54. package/dist/ellipsoid-tangent-plane.d.ts.map +1 -1
  55. package/dist/ellipsoid-tangent-plane.js +1 -1
  56. package/dist/ellipsoid-tangent-plane.js.map +1 -1
  57. package/dist/ellipsoid.d.ts +1 -1
  58. package/dist/ellipsoid.d.ts.map +1 -1
  59. package/dist/entries/ellipsoid.cjs +572 -0
  60. package/dist/entries/ellipsoid.cjs.map +6 -0
  61. package/dist/entries/ellipsoid.d.ts +5 -0
  62. package/dist/entries/ellipsoid.d.ts.map +1 -0
  63. package/dist/entries/ellipsoid.js +7 -0
  64. package/dist/entries/ellipsoid.js.map +1 -0
  65. package/dist/expressions.cjs +528 -0
  66. package/dist/expressions.cjs.map +6 -0
  67. package/dist/expressions.d.ts +4 -0
  68. package/dist/expressions.d.ts.map +1 -0
  69. package/dist/expressions.js +23 -0
  70. package/dist/expressions.js.map +1 -0
  71. package/dist/geoarrow/builder-entry.cjs +699 -0
  72. package/dist/geoarrow/builder-entry.cjs.map +6 -0
  73. package/dist/geoarrow/builder-entry.d.ts +4 -0
  74. package/dist/geoarrow/builder-entry.d.ts.map +1 -0
  75. package/dist/geoarrow/builder-entry.js +5 -0
  76. package/dist/geoarrow/builder-entry.js.map +1 -0
  77. package/dist/geoarrow/builder.d.ts +106 -0
  78. package/dist/geoarrow/builder.d.ts.map +1 -0
  79. package/dist/geoarrow/builder.js +668 -0
  80. package/dist/geoarrow/builder.js.map +1 -0
  81. package/dist/geoarrow/codecs.d.ts +24 -0
  82. package/dist/geoarrow/codecs.d.ts.map +1 -0
  83. package/dist/geoarrow/codecs.js +921 -0
  84. package/dist/geoarrow/codecs.js.map +1 -0
  85. package/dist/geoarrow/index.cjs +4089 -0
  86. package/dist/geoarrow/index.cjs.map +6 -0
  87. package/dist/geoarrow/index.d.ts +15 -0
  88. package/dist/geoarrow/index.d.ts.map +1 -0
  89. package/dist/geoarrow/index.js +11 -0
  90. package/dist/geoarrow/index.js.map +1 -0
  91. package/dist/geoarrow/kernels.d.ts +56 -0
  92. package/dist/geoarrow/kernels.d.ts.map +1 -0
  93. package/dist/geoarrow/kernels.js +982 -0
  94. package/dist/geoarrow/kernels.js.map +1 -0
  95. package/dist/geoarrow/layout.d.ts +64 -0
  96. package/dist/geoarrow/layout.d.ts.map +1 -0
  97. package/dist/geoarrow/layout.js +722 -0
  98. package/dist/geoarrow/layout.js.map +1 -0
  99. package/dist/geoarrow/tessellate.d.ts +31 -0
  100. package/dist/geoarrow/tessellate.d.ts.map +1 -0
  101. package/dist/geoarrow/tessellate.js +102 -0
  102. package/dist/geoarrow/tessellate.js.map +1 -0
  103. package/dist/geoarrow/tessellation-entry.cjs +431 -0
  104. package/dist/geoarrow/tessellation-entry.cjs.map +6 -0
  105. package/dist/geoarrow/tessellation-entry.d.ts +4 -0
  106. package/dist/geoarrow/tessellation-entry.d.ts.map +1 -0
  107. package/dist/geoarrow/tessellation-entry.js +5 -0
  108. package/dist/geoarrow/tessellation-entry.js.map +1 -0
  109. package/dist/geoarrow/types.d.ts +147 -0
  110. package/dist/geoarrow/types.d.ts.map +1 -0
  111. package/dist/geoarrow/types.js +41 -0
  112. package/dist/geoarrow/types.js.map +1 -0
  113. package/dist/geoarrow/views.d.ts +45 -0
  114. package/dist/geoarrow/views.d.ts.map +1 -0
  115. package/dist/geoarrow/views.js +114 -0
  116. package/dist/geoarrow/views.js.map +1 -0
  117. package/dist/geoarrow/wkb-entry.cjs +2467 -0
  118. package/dist/geoarrow/wkb-entry.cjs.map +6 -0
  119. package/dist/geoarrow/wkb-entry.d.ts +4 -0
  120. package/dist/geoarrow/wkb-entry.d.ts.map +1 -0
  121. package/dist/geoarrow/wkb-entry.js +6 -0
  122. package/dist/geoarrow/wkb-entry.js.map +1 -0
  123. package/dist/geoarrow/worker.cjs +77 -0
  124. package/dist/geoarrow/worker.cjs.map +6 -0
  125. package/dist/geoarrow/worker.d.ts +11 -0
  126. package/dist/geoarrow/worker.d.ts.map +1 -0
  127. package/dist/geoarrow/worker.js +10 -0
  128. package/dist/geoarrow/worker.js.map +1 -0
  129. package/dist/globe.cjs +1002 -0
  130. package/dist/globe.cjs.map +6 -0
  131. package/dist/globe.d.ts +10 -0
  132. package/dist/globe.d.ts.map +1 -0
  133. package/dist/globe.js +9 -0
  134. package/dist/globe.js.map +1 -0
  135. package/dist/index.cjs +154 -261
  136. package/dist/index.cjs.map +3 -3
  137. package/dist/index.d.ts +3 -15
  138. package/dist/index.d.ts.map +1 -1
  139. package/dist/index.js +3 -9
  140. package/dist/index.js.map +1 -1
  141. package/dist/make-obb-from-region.d.ts +1 -1
  142. package/dist/make-obb-from-region.d.ts.map +1 -1
  143. package/dist/make-obb-from-region.js +1 -1
  144. package/dist/make-obb-from-region.js.map +1 -1
  145. package/dist/projection/analysis.cjs +239 -0
  146. package/dist/projection/analysis.cjs.map +6 -0
  147. package/dist/projection/analysis.d.ts +72 -0
  148. package/dist/projection/analysis.d.ts.map +1 -0
  149. package/dist/projection/analysis.js +221 -0
  150. package/dist/projection/analysis.js.map +1 -0
  151. package/dist/projection/bulk.cjs +203 -0
  152. package/dist/projection/bulk.cjs.map +6 -0
  153. package/dist/projection/bulk.d.ts +51 -0
  154. package/dist/projection/bulk.d.ts.map +1 -0
  155. package/dist/projection/bulk.js +215 -0
  156. package/dist/projection/bulk.js.map +1 -0
  157. package/dist/projection/datums.cjs +1383 -0
  158. package/dist/projection/datums.cjs.map +6 -0
  159. package/dist/projection/datums.d.ts +5 -0
  160. package/dist/projection/datums.d.ts.map +1 -0
  161. package/dist/projection/datums.js +10 -0
  162. package/dist/projection/datums.js.map +1 -0
  163. package/dist/projection/deformation.cjs +134 -0
  164. package/dist/projection/deformation.cjs.map +6 -0
  165. package/dist/projection/deformation.d.ts +3 -0
  166. package/dist/projection/deformation.d.ts.map +1 -0
  167. package/dist/projection/deformation.js +5 -0
  168. package/dist/projection/deformation.js.map +1 -0
  169. package/dist/projection/experimental/catalogue-kernel.d.ts +9 -0
  170. package/dist/projection/experimental/catalogue-kernel.d.ts.map +1 -0
  171. package/dist/projection/experimental/catalogue-kernel.js +44 -0
  172. package/dist/projection/experimental/catalogue-kernel.js.map +1 -0
  173. package/dist/projection/experimental/common/adjust_lat.d.ts +2 -0
  174. package/dist/projection/experimental/common/adjust_lat.d.ts.map +1 -0
  175. package/dist/projection/experimental/common/adjust_lat.js +10 -0
  176. package/dist/projection/experimental/common/adjust_lat.js.map +1 -0
  177. package/dist/projection/experimental/common/adjust_lon.d.ts +2 -0
  178. package/dist/projection/experimental/common/adjust_lon.d.ts.map +1 -0
  179. package/dist/projection/experimental/common/adjust_lon.js +13 -0
  180. package/dist/projection/experimental/common/adjust_lon.js.map +1 -0
  181. package/dist/projection/experimental/common/asinhy.d.ts +2 -0
  182. package/dist/projection/experimental/common/asinhy.d.ts.map +1 -0
  183. package/dist/projection/experimental/common/asinhy.js +12 -0
  184. package/dist/projection/experimental/common/asinhy.js.map +1 -0
  185. package/dist/projection/experimental/common/asinz.d.ts +2 -0
  186. package/dist/projection/experimental/common/asinz.d.ts.map +1 -0
  187. package/dist/projection/experimental/common/asinz.js +11 -0
  188. package/dist/projection/experimental/common/asinz.js.map +1 -0
  189. package/dist/projection/experimental/common/authlat.d.ts +2 -0
  190. package/dist/projection/experimental/common/authlat.d.ts.map +1 -0
  191. package/dist/projection/experimental/common/authlat.js +9 -0
  192. package/dist/projection/experimental/common/authlat.js.map +1 -0
  193. package/dist/projection/experimental/common/authset.d.ts +2 -0
  194. package/dist/projection/experimental/common/authset.d.ts.map +1 -0
  195. package/dist/projection/experimental/common/authset.js +24 -0
  196. package/dist/projection/experimental/common/authset.js.map +1 -0
  197. package/dist/projection/experimental/common/clens.d.ts +2 -0
  198. package/dist/projection/experimental/common/clens.d.ts.map +1 -0
  199. package/dist/projection/experimental/common/clens.js +18 -0
  200. package/dist/projection/experimental/common/clens.js.map +1 -0
  201. package/dist/projection/experimental/common/clens_cmplx.d.ts +5 -0
  202. package/dist/projection/experimental/common/clens_cmplx.d.ts.map +1 -0
  203. package/dist/projection/experimental/common/clens_cmplx.js +34 -0
  204. package/dist/projection/experimental/common/clens_cmplx.js.map +1 -0
  205. package/dist/projection/experimental/common/constants.d.ts +9 -0
  206. package/dist/projection/experimental/common/constants.d.ts.map +1 -0
  207. package/dist/projection/experimental/common/constants.js +14 -0
  208. package/dist/projection/experimental/common/constants.js.map +1 -0
  209. package/dist/projection/experimental/common/cosh.d.ts +2 -0
  210. package/dist/projection/experimental/common/cosh.d.ts.map +1 -0
  211. package/dist/projection/experimental/common/cosh.js +10 -0
  212. package/dist/projection/experimental/common/cosh.js.map +1 -0
  213. package/dist/projection/experimental/common/e0fn.d.ts +2 -0
  214. package/dist/projection/experimental/common/e0fn.d.ts.map +1 -0
  215. package/dist/projection/experimental/common/e0fn.js +8 -0
  216. package/dist/projection/experimental/common/e0fn.js.map +1 -0
  217. package/dist/projection/experimental/common/e1fn.d.ts +2 -0
  218. package/dist/projection/experimental/common/e1fn.d.ts.map +1 -0
  219. package/dist/projection/experimental/common/e1fn.js +8 -0
  220. package/dist/projection/experimental/common/e1fn.js.map +1 -0
  221. package/dist/projection/experimental/common/e2fn.d.ts +2 -0
  222. package/dist/projection/experimental/common/e2fn.d.ts.map +1 -0
  223. package/dist/projection/experimental/common/e2fn.js +8 -0
  224. package/dist/projection/experimental/common/e2fn.js.map +1 -0
  225. package/dist/projection/experimental/common/e3fn.d.ts +2 -0
  226. package/dist/projection/experimental/common/e3fn.d.ts.map +1 -0
  227. package/dist/projection/experimental/common/e3fn.js +8 -0
  228. package/dist/projection/experimental/common/e3fn.js.map +1 -0
  229. package/dist/projection/experimental/common/fL.d.ts +2 -0
  230. package/dist/projection/experimental/common/fL.d.ts.map +1 -0
  231. package/dist/projection/experimental/common/fL.js +9 -0
  232. package/dist/projection/experimental/common/fL.js.map +1 -0
  233. package/dist/projection/experimental/common/gN.d.ts +2 -0
  234. package/dist/projection/experimental/common/gN.d.ts.map +1 -0
  235. package/dist/projection/experimental/common/gN.js +9 -0
  236. package/dist/projection/experimental/common/gN.js.map +1 -0
  237. package/dist/projection/experimental/common/gatg.d.ts +2 -0
  238. package/dist/projection/experimental/common/gatg.d.ts.map +1 -0
  239. package/dist/projection/experimental/common/gatg.js +18 -0
  240. package/dist/projection/experimental/common/gatg.js.map +1 -0
  241. package/dist/projection/experimental/common/hypot.d.ts +2 -0
  242. package/dist/projection/experimental/common/hypot.d.ts.map +1 -0
  243. package/dist/projection/experimental/common/hypot.js +12 -0
  244. package/dist/projection/experimental/common/hypot.js.map +1 -0
  245. package/dist/projection/experimental/common/imlfn.d.ts +2 -0
  246. package/dist/projection/experimental/common/imlfn.d.ts.map +1 -0
  247. package/dist/projection/experimental/common/imlfn.js +21 -0
  248. package/dist/projection/experimental/common/imlfn.js.map +1 -0
  249. package/dist/projection/experimental/common/invlatiso.d.ts +2 -0
  250. package/dist/projection/experimental/common/invlatiso.d.ts.map +1 -0
  251. package/dist/projection/experimental/common/invlatiso.js +20 -0
  252. package/dist/projection/experimental/common/invlatiso.js.map +1 -0
  253. package/dist/projection/experimental/common/iqsfnz.d.ts +2 -0
  254. package/dist/projection/experimental/common/iqsfnz.d.ts.map +1 -0
  255. package/dist/projection/experimental/common/iqsfnz.js +44 -0
  256. package/dist/projection/experimental/common/iqsfnz.js.map +1 -0
  257. package/dist/projection/experimental/common/latiso.d.ts +2 -0
  258. package/dist/projection/experimental/common/latiso.d.ts.map +1 -0
  259. package/dist/projection/experimental/common/latiso.js +19 -0
  260. package/dist/projection/experimental/common/latiso.js.map +1 -0
  261. package/dist/projection/experimental/common/log1py.d.ts +2 -0
  262. package/dist/projection/experimental/common/log1py.d.ts.map +1 -0
  263. package/dist/projection/experimental/common/log1py.js +10 -0
  264. package/dist/projection/experimental/common/log1py.js.map +1 -0
  265. package/dist/projection/experimental/common/meridian-distance.d.ts +5 -0
  266. package/dist/projection/experimental/common/meridian-distance.d.ts.map +1 -0
  267. package/dist/projection/experimental/common/meridian-distance.js +47 -0
  268. package/dist/projection/experimental/common/meridian-distance.js.map +1 -0
  269. package/dist/projection/experimental/common/mlfn.d.ts +2 -0
  270. package/dist/projection/experimental/common/mlfn.d.ts.map +1 -0
  271. package/dist/projection/experimental/common/mlfn.js +8 -0
  272. package/dist/projection/experimental/common/mlfn.js.map +1 -0
  273. package/dist/projection/experimental/common/msfnz.d.ts +2 -0
  274. package/dist/projection/experimental/common/msfnz.d.ts.map +1 -0
  275. package/dist/projection/experimental/common/msfnz.js +9 -0
  276. package/dist/projection/experimental/common/msfnz.js.map +1 -0
  277. package/dist/projection/experimental/common/phi2z.d.ts +2 -0
  278. package/dist/projection/experimental/common/phi2z.d.ts.map +1 -0
  279. package/dist/projection/experimental/common/phi2z.js +21 -0
  280. package/dist/projection/experimental/common/phi2z.js.map +1 -0
  281. package/dist/projection/experimental/common/pj_enfn.d.ts +2 -0
  282. package/dist/projection/experimental/common/pj_enfn.d.ts.map +1 -0
  283. package/dist/projection/experimental/common/pj_enfn.js +28 -0
  284. package/dist/projection/experimental/common/pj_enfn.js.map +1 -0
  285. package/dist/projection/experimental/common/pj_inv_mlfn.d.ts +2 -0
  286. package/dist/projection/experimental/common/pj_inv_mlfn.d.ts.map +1 -0
  287. package/dist/projection/experimental/common/pj_inv_mlfn.js +26 -0
  288. package/dist/projection/experimental/common/pj_inv_mlfn.js.map +1 -0
  289. package/dist/projection/experimental/common/pj_mlfn.d.ts +2 -0
  290. package/dist/projection/experimental/common/pj_mlfn.d.ts.map +1 -0
  291. package/dist/projection/experimental/common/pj_mlfn.js +10 -0
  292. package/dist/projection/experimental/common/pj_mlfn.js.map +1 -0
  293. package/dist/projection/experimental/common/qsfnz.d.ts +2 -0
  294. package/dist/projection/experimental/common/qsfnz.d.ts.map +1 -0
  295. package/dist/projection/experimental/common/qsfnz.js +16 -0
  296. package/dist/projection/experimental/common/qsfnz.js.map +1 -0
  297. package/dist/projection/experimental/common/sign.d.ts +2 -0
  298. package/dist/projection/experimental/common/sign.d.ts.map +1 -0
  299. package/dist/projection/experimental/common/sign.js +8 -0
  300. package/dist/projection/experimental/common/sign.js.map +1 -0
  301. package/dist/projection/experimental/common/sinh.d.ts +2 -0
  302. package/dist/projection/experimental/common/sinh.d.ts.map +1 -0
  303. package/dist/projection/experimental/common/sinh.js +10 -0
  304. package/dist/projection/experimental/common/sinh.js.map +1 -0
  305. package/dist/projection/experimental/common/srat.d.ts +2 -0
  306. package/dist/projection/experimental/common/srat.d.ts.map +1 -0
  307. package/dist/projection/experimental/common/srat.js +8 -0
  308. package/dist/projection/experimental/common/srat.js.map +1 -0
  309. package/dist/projection/experimental/common/tsfnz.d.ts +2 -0
  310. package/dist/projection/experimental/common/tsfnz.d.ts.map +1 -0
  311. package/dist/projection/experimental/common/tsfnz.js +12 -0
  312. package/dist/projection/experimental/common/tsfnz.js.map +1 -0
  313. package/dist/projection/experimental/common/vincenty.d.ts +29 -0
  314. package/dist/projection/experimental/common/vincenty.d.ts.map +1 -0
  315. package/dist/projection/experimental/common/vincenty.js +134 -0
  316. package/dist/projection/experimental/common/vincenty.js.map +1 -0
  317. package/dist/projection/experimental/core.cjs +1940 -0
  318. package/dist/projection/experimental/core.cjs.map +6 -0
  319. package/dist/projection/experimental/core.d.ts +16 -0
  320. package/dist/projection/experimental/core.d.ts.map +1 -0
  321. package/dist/projection/experimental/core.js +10 -0
  322. package/dist/projection/experimental/core.js.map +1 -0
  323. package/dist/projection/experimental/crs/datum-catalog.d.ts +5 -0
  324. package/dist/projection/experimental/crs/datum-catalog.d.ts.map +1 -0
  325. package/dist/projection/experimental/crs/datum-catalog.js +47 -0
  326. package/dist/projection/experimental/crs/datum-catalog.js.map +1 -0
  327. package/dist/projection/experimental/crs/datum-table.d.ts +8 -0
  328. package/dist/projection/experimental/crs/datum-table.d.ts.map +1 -0
  329. package/dist/projection/experimental/crs/datum-table.js +1355 -0
  330. package/dist/projection/experimental/crs/datum-table.js.map +1 -0
  331. package/dist/projection/experimental/crs/ellipsoid-table.d.ts +8 -0
  332. package/dist/projection/experimental/crs/ellipsoid-table.d.ts.map +1 -0
  333. package/dist/projection/experimental/crs/ellipsoid-table.js +229 -0
  334. package/dist/projection/experimental/crs/ellipsoid-table.js.map +1 -0
  335. package/dist/projection/experimental/crs/normalize.d.ts +8 -0
  336. package/dist/projection/experimental/crs/normalize.d.ts.map +1 -0
  337. package/dist/projection/experimental/crs/normalize.js +279 -0
  338. package/dist/projection/experimental/crs/normalize.js.map +1 -0
  339. package/dist/projection/experimental/crs/primemeridian-table.d.ts +3 -0
  340. package/dist/projection/experimental/crs/primemeridian-table.d.ts.map +1 -0
  341. package/dist/projection/experimental/crs/primemeridian-table.js +20 -0
  342. package/dist/projection/experimental/crs/primemeridian-table.js.map +1 -0
  343. package/dist/projection/experimental/crs/projjson.cjs +564 -0
  344. package/dist/projection/experimental/crs/projjson.cjs.map +6 -0
  345. package/dist/projection/experimental/crs/projjson.d.ts +4 -0
  346. package/dist/projection/experimental/crs/projjson.d.ts.map +1 -0
  347. package/dist/projection/experimental/crs/projjson.js +12 -0
  348. package/dist/projection/experimental/crs/projjson.js.map +1 -0
  349. package/dist/projection/experimental/crs/spatial-reference.d.ts +11 -0
  350. package/dist/projection/experimental/crs/spatial-reference.d.ts.map +1 -0
  351. package/dist/projection/experimental/crs/spatial-reference.js +91 -0
  352. package/dist/projection/experimental/crs/spatial-reference.js.map +1 -0
  353. package/dist/projection/experimental/crs/structured.d.ts +8 -0
  354. package/dist/projection/experimental/crs/structured.d.ts.map +1 -0
  355. package/dist/projection/experimental/crs/structured.js +534 -0
  356. package/dist/projection/experimental/crs/structured.js.map +1 -0
  357. package/dist/projection/experimental/crs/types.d.ts +73 -0
  358. package/dist/projection/experimental/crs/types.d.ts.map +1 -0
  359. package/dist/projection/experimental/crs/types.js +21 -0
  360. package/dist/projection/experimental/crs/types.js.map +1 -0
  361. package/dist/projection/experimental/crs/wkt.cjs +1229 -0
  362. package/dist/projection/experimental/crs/wkt.cjs.map +6 -0
  363. package/dist/projection/experimental/crs/wkt.d.ts +3 -0
  364. package/dist/projection/experimental/crs/wkt.d.ts.map +1 -0
  365. package/dist/projection/experimental/crs/wkt.js +190 -0
  366. package/dist/projection/experimental/crs/wkt.js.map +1 -0
  367. package/dist/projection/experimental/crs-descriptor.d.ts +10 -0
  368. package/dist/projection/experimental/crs-descriptor.d.ts.map +1 -0
  369. package/dist/projection/experimental/crs-descriptor.js +171 -0
  370. package/dist/projection/experimental/crs-descriptor.js.map +1 -0
  371. package/dist/projection/experimental/crs-rendering-scale.d.ts +5 -0
  372. package/dist/projection/experimental/crs-rendering-scale.d.ts.map +1 -0
  373. package/dist/projection/experimental/crs-rendering-scale.js +97 -0
  374. package/dist/projection/experimental/crs-rendering-scale.js.map +1 -0
  375. package/dist/projection/experimental/datum.d.ts +17 -0
  376. package/dist/projection/experimental/datum.d.ts.map +1 -0
  377. package/dist/projection/experimental/datum.js +160 -0
  378. package/dist/projection/experimental/datum.js.map +1 -0
  379. package/dist/projection/experimental/deformation-inverse.d.ts +5 -0
  380. package/dist/projection/experimental/deformation-inverse.d.ts.map +1 -0
  381. package/dist/projection/experimental/deformation-inverse.js +89 -0
  382. package/dist/projection/experimental/deformation-inverse.js.map +1 -0
  383. package/dist/projection/experimental/deformation.d.ts +23 -0
  384. package/dist/projection/experimental/deformation.d.ts.map +1 -0
  385. package/dist/projection/experimental/deformation.js +13 -0
  386. package/dist/projection/experimental/deformation.js.map +1 -0
  387. package/dist/projection/experimental/entries/projections/aea.cjs +642 -0
  388. package/dist/projection/experimental/entries/projections/aea.cjs.map +6 -0
  389. package/dist/projection/experimental/entries/projections/aea.d.ts +2 -0
  390. package/dist/projection/experimental/entries/projections/aea.d.ts.map +1 -0
  391. package/dist/projection/experimental/entries/projections/aea.js +5 -0
  392. package/dist/projection/experimental/entries/projections/aea.js.map +1 -0
  393. package/dist/projection/experimental/entries/projections/aeqd.cjs +718 -0
  394. package/dist/projection/experimental/entries/projections/aeqd.cjs.map +6 -0
  395. package/dist/projection/experimental/entries/projections/aeqd.d.ts +2 -0
  396. package/dist/projection/experimental/entries/projections/aeqd.d.ts.map +1 -0
  397. package/dist/projection/experimental/entries/projections/aeqd.js +5 -0
  398. package/dist/projection/experimental/entries/projections/aeqd.js.map +1 -0
  399. package/dist/projection/experimental/entries/projections/bonne.cjs +621 -0
  400. package/dist/projection/experimental/entries/projections/bonne.cjs.map +6 -0
  401. package/dist/projection/experimental/entries/projections/bonne.d.ts +2 -0
  402. package/dist/projection/experimental/entries/projections/bonne.d.ts.map +1 -0
  403. package/dist/projection/experimental/entries/projections/bonne.js +5 -0
  404. package/dist/projection/experimental/entries/projections/bonne.js.map +1 -0
  405. package/dist/projection/experimental/entries/projections/cass.cjs +610 -0
  406. package/dist/projection/experimental/entries/projections/cass.cjs.map +6 -0
  407. package/dist/projection/experimental/entries/projections/cass.d.ts +2 -0
  408. package/dist/projection/experimental/entries/projections/cass.d.ts.map +1 -0
  409. package/dist/projection/experimental/entries/projections/cass.js +5 -0
  410. package/dist/projection/experimental/entries/projections/cass.js.map +1 -0
  411. package/dist/projection/experimental/entries/projections/cea.cjs +536 -0
  412. package/dist/projection/experimental/entries/projections/cea.cjs.map +6 -0
  413. package/dist/projection/experimental/entries/projections/cea.d.ts +2 -0
  414. package/dist/projection/experimental/entries/projections/cea.d.ts.map +1 -0
  415. package/dist/projection/experimental/entries/projections/cea.js +5 -0
  416. package/dist/projection/experimental/entries/projections/cea.js.map +1 -0
  417. package/dist/projection/experimental/entries/projections/eck6.cjs +559 -0
  418. package/dist/projection/experimental/entries/projections/eck6.cjs.map +6 -0
  419. package/dist/projection/experimental/entries/projections/eck6.d.ts +2 -0
  420. package/dist/projection/experimental/entries/projections/eck6.d.ts.map +1 -0
  421. package/dist/projection/experimental/entries/projections/eck6.js +5 -0
  422. package/dist/projection/experimental/entries/projections/eck6.js.map +1 -0
  423. package/dist/projection/experimental/entries/projections/eqc.cjs +256 -0
  424. package/dist/projection/experimental/entries/projections/eqc.cjs.map +6 -0
  425. package/dist/projection/experimental/entries/projections/eqc.d.ts +2 -0
  426. package/dist/projection/experimental/entries/projections/eqc.d.ts.map +1 -0
  427. package/dist/projection/experimental/entries/projections/eqc.js +5 -0
  428. package/dist/projection/experimental/entries/projections/eqc.js.map +1 -0
  429. package/dist/projection/experimental/entries/projections/eqdc.cjs +650 -0
  430. package/dist/projection/experimental/entries/projections/eqdc.cjs.map +6 -0
  431. package/dist/projection/experimental/entries/projections/eqdc.d.ts +2 -0
  432. package/dist/projection/experimental/entries/projections/eqdc.d.ts.map +1 -0
  433. package/dist/projection/experimental/entries/projections/eqdc.js +5 -0
  434. package/dist/projection/experimental/entries/projections/eqdc.js.map +1 -0
  435. package/dist/projection/experimental/entries/projections/eqearth.cjs +451 -0
  436. package/dist/projection/experimental/entries/projections/eqearth.cjs.map +6 -0
  437. package/dist/projection/experimental/entries/projections/eqearth.d.ts +2 -0
  438. package/dist/projection/experimental/entries/projections/eqearth.d.ts.map +1 -0
  439. package/dist/projection/experimental/entries/projections/eqearth.js +5 -0
  440. package/dist/projection/experimental/entries/projections/eqearth.js.map +1 -0
  441. package/dist/projection/experimental/entries/projections/equi.cjs +475 -0
  442. package/dist/projection/experimental/entries/projections/equi.cjs.map +6 -0
  443. package/dist/projection/experimental/entries/projections/equi.d.ts +2 -0
  444. package/dist/projection/experimental/entries/projections/equi.d.ts.map +1 -0
  445. package/dist/projection/experimental/entries/projections/equi.js +5 -0
  446. package/dist/projection/experimental/entries/projections/equi.js.map +1 -0
  447. package/dist/projection/experimental/entries/projections/etmerc.cjs +887 -0
  448. package/dist/projection/experimental/entries/projections/etmerc.cjs.map +6 -0
  449. package/dist/projection/experimental/entries/projections/etmerc.d.ts +2 -0
  450. package/dist/projection/experimental/entries/projections/etmerc.d.ts.map +1 -0
  451. package/dist/projection/experimental/entries/projections/etmerc.js +5 -0
  452. package/dist/projection/experimental/entries/projections/etmerc.js.map +1 -0
  453. package/dist/projection/experimental/entries/projections/geocent.cjs +215 -0
  454. package/dist/projection/experimental/entries/projections/geocent.cjs.map +6 -0
  455. package/dist/projection/experimental/entries/projections/geocent.d.ts +2 -0
  456. package/dist/projection/experimental/entries/projections/geocent.d.ts.map +1 -0
  457. package/dist/projection/experimental/entries/projections/geocent.js +5 -0
  458. package/dist/projection/experimental/entries/projections/geocent.js.map +1 -0
  459. package/dist/projection/experimental/entries/projections/geos.cjs +703 -0
  460. package/dist/projection/experimental/entries/projections/geos.cjs.map +6 -0
  461. package/dist/projection/experimental/entries/projections/geos.d.ts +2 -0
  462. package/dist/projection/experimental/entries/projections/geos.d.ts.map +1 -0
  463. package/dist/projection/experimental/entries/projections/geos.js +5 -0
  464. package/dist/projection/experimental/entries/projections/geos.js.map +1 -0
  465. package/dist/projection/experimental/entries/projections/gnom.cjs +571 -0
  466. package/dist/projection/experimental/entries/projections/gnom.cjs.map +6 -0
  467. package/dist/projection/experimental/entries/projections/gnom.d.ts +2 -0
  468. package/dist/projection/experimental/entries/projections/gnom.d.ts.map +1 -0
  469. package/dist/projection/experimental/entries/projections/gnom.js +5 -0
  470. package/dist/projection/experimental/entries/projections/gnom.js.map +1 -0
  471. package/dist/projection/experimental/entries/projections/gstmerc.cjs +526 -0
  472. package/dist/projection/experimental/entries/projections/gstmerc.cjs.map +6 -0
  473. package/dist/projection/experimental/entries/projections/gstmerc.d.ts +2 -0
  474. package/dist/projection/experimental/entries/projections/gstmerc.d.ts.map +1 -0
  475. package/dist/projection/experimental/entries/projections/gstmerc.js +5 -0
  476. package/dist/projection/experimental/entries/projections/gstmerc.js.map +1 -0
  477. package/dist/projection/experimental/entries/projections/krovak.cjs +683 -0
  478. package/dist/projection/experimental/entries/projections/krovak.cjs.map +6 -0
  479. package/dist/projection/experimental/entries/projections/krovak.d.ts +2 -0
  480. package/dist/projection/experimental/entries/projections/krovak.d.ts.map +1 -0
  481. package/dist/projection/experimental/entries/projections/krovak.js +5 -0
  482. package/dist/projection/experimental/entries/projections/krovak.js.map +1 -0
  483. package/dist/projection/experimental/entries/projections/laea.cjs +761 -0
  484. package/dist/projection/experimental/entries/projections/laea.cjs.map +6 -0
  485. package/dist/projection/experimental/entries/projections/laea.d.ts +2 -0
  486. package/dist/projection/experimental/entries/projections/laea.d.ts.map +1 -0
  487. package/dist/projection/experimental/entries/projections/laea.js +5 -0
  488. package/dist/projection/experimental/entries/projections/laea.js.map +1 -0
  489. package/dist/projection/experimental/entries/projections/lcc.cjs +642 -0
  490. package/dist/projection/experimental/entries/projections/lcc.cjs.map +6 -0
  491. package/dist/projection/experimental/entries/projections/lcc.d.ts +2 -0
  492. package/dist/projection/experimental/entries/projections/lcc.d.ts.map +1 -0
  493. package/dist/projection/experimental/entries/projections/lcc.js +5 -0
  494. package/dist/projection/experimental/entries/projections/lcc.js.map +1 -0
  495. package/dist/projection/experimental/entries/projections/merc.cjs +354 -0
  496. package/dist/projection/experimental/entries/projections/merc.cjs.map +6 -0
  497. package/dist/projection/experimental/entries/projections/merc.d.ts +2 -0
  498. package/dist/projection/experimental/entries/projections/merc.d.ts.map +1 -0
  499. package/dist/projection/experimental/entries/projections/merc.js +5 -0
  500. package/dist/projection/experimental/entries/projections/merc.js.map +1 -0
  501. package/dist/projection/experimental/entries/projections/mill.cjs +470 -0
  502. package/dist/projection/experimental/entries/projections/mill.cjs.map +6 -0
  503. package/dist/projection/experimental/entries/projections/mill.d.ts +2 -0
  504. package/dist/projection/experimental/entries/projections/mill.d.ts.map +1 -0
  505. package/dist/projection/experimental/entries/projections/mill.js +5 -0
  506. package/dist/projection/experimental/entries/projections/mill.js.map +1 -0
  507. package/dist/projection/experimental/entries/projections/moll.cjs +510 -0
  508. package/dist/projection/experimental/entries/projections/moll.cjs.map +6 -0
  509. package/dist/projection/experimental/entries/projections/moll.d.ts +2 -0
  510. package/dist/projection/experimental/entries/projections/moll.d.ts.map +1 -0
  511. package/dist/projection/experimental/entries/projections/moll.js +5 -0
  512. package/dist/projection/experimental/entries/projections/moll.js.map +1 -0
  513. package/dist/projection/experimental/entries/projections/nzmg.cjs +623 -0
  514. package/dist/projection/experimental/entries/projections/nzmg.cjs.map +6 -0
  515. package/dist/projection/experimental/entries/projections/nzmg.d.ts +2 -0
  516. package/dist/projection/experimental/entries/projections/nzmg.d.ts.map +1 -0
  517. package/dist/projection/experimental/entries/projections/nzmg.js +5 -0
  518. package/dist/projection/experimental/entries/projections/nzmg.js.map +1 -0
  519. package/dist/projection/experimental/entries/projections/ob_tran.cjs +540 -0
  520. package/dist/projection/experimental/entries/projections/ob_tran.cjs.map +6 -0
  521. package/dist/projection/experimental/entries/projections/ob_tran.d.ts +2 -0
  522. package/dist/projection/experimental/entries/projections/ob_tran.d.ts.map +1 -0
  523. package/dist/projection/experimental/entries/projections/ob_tran.js +5 -0
  524. package/dist/projection/experimental/entries/projections/ob_tran.js.map +1 -0
  525. package/dist/projection/experimental/entries/projections/omerc.cjs +852 -0
  526. package/dist/projection/experimental/entries/projections/omerc.cjs.map +6 -0
  527. package/dist/projection/experimental/entries/projections/omerc.d.ts +2 -0
  528. package/dist/projection/experimental/entries/projections/omerc.d.ts.map +1 -0
  529. package/dist/projection/experimental/entries/projections/omerc.js +5 -0
  530. package/dist/projection/experimental/entries/projections/omerc.js.map +1 -0
  531. package/dist/projection/experimental/entries/projections/ortho.cjs +573 -0
  532. package/dist/projection/experimental/entries/projections/ortho.cjs.map +6 -0
  533. package/dist/projection/experimental/entries/projections/ortho.d.ts +2 -0
  534. package/dist/projection/experimental/entries/projections/ortho.d.ts.map +1 -0
  535. package/dist/projection/experimental/entries/projections/ortho.js +5 -0
  536. package/dist/projection/experimental/entries/projections/ortho.js.map +1 -0
  537. package/dist/projection/experimental/entries/projections/poly.cjs +588 -0
  538. package/dist/projection/experimental/entries/projections/poly.cjs.map +6 -0
  539. package/dist/projection/experimental/entries/projections/poly.d.ts +2 -0
  540. package/dist/projection/experimental/entries/projections/poly.d.ts.map +1 -0
  541. package/dist/projection/experimental/entries/projections/poly.js +5 -0
  542. package/dist/projection/experimental/entries/projections/poly.js.map +1 -0
  543. package/dist/projection/experimental/entries/projections/qsc.cjs +714 -0
  544. package/dist/projection/experimental/entries/projections/qsc.cjs.map +6 -0
  545. package/dist/projection/experimental/entries/projections/qsc.d.ts +2 -0
  546. package/dist/projection/experimental/entries/projections/qsc.d.ts.map +1 -0
  547. package/dist/projection/experimental/entries/projections/qsc.js +5 -0
  548. package/dist/projection/experimental/entries/projections/qsc.js.map +1 -0
  549. package/dist/projection/experimental/entries/projections/robin.cjs +584 -0
  550. package/dist/projection/experimental/entries/projections/robin.cjs.map +6 -0
  551. package/dist/projection/experimental/entries/projections/robin.d.ts +2 -0
  552. package/dist/projection/experimental/entries/projections/robin.d.ts.map +1 -0
  553. package/dist/projection/experimental/entries/projections/robin.js +5 -0
  554. package/dist/projection/experimental/entries/projections/robin.js.map +1 -0
  555. package/dist/projection/experimental/entries/projections/sinu.cjs +583 -0
  556. package/dist/projection/experimental/entries/projections/sinu.cjs.map +6 -0
  557. package/dist/projection/experimental/entries/projections/sinu.d.ts +2 -0
  558. package/dist/projection/experimental/entries/projections/sinu.d.ts.map +1 -0
  559. package/dist/projection/experimental/entries/projections/sinu.js +5 -0
  560. package/dist/projection/experimental/entries/projections/sinu.js.map +1 -0
  561. package/dist/projection/experimental/entries/projections/somerc.cjs +582 -0
  562. package/dist/projection/experimental/entries/projections/somerc.cjs.map +6 -0
  563. package/dist/projection/experimental/entries/projections/somerc.d.ts +2 -0
  564. package/dist/projection/experimental/entries/projections/somerc.d.ts.map +1 -0
  565. package/dist/projection/experimental/entries/projections/somerc.js +5 -0
  566. package/dist/projection/experimental/entries/projections/somerc.js.map +1 -0
  567. package/dist/projection/experimental/entries/projections/stere.cjs +684 -0
  568. package/dist/projection/experimental/entries/projections/stere.cjs.map +6 -0
  569. package/dist/projection/experimental/entries/projections/stere.d.ts +2 -0
  570. package/dist/projection/experimental/entries/projections/stere.d.ts.map +1 -0
  571. package/dist/projection/experimental/entries/projections/stere.js +5 -0
  572. package/dist/projection/experimental/entries/projections/stere.js.map +1 -0
  573. package/dist/projection/experimental/entries/projections/sterea.cjs +623 -0
  574. package/dist/projection/experimental/entries/projections/sterea.cjs.map +6 -0
  575. package/dist/projection/experimental/entries/projections/sterea.d.ts +2 -0
  576. package/dist/projection/experimental/entries/projections/sterea.d.ts.map +1 -0
  577. package/dist/projection/experimental/entries/projections/sterea.js +5 -0
  578. package/dist/projection/experimental/entries/projections/sterea.js.map +1 -0
  579. package/dist/projection/experimental/entries/projections/tmerc.cjs +887 -0
  580. package/dist/projection/experimental/entries/projections/tmerc.cjs.map +6 -0
  581. package/dist/projection/experimental/entries/projections/tmerc.d.ts +2 -0
  582. package/dist/projection/experimental/entries/projections/tmerc.d.ts.map +1 -0
  583. package/dist/projection/experimental/entries/projections/tmerc.js +5 -0
  584. package/dist/projection/experimental/entries/projections/tmerc.js.map +1 -0
  585. package/dist/projection/experimental/entries/projections/tpers.cjs +645 -0
  586. package/dist/projection/experimental/entries/projections/tpers.cjs.map +6 -0
  587. package/dist/projection/experimental/entries/projections/tpers.d.ts +2 -0
  588. package/dist/projection/experimental/entries/projections/tpers.d.ts.map +1 -0
  589. package/dist/projection/experimental/entries/projections/tpers.js +5 -0
  590. package/dist/projection/experimental/entries/projections/tpers.js.map +1 -0
  591. package/dist/projection/experimental/entries/projections/utm.cjs +915 -0
  592. package/dist/projection/experimental/entries/projections/utm.cjs.map +6 -0
  593. package/dist/projection/experimental/entries/projections/utm.d.ts +2 -0
  594. package/dist/projection/experimental/entries/projections/utm.d.ts.map +1 -0
  595. package/dist/projection/experimental/entries/projections/utm.js +5 -0
  596. package/dist/projection/experimental/entries/projections/utm.js.map +1 -0
  597. package/dist/projection/experimental/entries/projections/vandg.cjs +560 -0
  598. package/dist/projection/experimental/entries/projections/vandg.cjs.map +6 -0
  599. package/dist/projection/experimental/entries/projections/vandg.d.ts +2 -0
  600. package/dist/projection/experimental/entries/projections/vandg.d.ts.map +1 -0
  601. package/dist/projection/experimental/entries/projections/vandg.js +5 -0
  602. package/dist/projection/experimental/entries/projections/vandg.js.map +1 -0
  603. package/dist/projection/experimental/exact-helmert.d.ts +9 -0
  604. package/dist/projection/experimental/exact-helmert.d.ts.map +1 -0
  605. package/dist/projection/experimental/exact-helmert.js +32 -0
  606. package/dist/projection/experimental/exact-helmert.js.map +1 -0
  607. package/dist/projection/experimental/flat-projection.d.ts +15 -0
  608. package/dist/projection/experimental/flat-projection.d.ts.map +1 -0
  609. package/dist/projection/experimental/flat-projection.js +70 -0
  610. package/dist/projection/experimental/flat-projection.js.map +1 -0
  611. package/dist/projection/experimental/grids/geotiff.cjs +180 -0
  612. package/dist/projection/experimental/grids/geotiff.cjs.map +6 -0
  613. package/dist/projection/experimental/grids/geotiff.d.ts +23 -0
  614. package/dist/projection/experimental/grids/geotiff.d.ts.map +1 -0
  615. package/dist/projection/experimental/grids/geotiff.js +59 -0
  616. package/dist/projection/experimental/grids/geotiff.js.map +1 -0
  617. package/dist/projection/experimental/grids/grid.d.ts +4 -0
  618. package/dist/projection/experimental/grids/grid.d.ts.map +1 -0
  619. package/dist/projection/experimental/grids/grid.js +111 -0
  620. package/dist/projection/experimental/grids/grid.js.map +1 -0
  621. package/dist/projection/experimental/grids/gtx.cjs +91 -0
  622. package/dist/projection/experimental/grids/gtx.cjs.map +6 -0
  623. package/dist/projection/experimental/grids/gtx.d.ts +7 -0
  624. package/dist/projection/experimental/grids/gtx.d.ts.map +1 -0
  625. package/dist/projection/experimental/grids/gtx.js +30 -0
  626. package/dist/projection/experimental/grids/gtx.js.map +1 -0
  627. package/dist/projection/experimental/grids/ntv2.cjs +181 -0
  628. package/dist/projection/experimental/grids/ntv2.cjs.map +6 -0
  629. package/dist/projection/experimental/grids/ntv2.d.ts +8 -0
  630. package/dist/projection/experimental/grids/ntv2.d.ts.map +1 -0
  631. package/dist/projection/experimental/grids/ntv2.js +56 -0
  632. package/dist/projection/experimental/grids/ntv2.js.map +1 -0
  633. package/dist/projection/experimental/grids/scalar-geotiff.d.ts +58 -0
  634. package/dist/projection/experimental/grids/scalar-geotiff.d.ts.map +1 -0
  635. package/dist/projection/experimental/grids/scalar-geotiff.js +147 -0
  636. package/dist/projection/experimental/grids/scalar-geotiff.js.map +1 -0
  637. package/dist/projection/experimental/grids/types.d.ts +35 -0
  638. package/dist/projection/experimental/grids/types.d.ts.map +1 -0
  639. package/dist/projection/experimental/grids/types.js +2 -0
  640. package/dist/projection/experimental/grids/types.js.map +1 -0
  641. package/dist/projection/experimental/grids/velocity-geotiff.cjs +247 -0
  642. package/dist/projection/experimental/grids/velocity-geotiff.cjs.map +6 -0
  643. package/dist/projection/experimental/grids/velocity-geotiff.d.ts +11 -0
  644. package/dist/projection/experimental/grids/velocity-geotiff.d.ts.map +1 -0
  645. package/dist/projection/experimental/grids/velocity-geotiff.js +61 -0
  646. package/dist/projection/experimental/grids/velocity-geotiff.js.map +1 -0
  647. package/dist/projection/experimental/grids/velocity.d.ts +21 -0
  648. package/dist/projection/experimental/grids/velocity.d.ts.map +1 -0
  649. package/dist/projection/experimental/grids/velocity.js +29 -0
  650. package/dist/projection/experimental/grids/velocity.js.map +1 -0
  651. package/dist/projection/experimental/grids/vertical-geotiff.cjs +195 -0
  652. package/dist/projection/experimental/grids/vertical-geotiff.cjs.map +6 -0
  653. package/dist/projection/experimental/grids/vertical-geotiff.d.ts +6 -0
  654. package/dist/projection/experimental/grids/vertical-geotiff.d.ts.map +1 -0
  655. package/dist/projection/experimental/grids/vertical-geotiff.js +20 -0
  656. package/dist/projection/experimental/grids/vertical-geotiff.js.map +1 -0
  657. package/dist/projection/experimental/grids/vertical.cjs +80 -0
  658. package/dist/projection/experimental/grids/vertical.cjs.map +6 -0
  659. package/dist/projection/experimental/grids/vertical.d.ts +22 -0
  660. package/dist/projection/experimental/grids/vertical.d.ts.map +1 -0
  661. package/dist/projection/experimental/grids/vertical.js +73 -0
  662. package/dist/projection/experimental/grids/vertical.js.map +1 -0
  663. package/dist/projection/experimental/helmert-flat.d.ts +4 -0
  664. package/dist/projection/experimental/helmert-flat.d.ts.map +1 -0
  665. package/dist/projection/experimental/helmert-flat.js +53 -0
  666. package/dist/projection/experimental/helmert-flat.js.map +1 -0
  667. package/dist/projection/experimental/index.cjs +10047 -0
  668. package/dist/projection/experimental/index.cjs.map +6 -0
  669. package/dist/projection/experimental/index.d.ts +49 -0
  670. package/dist/projection/experimental/index.d.ts.map +1 -0
  671. package/dist/projection/experimental/index.js +48 -0
  672. package/dist/projection/experimental/index.js.map +1 -0
  673. package/dist/projection/experimental/kernel.d.ts +37 -0
  674. package/dist/projection/experimental/kernel.d.ts.map +1 -0
  675. package/dist/projection/experimental/kernel.js +81 -0
  676. package/dist/projection/experimental/kernel.js.map +1 -0
  677. package/dist/projection/experimental/kernels/aea.d.ts +25 -0
  678. package/dist/projection/experimental/kernels/aea.d.ts.map +1 -0
  679. package/dist/projection/experimental/kernels/aea.js +136 -0
  680. package/dist/projection/experimental/kernels/aea.js.map +1 -0
  681. package/dist/projection/experimental/kernels/aeqd.d.ts +10 -0
  682. package/dist/projection/experimental/kernels/aeqd.d.ts.map +1 -0
  683. package/dist/projection/experimental/kernels/aeqd.js +168 -0
  684. package/dist/projection/experimental/kernels/aeqd.js.map +1 -0
  685. package/dist/projection/experimental/kernels/bonne.d.ts +12 -0
  686. package/dist/projection/experimental/kernels/bonne.d.ts.map +1 -0
  687. package/dist/projection/experimental/kernels/bonne.js +128 -0
  688. package/dist/projection/experimental/kernels/bonne.js.map +1 -0
  689. package/dist/projection/experimental/kernels/cass.d.ts +10 -0
  690. package/dist/projection/experimental/kernels/cass.d.ts.map +1 -0
  691. package/dist/projection/experimental/kernels/cass.js +122 -0
  692. package/dist/projection/experimental/kernels/cass.js.map +1 -0
  693. package/dist/projection/experimental/kernels/cea.d.ts +6 -0
  694. package/dist/projection/experimental/kernels/cea.d.ts.map +1 -0
  695. package/dist/projection/experimental/kernels/cea.js +63 -0
  696. package/dist/projection/experimental/kernels/cea.js.map +1 -0
  697. package/dist/projection/experimental/kernels/eck6.d.ts +13 -0
  698. package/dist/projection/experimental/kernels/eck6.d.ts.map +1 -0
  699. package/dist/projection/experimental/kernels/eck6.js +23 -0
  700. package/dist/projection/experimental/kernels/eck6.js.map +1 -0
  701. package/dist/projection/experimental/kernels/eqdc.d.ts +19 -0
  702. package/dist/projection/experimental/kernels/eqdc.d.ts.map +1 -0
  703. package/dist/projection/experimental/kernels/eqdc.js +117 -0
  704. package/dist/projection/experimental/kernels/eqdc.js.map +1 -0
  705. package/dist/projection/experimental/kernels/eqearth.d.ts +10 -0
  706. package/dist/projection/experimental/kernels/eqearth.d.ts.map +1 -0
  707. package/dist/projection/experimental/kernels/eqearth.js +103 -0
  708. package/dist/projection/experimental/kernels/eqearth.js.map +1 -0
  709. package/dist/projection/experimental/kernels/equi.d.ts +9 -0
  710. package/dist/projection/experimental/kernels/equi.d.ts.map +1 -0
  711. package/dist/projection/experimental/kernels/equi.js +41 -0
  712. package/dist/projection/experimental/kernels/equi.js.map +1 -0
  713. package/dist/projection/experimental/kernels/etmerc.d.ts +13 -0
  714. package/dist/projection/experimental/kernels/etmerc.d.ts.map +1 -0
  715. package/dist/projection/experimental/kernels/etmerc.js +145 -0
  716. package/dist/projection/experimental/kernels/etmerc.js.map +1 -0
  717. package/dist/projection/experimental/kernels/gauss.d.ts +12 -0
  718. package/dist/projection/experimental/kernels/gauss.d.ts.map +1 -0
  719. package/dist/projection/experimental/kernels/gauss.js +64 -0
  720. package/dist/projection/experimental/kernels/gauss.js.map +1 -0
  721. package/dist/projection/experimental/kernels/geos.d.ts +17 -0
  722. package/dist/projection/experimental/kernels/geos.d.ts.map +1 -0
  723. package/dist/projection/experimental/kernels/geos.js +153 -0
  724. package/dist/projection/experimental/kernels/geos.js.map +1 -0
  725. package/dist/projection/experimental/kernels/gnom.d.ts +12 -0
  726. package/dist/projection/experimental/kernels/gnom.d.ts.map +1 -0
  727. package/dist/projection/experimental/kernels/gnom.js +95 -0
  728. package/dist/projection/experimental/kernels/gnom.js.map +1 -0
  729. package/dist/projection/experimental/kernels/gstmerc.d.ts +13 -0
  730. package/dist/projection/experimental/kernels/gstmerc.d.ts.map +1 -0
  731. package/dist/projection/experimental/kernels/gstmerc.js +57 -0
  732. package/dist/projection/experimental/kernels/gstmerc.js.map +1 -0
  733. package/dist/projection/experimental/kernels/krovak.d.ts +23 -0
  734. package/dist/projection/experimental/kernels/krovak.d.ts.map +1 -0
  735. package/dist/projection/experimental/kernels/krovak.js +128 -0
  736. package/dist/projection/experimental/kernels/krovak.js.map +1 -0
  737. package/dist/projection/experimental/kernels/laea.d.ts +23 -0
  738. package/dist/projection/experimental/kernels/laea.d.ts.map +1 -0
  739. package/dist/projection/experimental/kernels/laea.js +278 -0
  740. package/dist/projection/experimental/kernels/laea.js.map +1 -0
  741. package/dist/projection/experimental/kernels/lcc.d.ts +10 -0
  742. package/dist/projection/experimental/kernels/lcc.d.ts.map +1 -0
  743. package/dist/projection/experimental/kernels/lcc.js +131 -0
  744. package/dist/projection/experimental/kernels/lcc.js.map +1 -0
  745. package/dist/projection/experimental/kernels/mill.d.ts +6 -0
  746. package/dist/projection/experimental/kernels/mill.d.ts.map +1 -0
  747. package/dist/projection/experimental/kernels/mill.js +49 -0
  748. package/dist/projection/experimental/kernels/mill.js.map +1 -0
  749. package/dist/projection/experimental/kernels/moll.d.ts +6 -0
  750. package/dist/projection/experimental/kernels/moll.d.ts.map +1 -0
  751. package/dist/projection/experimental/kernels/moll.js +89 -0
  752. package/dist/projection/experimental/kernels/moll.js.map +1 -0
  753. package/dist/projection/experimental/kernels/nzmg.d.ts +28 -0
  754. package/dist/projection/experimental/kernels/nzmg.d.ts.map +1 -0
  755. package/dist/projection/experimental/kernels/nzmg.js +209 -0
  756. package/dist/projection/experimental/kernels/nzmg.js.map +1 -0
  757. package/dist/projection/experimental/kernels/omerc.d.ts +30 -0
  758. package/dist/projection/experimental/kernels/omerc.d.ts.map +1 -0
  759. package/dist/projection/experimental/kernels/omerc.js +260 -0
  760. package/dist/projection/experimental/kernels/omerc.js.map +1 -0
  761. package/dist/projection/experimental/kernels/ortho.d.ts +9 -0
  762. package/dist/projection/experimental/kernels/ortho.d.ts.map +1 -0
  763. package/dist/projection/experimental/kernels/ortho.js +91 -0
  764. package/dist/projection/experimental/kernels/ortho.js.map +1 -0
  765. package/dist/projection/experimental/kernels/poly.d.ts +13 -0
  766. package/dist/projection/experimental/kernels/poly.d.ts.map +1 -0
  767. package/dist/projection/experimental/kernels/poly.js +141 -0
  768. package/dist/projection/experimental/kernels/poly.js.map +1 -0
  769. package/dist/projection/experimental/kernels/qsc.d.ts +10 -0
  770. package/dist/projection/experimental/kernels/qsc.d.ts.map +1 -0
  771. package/dist/projection/experimental/kernels/qsc.js +379 -0
  772. package/dist/projection/experimental/kernels/qsc.js.map +1 -0
  773. package/dist/projection/experimental/kernels/robin.d.ts +6 -0
  774. package/dist/projection/experimental/kernels/robin.d.ts.map +1 -0
  775. package/dist/projection/experimental/kernels/robin.js +166 -0
  776. package/dist/projection/experimental/kernels/robin.js.map +1 -0
  777. package/dist/projection/experimental/kernels/sinu.d.ts +12 -0
  778. package/dist/projection/experimental/kernels/sinu.d.ts.map +1 -0
  779. package/dist/projection/experimental/kernels/sinu.js +104 -0
  780. package/dist/projection/experimental/kernels/sinu.js.map +1 -0
  781. package/dist/projection/experimental/kernels/somerc.d.ts +13 -0
  782. package/dist/projection/experimental/kernels/somerc.d.ts.map +1 -0
  783. package/dist/projection/experimental/kernels/somerc.js +81 -0
  784. package/dist/projection/experimental/kernels/somerc.js.map +1 -0
  785. package/dist/projection/experimental/kernels/stere.d.ts +15 -0
  786. package/dist/projection/experimental/kernels/stere.d.ts.map +1 -0
  787. package/dist/projection/experimental/kernels/stere.js +195 -0
  788. package/dist/projection/experimental/kernels/stere.js.map +1 -0
  789. package/dist/projection/experimental/kernels/sterea.d.ts +11 -0
  790. package/dist/projection/experimental/kernels/sterea.d.ts.map +1 -0
  791. package/dist/projection/experimental/kernels/sterea.js +65 -0
  792. package/dist/projection/experimental/kernels/sterea.js.map +1 -0
  793. package/dist/projection/experimental/kernels/tmerc.d.ts +9 -0
  794. package/dist/projection/experimental/kernels/tmerc.d.ts.map +1 -0
  795. package/dist/projection/experimental/kernels/tmerc.js +201 -0
  796. package/dist/projection/experimental/kernels/tmerc.js.map +1 -0
  797. package/dist/projection/experimental/kernels/tpers.d.ts +22 -0
  798. package/dist/projection/experimental/kernels/tpers.d.ts.map +1 -0
  799. package/dist/projection/experimental/kernels/tpers.js +156 -0
  800. package/dist/projection/experimental/kernels/tpers.js.map +1 -0
  801. package/dist/projection/experimental/kernels/vandg.d.ts +8 -0
  802. package/dist/projection/experimental/kernels/vandg.d.ts.map +1 -0
  803. package/dist/projection/experimental/kernels/vandg.js +133 -0
  804. package/dist/projection/experimental/kernels/vandg.js.map +1 -0
  805. package/dist/projection/experimental/kinematic-helmert-flat.d.ts +4 -0
  806. package/dist/projection/experimental/kinematic-helmert-flat.d.ts.map +1 -0
  807. package/dist/projection/experimental/kinematic-helmert-flat.js +60 -0
  808. package/dist/projection/experimental/kinematic-helmert-flat.js.map +1 -0
  809. package/dist/projection/experimental/kinematic-helmert.d.ts +11 -0
  810. package/dist/projection/experimental/kinematic-helmert.d.ts.map +1 -0
  811. package/dist/projection/experimental/kinematic-helmert.js +103 -0
  812. package/dist/projection/experimental/kinematic-helmert.js.map +1 -0
  813. package/dist/projection/experimental/lazy-projection.d.ts +17 -0
  814. package/dist/projection/experimental/lazy-projection.d.ts.map +1 -0
  815. package/dist/projection/experimental/lazy-projection.js +156 -0
  816. package/dist/projection/experimental/lazy-projection.js.map +1 -0
  817. package/dist/projection/experimental/lazy-projections/aea.cjs +79 -0
  818. package/dist/projection/experimental/lazy-projections/aea.cjs.map +6 -0
  819. package/dist/projection/experimental/lazy-projections/aea.d.ts +3 -0
  820. package/dist/projection/experimental/lazy-projections/aea.d.ts.map +1 -0
  821. package/dist/projection/experimental/lazy-projections/aea.js +7 -0
  822. package/dist/projection/experimental/lazy-projections/aea.js.map +1 -0
  823. package/dist/projection/experimental/lazy-projections/aeqd.cjs +79 -0
  824. package/dist/projection/experimental/lazy-projections/aeqd.cjs.map +6 -0
  825. package/dist/projection/experimental/lazy-projections/aeqd.d.ts +3 -0
  826. package/dist/projection/experimental/lazy-projections/aeqd.d.ts.map +1 -0
  827. package/dist/projection/experimental/lazy-projections/aeqd.js +8 -0
  828. package/dist/projection/experimental/lazy-projections/aeqd.js.map +1 -0
  829. package/dist/projection/experimental/lazy-projections/bonne.cjs +79 -0
  830. package/dist/projection/experimental/lazy-projections/bonne.cjs.map +6 -0
  831. package/dist/projection/experimental/lazy-projections/bonne.d.ts +3 -0
  832. package/dist/projection/experimental/lazy-projections/bonne.d.ts.map +1 -0
  833. package/dist/projection/experimental/lazy-projections/bonne.js +7 -0
  834. package/dist/projection/experimental/lazy-projections/bonne.js.map +1 -0
  835. package/dist/projection/experimental/lazy-projections/cass.cjs +79 -0
  836. package/dist/projection/experimental/lazy-projections/cass.cjs.map +6 -0
  837. package/dist/projection/experimental/lazy-projections/cass.d.ts +3 -0
  838. package/dist/projection/experimental/lazy-projections/cass.d.ts.map +1 -0
  839. package/dist/projection/experimental/lazy-projections/cass.js +7 -0
  840. package/dist/projection/experimental/lazy-projections/cass.js.map +1 -0
  841. package/dist/projection/experimental/lazy-projections/cea.cjs +79 -0
  842. package/dist/projection/experimental/lazy-projections/cea.cjs.map +6 -0
  843. package/dist/projection/experimental/lazy-projections/cea.d.ts +3 -0
  844. package/dist/projection/experimental/lazy-projections/cea.d.ts.map +1 -0
  845. package/dist/projection/experimental/lazy-projections/cea.js +8 -0
  846. package/dist/projection/experimental/lazy-projections/cea.js.map +1 -0
  847. package/dist/projection/experimental/lazy-projections/eck6.cjs +79 -0
  848. package/dist/projection/experimental/lazy-projections/eck6.cjs.map +6 -0
  849. package/dist/projection/experimental/lazy-projections/eck6.d.ts +3 -0
  850. package/dist/projection/experimental/lazy-projections/eck6.d.ts.map +1 -0
  851. package/dist/projection/experimental/lazy-projections/eck6.js +7 -0
  852. package/dist/projection/experimental/lazy-projections/eck6.js.map +1 -0
  853. package/dist/projection/experimental/lazy-projections/eqc.cjs +82 -0
  854. package/dist/projection/experimental/lazy-projections/eqc.cjs.map +6 -0
  855. package/dist/projection/experimental/lazy-projections/eqc.d.ts +3 -0
  856. package/dist/projection/experimental/lazy-projections/eqc.d.ts.map +1 -0
  857. package/dist/projection/experimental/lazy-projections/eqc.js +11 -0
  858. package/dist/projection/experimental/lazy-projections/eqc.js.map +1 -0
  859. package/dist/projection/experimental/lazy-projections/eqdc.cjs +79 -0
  860. package/dist/projection/experimental/lazy-projections/eqdc.cjs.map +6 -0
  861. package/dist/projection/experimental/lazy-projections/eqdc.d.ts +3 -0
  862. package/dist/projection/experimental/lazy-projections/eqdc.d.ts.map +1 -0
  863. package/dist/projection/experimental/lazy-projections/eqdc.js +8 -0
  864. package/dist/projection/experimental/lazy-projections/eqdc.js.map +1 -0
  865. package/dist/projection/experimental/lazy-projections/eqearth.cjs +79 -0
  866. package/dist/projection/experimental/lazy-projections/eqearth.cjs.map +6 -0
  867. package/dist/projection/experimental/lazy-projections/eqearth.d.ts +3 -0
  868. package/dist/projection/experimental/lazy-projections/eqearth.d.ts.map +1 -0
  869. package/dist/projection/experimental/lazy-projections/eqearth.js +7 -0
  870. package/dist/projection/experimental/lazy-projections/eqearth.js.map +1 -0
  871. package/dist/projection/experimental/lazy-projections/equi.cjs +79 -0
  872. package/dist/projection/experimental/lazy-projections/equi.cjs.map +6 -0
  873. package/dist/projection/experimental/lazy-projections/equi.d.ts +3 -0
  874. package/dist/projection/experimental/lazy-projections/equi.d.ts.map +1 -0
  875. package/dist/projection/experimental/lazy-projections/equi.js +7 -0
  876. package/dist/projection/experimental/lazy-projections/equi.js.map +1 -0
  877. package/dist/projection/experimental/lazy-projections/etmerc.cjs +79 -0
  878. package/dist/projection/experimental/lazy-projections/etmerc.cjs.map +6 -0
  879. package/dist/projection/experimental/lazy-projections/etmerc.d.ts +3 -0
  880. package/dist/projection/experimental/lazy-projections/etmerc.d.ts.map +1 -0
  881. package/dist/projection/experimental/lazy-projections/etmerc.js +8 -0
  882. package/dist/projection/experimental/lazy-projections/etmerc.js.map +1 -0
  883. package/dist/projection/experimental/lazy-projections/geocent.cjs +79 -0
  884. package/dist/projection/experimental/lazy-projections/geocent.cjs.map +6 -0
  885. package/dist/projection/experimental/lazy-projections/geocent.d.ts +3 -0
  886. package/dist/projection/experimental/lazy-projections/geocent.d.ts.map +1 -0
  887. package/dist/projection/experimental/lazy-projections/geocent.js +7 -0
  888. package/dist/projection/experimental/lazy-projections/geocent.js.map +1 -0
  889. package/dist/projection/experimental/lazy-projections/geos.cjs +79 -0
  890. package/dist/projection/experimental/lazy-projections/geos.cjs.map +6 -0
  891. package/dist/projection/experimental/lazy-projections/geos.d.ts +3 -0
  892. package/dist/projection/experimental/lazy-projections/geos.d.ts.map +1 -0
  893. package/dist/projection/experimental/lazy-projections/geos.js +7 -0
  894. package/dist/projection/experimental/lazy-projections/geos.js.map +1 -0
  895. package/dist/projection/experimental/lazy-projections/gnom.cjs +79 -0
  896. package/dist/projection/experimental/lazy-projections/gnom.cjs.map +6 -0
  897. package/dist/projection/experimental/lazy-projections/gnom.d.ts +3 -0
  898. package/dist/projection/experimental/lazy-projections/gnom.d.ts.map +1 -0
  899. package/dist/projection/experimental/lazy-projections/gnom.js +7 -0
  900. package/dist/projection/experimental/lazy-projections/gnom.js.map +1 -0
  901. package/dist/projection/experimental/lazy-projections/gstmerc.cjs +79 -0
  902. package/dist/projection/experimental/lazy-projections/gstmerc.cjs.map +6 -0
  903. package/dist/projection/experimental/lazy-projections/gstmerc.d.ts +3 -0
  904. package/dist/projection/experimental/lazy-projections/gstmerc.d.ts.map +1 -0
  905. package/dist/projection/experimental/lazy-projections/gstmerc.js +9 -0
  906. package/dist/projection/experimental/lazy-projections/gstmerc.js.map +1 -0
  907. package/dist/projection/experimental/lazy-projections/index.cjs +2243 -0
  908. package/dist/projection/experimental/lazy-projections/index.cjs.map +6 -0
  909. package/dist/projection/experimental/lazy-projections/index.d.ts +38 -0
  910. package/dist/projection/experimental/lazy-projections/index.d.ts.map +1 -0
  911. package/dist/projection/experimental/lazy-projections/index.js +41 -0
  912. package/dist/projection/experimental/lazy-projections/index.js.map +1 -0
  913. package/dist/projection/experimental/lazy-projections/krovak.cjs +87 -0
  914. package/dist/projection/experimental/lazy-projections/krovak.cjs.map +6 -0
  915. package/dist/projection/experimental/lazy-projections/krovak.d.ts +3 -0
  916. package/dist/projection/experimental/lazy-projections/krovak.d.ts.map +1 -0
  917. package/dist/projection/experimental/lazy-projections/krovak.js +15 -0
  918. package/dist/projection/experimental/lazy-projections/krovak.js.map +1 -0
  919. package/dist/projection/experimental/lazy-projections/laea.cjs +79 -0
  920. package/dist/projection/experimental/lazy-projections/laea.cjs.map +6 -0
  921. package/dist/projection/experimental/lazy-projections/laea.d.ts +3 -0
  922. package/dist/projection/experimental/lazy-projections/laea.d.ts.map +1 -0
  923. package/dist/projection/experimental/lazy-projections/laea.js +8 -0
  924. package/dist/projection/experimental/lazy-projections/laea.js.map +1 -0
  925. package/dist/projection/experimental/lazy-projections/lcc.cjs +89 -0
  926. package/dist/projection/experimental/lazy-projections/lcc.cjs.map +6 -0
  927. package/dist/projection/experimental/lazy-projections/lcc.d.ts +3 -0
  928. package/dist/projection/experimental/lazy-projections/lcc.d.ts.map +1 -0
  929. package/dist/projection/experimental/lazy-projections/lcc.js +18 -0
  930. package/dist/projection/experimental/lazy-projections/lcc.js.map +1 -0
  931. package/dist/projection/experimental/lazy-projections/merc.cjs +88 -0
  932. package/dist/projection/experimental/lazy-projections/merc.cjs.map +6 -0
  933. package/dist/projection/experimental/lazy-projections/merc.d.ts +3 -0
  934. package/dist/projection/experimental/lazy-projections/merc.d.ts.map +1 -0
  935. package/dist/projection/experimental/lazy-projections/merc.js +16 -0
  936. package/dist/projection/experimental/lazy-projections/merc.js.map +1 -0
  937. package/dist/projection/experimental/lazy-projections/mill.cjs +79 -0
  938. package/dist/projection/experimental/lazy-projections/mill.cjs.map +6 -0
  939. package/dist/projection/experimental/lazy-projections/mill.d.ts +3 -0
  940. package/dist/projection/experimental/lazy-projections/mill.d.ts.map +1 -0
  941. package/dist/projection/experimental/lazy-projections/mill.js +8 -0
  942. package/dist/projection/experimental/lazy-projections/mill.js.map +1 -0
  943. package/dist/projection/experimental/lazy-projections/moll.cjs +79 -0
  944. package/dist/projection/experimental/lazy-projections/moll.cjs.map +6 -0
  945. package/dist/projection/experimental/lazy-projections/moll.d.ts +3 -0
  946. package/dist/projection/experimental/lazy-projections/moll.d.ts.map +1 -0
  947. package/dist/projection/experimental/lazy-projections/moll.js +7 -0
  948. package/dist/projection/experimental/lazy-projections/moll.js.map +1 -0
  949. package/dist/projection/experimental/lazy-projections/nzmg.cjs +79 -0
  950. package/dist/projection/experimental/lazy-projections/nzmg.cjs.map +6 -0
  951. package/dist/projection/experimental/lazy-projections/nzmg.d.ts +3 -0
  952. package/dist/projection/experimental/lazy-projections/nzmg.d.ts.map +1 -0
  953. package/dist/projection/experimental/lazy-projections/nzmg.js +8 -0
  954. package/dist/projection/experimental/lazy-projections/nzmg.js.map +1 -0
  955. package/dist/projection/experimental/lazy-projections/ob_tran.cjs +90 -0
  956. package/dist/projection/experimental/lazy-projections/ob_tran.cjs.map +6 -0
  957. package/dist/projection/experimental/lazy-projections/ob_tran.d.ts +5 -0
  958. package/dist/projection/experimental/lazy-projections/ob_tran.d.ts.map +1 -0
  959. package/dist/projection/experimental/lazy-projections/ob_tran.js +18 -0
  960. package/dist/projection/experimental/lazy-projections/ob_tran.js.map +1 -0
  961. package/dist/projection/experimental/lazy-projections/omerc.cjs +91 -0
  962. package/dist/projection/experimental/lazy-projections/omerc.cjs.map +6 -0
  963. package/dist/projection/experimental/lazy-projections/omerc.d.ts +3 -0
  964. package/dist/projection/experimental/lazy-projections/omerc.d.ts.map +1 -0
  965. package/dist/projection/experimental/lazy-projections/omerc.js +19 -0
  966. package/dist/projection/experimental/lazy-projections/omerc.js.map +1 -0
  967. package/dist/projection/experimental/lazy-projections/ortho.cjs +79 -0
  968. package/dist/projection/experimental/lazy-projections/ortho.cjs.map +6 -0
  969. package/dist/projection/experimental/lazy-projections/ortho.d.ts +3 -0
  970. package/dist/projection/experimental/lazy-projections/ortho.d.ts.map +1 -0
  971. package/dist/projection/experimental/lazy-projections/ortho.js +7 -0
  972. package/dist/projection/experimental/lazy-projections/ortho.js.map +1 -0
  973. package/dist/projection/experimental/lazy-projections/poly.cjs +79 -0
  974. package/dist/projection/experimental/lazy-projections/poly.cjs.map +6 -0
  975. package/dist/projection/experimental/lazy-projections/poly.d.ts +3 -0
  976. package/dist/projection/experimental/lazy-projections/poly.d.ts.map +1 -0
  977. package/dist/projection/experimental/lazy-projections/poly.js +7 -0
  978. package/dist/projection/experimental/lazy-projections/poly.js.map +1 -0
  979. package/dist/projection/experimental/lazy-projections/qsc.cjs +82 -0
  980. package/dist/projection/experimental/lazy-projections/qsc.cjs.map +6 -0
  981. package/dist/projection/experimental/lazy-projections/qsc.d.ts +3 -0
  982. package/dist/projection/experimental/lazy-projections/qsc.d.ts.map +1 -0
  983. package/dist/projection/experimental/lazy-projections/qsc.js +12 -0
  984. package/dist/projection/experimental/lazy-projections/qsc.js.map +1 -0
  985. package/dist/projection/experimental/lazy-projections/robin.cjs +79 -0
  986. package/dist/projection/experimental/lazy-projections/robin.cjs.map +6 -0
  987. package/dist/projection/experimental/lazy-projections/robin.d.ts +3 -0
  988. package/dist/projection/experimental/lazy-projections/robin.d.ts.map +1 -0
  989. package/dist/projection/experimental/lazy-projections/robin.js +7 -0
  990. package/dist/projection/experimental/lazy-projections/robin.js.map +1 -0
  991. package/dist/projection/experimental/lazy-projections/sinu.cjs +79 -0
  992. package/dist/projection/experimental/lazy-projections/sinu.cjs.map +6 -0
  993. package/dist/projection/experimental/lazy-projections/sinu.d.ts +3 -0
  994. package/dist/projection/experimental/lazy-projections/sinu.d.ts.map +1 -0
  995. package/dist/projection/experimental/lazy-projections/sinu.js +7 -0
  996. package/dist/projection/experimental/lazy-projections/sinu.js.map +1 -0
  997. package/dist/projection/experimental/lazy-projections/somerc.cjs +79 -0
  998. package/dist/projection/experimental/lazy-projections/somerc.cjs.map +6 -0
  999. package/dist/projection/experimental/lazy-projections/somerc.d.ts +3 -0
  1000. package/dist/projection/experimental/lazy-projections/somerc.d.ts.map +1 -0
  1001. package/dist/projection/experimental/lazy-projections/somerc.js +8 -0
  1002. package/dist/projection/experimental/lazy-projections/somerc.js.map +1 -0
  1003. package/dist/projection/experimental/lazy-projections/stere.cjs +87 -0
  1004. package/dist/projection/experimental/lazy-projections/stere.cjs.map +6 -0
  1005. package/dist/projection/experimental/lazy-projections/stere.d.ts +3 -0
  1006. package/dist/projection/experimental/lazy-projections/stere.d.ts.map +1 -0
  1007. package/dist/projection/experimental/lazy-projections/stere.js +15 -0
  1008. package/dist/projection/experimental/lazy-projections/stere.js.map +1 -0
  1009. package/dist/projection/experimental/lazy-projections/sterea.cjs +87 -0
  1010. package/dist/projection/experimental/lazy-projections/sterea.cjs.map +6 -0
  1011. package/dist/projection/experimental/lazy-projections/sterea.d.ts +3 -0
  1012. package/dist/projection/experimental/lazy-projections/sterea.d.ts.map +1 -0
  1013. package/dist/projection/experimental/lazy-projections/sterea.js +16 -0
  1014. package/dist/projection/experimental/lazy-projections/sterea.js.map +1 -0
  1015. package/dist/projection/experimental/lazy-projections/tmerc.cjs +89 -0
  1016. package/dist/projection/experimental/lazy-projections/tmerc.cjs.map +6 -0
  1017. package/dist/projection/experimental/lazy-projections/tmerc.d.ts +3 -0
  1018. package/dist/projection/experimental/lazy-projections/tmerc.d.ts.map +1 -0
  1019. package/dist/projection/experimental/lazy-projections/tmerc.js +18 -0
  1020. package/dist/projection/experimental/lazy-projections/tmerc.js.map +1 -0
  1021. package/dist/projection/experimental/lazy-projections/tpers.cjs +79 -0
  1022. package/dist/projection/experimental/lazy-projections/tpers.cjs.map +6 -0
  1023. package/dist/projection/experimental/lazy-projections/tpers.d.ts +3 -0
  1024. package/dist/projection/experimental/lazy-projections/tpers.d.ts.map +1 -0
  1025. package/dist/projection/experimental/lazy-projections/tpers.js +8 -0
  1026. package/dist/projection/experimental/lazy-projections/tpers.js.map +1 -0
  1027. package/dist/projection/experimental/lazy-projections/utm.cjs +79 -0
  1028. package/dist/projection/experimental/lazy-projections/utm.cjs.map +6 -0
  1029. package/dist/projection/experimental/lazy-projections/utm.d.ts +3 -0
  1030. package/dist/projection/experimental/lazy-projections/utm.d.ts.map +1 -0
  1031. package/dist/projection/experimental/lazy-projections/utm.js +8 -0
  1032. package/dist/projection/experimental/lazy-projections/utm.js.map +1 -0
  1033. package/dist/projection/experimental/lazy-projections/vandg.cjs +79 -0
  1034. package/dist/projection/experimental/lazy-projections/vandg.cjs.map +6 -0
  1035. package/dist/projection/experimental/lazy-projections/vandg.d.ts +3 -0
  1036. package/dist/projection/experimental/lazy-projections/vandg.d.ts.map +1 -0
  1037. package/dist/projection/experimental/lazy-projections/vandg.js +7 -0
  1038. package/dist/projection/experimental/lazy-projections/vandg.js.map +1 -0
  1039. package/dist/projection/experimental/mutable-projection.d.ts +6 -0
  1040. package/dist/projection/experimental/mutable-projection.d.ts.map +1 -0
  1041. package/dist/projection/experimental/mutable-projection.js +53 -0
  1042. package/dist/projection/experimental/mutable-projection.js.map +1 -0
  1043. package/dist/projection/experimental/numeric-flat.d.ts +8 -0
  1044. package/dist/projection/experimental/numeric-flat.d.ts.map +1 -0
  1045. package/dist/projection/experimental/numeric-flat.js +54 -0
  1046. package/dist/projection/experimental/numeric-flat.js.map +1 -0
  1047. package/dist/projection/experimental/parameters.d.ts +8 -0
  1048. package/dist/projection/experimental/parameters.d.ts.map +1 -0
  1049. package/dist/projection/experimental/parameters.js +31 -0
  1050. package/dist/projection/experimental/parameters.js.map +1 -0
  1051. package/dist/projection/experimental/projection-descriptor.d.ts +13 -0
  1052. package/dist/projection/experimental/projection-descriptor.d.ts.map +1 -0
  1053. package/dist/projection/experimental/projection-descriptor.js +52 -0
  1054. package/dist/projection/experimental/projection-descriptor.js.map +1 -0
  1055. package/dist/projection/experimental/projection-engine.d.ts +27 -0
  1056. package/dist/projection/experimental/projection-engine.d.ts.map +1 -0
  1057. package/dist/projection/experimental/projection-engine.js +50 -0
  1058. package/dist/projection/experimental/projection-engine.js.map +1 -0
  1059. package/dist/projection/experimental/projection-pipeline.d.ts +142 -0
  1060. package/dist/projection/experimental/projection-pipeline.d.ts.map +1 -0
  1061. package/dist/projection/experimental/projection-pipeline.js +740 -0
  1062. package/dist/projection/experimental/projection-pipeline.js.map +1 -0
  1063. package/dist/projection/experimental/projection-scratch.d.ts +11 -0
  1064. package/dist/projection/experimental/projection-scratch.d.ts.map +1 -0
  1065. package/dist/projection/experimental/projection-scratch.js +25 -0
  1066. package/dist/projection/experimental/projection-scratch.js.map +1 -0
  1067. package/dist/projection/experimental/projections/aea.d.ts +3 -0
  1068. package/dist/projection/experimental/projections/aea.d.ts.map +1 -0
  1069. package/dist/projection/experimental/projections/aea.js +24 -0
  1070. package/dist/projection/experimental/projections/aea.js.map +1 -0
  1071. package/dist/projection/experimental/projections/aeqd.d.ts +3 -0
  1072. package/dist/projection/experimental/projections/aeqd.d.ts.map +1 -0
  1073. package/dist/projection/experimental/projections/aeqd.js +19 -0
  1074. package/dist/projection/experimental/projections/aeqd.js.map +1 -0
  1075. package/dist/projection/experimental/projections/bonne.d.ts +3 -0
  1076. package/dist/projection/experimental/projections/bonne.d.ts.map +1 -0
  1077. package/dist/projection/experimental/projections/bonne.js +25 -0
  1078. package/dist/projection/experimental/projections/bonne.js.map +1 -0
  1079. package/dist/projection/experimental/projections/cass.d.ts +3 -0
  1080. package/dist/projection/experimental/projections/cass.d.ts.map +1 -0
  1081. package/dist/projection/experimental/projections/cass.js +22 -0
  1082. package/dist/projection/experimental/projections/cass.js.map +1 -0
  1083. package/dist/projection/experimental/projections/cea.d.ts +3 -0
  1084. package/dist/projection/experimental/projections/cea.d.ts.map +1 -0
  1085. package/dist/projection/experimental/projections/cea.js +24 -0
  1086. package/dist/projection/experimental/projections/cea.js.map +1 -0
  1087. package/dist/projection/experimental/projections/eck6.d.ts +3 -0
  1088. package/dist/projection/experimental/projections/eck6.d.ts.map +1 -0
  1089. package/dist/projection/experimental/projections/eck6.js +22 -0
  1090. package/dist/projection/experimental/projections/eck6.js.map +1 -0
  1091. package/dist/projection/experimental/projections/eqdc.d.ts +3 -0
  1092. package/dist/projection/experimental/projections/eqdc.d.ts.map +1 -0
  1093. package/dist/projection/experimental/projections/eqdc.js +23 -0
  1094. package/dist/projection/experimental/projections/eqdc.js.map +1 -0
  1095. package/dist/projection/experimental/projections/eqearth.d.ts +3 -0
  1096. package/dist/projection/experimental/projections/eqearth.d.ts.map +1 -0
  1097. package/dist/projection/experimental/projections/eqearth.js +47 -0
  1098. package/dist/projection/experimental/projections/eqearth.js.map +1 -0
  1099. package/dist/projection/experimental/projections/equi.d.ts +3 -0
  1100. package/dist/projection/experimental/projections/equi.d.ts.map +1 -0
  1101. package/dist/projection/experimental/projections/equi.js +24 -0
  1102. package/dist/projection/experimental/projections/equi.js.map +1 -0
  1103. package/dist/projection/experimental/projections/equidistant-cylindrical.d.ts +4 -0
  1104. package/dist/projection/experimental/projections/equidistant-cylindrical.d.ts.map +1 -0
  1105. package/dist/projection/experimental/projections/equidistant-cylindrical.js +47 -0
  1106. package/dist/projection/experimental/projections/equidistant-cylindrical.js.map +1 -0
  1107. package/dist/projection/experimental/projections/geocentric.d.ts +3 -0
  1108. package/dist/projection/experimental/projections/geocentric.d.ts.map +1 -0
  1109. package/dist/projection/experimental/projections/geocentric.js +34 -0
  1110. package/dist/projection/experimental/projections/geocentric.js.map +1 -0
  1111. package/dist/projection/experimental/projections/geos.d.ts +3 -0
  1112. package/dist/projection/experimental/projections/geos.d.ts.map +1 -0
  1113. package/dist/projection/experimental/projections/geos.js +30 -0
  1114. package/dist/projection/experimental/projections/geos.js.map +1 -0
  1115. package/dist/projection/experimental/projections/gnom.d.ts +3 -0
  1116. package/dist/projection/experimental/projections/gnom.d.ts.map +1 -0
  1117. package/dist/projection/experimental/projections/gnom.js +20 -0
  1118. package/dist/projection/experimental/projections/gnom.js.map +1 -0
  1119. package/dist/projection/experimental/projections/gstmerc.d.ts +3 -0
  1120. package/dist/projection/experimental/projections/gstmerc.d.ts.map +1 -0
  1121. package/dist/projection/experimental/projections/gstmerc.js +23 -0
  1122. package/dist/projection/experimental/projections/gstmerc.js.map +1 -0
  1123. package/dist/projection/experimental/projections/krovak.d.ts +3 -0
  1124. package/dist/projection/experimental/projections/krovak.d.ts.map +1 -0
  1125. package/dist/projection/experimental/projections/krovak.js +41 -0
  1126. package/dist/projection/experimental/projections/krovak.js.map +1 -0
  1127. package/dist/projection/experimental/projections/laea.d.ts +3 -0
  1128. package/dist/projection/experimental/projections/laea.d.ts.map +1 -0
  1129. package/dist/projection/experimental/projections/laea.js +22 -0
  1130. package/dist/projection/experimental/projections/laea.js.map +1 -0
  1131. package/dist/projection/experimental/projections/lcc.d.ts +3 -0
  1132. package/dist/projection/experimental/projections/lcc.d.ts.map +1 -0
  1133. package/dist/projection/experimental/projections/lcc.js +39 -0
  1134. package/dist/projection/experimental/projections/lcc.js.map +1 -0
  1135. package/dist/projection/experimental/projections/mercator.d.ts +4 -0
  1136. package/dist/projection/experimental/projections/mercator.d.ts.map +1 -0
  1137. package/dist/projection/experimental/projections/mercator.js +106 -0
  1138. package/dist/projection/experimental/projections/mercator.js.map +1 -0
  1139. package/dist/projection/experimental/projections/mill.d.ts +3 -0
  1140. package/dist/projection/experimental/projections/mill.d.ts.map +1 -0
  1141. package/dist/projection/experimental/projections/mill.js +22 -0
  1142. package/dist/projection/experimental/projections/mill.js.map +1 -0
  1143. package/dist/projection/experimental/projections/moll.d.ts +3 -0
  1144. package/dist/projection/experimental/projections/moll.d.ts.map +1 -0
  1145. package/dist/projection/experimental/projections/moll.js +22 -0
  1146. package/dist/projection/experimental/projections/moll.js.map +1 -0
  1147. package/dist/projection/experimental/projections/nzmg.d.ts +3 -0
  1148. package/dist/projection/experimental/projections/nzmg.d.ts.map +1 -0
  1149. package/dist/projection/experimental/projections/nzmg.js +29 -0
  1150. package/dist/projection/experimental/projections/nzmg.js.map +1 -0
  1151. package/dist/projection/experimental/projections/ob-tran.d.ts +4 -0
  1152. package/dist/projection/experimental/projections/ob-tran.d.ts.map +1 -0
  1153. package/dist/projection/experimental/projections/ob-tran.js +194 -0
  1154. package/dist/projection/experimental/projections/ob-tran.js.map +1 -0
  1155. package/dist/projection/experimental/projections/omerc.d.ts +3 -0
  1156. package/dist/projection/experimental/projections/omerc.d.ts.map +1 -0
  1157. package/dist/projection/experimental/projections/omerc.js +69 -0
  1158. package/dist/projection/experimental/projections/omerc.js.map +1 -0
  1159. package/dist/projection/experimental/projections/ortho.d.ts +3 -0
  1160. package/dist/projection/experimental/projections/ortho.d.ts.map +1 -0
  1161. package/dist/projection/experimental/projections/ortho.js +20 -0
  1162. package/dist/projection/experimental/projections/ortho.js.map +1 -0
  1163. package/dist/projection/experimental/projections/poly.d.ts +3 -0
  1164. package/dist/projection/experimental/projections/poly.d.ts.map +1 -0
  1165. package/dist/projection/experimental/projections/poly.js +22 -0
  1166. package/dist/projection/experimental/projections/poly.js.map +1 -0
  1167. package/dist/projection/experimental/projections/qsc.d.ts +3 -0
  1168. package/dist/projection/experimental/projections/qsc.d.ts.map +1 -0
  1169. package/dist/projection/experimental/projections/qsc.js +64 -0
  1170. package/dist/projection/experimental/projections/qsc.js.map +1 -0
  1171. package/dist/projection/experimental/projections/robin.d.ts +3 -0
  1172. package/dist/projection/experimental/projections/robin.d.ts.map +1 -0
  1173. package/dist/projection/experimental/projections/robin.js +22 -0
  1174. package/dist/projection/experimental/projections/robin.js.map +1 -0
  1175. package/dist/projection/experimental/projections/sinu.d.ts +3 -0
  1176. package/dist/projection/experimental/projections/sinu.d.ts.map +1 -0
  1177. package/dist/projection/experimental/projections/sinu.js +22 -0
  1178. package/dist/projection/experimental/projections/sinu.js.map +1 -0
  1179. package/dist/projection/experimental/projections/somerc.d.ts +3 -0
  1180. package/dist/projection/experimental/projections/somerc.d.ts.map +1 -0
  1181. package/dist/projection/experimental/projections/somerc.js +22 -0
  1182. package/dist/projection/experimental/projections/somerc.js.map +1 -0
  1183. package/dist/projection/experimental/projections/stere.d.ts +3 -0
  1184. package/dist/projection/experimental/projections/stere.d.ts.map +1 -0
  1185. package/dist/projection/experimental/projections/stere.js +32 -0
  1186. package/dist/projection/experimental/projections/stere.js.map +1 -0
  1187. package/dist/projection/experimental/projections/sterea.d.ts +3 -0
  1188. package/dist/projection/experimental/projections/sterea.d.ts.map +1 -0
  1189. package/dist/projection/experimental/projections/sterea.js +32 -0
  1190. package/dist/projection/experimental/projections/sterea.js.map +1 -0
  1191. package/dist/projection/experimental/projections/tpers.d.ts +3 -0
  1192. package/dist/projection/experimental/projections/tpers.d.ts.map +1 -0
  1193. package/dist/projection/experimental/projections/tpers.js +31 -0
  1194. package/dist/projection/experimental/projections/tpers.js.map +1 -0
  1195. package/dist/projection/experimental/projections/transverse-mercator.d.ts +6 -0
  1196. package/dist/projection/experimental/projections/transverse-mercator.d.ts.map +1 -0
  1197. package/dist/projection/experimental/projections/transverse-mercator.js +48 -0
  1198. package/dist/projection/experimental/projections/transverse-mercator.js.map +1 -0
  1199. package/dist/projection/experimental/projections/utm.d.ts +3 -0
  1200. package/dist/projection/experimental/projections/utm.d.ts.map +1 -0
  1201. package/dist/projection/experimental/projections/utm.js +37 -0
  1202. package/dist/projection/experimental/projections/utm.js.map +1 -0
  1203. package/dist/projection/experimental/projections/vandg.d.ts +3 -0
  1204. package/dist/projection/experimental/projections/vandg.d.ts.map +1 -0
  1205. package/dist/projection/experimental/projections/vandg.js +22 -0
  1206. package/dist/projection/experimental/projections/vandg.js.map +1 -0
  1207. package/dist/projection/experimental/rendering-profile/angular-rendering-profile.d.ts +9 -0
  1208. package/dist/projection/experimental/rendering-profile/angular-rendering-profile.d.ts.map +1 -0
  1209. package/dist/projection/experimental/rendering-profile/angular-rendering-profile.js +79 -0
  1210. package/dist/projection/experimental/rendering-profile/angular-rendering-profile.js.map +1 -0
  1211. package/dist/projection/experimental/rendering-profile/azimuthal-rendering-bounds.d.ts +16 -0
  1212. package/dist/projection/experimental/rendering-profile/azimuthal-rendering-bounds.d.ts.map +1 -0
  1213. package/dist/projection/experimental/rendering-profile/azimuthal-rendering-bounds.js +91 -0
  1214. package/dist/projection/experimental/rendering-profile/azimuthal-rendering-bounds.js.map +1 -0
  1215. package/dist/projection/experimental/rendering-profile/geographic-bounds.d.ts +29 -0
  1216. package/dist/projection/experimental/rendering-profile/geographic-bounds.d.ts.map +1 -0
  1217. package/dist/projection/experimental/rendering-profile/geographic-bounds.js +127 -0
  1218. package/dist/projection/experimental/rendering-profile/geographic-bounds.js.map +1 -0
  1219. package/dist/projection/experimental/rendering-profile/geographic-rendering-profile.d.ts +4 -0
  1220. package/dist/projection/experimental/rendering-profile/geographic-rendering-profile.d.ts.map +1 -0
  1221. package/dist/projection/experimental/rendering-profile/geographic-rendering-profile.js +18 -0
  1222. package/dist/projection/experimental/rendering-profile/geographic-rendering-profile.js.map +1 -0
  1223. package/dist/projection/experimental/rendering-profile/geostationary-rendering-profile.d.ts +7 -0
  1224. package/dist/projection/experimental/rendering-profile/geostationary-rendering-profile.d.ts.map +1 -0
  1225. package/dist/projection/experimental/rendering-profile/geostationary-rendering-profile.js +86 -0
  1226. package/dist/projection/experimental/rendering-profile/geostationary-rendering-profile.js.map +1 -0
  1227. package/dist/projection/experimental/rendering-profile/identity-rendering-profile.d.ts +4 -0
  1228. package/dist/projection/experimental/rendering-profile/identity-rendering-profile.d.ts.map +1 -0
  1229. package/dist/projection/experimental/rendering-profile/identity-rendering-profile.js +13 -0
  1230. package/dist/projection/experimental/rendering-profile/identity-rendering-profile.js.map +1 -0
  1231. package/dist/projection/experimental/rendering-profile/rectangular-rendering-profile.d.ts +13 -0
  1232. package/dist/projection/experimental/rendering-profile/rectangular-rendering-profile.d.ts.map +1 -0
  1233. package/dist/projection/experimental/rendering-profile/rectangular-rendering-profile.js +76 -0
  1234. package/dist/projection/experimental/rendering-profile/rectangular-rendering-profile.js.map +1 -0
  1235. package/dist/projection/experimental/rendering-profile/regional-rendering-bounds.d.ts +29 -0
  1236. package/dist/projection/experimental/rendering-profile/regional-rendering-bounds.d.ts.map +1 -0
  1237. package/dist/projection/experimental/rendering-profile/regional-rendering-bounds.js +143 -0
  1238. package/dist/projection/experimental/rendering-profile/regional-rendering-bounds.js.map +1 -0
  1239. package/dist/projection/experimental/rendering-profile/rendering-bounds.d.ts +28 -0
  1240. package/dist/projection/experimental/rendering-profile/rendering-bounds.d.ts.map +1 -0
  1241. package/dist/projection/experimental/rendering-profile/rendering-bounds.js +111 -0
  1242. package/dist/projection/experimental/rendering-profile/rendering-bounds.js.map +1 -0
  1243. package/dist/projection/experimental/rendering-profile/rendering-profile.d.ts +11 -0
  1244. package/dist/projection/experimental/rendering-profile/rendering-profile.d.ts.map +1 -0
  1245. package/dist/projection/experimental/rendering-profile/rendering-profile.js +81 -0
  1246. package/dist/projection/experimental/rendering-profile/rendering-profile.js.map +1 -0
  1247. package/dist/projection/experimental/rendering-profile/spherical-rendering-domain.d.ts +24 -0
  1248. package/dist/projection/experimental/rendering-profile/spherical-rendering-domain.d.ts.map +1 -0
  1249. package/dist/projection/experimental/rendering-profile/spherical-rendering-domain.js +129 -0
  1250. package/dist/projection/experimental/rendering-profile/spherical-rendering-domain.js.map +1 -0
  1251. package/dist/projection/experimental/scalar-output.d.ts +8 -0
  1252. package/dist/projection/experimental/scalar-output.d.ts.map +1 -0
  1253. package/dist/projection/experimental/scalar-output.js +46 -0
  1254. package/dist/projection/experimental/scalar-output.js.map +1 -0
  1255. package/dist/projection/experimental/spatial-deformation.d.ts +6 -0
  1256. package/dist/projection/experimental/spatial-deformation.d.ts.map +1 -0
  1257. package/dist/projection/experimental/spatial-deformation.js +85 -0
  1258. package/dist/projection/experimental/spatial-deformation.js.map +1 -0
  1259. package/dist/projection/experimental/types.d.ts +156 -0
  1260. package/dist/projection/experimental/types.d.ts.map +1 -0
  1261. package/dist/projection/experimental/types.js +5 -0
  1262. package/dist/projection/experimental/types.js.map +1 -0
  1263. package/dist/projection/experimental/typescript-projection.d.ts +76 -0
  1264. package/dist/projection/experimental/typescript-projection.d.ts.map +1 -0
  1265. package/dist/projection/experimental/typescript-projection.js +459 -0
  1266. package/dist/projection/experimental/typescript-projection.js.map +1 -0
  1267. package/dist/projection/experimental/vertical-datum.d.ts +4 -0
  1268. package/dist/projection/experimental/vertical-datum.d.ts.map +1 -0
  1269. package/dist/projection/experimental/vertical-datum.js +43 -0
  1270. package/dist/projection/experimental/vertical-datum.js.map +1 -0
  1271. package/dist/projection/grids/velocity.cjs +92 -0
  1272. package/dist/projection/grids/velocity.cjs.map +6 -0
  1273. package/dist/projection/grids/velocity.d.ts +3 -0
  1274. package/dist/projection/grids/velocity.d.ts.map +1 -0
  1275. package/dist/projection/grids/velocity.js +5 -0
  1276. package/dist/projection/grids/velocity.js.map +1 -0
  1277. package/dist/projection/index.cjs +11504 -0
  1278. package/dist/projection/index.cjs.map +6 -0
  1279. package/dist/projection/index.d.ts +3 -0
  1280. package/dist/projection/index.d.ts.map +1 -0
  1281. package/dist/projection/index.js +6 -0
  1282. package/dist/projection/index.js.map +1 -0
  1283. package/dist/projection/lib/projection.d.ts +8 -0
  1284. package/dist/projection/lib/projection.d.ts.map +1 -0
  1285. package/dist/projection/lib/projection.js +115 -0
  1286. package/dist/projection/lib/projection.js.map +1 -0
  1287. package/dist/projection/numerical-derivative.d.ts +15 -0
  1288. package/dist/projection/numerical-derivative.d.ts.map +1 -0
  1289. package/dist/projection/numerical-derivative.js +47 -0
  1290. package/dist/projection/numerical-derivative.js.map +1 -0
  1291. package/dist/projection/operations.cjs +322 -0
  1292. package/dist/projection/operations.cjs.map +6 -0
  1293. package/dist/projection/operations.d.ts +89 -0
  1294. package/dist/projection/operations.d.ts.map +1 -0
  1295. package/dist/projection/operations.js +344 -0
  1296. package/dist/projection/operations.js.map +1 -0
  1297. package/dist/projection/pipeline.cjs +1961 -0
  1298. package/dist/projection/pipeline.cjs.map +6 -0
  1299. package/dist/projection/pipeline.d.ts +2 -0
  1300. package/dist/projection/pipeline.d.ts.map +1 -0
  1301. package/dist/projection/pipeline.js +5 -0
  1302. package/dist/projection/pipeline.js.map +1 -0
  1303. package/dist/projection/temporal.cjs +290 -0
  1304. package/dist/projection/temporal.cjs.map +6 -0
  1305. package/dist/projection/temporal.d.ts +31 -0
  1306. package/dist/projection/temporal.d.ts.map +1 -0
  1307. package/dist/projection/temporal.js +91 -0
  1308. package/dist/projection/temporal.js.map +1 -0
  1309. package/dist/projection/transform-analysis.cjs +1889 -0
  1310. package/dist/projection/transform-analysis.cjs.map +6 -0
  1311. package/dist/projection/transform-analysis.d.ts +43 -0
  1312. package/dist/projection/transform-analysis.d.ts.map +1 -0
  1313. package/dist/projection/transform-analysis.js +110 -0
  1314. package/dist/projection/transform-analysis.js.map +1 -0
  1315. package/dist/projection/types.cjs +18 -0
  1316. package/dist/projection/types.cjs.map +6 -0
  1317. package/dist/projection/types.d.ts +47 -0
  1318. package/dist/projection/types.d.ts.map +1 -0
  1319. package/dist/projection/types.js +5 -0
  1320. package/dist/projection/types.js.map +1 -0
  1321. package/dist/projection/web-mercator.cjs +171 -0
  1322. package/dist/projection/web-mercator.cjs.map +6 -0
  1323. package/dist/projection/web-mercator.d.ts +7 -0
  1324. package/dist/projection/web-mercator.d.ts.map +1 -0
  1325. package/dist/projection/web-mercator.js +113 -0
  1326. package/dist/projection/web-mercator.js.map +1 -0
  1327. package/dist/subdivide-globe-mesh.d.ts +20 -0
  1328. package/dist/subdivide-globe-mesh.d.ts.map +1 -0
  1329. package/dist/subdivide-globe-mesh.js +54 -0
  1330. package/dist/subdivide-globe-mesh.js.map +1 -0
  1331. package/dist/tile-matrix.cjs +94 -20
  1332. package/dist/tile-matrix.cjs.map +1 -1
  1333. package/dist/tile-matrix.d.ts +30 -8
  1334. package/dist/tile-matrix.d.ts.map +1 -1
  1335. package/dist/tile-matrix.js +125 -25
  1336. package/dist/tile-matrix.js.map +1 -1
  1337. package/dist/tiles.cjs +303 -0
  1338. package/dist/tiles.cjs.map +6 -0
  1339. package/dist/tiles.d.ts +5 -0
  1340. package/dist/tiles.d.ts.map +1 -0
  1341. package/dist/tiles.js +6 -0
  1342. package/dist/tiles.js.map +1 -0
  1343. package/dist/web-mercator.cjs +20 -0
  1344. package/dist/web-mercator.cjs.map +6 -0
  1345. package/dist/web-mercator.d.ts +2 -0
  1346. package/dist/web-mercator.d.ts.map +1 -0
  1347. package/dist/web-mercator.js +5 -0
  1348. package/dist/web-mercator.js.map +1 -0
  1349. package/dist/wkb/index.cjs +1050 -0
  1350. package/dist/wkb/index.cjs.map +6 -0
  1351. package/dist/wkb/index.d.ts +11 -0
  1352. package/dist/wkb/index.d.ts.map +1 -0
  1353. package/dist/wkb/index.js +9 -0
  1354. package/dist/wkb/index.js.map +1 -0
  1355. package/dist/wkb/types.d.ts +30 -0
  1356. package/dist/wkb/types.d.ts.map +1 -0
  1357. package/dist/wkb/types.js +34 -0
  1358. package/dist/wkb/types.js.map +1 -0
  1359. package/dist/wkb/wkb-builder.d.ts +91 -0
  1360. package/dist/wkb/wkb-builder.d.ts.map +1 -0
  1361. package/dist/wkb/wkb-builder.js +276 -0
  1362. package/dist/wkb/wkb-builder.js.map +1 -0
  1363. package/dist/wkb/wkb-reader.d.ts +74 -0
  1364. package/dist/wkb/wkb-reader.d.ts.map +1 -0
  1365. package/dist/wkb/wkb-reader.js +251 -0
  1366. package/dist/wkb/wkb-reader.js.map +1 -0
  1367. package/dist/wkb/wkb.d.ts +21 -0
  1368. package/dist/wkb/wkb.d.ts.map +1 -0
  1369. package/dist/wkb/wkb.js +204 -0
  1370. package/dist/wkb/wkb.js.map +1 -0
  1371. package/dist/wkb/wkt.d.ts +19 -0
  1372. package/dist/wkb/wkt.d.ts.map +1 -0
  1373. package/dist/wkb/wkt.js +321 -0
  1374. package/dist/wkb/wkt.js.map +1 -0
  1375. package/package.json +1053 -6
  1376. package/projection/APACHE-2.0-LICENSE.txt +55 -0
  1377. package/projection/PROJ-LICENSE.txt +37 -0
  1378. package/projection/PROJ4-LICENSE.md +29 -0
  1379. package/projection/THIRD-PARTY-NOTICES.md +163 -0
  1380. package/src/crs/crs-metadata.ts +63 -0
  1381. package/src/crs/crs.ts +36 -0
  1382. package/src/crs/index.ts +65 -0
  1383. package/src/crs/proj-string.ts +239 -0
  1384. package/src/crs/projjson-schema-constants.ts +9 -0
  1385. package/src/crs/projjson-types.ts +665 -0
  1386. package/src/crs/spatial-reference.ts +221 -0
  1387. package/src/crs/units-table.ts +51 -0
  1388. package/src/crs/wkt-crs.ts +790 -0
  1389. package/src/ellipsoid-helpers/ellipsoid-transform.ts +1 -1
  1390. package/src/ellipsoid-tangent-plane.ts +1 -1
  1391. package/src/ellipsoid.ts +1 -1
  1392. package/src/entries/ellipsoid.ts +8 -0
  1393. package/src/expressions.ts +34 -0
  1394. package/src/geoarrow/builder-entry.ts +18 -0
  1395. package/src/geoarrow/builder.ts +860 -0
  1396. package/src/geoarrow/codecs.ts +1274 -0
  1397. package/src/geoarrow/index.ts +100 -0
  1398. package/src/geoarrow/kernels.ts +1290 -0
  1399. package/src/geoarrow/layout.ts +899 -0
  1400. package/src/geoarrow/tessellate.ts +133 -0
  1401. package/src/geoarrow/tessellation-entry.ts +7 -0
  1402. package/src/geoarrow/types.ts +219 -0
  1403. package/src/geoarrow/views.ts +150 -0
  1404. package/src/geoarrow/wkb-entry.ts +13 -0
  1405. package/src/geoarrow/worker.ts +20 -0
  1406. package/src/globe.ts +14 -0
  1407. package/src/index.ts +3 -30
  1408. package/src/make-obb-from-region.ts +1 -1
  1409. package/src/projection/analysis.ts +284 -0
  1410. package/src/projection/bulk.ts +343 -0
  1411. package/src/projection/datums.ts +13 -0
  1412. package/src/projection/deformation.ts +5 -0
  1413. package/src/projection/experimental/catalogue-kernel.ts +65 -0
  1414. package/src/projection/experimental/common/adjust_lat.ts +11 -0
  1415. package/src/projection/experimental/common/adjust_lon.ts +14 -0
  1416. package/src/projection/experimental/common/asinhy.ts +14 -0
  1417. package/src/projection/experimental/common/asinz.ts +11 -0
  1418. package/src/projection/experimental/common/authlat.ts +9 -0
  1419. package/src/projection/experimental/common/authset.ts +25 -0
  1420. package/src/projection/experimental/common/clens.ts +20 -0
  1421. package/src/projection/experimental/common/clens_cmplx.ts +43 -0
  1422. package/src/projection/experimental/common/constants.ts +15 -0
  1423. package/src/projection/experimental/common/cosh.ts +10 -0
  1424. package/src/projection/experimental/common/e0fn.ts +8 -0
  1425. package/src/projection/experimental/common/e1fn.ts +8 -0
  1426. package/src/projection/experimental/common/e2fn.ts +8 -0
  1427. package/src/projection/experimental/common/e3fn.ts +8 -0
  1428. package/src/projection/experimental/common/fL.ts +10 -0
  1429. package/src/projection/experimental/common/gN.ts +9 -0
  1430. package/src/projection/experimental/common/gatg.ts +20 -0
  1431. package/src/projection/experimental/common/hypot.ts +13 -0
  1432. package/src/projection/experimental/common/imlfn.ts +23 -0
  1433. package/src/projection/experimental/common/invlatiso.ts +20 -0
  1434. package/src/projection/experimental/common/iqsfnz.ts +45 -0
  1435. package/src/projection/experimental/common/latiso.ts +21 -0
  1436. package/src/projection/experimental/common/log1py.ts +11 -0
  1437. package/src/projection/experimental/common/meridian-distance.ts +45 -0
  1438. package/src/projection/experimental/common/mlfn.ts +8 -0
  1439. package/src/projection/experimental/common/msfnz.ts +9 -0
  1440. package/src/projection/experimental/common/phi2z.ts +22 -0
  1441. package/src/projection/experimental/common/pj_enfn.ts +29 -0
  1442. package/src/projection/experimental/common/pj_inv_mlfn.ts +28 -0
  1443. package/src/projection/experimental/common/pj_mlfn.ts +10 -0
  1444. package/src/projection/experimental/common/qsfnz.ts +17 -0
  1445. package/src/projection/experimental/common/sign.ts +8 -0
  1446. package/src/projection/experimental/common/sinh.ts +10 -0
  1447. package/src/projection/experimental/common/srat.ts +8 -0
  1448. package/src/projection/experimental/common/tsfnz.ts +13 -0
  1449. package/src/projection/experimental/common/vincenty.ts +180 -0
  1450. package/src/projection/experimental/core.ts +77 -0
  1451. package/src/projection/experimental/crs/datum-catalog.ts +65 -0
  1452. package/src/projection/experimental/crs/datum-table.ts +1360 -0
  1453. package/src/projection/experimental/crs/ellipsoid-table.ts +230 -0
  1454. package/src/projection/experimental/crs/normalize.ts +306 -0
  1455. package/src/projection/experimental/crs/primemeridian-table.ts +22 -0
  1456. package/src/projection/experimental/crs/projjson.ts +12 -0
  1457. package/src/projection/experimental/crs/spatial-reference.ts +115 -0
  1458. package/src/projection/experimental/crs/structured.ts +580 -0
  1459. package/src/projection/experimental/crs/types.ts +97 -0
  1460. package/src/projection/experimental/crs/wkt.ts +201 -0
  1461. package/src/projection/experimental/crs-descriptor.ts +250 -0
  1462. package/src/projection/experimental/crs-rendering-scale.ts +115 -0
  1463. package/src/projection/experimental/datum.ts +185 -0
  1464. package/src/projection/experimental/deformation-inverse.ts +125 -0
  1465. package/src/projection/experimental/deformation.ts +30 -0
  1466. package/src/projection/experimental/entries/projections/aea.ts +5 -0
  1467. package/src/projection/experimental/entries/projections/aeqd.ts +5 -0
  1468. package/src/projection/experimental/entries/projections/bonne.ts +5 -0
  1469. package/src/projection/experimental/entries/projections/cass.ts +5 -0
  1470. package/src/projection/experimental/entries/projections/cea.ts +5 -0
  1471. package/src/projection/experimental/entries/projections/eck6.ts +5 -0
  1472. package/src/projection/experimental/entries/projections/eqc.ts +5 -0
  1473. package/src/projection/experimental/entries/projections/eqdc.ts +5 -0
  1474. package/src/projection/experimental/entries/projections/eqearth.ts +5 -0
  1475. package/src/projection/experimental/entries/projections/equi.ts +5 -0
  1476. package/src/projection/experimental/entries/projections/etmerc.ts +5 -0
  1477. package/src/projection/experimental/entries/projections/geocent.ts +5 -0
  1478. package/src/projection/experimental/entries/projections/geos.ts +5 -0
  1479. package/src/projection/experimental/entries/projections/gnom.ts +5 -0
  1480. package/src/projection/experimental/entries/projections/gstmerc.ts +5 -0
  1481. package/src/projection/experimental/entries/projections/krovak.ts +5 -0
  1482. package/src/projection/experimental/entries/projections/laea.ts +5 -0
  1483. package/src/projection/experimental/entries/projections/lcc.ts +5 -0
  1484. package/src/projection/experimental/entries/projections/merc.ts +5 -0
  1485. package/src/projection/experimental/entries/projections/mill.ts +5 -0
  1486. package/src/projection/experimental/entries/projections/moll.ts +5 -0
  1487. package/src/projection/experimental/entries/projections/nzmg.ts +5 -0
  1488. package/src/projection/experimental/entries/projections/ob_tran.ts +5 -0
  1489. package/src/projection/experimental/entries/projections/omerc.ts +5 -0
  1490. package/src/projection/experimental/entries/projections/ortho.ts +5 -0
  1491. package/src/projection/experimental/entries/projections/poly.ts +5 -0
  1492. package/src/projection/experimental/entries/projections/qsc.ts +5 -0
  1493. package/src/projection/experimental/entries/projections/robin.ts +5 -0
  1494. package/src/projection/experimental/entries/projections/sinu.ts +5 -0
  1495. package/src/projection/experimental/entries/projections/somerc.ts +5 -0
  1496. package/src/projection/experimental/entries/projections/stere.ts +5 -0
  1497. package/src/projection/experimental/entries/projections/sterea.ts +5 -0
  1498. package/src/projection/experimental/entries/projections/tmerc.ts +5 -0
  1499. package/src/projection/experimental/entries/projections/tpers.ts +5 -0
  1500. package/src/projection/experimental/entries/projections/utm.ts +5 -0
  1501. package/src/projection/experimental/entries/projections/vandg.ts +5 -0
  1502. package/src/projection/experimental/exact-helmert.ts +58 -0
  1503. package/src/projection/experimental/flat-projection.ts +80 -0
  1504. package/src/projection/experimental/grids/geotiff.ts +88 -0
  1505. package/src/projection/experimental/grids/grid.ts +141 -0
  1506. package/src/projection/experimental/grids/gtx.ts +31 -0
  1507. package/src/projection/experimental/grids/ntv2.ts +71 -0
  1508. package/src/projection/experimental/grids/scalar-geotiff.ts +231 -0
  1509. package/src/projection/experimental/grids/types.ts +35 -0
  1510. package/src/projection/experimental/grids/velocity-geotiff.ts +82 -0
  1511. package/src/projection/experimental/grids/velocity.ts +58 -0
  1512. package/src/projection/experimental/grids/vertical-geotiff.ts +28 -0
  1513. package/src/projection/experimental/grids/vertical.ts +99 -0
  1514. package/src/projection/experimental/helmert-flat.ts +76 -0
  1515. package/src/projection/experimental/index.ts +59 -0
  1516. package/src/projection/experimental/kernel.ts +142 -0
  1517. package/src/projection/experimental/kernels/aea.ts +170 -0
  1518. package/src/projection/experimental/kernels/aeqd.ts +171 -0
  1519. package/src/projection/experimental/kernels/bonne.ts +141 -0
  1520. package/src/projection/experimental/kernels/cass.ts +140 -0
  1521. package/src/projection/experimental/kernels/cea.ts +71 -0
  1522. package/src/projection/experimental/kernels/eck6.ts +36 -0
  1523. package/src/projection/experimental/kernels/eqdc.ts +137 -0
  1524. package/src/projection/experimental/kernels/eqearth.ts +136 -0
  1525. package/src/projection/experimental/kernels/equi.ts +53 -0
  1526. package/src/projection/experimental/kernels/etmerc.ts +190 -0
  1527. package/src/projection/experimental/kernels/gauss.ts +79 -0
  1528. package/src/projection/experimental/kernels/geos.ts +183 -0
  1529. package/src/projection/experimental/kernels/gnom.ts +113 -0
  1530. package/src/projection/experimental/kernels/gstmerc.ts +74 -0
  1531. package/src/projection/experimental/kernels/krovak.ts +166 -0
  1532. package/src/projection/experimental/kernels/laea.ts +297 -0
  1533. package/src/projection/experimental/kernels/lcc.ts +147 -0
  1534. package/src/projection/experimental/kernels/mill.ts +60 -0
  1535. package/src/projection/experimental/kernels/moll.ts +105 -0
  1536. package/src/projection/experimental/kernels/nzmg.ts +249 -0
  1537. package/src/projection/experimental/kernels/omerc.ts +343 -0
  1538. package/src/projection/experimental/kernels/ortho.ts +106 -0
  1539. package/src/projection/experimental/kernels/poly.ts +156 -0
  1540. package/src/projection/experimental/kernels/qsc.ts +369 -0
  1541. package/src/projection/experimental/kernels/robin.ts +189 -0
  1542. package/src/projection/experimental/kernels/sinu.ts +116 -0
  1543. package/src/projection/experimental/kernels/somerc.ts +112 -0
  1544. package/src/projection/experimental/kernels/stere.ts +221 -0
  1545. package/src/projection/experimental/kernels/sterea.ts +80 -0
  1546. package/src/projection/experimental/kernels/tmerc.ts +227 -0
  1547. package/src/projection/experimental/kernels/tpers.ts +187 -0
  1548. package/src/projection/experimental/kernels/vandg.ts +147 -0
  1549. package/src/projection/experimental/kinematic-helmert-flat.ts +85 -0
  1550. package/src/projection/experimental/kinematic-helmert.ts +132 -0
  1551. package/src/projection/experimental/lazy-projection.ts +179 -0
  1552. package/src/projection/experimental/lazy-projections/aea.ts +10 -0
  1553. package/src/projection/experimental/lazy-projections/aeqd.ts +12 -0
  1554. package/src/projection/experimental/lazy-projections/bonne.ts +10 -0
  1555. package/src/projection/experimental/lazy-projections/cass.ts +10 -0
  1556. package/src/projection/experimental/lazy-projections/cea.ts +12 -0
  1557. package/src/projection/experimental/lazy-projections/eck6.ts +10 -0
  1558. package/src/projection/experimental/lazy-projections/eqc.ts +15 -0
  1559. package/src/projection/experimental/lazy-projections/eqdc.ts +11 -0
  1560. package/src/projection/experimental/lazy-projections/eqearth.ts +10 -0
  1561. package/src/projection/experimental/lazy-projections/equi.ts +10 -0
  1562. package/src/projection/experimental/lazy-projections/etmerc.ts +12 -0
  1563. package/src/projection/experimental/lazy-projections/geocent.ts +10 -0
  1564. package/src/projection/experimental/lazy-projections/geos.ts +10 -0
  1565. package/src/projection/experimental/lazy-projections/gnom.ts +10 -0
  1566. package/src/projection/experimental/lazy-projections/gstmerc.ts +13 -0
  1567. package/src/projection/experimental/lazy-projections/index.ts +41 -0
  1568. package/src/projection/experimental/lazy-projections/krovak.ts +18 -0
  1569. package/src/projection/experimental/lazy-projections/laea.ts +12 -0
  1570. package/src/projection/experimental/lazy-projections/lcc.ts +22 -0
  1571. package/src/projection/experimental/lazy-projections/merc.ts +19 -0
  1572. package/src/projection/experimental/lazy-projections/mill.ts +11 -0
  1573. package/src/projection/experimental/lazy-projections/moll.ts +10 -0
  1574. package/src/projection/experimental/lazy-projections/nzmg.ts +11 -0
  1575. package/src/projection/experimental/lazy-projections/ob_tran.ts +25 -0
  1576. package/src/projection/experimental/lazy-projections/omerc.ts +22 -0
  1577. package/src/projection/experimental/lazy-projections/ortho.ts +10 -0
  1578. package/src/projection/experimental/lazy-projections/poly.ts +10 -0
  1579. package/src/projection/experimental/lazy-projections/qsc.ts +16 -0
  1580. package/src/projection/experimental/lazy-projections/robin.ts +10 -0
  1581. package/src/projection/experimental/lazy-projections/sinu.ts +10 -0
  1582. package/src/projection/experimental/lazy-projections/somerc.ts +12 -0
  1583. package/src/projection/experimental/lazy-projections/stere.ts +18 -0
  1584. package/src/projection/experimental/lazy-projections/sterea.ts +20 -0
  1585. package/src/projection/experimental/lazy-projections/tmerc.ts +22 -0
  1586. package/src/projection/experimental/lazy-projections/tpers.ts +11 -0
  1587. package/src/projection/experimental/lazy-projections/utm.ts +12 -0
  1588. package/src/projection/experimental/lazy-projections/vandg.ts +10 -0
  1589. package/src/projection/experimental/mutable-projection.ts +63 -0
  1590. package/src/projection/experimental/numeric-flat.ts +73 -0
  1591. package/src/projection/experimental/parameters.ts +36 -0
  1592. package/src/projection/experimental/projection-descriptor.ts +79 -0
  1593. package/src/projection/experimental/projection-engine.ts +81 -0
  1594. package/src/projection/experimental/projection-pipeline.ts +1047 -0
  1595. package/src/projection/experimental/projection-scratch.ts +26 -0
  1596. package/src/projection/experimental/projections/aea.ts +41 -0
  1597. package/src/projection/experimental/projections/aeqd.ts +27 -0
  1598. package/src/projection/experimental/projections/bonne.ts +38 -0
  1599. package/src/projection/experimental/projections/cass.ts +39 -0
  1600. package/src/projection/experimental/projections/cea.ts +31 -0
  1601. package/src/projection/experimental/projections/eck6.ts +30 -0
  1602. package/src/projection/experimental/projections/eqdc.ts +40 -0
  1603. package/src/projection/experimental/projections/eqearth.ts +72 -0
  1604. package/src/projection/experimental/projections/equi.ts +31 -0
  1605. package/src/projection/experimental/projections/equidistant-cylindrical.ts +79 -0
  1606. package/src/projection/experimental/projections/geocentric.ts +42 -0
  1607. package/src/projection/experimental/projections/geos.ts +46 -0
  1608. package/src/projection/experimental/projections/gnom.ts +34 -0
  1609. package/src/projection/experimental/projections/gstmerc.ts +43 -0
  1610. package/src/projection/experimental/projections/krovak.ts +61 -0
  1611. package/src/projection/experimental/projections/laea.ts +39 -0
  1612. package/src/projection/experimental/projections/lcc.ts +67 -0
  1613. package/src/projection/experimental/projections/mercator.ts +150 -0
  1614. package/src/projection/experimental/projections/mill.ts +30 -0
  1615. package/src/projection/experimental/projections/moll.ts +30 -0
  1616. package/src/projection/experimental/projections/nzmg.ts +47 -0
  1617. package/src/projection/experimental/projections/ob-tran.ts +279 -0
  1618. package/src/projection/experimental/projections/omerc.ts +86 -0
  1619. package/src/projection/experimental/projections/ortho.ts +34 -0
  1620. package/src/projection/experimental/projections/poly.ts +40 -0
  1621. package/src/projection/experimental/projections/qsc.ts +84 -0
  1622. package/src/projection/experimental/projections/robin.ts +30 -0
  1623. package/src/projection/experimental/projections/sinu.ts +30 -0
  1624. package/src/projection/experimental/projections/somerc.ts +39 -0
  1625. package/src/projection/experimental/projections/stere.ts +59 -0
  1626. package/src/projection/experimental/projections/sterea.ts +61 -0
  1627. package/src/projection/experimental/projections/tpers.ts +59 -0
  1628. package/src/projection/experimental/projections/transverse-mercator.ts +89 -0
  1629. package/src/projection/experimental/projections/utm.ts +50 -0
  1630. package/src/projection/experimental/projections/vandg.ts +30 -0
  1631. package/src/projection/experimental/rendering-profile/angular-rendering-profile.ts +117 -0
  1632. package/src/projection/experimental/rendering-profile/azimuthal-rendering-bounds.ts +181 -0
  1633. package/src/projection/experimental/rendering-profile/geographic-bounds.ts +190 -0
  1634. package/src/projection/experimental/rendering-profile/geographic-rendering-profile.ts +29 -0
  1635. package/src/projection/experimental/rendering-profile/geostationary-rendering-profile.ts +128 -0
  1636. package/src/projection/experimental/rendering-profile/identity-rendering-profile.ts +15 -0
  1637. package/src/projection/experimental/rendering-profile/rectangular-rendering-profile.ts +133 -0
  1638. package/src/projection/experimental/rendering-profile/regional-rendering-bounds.ts +252 -0
  1639. package/src/projection/experimental/rendering-profile/rendering-bounds.ts +163 -0
  1640. package/src/projection/experimental/rendering-profile/rendering-profile.ts +96 -0
  1641. package/src/projection/experimental/rendering-profile/spherical-rendering-domain.ts +175 -0
  1642. package/src/projection/experimental/scalar-output.ts +74 -0
  1643. package/src/projection/experimental/spatial-deformation.ts +115 -0
  1644. package/src/projection/experimental/types.ts +181 -0
  1645. package/src/projection/experimental/typescript-projection.ts +581 -0
  1646. package/src/projection/experimental/vertical-datum.ts +39 -0
  1647. package/src/projection/grids/velocity.ts +5 -0
  1648. package/src/projection/index.ts +6 -0
  1649. package/src/projection/lib/projection.ts +161 -0
  1650. package/src/projection/numerical-derivative.ts +50 -0
  1651. package/src/projection/operations.ts +479 -0
  1652. package/src/projection/pipeline.ts +4 -0
  1653. package/src/projection/temporal.ts +133 -0
  1654. package/src/projection/transform-analysis.ts +169 -0
  1655. package/src/projection/types.ts +79 -0
  1656. package/src/projection/web-mercator.ts +148 -0
  1657. package/src/subdivide-globe-mesh.ts +75 -0
  1658. package/src/tile-matrix.ts +205 -34
  1659. package/src/tiles.ts +28 -0
  1660. package/src/web-mercator.ts +5 -0
  1661. package/src/wkb/index.ts +38 -0
  1662. package/src/wkb/types.ts +54 -0
  1663. package/src/wkb/wkb-builder.ts +386 -0
  1664. package/src/wkb/wkb-reader.ts +401 -0
  1665. package/src/wkb/wkb.ts +255 -0
  1666. package/src/wkb/wkt.ts +375 -0
@@ -0,0 +1,4089 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // dist/geoarrow/index.js
20
+ var index_exports = {};
21
+ __export(index_exports, {
22
+ GeoArrowBuilder: () => GeoArrowBuilder,
23
+ allocateGeoArrowBuilderTarget: () => allocateGeoArrowBuilderTarget,
24
+ assertGeoArrowResourceLimits: () => assertGeoArrowResourceLimits,
25
+ concatenateGeoArrowColumns: () => concatenateGeoArrowColumns,
26
+ convertGeoArrowColumn: () => convertGeoArrowColumn,
27
+ decodeGeoArrowWKB: () => decodeGeoArrowWKB,
28
+ decodeGeoArrowWKT: () => decodeGeoArrowWKT,
29
+ encodeGeoArrowWKB: () => encodeGeoArrowWKB,
30
+ encodeGeoArrowWKT: () => encodeGeoArrowWKT,
31
+ getGeoArrowBounds: () => getGeoArrowBounds,
32
+ getGeoArrowDimensionSize: () => getGeoArrowDimensionSize,
33
+ getGeoArrowEncodingForGeometry: () => getGeoArrowEncodingForGeometry,
34
+ getGeoArrowGeometryType: () => getGeoArrowGeometryType,
35
+ getGeoArrowRowBounds: () => getGeoArrowRowBounds,
36
+ getGeoArrowRowCount: () => getGeoArrowRowCount,
37
+ getGeoArrowRowView: () => getGeoArrowRowView,
38
+ getGeoArrowTransferList: () => getGeoArrowTransferList,
39
+ getGeoArrowVertexCount: () => getGeoArrowVertexCount,
40
+ getGeoArrowWKBVertexCount: () => getGeoArrowWKBVertexCount,
41
+ inspectGeoArrowColumn: () => inspectGeoArrowColumn,
42
+ interleaveGeoArrowCoordinates: () => interleaveGeoArrowCoordinates,
43
+ isGeoArrowValueValid: () => isGeoArrowValueValid,
44
+ iterateGeoArrowBatches: () => iterateGeoArrowBatches,
45
+ makeGeoArrowColumnFromGeometryRows: () => makeGeoArrowColumnFromGeometryRows,
46
+ mapGeoArrowCoordinates: () => mapGeoArrowCoordinates,
47
+ mapGeoArrowCoordinatesInto: () => mapGeoArrowCoordinatesInto,
48
+ materializeGeoArrowRows: () => materializeGeoArrowRows,
49
+ normalizeGeoArrowUnion: () => normalizeGeoArrowUnion,
50
+ rewindGeoArrow: () => rewindGeoArrow,
51
+ sliceGeoArrowArray: () => sliceGeoArrowArray,
52
+ sliceGeoArrowColumn: () => sliceGeoArrowColumn,
53
+ tessellateGeoArrowPolygons: () => tessellateGeoArrowPolygons,
54
+ validateGeoArrowColumn: () => validateGeoArrowColumn,
55
+ visitGeoArrowCoordinates: () => visitGeoArrowCoordinates
56
+ });
57
+ module.exports = __toCommonJS(index_exports);
58
+
59
+ // dist/geoarrow/types.js
60
+ function getGeoArrowDimensionSize(dimension) {
61
+ switch (dimension) {
62
+ case "xy":
63
+ return 2;
64
+ case "xyz":
65
+ case "xym":
66
+ return 3;
67
+ case "xyzm":
68
+ return 4;
69
+ }
70
+ }
71
+ function getGeoArrowGeometryType(encoding) {
72
+ switch (encoding) {
73
+ case "geoarrow.point":
74
+ return "Point";
75
+ case "geoarrow.linestring":
76
+ return "LineString";
77
+ case "geoarrow.polygon":
78
+ return "Polygon";
79
+ case "geoarrow.multipoint":
80
+ return "MultiPoint";
81
+ case "geoarrow.multilinestring":
82
+ return "MultiLineString";
83
+ case "geoarrow.multipolygon":
84
+ return "MultiPolygon";
85
+ case "geoarrow.geometrycollection":
86
+ return "GeometryCollection";
87
+ default:
88
+ return null;
89
+ }
90
+ }
91
+ function getGeoArrowEncodingForGeometry(type) {
92
+ return `geoarrow.${type.toLowerCase()}`;
93
+ }
94
+
95
+ // dist/geoarrow/layout.js
96
+ function isGeoArrowValueValid(validity, index) {
97
+ if (!validity)
98
+ return true;
99
+ const bitIndex = (validity.bitOffset || 0) + index;
100
+ return Boolean(validity.values[bitIndex >> 3] & 1 << (bitIndex & 7));
101
+ }
102
+ function getGeoArrowRowCount(column) {
103
+ return column.chunks.reduce((count, chunk) => count + chunk.length, 0);
104
+ }
105
+ function visitGeoArrowCoordinates(column, visitor) {
106
+ let rowOffset = 0;
107
+ for (const chunk of column.chunks) {
108
+ visitChunkCoordinates(chunk, column.encoding, rowOffset, visitor);
109
+ rowOffset += chunk.length;
110
+ }
111
+ }
112
+ function sliceGeoArrowColumn(column, begin = 0, end = getGeoArrowRowCount(column)) {
113
+ const rowCount = getGeoArrowRowCount(column);
114
+ const first = normalizeSliceIndex(begin, rowCount);
115
+ const last = Math.max(first, normalizeSliceIndex(end, rowCount));
116
+ if (first === 0 && last === rowCount)
117
+ return column;
118
+ const chunks = [];
119
+ let chunkStart = 0;
120
+ for (const chunk of column.chunks) {
121
+ const chunkEnd = chunkStart + chunk.length;
122
+ const localFirst = Math.max(0, first - chunkStart);
123
+ const localLast = Math.min(chunk.length, last - chunkStart);
124
+ if (localLast > localFirst) {
125
+ chunks.push(sliceGeoArrowArray(chunk, localFirst, localLast));
126
+ }
127
+ chunkStart = chunkEnd;
128
+ if (chunkStart >= last)
129
+ break;
130
+ }
131
+ return { ...column, chunks };
132
+ }
133
+ function sliceGeoArrowArray(array, begin, end) {
134
+ if (begin === 0 && end === array.length)
135
+ return array;
136
+ const length = end - begin;
137
+ const validity = array.validity ? { ...array.validity, bitOffset: (array.validity.bitOffset || 0) + begin } : void 0;
138
+ switch (array.kind) {
139
+ case "primitive":
140
+ return {
141
+ ...array,
142
+ length,
143
+ offset: (array.offset || 0) + begin * (array.stride || 1),
144
+ validity
145
+ };
146
+ case "fixed-size-list":
147
+ return { ...array, length, offset: (array.offset || 0) + begin, validity };
148
+ case "list":
149
+ case "serialized":
150
+ return { ...array, length, offset: (array.offset || 0) + begin, validity };
151
+ case "struct":
152
+ return { ...array, length, offset: (array.offset || 0) + begin, validity };
153
+ case "dense-union":
154
+ return { ...array, length, offset: (array.offset || 0) + begin, validity };
155
+ }
156
+ }
157
+ function validateGeoArrowColumn(column) {
158
+ const issues = [];
159
+ for (let chunkIndex = 0; chunkIndex < column.chunks.length; chunkIndex++) {
160
+ validateArray(column.chunks[chunkIndex], `chunks[${chunkIndex}]`, issues);
161
+ }
162
+ validateColumnLayout(column, issues);
163
+ return { valid: issues.length === 0, issues };
164
+ }
165
+ function inspectGeoArrowColumn(column) {
166
+ const validation = validateGeoArrowColumn(column);
167
+ const storageKinds = [];
168
+ let nullCount = 0;
169
+ for (const chunk of column.chunks) {
170
+ collectStorageKinds(chunk, storageKinds);
171
+ for (let rowIndex = 0; rowIndex < chunk.length; rowIndex++) {
172
+ if (!isGeoArrowRowValid(chunk, rowIndex))
173
+ nullCount++;
174
+ }
175
+ }
176
+ return {
177
+ encoding: column.encoding,
178
+ rowCount: getGeoArrowRowCount(column),
179
+ chunkCount: column.chunks.length,
180
+ nullCount,
181
+ coordinateCount: getGeoArrowVertexCount(column),
182
+ storageKinds,
183
+ valid: validation.valid,
184
+ issues: validation.issues
185
+ };
186
+ }
187
+ function isGeoArrowRowValid(array, rowIndex) {
188
+ if (!isGeoArrowValueValid(array.validity, rowIndex))
189
+ return false;
190
+ if (array.kind !== "dense-union")
191
+ return true;
192
+ const physicalIndex = (array.offset || 0) + rowIndex;
193
+ const child = array.children.find((candidate) => candidate.typeId === array.typeIds[physicalIndex]);
194
+ const valueOffset = array.valueOffsets[physicalIndex];
195
+ return Boolean(child && valueOffset >= 0 && valueOffset < child.data.length && isGeoArrowValueValid(child.data.validity, valueOffset));
196
+ }
197
+ function getGeoArrowVertexCount(column) {
198
+ if (column.encoding === "geoarrow.wkb" || column.encoding === "geoarrow.wkt" || column.encoding === "geoarrow.box") {
199
+ return 0;
200
+ }
201
+ let count = 0;
202
+ visitGeoArrowCoordinates(column, (coordinate) => {
203
+ count++;
204
+ return coordinate;
205
+ });
206
+ return count;
207
+ }
208
+ function getGeoArrowTransferList(column) {
209
+ const buffers = /* @__PURE__ */ new Set();
210
+ for (const chunk of column.chunks)
211
+ collectArrayBuffers(chunk, buffers);
212
+ return [...buffers];
213
+ }
214
+ function materializeGeoArrowRows(column) {
215
+ if (column.encoding === "geoarrow.wkb" || column.encoding === "geoarrow.wkt") {
216
+ throw new Error("Serialized GeoArrow columns must be decoded before materialization");
217
+ }
218
+ const rows = [];
219
+ for (const chunk of column.chunks) {
220
+ for (let rowIndex = 0; rowIndex < chunk.length; rowIndex++) {
221
+ rows.push(materializeGeometryRow(chunk, rowIndex, column.encoding));
222
+ }
223
+ }
224
+ return rows;
225
+ }
226
+ function materializeGeometryRow(array, rowIndex, encoding) {
227
+ if (!isGeoArrowValueValid(array.validity, rowIndex))
228
+ return null;
229
+ if (encoding === "geoarrow.geometry") {
230
+ if (array.kind !== "dense-union")
231
+ return null;
232
+ return materializeUnionRow(array, rowIndex);
233
+ }
234
+ if (encoding === "geoarrow.geometrycollection") {
235
+ if (array.kind !== "list")
236
+ return null;
237
+ const [first, last] = getListRange(array, rowIndex);
238
+ const geometries = [];
239
+ for (let index = first; index < last; index++) {
240
+ if (array.child.kind !== "dense-union")
241
+ continue;
242
+ const geometry = materializeUnionRow(array.child, index);
243
+ if (geometry)
244
+ geometries.push(geometry);
245
+ }
246
+ return { type: "GeometryCollection", geometries };
247
+ }
248
+ const geometryType = getGeoArrowGeometryType(encoding);
249
+ if (!geometryType || geometryType === "GeometryCollection")
250
+ return null;
251
+ const depth = getEncodingDepth(encoding);
252
+ const coordinates = readNestedCoordinates(array, rowIndex, depth, geometryType === "Point" || geometryType === "MultiPoint");
253
+ if (!coordinates)
254
+ return null;
255
+ return { type: geometryType, coordinates };
256
+ }
257
+ function getGeoArrowOffset(offsets, index) {
258
+ const value = offsets[index];
259
+ const numericValue = typeof value === "bigint" ? Number(value) : value;
260
+ if (!Number.isSafeInteger(numericValue)) {
261
+ throw new Error(`GeoArrow offset ${String(value)} exceeds JavaScript's safe integer range`);
262
+ }
263
+ return numericValue;
264
+ }
265
+ function getListRange(list, rowIndex) {
266
+ const offsetIndex = (list.offset || 0) + rowIndex;
267
+ const baseValue = list.offsetBase ?? 0;
268
+ const base = typeof baseValue === "bigint" ? Number(baseValue) : baseValue;
269
+ return [
270
+ getGeoArrowOffset(list.offsets, offsetIndex) - base,
271
+ getGeoArrowOffset(list.offsets, offsetIndex + 1) - base
272
+ ];
273
+ }
274
+ function visitChunkCoordinates(array, encoding, rowOffset, visitor) {
275
+ for (let rowIndex = 0; rowIndex < array.length; rowIndex++) {
276
+ if (!isGeoArrowValueValid(array.validity, rowIndex))
277
+ continue;
278
+ if (encoding === "geoarrow.geometry" && array.kind === "dense-union") {
279
+ visitUnionRowCoordinates(array, rowIndex, rowOffset + rowIndex, visitor);
280
+ continue;
281
+ }
282
+ if (encoding === "geoarrow.geometrycollection" && array.kind === "list") {
283
+ const [first, last] = getListRange(array, rowIndex);
284
+ if (array.child.kind === "dense-union") {
285
+ for (let index = first; index < last; index++) {
286
+ visitUnionRowCoordinates(array.child, index, rowOffset + rowIndex, visitor);
287
+ }
288
+ }
289
+ continue;
290
+ }
291
+ const depth = getEncodingDepth(encoding);
292
+ visitNestedCoordinates(array, rowIndex, depth, rowOffset + rowIndex, visitor);
293
+ }
294
+ }
295
+ function visitUnionRowCoordinates(union, rowIndex, sourceRowIndex, visitor) {
296
+ if (!isGeoArrowValueValid(union.validity, rowIndex))
297
+ return;
298
+ const physicalIndex = (union.offset || 0) + rowIndex;
299
+ const typeId = union.typeIds[physicalIndex];
300
+ const valueOffset = union.valueOffsets[physicalIndex];
301
+ const child = union.children.find((candidate) => candidate.typeId === typeId);
302
+ if (!child)
303
+ return;
304
+ const encoding = child.encoding || getEncodingFromChildName(child.name);
305
+ if (encoding === "geoarrow.geometrycollection" && child.data.kind === "list") {
306
+ const [first, last] = getListRange(child.data, valueOffset);
307
+ if (child.data.child.kind === "dense-union") {
308
+ for (let index = first; index < last; index++) {
309
+ visitUnionRowCoordinates(child.data.child, index, sourceRowIndex, visitor);
310
+ }
311
+ }
312
+ return;
313
+ }
314
+ visitNestedCoordinates(child.data, valueOffset, getEncodingDepth(encoding), sourceRowIndex, visitor);
315
+ }
316
+ function visitNestedCoordinates(array, index, depth, rowIndex, visitor) {
317
+ if (depth === 0) {
318
+ const coordinate = readCoordinate(array, index);
319
+ if (coordinate)
320
+ visitor(coordinate, rowIndex);
321
+ return;
322
+ }
323
+ if (array.kind !== "list" || !isGeoArrowValueValid(array.validity, index))
324
+ return;
325
+ const [first, last] = getListRange(array, index);
326
+ for (let childIndex = first; childIndex < last; childIndex++) {
327
+ visitNestedCoordinates(array.child, childIndex, depth - 1, rowIndex, visitor);
328
+ }
329
+ }
330
+ function readNestedCoordinates(array, index, depth, normalizeEmptyPoints) {
331
+ if (depth === 0) {
332
+ const coordinate = readCoordinate(array, index);
333
+ return normalizeEmptyPoints && (coordinate == null ? void 0 : coordinate.every((value) => !Number.isFinite(value))) ? [] : coordinate;
334
+ }
335
+ if (array.kind !== "list" || !isGeoArrowValueValid(array.validity, index))
336
+ return null;
337
+ const [first, last] = getListRange(array, index);
338
+ const values = [];
339
+ for (let childIndex = first; childIndex < last; childIndex++) {
340
+ const value = readNestedCoordinates(array.child, childIndex, depth - 1, normalizeEmptyPoints);
341
+ if (value !== null)
342
+ values.push(value);
343
+ }
344
+ return values;
345
+ }
346
+ function readCoordinate(array, index) {
347
+ if (!isGeoArrowValueValid(array.validity, index))
348
+ return null;
349
+ if (array.kind === "fixed-size-list") {
350
+ const listIndex = (array.offset || 0) + index;
351
+ const coordinate = [];
352
+ for (let component = 0; component < array.size; component++) {
353
+ coordinate.push(readPrimitive(array.child, listIndex * array.size + component));
354
+ }
355
+ return coordinate;
356
+ }
357
+ if (array.kind === "struct") {
358
+ const structIndex = (array.offset || 0) + index;
359
+ const coordinate = [];
360
+ for (const name of ["x", "y", "z", "m"]) {
361
+ const child = array.children[name];
362
+ if (child)
363
+ coordinate.push(readPrimitive(child, structIndex));
364
+ }
365
+ return coordinate.length >= 2 ? coordinate : null;
366
+ }
367
+ return null;
368
+ }
369
+ function readPrimitive(array, index) {
370
+ if (array.kind !== "primitive")
371
+ throw new Error("GeoArrow coordinate child must be primitive");
372
+ if (!isGeoArrowValueValid(array.validity, index))
373
+ return Number.NaN;
374
+ const valueIndex = (array.offset || 0) + index * (array.stride || 1);
375
+ return Number(array.values[valueIndex]);
376
+ }
377
+ function materializeUnionRow(union, rowIndex) {
378
+ if (!isGeoArrowValueValid(union.validity, rowIndex))
379
+ return null;
380
+ const physicalIndex = (union.offset || 0) + rowIndex;
381
+ const typeId = union.typeIds[physicalIndex];
382
+ const valueOffset = union.valueOffsets[physicalIndex];
383
+ const child = union.children.find((candidate) => candidate.typeId === typeId);
384
+ if (!child || valueOffset < 0 || valueOffset >= child.data.length)
385
+ return null;
386
+ return materializeGeometryRow(child.data, valueOffset, child.encoding || getEncodingFromChildName(child.name));
387
+ }
388
+ function getEncodingFromChildName(name) {
389
+ const normalized = name.replace(/[^a-z]/gi, "").toLowerCase();
390
+ switch (normalized) {
391
+ case "point":
392
+ return "geoarrow.point";
393
+ case "linestring":
394
+ return "geoarrow.linestring";
395
+ case "polygon":
396
+ return "geoarrow.polygon";
397
+ case "multipoint":
398
+ return "geoarrow.multipoint";
399
+ case "multilinestring":
400
+ return "geoarrow.multilinestring";
401
+ case "multipolygon":
402
+ return "geoarrow.multipolygon";
403
+ case "geometrycollection":
404
+ return "geoarrow.geometrycollection";
405
+ default:
406
+ throw new Error(`Unknown GeoArrow dense-union child ${name}`);
407
+ }
408
+ }
409
+ function getEncodingDepth(encoding) {
410
+ switch (encoding) {
411
+ case "geoarrow.point":
412
+ return 0;
413
+ case "geoarrow.linestring":
414
+ case "geoarrow.multipoint":
415
+ return 1;
416
+ case "geoarrow.polygon":
417
+ case "geoarrow.multilinestring":
418
+ return 2;
419
+ case "geoarrow.multipolygon":
420
+ return 3;
421
+ default:
422
+ return 0;
423
+ }
424
+ }
425
+ function validateArray(array, path, issues) {
426
+ if (!Number.isSafeInteger(array.length) || array.length < 0) {
427
+ issues.push({
428
+ code: "invalid-length",
429
+ path,
430
+ message: "Length must be a non-negative safe integer."
431
+ });
432
+ return;
433
+ }
434
+ validateValidity(array.validity, array.length, path, issues);
435
+ switch (array.kind) {
436
+ case "primitive": {
437
+ const stride = array.stride || 1;
438
+ const offset = array.offset || 0;
439
+ if (!Number.isSafeInteger(stride) || stride < 1) {
440
+ issues.push({ code: "invalid-stride", path, message: "Primitive stride must be positive." });
441
+ }
442
+ const requiredLength = array.length === 0 ? offset : offset + (array.length - 1) * stride + 1;
443
+ if (offset < 0 || requiredLength > array.values.length) {
444
+ issues.push({
445
+ code: "invalid-length",
446
+ path,
447
+ message: "Primitive values do not cover the logical range."
448
+ });
449
+ }
450
+ break;
451
+ }
452
+ case "fixed-size-list": {
453
+ const offset = array.offset ?? 0;
454
+ const validOffset = Number.isSafeInteger(offset) && offset >= 0;
455
+ if (!validOffset) {
456
+ issues.push({
457
+ code: "invalid-offset",
458
+ path,
459
+ message: "Fixed-size list offset must be a non-negative safe integer."
460
+ });
461
+ }
462
+ if (!Number.isSafeInteger(array.size) || array.size < 1) {
463
+ issues.push({
464
+ code: "invalid-length",
465
+ path,
466
+ message: "Fixed-size list size must be positive."
467
+ });
468
+ }
469
+ const childEnd = (offset + array.length) * array.size;
470
+ if (validOffset && childEnd > array.child.length) {
471
+ issues.push({ code: "invalid-child", path, message: "Fixed-size list child is too short." });
472
+ }
473
+ validateArray(array.child, `${path}.child`, issues);
474
+ break;
475
+ }
476
+ case "list":
477
+ validateList(array, path, issues);
478
+ validateArray(array.child, `${path}.child`, issues);
479
+ break;
480
+ case "struct":
481
+ if (Object.keys(array.children).length === 0) {
482
+ issues.push({ code: "invalid-child", path, message: "Struct must contain children." });
483
+ }
484
+ for (const [name, child] of Object.entries(array.children)) {
485
+ if ((array.offset || 0) + array.length > child.length) {
486
+ issues.push({
487
+ code: "invalid-child",
488
+ path: `${path}.${name}`,
489
+ message: "Struct child is too short."
490
+ });
491
+ }
492
+ validateArray(child, `${path}.${name}`, issues);
493
+ }
494
+ break;
495
+ case "dense-union": {
496
+ const end = (array.offset || 0) + array.length;
497
+ if (end > array.typeIds.length || end > array.valueOffsets.length) {
498
+ issues.push({
499
+ code: "invalid-union",
500
+ path,
501
+ message: "Dense-union dispatch buffers are too short."
502
+ });
503
+ }
504
+ const childIds = /* @__PURE__ */ new Set();
505
+ for (const child of array.children) {
506
+ if (childIds.has(child.typeId)) {
507
+ issues.push({
508
+ code: "invalid-union",
509
+ path,
510
+ message: `Duplicate dense-union type ID ${child.typeId}.`
511
+ });
512
+ }
513
+ childIds.add(child.typeId);
514
+ validateArray(child.data, `${path}.${child.name}`, issues);
515
+ }
516
+ for (let index = array.offset || 0; index < end; index++) {
517
+ if (!isGeoArrowValueValid(array.validity, index - (array.offset || 0)))
518
+ continue;
519
+ const child = array.children.find((candidate) => candidate.typeId === array.typeIds[index]);
520
+ const valueOffset = array.valueOffsets[index];
521
+ if (!child || valueOffset < 0 || valueOffset >= child.data.length) {
522
+ issues.push({
523
+ code: "invalid-union",
524
+ path: `${path}[${index}]`,
525
+ message: "Dense-union row references an invalid child value."
526
+ });
527
+ }
528
+ }
529
+ break;
530
+ }
531
+ case "serialized": {
532
+ if (array.views) {
533
+ const requiredWords = ((array.offset || 0) + array.length) * 4;
534
+ if (requiredWords > array.views.length) {
535
+ issues.push({
536
+ code: "invalid-length",
537
+ path,
538
+ message: "Serialized view records are too short."
539
+ });
540
+ }
541
+ } else {
542
+ validateOffsets(array.offsets, array.offset || 0, array.length, array.values.length, array.offsetBase, path, issues);
543
+ }
544
+ break;
545
+ }
546
+ }
547
+ }
548
+ function validateList(list, path, issues) {
549
+ validateOffsets(list.offsets, list.offset || 0, list.length, list.child.length, list.offsetBase, path, issues);
550
+ }
551
+ function validateOffsets(offsets, offset, length, childLength, offsetBase, path, issues) {
552
+ if (offset < 0 || offset + length >= offsets.length) {
553
+ issues.push({ code: "invalid-offset", path, message: "Offset buffer is too short." });
554
+ return;
555
+ }
556
+ const base = typeof offsetBase === "bigint" ? Number(offsetBase) : offsetBase || 0;
557
+ let previous;
558
+ try {
559
+ previous = getGeoArrowOffset(offsets, offset) - base;
560
+ } catch (error) {
561
+ issues.push({ code: "unsafe-offset", path, message: error.message });
562
+ return;
563
+ }
564
+ for (let index = 1; index <= length; index++) {
565
+ let current;
566
+ try {
567
+ current = getGeoArrowOffset(offsets, offset + index) - base;
568
+ } catch (error) {
569
+ issues.push({ code: "unsafe-offset", path, message: error.message });
570
+ return;
571
+ }
572
+ if (current < previous || current < 0 || current > childLength) {
573
+ issues.push({
574
+ code: "invalid-offset",
575
+ path,
576
+ message: "Offsets must be monotonic and within child storage."
577
+ });
578
+ return;
579
+ }
580
+ previous = current;
581
+ }
582
+ }
583
+ function validateValidity(validity, length, path, issues) {
584
+ if (!validity)
585
+ return;
586
+ const bitOffset = validity.bitOffset || 0;
587
+ if (bitOffset < 0 || bitOffset + length > validity.values.length * 8) {
588
+ issues.push({ code: "invalid-validity", path, message: "Validity bitmap is too short." });
589
+ }
590
+ }
591
+ function validateColumnLayout(column, issues) {
592
+ var _a;
593
+ if (column.encoding === "geoarrow.wkb" || column.encoding === "geoarrow.wkt") {
594
+ for (const [index, chunk] of column.chunks.entries()) {
595
+ const expectedEncoding = column.encoding === "geoarrow.wkb" ? "binary" : "utf8";
596
+ if (chunk.kind !== "serialized" || chunk.encoding !== expectedEncoding) {
597
+ issues.push({
598
+ code: "invalid-layout",
599
+ path: `chunks[${index}]`,
600
+ message: `Serialized encoding requires ${expectedEncoding} storage.`
601
+ });
602
+ }
603
+ }
604
+ return;
605
+ }
606
+ if (column.encoding === "geoarrow.box") {
607
+ for (const [index, chunk] of column.chunks.entries()) {
608
+ if (chunk.kind !== "struct") {
609
+ addInvalidLayout(`chunks[${index}]`, "Box encoding requires struct storage.", issues);
610
+ continue;
611
+ }
612
+ const requiredNames = column.dimension === "xy" ? ["xmin", "ymin", "xmax", "ymax"] : column.dimension === "xyz" ? ["xmin", "ymin", "zmin", "xmax", "ymax", "zmax"] : column.dimension === "xym" ? ["xmin", "ymin", "mmin", "xmax", "ymax", "mmax"] : ["xmin", "ymin", "zmin", "mmin", "xmax", "ymax", "zmax", "mmax"];
613
+ for (const name of requiredNames) {
614
+ if (((_a = chunk.children[name]) == null ? void 0 : _a.kind) !== "primitive") {
615
+ addInvalidLayout(`chunks[${index}].${name}`, `Box storage requires primitive ${name}.`, issues);
616
+ }
617
+ }
618
+ }
619
+ return;
620
+ }
621
+ if (!column.coordinateLayout) {
622
+ addInvalidLayout("coordinateLayout", "Native geometry requires a coordinate layout.", issues);
623
+ return;
624
+ }
625
+ for (const [index, chunk] of column.chunks.entries()) {
626
+ validateGeometryLayout(chunk, column.encoding, column, `chunks[${index}]`, issues);
627
+ }
628
+ }
629
+ function validateGeometryLayout(array, encoding, column, path, issues) {
630
+ if (encoding === "geoarrow.geometry") {
631
+ if (array.kind !== "dense-union") {
632
+ addInvalidLayout(path, "Mixed geometry encoding requires dense-union storage.", issues);
633
+ return;
634
+ }
635
+ validateUnionLayouts(array, column, path, issues);
636
+ return;
637
+ }
638
+ if (encoding === "geoarrow.geometrycollection") {
639
+ if (array.kind !== "list" || array.child.kind !== "dense-union") {
640
+ addInvalidLayout(path, "GeometryCollection requires list-of-dense-union storage.", issues);
641
+ return;
642
+ }
643
+ validateUnionLayouts(array.child, column, `${path}.child`, issues);
644
+ return;
645
+ }
646
+ let coordinateArray = array;
647
+ const depth = getEncodingDepth(encoding);
648
+ for (let level = 0; level < depth; level++) {
649
+ if (coordinateArray.kind !== "list") {
650
+ addInvalidLayout(path, `${encoding} requires ${depth} variable-list levels.`, issues);
651
+ return;
652
+ }
653
+ coordinateArray = coordinateArray.child;
654
+ }
655
+ validateCoordinateLayout(coordinateArray, column, path, issues);
656
+ }
657
+ function validateUnionLayouts(union, column, path, issues) {
658
+ for (const child of union.children) {
659
+ let encoding;
660
+ try {
661
+ encoding = child.encoding || getEncodingFromChildName(child.name);
662
+ } catch (error) {
663
+ addInvalidLayout(`${path}.${child.name}`, error.message, issues);
664
+ continue;
665
+ }
666
+ const childColumn = child.dimension || child.coordinateLayout ? {
667
+ ...column,
668
+ dimension: child.dimension || column.dimension,
669
+ coordinateLayout: child.coordinateLayout || column.coordinateLayout
670
+ } : column;
671
+ validateGeometryLayout(child.data, encoding, childColumn, `${path}.${child.name}`, issues);
672
+ }
673
+ }
674
+ function validateCoordinateLayout(array, column, path, issues) {
675
+ var _a;
676
+ const dimensionSize = getGeoArrowDimensionSize(column.dimension);
677
+ if (column.coordinateLayout === "interleaved") {
678
+ if (array.kind !== "fixed-size-list" || array.size !== dimensionSize || array.child.kind !== "primitive") {
679
+ addInvalidLayout(path, `Interleaved ${column.dimension} coordinates require fixed-size-list<${dimensionSize}> primitive storage.`, issues);
680
+ }
681
+ return;
682
+ }
683
+ if (array.kind !== "struct") {
684
+ addInvalidLayout(path, `Separated ${column.dimension} coordinates require struct storage.`, issues);
685
+ return;
686
+ }
687
+ const requiredNames = column.dimension === "xy" ? ["x", "y"] : column.dimension === "xyz" ? ["x", "y", "z"] : column.dimension === "xym" ? ["x", "y", "m"] : ["x", "y", "z", "m"];
688
+ for (const name of requiredNames) {
689
+ if (((_a = array.children[name]) == null ? void 0 : _a.kind) !== "primitive") {
690
+ addInvalidLayout(`${path}.${name}`, `Separated coordinates require primitive ${name}.`, issues);
691
+ }
692
+ }
693
+ }
694
+ function addInvalidLayout(path, message, issues) {
695
+ issues.push({ code: "invalid-layout", path, message });
696
+ }
697
+ function collectStorageKinds(array, kinds) {
698
+ kinds.push(array.kind);
699
+ switch (array.kind) {
700
+ case "fixed-size-list":
701
+ case "list":
702
+ collectStorageKinds(array.child, kinds);
703
+ break;
704
+ case "struct":
705
+ for (const child of Object.values(array.children))
706
+ collectStorageKinds(child, kinds);
707
+ break;
708
+ case "dense-union":
709
+ for (const child of array.children)
710
+ collectStorageKinds(child.data, kinds);
711
+ break;
712
+ default:
713
+ break;
714
+ }
715
+ }
716
+ function collectArrayBuffers(array, buffers) {
717
+ if (array.validity)
718
+ addBuffer(array.validity.values.buffer, buffers);
719
+ switch (array.kind) {
720
+ case "primitive":
721
+ addBuffer(array.values.buffer, buffers);
722
+ break;
723
+ case "fixed-size-list":
724
+ collectArrayBuffers(array.child, buffers);
725
+ break;
726
+ case "list":
727
+ addBuffer(array.offsets.buffer, buffers);
728
+ collectArrayBuffers(array.child, buffers);
729
+ break;
730
+ case "struct":
731
+ for (const child of Object.values(array.children))
732
+ collectArrayBuffers(child, buffers);
733
+ break;
734
+ case "dense-union":
735
+ addBuffer(array.typeIds.buffer, buffers);
736
+ addBuffer(array.valueOffsets.buffer, buffers);
737
+ for (const child of array.children)
738
+ collectArrayBuffers(child.data, buffers);
739
+ break;
740
+ case "serialized":
741
+ addBuffer(array.offsets.buffer, buffers);
742
+ addBuffer(array.values.buffer, buffers);
743
+ if (array.views)
744
+ addBuffer(array.views.buffer, buffers);
745
+ for (const data of array.dataBuffers || [])
746
+ addBuffer(data.buffer, buffers);
747
+ break;
748
+ }
749
+ }
750
+ function addBuffer(buffer, buffers) {
751
+ if (buffer instanceof ArrayBuffer)
752
+ buffers.add(buffer);
753
+ }
754
+ function normalizeSliceIndex(index, length) {
755
+ const normalized = index < 0 ? Math.max(0, length + index) : Math.min(length, index);
756
+ return Math.max(0, Math.trunc(normalized));
757
+ }
758
+
759
+ // dist/geoarrow/views.js
760
+ function* iterateGeoArrowBatches(column) {
761
+ assertNativeGeometryColumn(column);
762
+ let rowOffset = 0;
763
+ for (let chunkIndex = 0; chunkIndex < column.chunks.length; chunkIndex++) {
764
+ const chunk = column.chunks[chunkIndex];
765
+ yield { column: { ...column, chunks: [chunk] }, chunkIndex, rowOffset };
766
+ rowOffset += chunk.length;
767
+ }
768
+ }
769
+ function getGeoArrowRowView(column, rowIndex) {
770
+ assertNativeGeometryColumn(column);
771
+ if (!Number.isSafeInteger(rowIndex) || rowIndex < 0) {
772
+ throw new RangeError("GeoArrow row index must be a nonnegative safe integer");
773
+ }
774
+ let chunkRowIndex = rowIndex;
775
+ for (let chunkIndex = 0; chunkIndex < column.chunks.length; chunkIndex++) {
776
+ const chunk = column.chunks[chunkIndex];
777
+ if (chunkRowIndex >= chunk.length) {
778
+ chunkRowIndex -= chunk.length;
779
+ continue;
780
+ }
781
+ let rowColumn = {
782
+ ...column,
783
+ chunks: [sliceGeoArrowArray(chunk, chunkRowIndex, chunkRowIndex + 1)]
784
+ };
785
+ if (column.encoding === "geoarrow.geometry" && isGeoArrowValueValid(chunk.validity, chunkRowIndex)) {
786
+ if (chunk.kind !== "dense-union") {
787
+ throw new Error("Mixed GeoArrow geometry requires dense-union storage");
788
+ }
789
+ const physicalIndex = (chunk.offset || 0) + chunkRowIndex;
790
+ const child = chunk.children.find((candidate) => candidate.typeId === chunk.typeIds[physicalIndex]);
791
+ const valueOffset = chunk.valueOffsets[physicalIndex];
792
+ if (!child || !Number.isInteger(valueOffset) || valueOffset < 0 || valueOffset >= child.data.length) {
793
+ throw new Error("Invalid GeoArrow union row dispatch");
794
+ }
795
+ const encoding = child.encoding || getEncodingFromChildName(child.name);
796
+ if (encoding === "geoarrow.geometry") {
797
+ throw new Error("GeoArrow geometry union children must be concrete geometries");
798
+ }
799
+ const data = sliceGeoArrowArray(child.data, valueOffset, valueOffset + 1);
800
+ rowColumn = {
801
+ ...column,
802
+ encoding,
803
+ dimension: child.dimension ?? column.dimension,
804
+ coordinateLayout: child.coordinateLayout ?? column.coordinateLayout,
805
+ chunks: [data]
806
+ };
807
+ assertNativeGeometryColumn(rowColumn);
808
+ }
809
+ return { column: rowColumn, rowIndex, chunkIndex, chunkRowIndex };
810
+ }
811
+ throw new RangeError("GeoArrow row index exceeds column length");
812
+ }
813
+ function concatenateGeoArrowColumns(columns) {
814
+ let firstColumn;
815
+ const chunks = [];
816
+ for (const column of columns) {
817
+ assertNativeGeometryColumn(column);
818
+ if (!firstColumn) {
819
+ firstColumn = column;
820
+ } else if (column.encoding !== firstColumn.encoding || column.dimension !== firstColumn.dimension || column.coordinateLayout !== firstColumn.coordinateLayout || (column.edges ?? "planar") !== (firstColumn.edges ?? "planar") || column.spatialReference !== firstColumn.spatialReference || column.metadata !== firstColumn.metadata) {
821
+ throw new Error("Cannot concatenate GeoArrow columns with different semantic envelopes");
822
+ }
823
+ for (const chunk of column.chunks)
824
+ chunks.push(chunk);
825
+ }
826
+ if (!firstColumn)
827
+ throw new Error("At least one GeoArrow column is required");
828
+ return { ...firstColumn, chunks };
829
+ }
830
+ function assertNativeGeometryColumn(column) {
831
+ if (column.encoding === "geoarrow.wkb" || column.encoding === "geoarrow.wkt" || column.encoding === "geoarrow.box") {
832
+ throw new Error("GeoArrow geometry views require native geometry; decode WKB/WKT first");
833
+ }
834
+ }
835
+
836
+ // dist/geoarrow/builder.js
837
+ var GeoArrowBuilder = class _GeoArrowBuilder {
838
+ constructor(options) {
839
+ this.length = 0;
840
+ this.nullCount = 0;
841
+ this.coordinateCount = 0;
842
+ this.partCount = 0;
843
+ this.ringCount = 0;
844
+ this.eventStack = [];
845
+ this.mode = options.mode;
846
+ this.encoding = options.encoding;
847
+ this.dimension = options.dimension || "xy";
848
+ this.coordinateLayout = options.coordinateLayout || "interleaved";
849
+ this.offsetType = options.offsetType || "int32";
850
+ this.coordinateType = options.coordinateType || "float64";
851
+ this.target = options.mode === "write" ? options.target : void 0;
852
+ if (this.target)
853
+ this.initializeTargetOffsets(this.target);
854
+ }
855
+ /** Appends one geometry row or null. */
856
+ append(geometry) {
857
+ var _a, _b, _c, _d, _e, _f;
858
+ const rowIndex = this.length++;
859
+ if (!geometry) {
860
+ this.nullCount++;
861
+ this.appendNull(rowIndex);
862
+ return this;
863
+ }
864
+ const expectedType = getGeoArrowGeometryType(this.encoding);
865
+ if (geometry.type !== expectedType) {
866
+ throw new Error(`GeoArrowBuilder for ${this.encoding} cannot append ${geometry.type}`);
867
+ }
868
+ if (geometry.type === "GeometryCollection") {
869
+ throw new Error("GeoArrowBuilder only accepts concrete geometry families");
870
+ }
871
+ if (this.target)
872
+ setValidityBit(this.target.validity, rowIndex);
873
+ const depth = getBuilderDepth(this.encoding);
874
+ const coordinates = geometry.coordinates;
875
+ if (depth === 0) {
876
+ this.writeCoordinateValues(coordinates);
877
+ } else if (depth === 1) {
878
+ this.writeCoordinateList(coordinates);
879
+ this.writeOffset((_a = this.target) == null ? void 0 : _a.geometryOffsets, rowIndex + 1, this.coordinateCount);
880
+ } else if (depth === 2) {
881
+ for (const part of coordinates) {
882
+ this.writeCoordinateList(part);
883
+ this.partCount++;
884
+ this.writeOffset((_b = this.target) == null ? void 0 : _b.partOffsets, this.partCount, this.coordinateCount);
885
+ }
886
+ this.writeOffset((_c = this.target) == null ? void 0 : _c.geometryOffsets, rowIndex + 1, this.partCount);
887
+ } else {
888
+ for (const polygon of coordinates) {
889
+ for (const ring of polygon) {
890
+ this.writeCoordinateList(ring);
891
+ this.ringCount++;
892
+ this.writeOffset((_d = this.target) == null ? void 0 : _d.ringOffsets, this.ringCount, this.coordinateCount);
893
+ }
894
+ this.partCount++;
895
+ this.writeOffset((_e = this.target) == null ? void 0 : _e.partOffsets, this.partCount, this.ringCount);
896
+ }
897
+ this.writeOffset((_f = this.target) == null ? void 0 : _f.geometryOffsets, rowIndex + 1, this.partCount);
898
+ }
899
+ return this;
900
+ }
901
+ /** Returns current exact allocation counts. */
902
+ getMeasurement() {
903
+ const depth = getBuilderDepth(this.encoding);
904
+ return {
905
+ length: this.length,
906
+ nullCount: this.nullCount,
907
+ coordinateCount: this.coordinateCount,
908
+ geometryOffsetCount: depth >= 1 ? this.length + 1 : 0,
909
+ partOffsetCount: depth >= 2 ? this.partCount + 1 : 0,
910
+ ringOffsetCount: depth >= 3 ? this.ringCount + 1 : 0
911
+ };
912
+ }
913
+ /** Allocates a write target from the current measure pass. */
914
+ allocateTarget() {
915
+ if (this.mode !== "measure")
916
+ throw new Error("Only a measure builder can allocate a target");
917
+ return allocateGeoArrowBuilderTarget(this.getMeasurement(), {
918
+ encoding: this.encoding,
919
+ dimension: this.dimension,
920
+ coordinateLayout: this.coordinateLayout,
921
+ offsetType: this.offsetType,
922
+ coordinateType: this.coordinateType
923
+ });
924
+ }
925
+ /** Finishes a write pass and returns a one-chunk borrowed column. */
926
+ finish() {
927
+ if (!this.target)
928
+ throw new Error("A measure builder has no finished column");
929
+ const measurement = this.getMeasurement();
930
+ assertTargetCapacity(this.target, measurement, getGeoArrowDimensionSize(this.dimension));
931
+ const coordinates = makeCoordinateArray(this.target.coordinates, measurement.coordinateCount, this.dimension, this.coordinateLayout);
932
+ const depth = getBuilderDepth(this.encoding);
933
+ let chunk = coordinates;
934
+ if (depth >= 3) {
935
+ chunk = {
936
+ kind: "list",
937
+ length: this.ringCount,
938
+ offsets: this.target.ringOffsets,
939
+ child: chunk
940
+ };
941
+ }
942
+ if (depth >= 2) {
943
+ chunk = {
944
+ kind: "list",
945
+ length: this.partCount,
946
+ offsets: this.target.partOffsets,
947
+ child: chunk
948
+ };
949
+ }
950
+ if (depth >= 1) {
951
+ chunk = {
952
+ kind: "list",
953
+ length: this.length,
954
+ offsets: this.target.geometryOffsets,
955
+ child: chunk,
956
+ validity: { values: this.target.validity }
957
+ };
958
+ } else {
959
+ chunk = { ...chunk, validity: { values: this.target.validity } };
960
+ }
961
+ return {
962
+ encoding: this.encoding,
963
+ dimension: this.dimension,
964
+ coordinateLayout: this.coordinateLayout,
965
+ chunks: [chunk]
966
+ };
967
+ }
968
+ /** Builds a homogeneous column using an internal measure/write pair. */
969
+ static build(rows, options) {
970
+ const measure = new _GeoArrowBuilder({ ...options, mode: "measure" });
971
+ for (const row of rows)
972
+ measure.append(row);
973
+ const write = new _GeoArrowBuilder({
974
+ ...options,
975
+ mode: "write",
976
+ target: measure.allocateTarget()
977
+ });
978
+ for (const row of rows)
979
+ write.append(row);
980
+ return write.finish();
981
+ }
982
+ appendNull(rowIndex) {
983
+ var _a;
984
+ const depth = getBuilderDepth(this.encoding);
985
+ if (depth === 0) {
986
+ this.writeCoordinateValues(new Array(getGeoArrowDimensionSize(this.dimension)).fill(0));
987
+ } else {
988
+ this.writeOffset((_a = this.target) == null ? void 0 : _a.geometryOffsets, rowIndex + 1, depth === 1 ? this.coordinateCount : this.partCount);
989
+ }
990
+ }
991
+ writeCoordinateList(coordinates) {
992
+ for (const coordinate of coordinates)
993
+ this.writeCoordinateValues(coordinate);
994
+ }
995
+ writeCoordinateValues(coordinate) {
996
+ const size = getGeoArrowDimensionSize(this.dimension);
997
+ if (coordinate.length === 0 && (this.encoding === "geoarrow.point" || this.encoding === "geoarrow.multipoint")) {
998
+ coordinate = new Array(size).fill(Number.NaN);
999
+ }
1000
+ if (coordinate.length !== size) {
1001
+ throw new Error(`Expected ${size} coordinate values for ${this.dimension}`);
1002
+ }
1003
+ if (this.target)
1004
+ writeCoordinate(this.target.coordinates, this.coordinateCount, coordinate, this.dimension);
1005
+ this.coordinateCount++;
1006
+ }
1007
+ writeCoordinateComponents(x, y, z, m, sourceDimension) {
1008
+ const targetZ = sourceDimension === "xyz" || sourceDimension === "xyzm" ? z ?? 0 : 0;
1009
+ const targetM = sourceDimension === "xym" || sourceDimension === "xyzm" ? m ?? 0 : 0;
1010
+ if (this.target) {
1011
+ writeCoordinateComponents(this.target.coordinates, this.coordinateCount, x, y, targetZ, targetM, this.dimension);
1012
+ }
1013
+ this.coordinateCount++;
1014
+ }
1015
+ /** Begins an event-driven geometry. Events are accepted by both measure and write builders. */
1016
+ beginGeometry(type, dimension = this.dimension, _count) {
1017
+ const direct = getGeoArrowGeometryType(this.encoding) === type;
1018
+ const rowIndex = direct ? this.length++ : -1;
1019
+ this.eventStack.push({
1020
+ type,
1021
+ dimension,
1022
+ direct,
1023
+ rowIndex,
1024
+ ringStarted: false,
1025
+ polygonStarted: false,
1026
+ ...direct ? {} : { rings: [], polygons: [] },
1027
+ ...direct ? {} : { children: [] }
1028
+ });
1029
+ return this;
1030
+ }
1031
+ /** Begins a polygon part inside an event-built MultiPolygon. */
1032
+ beginPolygon() {
1033
+ const state = this.eventStack[this.eventStack.length - 1];
1034
+ if (!state || state.type !== "MultiPolygon") {
1035
+ throw new Error("beginPolygon must follow beginGeometry('MultiPolygon')");
1036
+ }
1037
+ if (state.direct) {
1038
+ this.finishEventRing(state);
1039
+ this.finishEventPolygon(state);
1040
+ state.polygonStarted = true;
1041
+ return this;
1042
+ }
1043
+ state.currentPolygon = [];
1044
+ state.polygons.push(state.currentPolygon);
1045
+ state.currentRing = void 0;
1046
+ return this;
1047
+ }
1048
+ /** Begins a ring/part in the current event geometry. */
1049
+ beginRing(_count) {
1050
+ const state = this.eventStack[this.eventStack.length - 1];
1051
+ if (!state)
1052
+ throw new Error("beginRing must follow beginGeometry");
1053
+ if (state.direct) {
1054
+ this.finishEventRing(state);
1055
+ state.ringStarted = true;
1056
+ return this;
1057
+ }
1058
+ state.currentRing = [];
1059
+ if (state.type === "MultiPolygon") {
1060
+ if (!state.currentPolygon)
1061
+ this.beginPolygon();
1062
+ state.currentPolygon.push(state.currentRing);
1063
+ } else {
1064
+ state.rings.push(state.currentRing);
1065
+ }
1066
+ return this;
1067
+ }
1068
+ /** Writes one coordinate into the current event ring or point. */
1069
+ writeCoordinate(x, y, z, m) {
1070
+ const state = this.eventStack[this.eventStack.length - 1];
1071
+ if (!state)
1072
+ throw new Error("writeCoordinate must follow beginGeometry");
1073
+ if (typeof x === "number" && state.direct) {
1074
+ this.writeCoordinateComponents(x, y, z, m, state.dimension);
1075
+ return this;
1076
+ }
1077
+ const coordinate = Array.isArray(x) ? [...x] : [x, y, ...z === void 0 ? [] : [z], ...m === void 0 ? [] : [m]];
1078
+ const size = getGeoArrowDimensionSize(state.dimension);
1079
+ if (coordinate.length !== size)
1080
+ throw new Error(`Expected ${size} coordinate values for ${state.dimension}`);
1081
+ if (state.direct) {
1082
+ this.writeCoordinateValues(resizeEventCoordinate(coordinate, state.dimension, this.dimension));
1083
+ return this;
1084
+ }
1085
+ if (state.type === "Point") {
1086
+ state.rings = [[coordinate]];
1087
+ return this;
1088
+ }
1089
+ if (!state.currentRing)
1090
+ this.beginRing();
1091
+ state.currentRing.push(coordinate);
1092
+ return this;
1093
+ }
1094
+ /** Writes scalar ordinates tagged with their source dimension without allocating a tuple. */
1095
+ writeCoordinateFromDimension(x, y, z, m, sourceDimension) {
1096
+ const state = this.eventStack[this.eventStack.length - 1];
1097
+ if (!state)
1098
+ throw new Error("writeCoordinateFromDimension must follow beginGeometry");
1099
+ if (state.direct) {
1100
+ this.writeCoordinateComponents(x, y, z, m, sourceDimension);
1101
+ return this;
1102
+ }
1103
+ const coordinate = getDimensionNames(state.dimension).map((name) => {
1104
+ if (name === "x")
1105
+ return x;
1106
+ if (name === "y")
1107
+ return y;
1108
+ if (name === "z")
1109
+ return sourceDimension === "xyz" || sourceDimension === "xyzm" ? z ?? 0 : 0;
1110
+ return sourceDimension === "xym" || sourceDimension === "xyzm" ? m ?? 0 : 0;
1111
+ });
1112
+ return this.writeCoordinate(coordinate);
1113
+ }
1114
+ /** Ends the current event geometry and appends it to the builder/parent. */
1115
+ endGeometry() {
1116
+ var _a, _b, _c;
1117
+ const state = this.eventStack.pop();
1118
+ if (!state)
1119
+ throw new Error("endGeometry without beginGeometry");
1120
+ if (state.direct) {
1121
+ this.finishEventRing(state);
1122
+ this.finishEventPolygon(state);
1123
+ const depth = getBuilderDepth(this.encoding);
1124
+ if (depth >= 1) {
1125
+ this.writeOffset((_a = this.target) == null ? void 0 : _a.geometryOffsets, state.rowIndex + 1, depth === 1 ? this.coordinateCount : this.partCount);
1126
+ }
1127
+ if (this.target)
1128
+ setValidityBit(this.target.validity, state.rowIndex);
1129
+ return this;
1130
+ }
1131
+ const coordinates = state.rings || [];
1132
+ let geometry;
1133
+ switch (state.type) {
1134
+ case "Point":
1135
+ geometry = { type: "Point", coordinates: ((_b = coordinates[0]) == null ? void 0 : _b[0]) || [] };
1136
+ break;
1137
+ case "LineString":
1138
+ geometry = { type: "LineString", coordinates: coordinates[0] || [] };
1139
+ break;
1140
+ case "MultiPoint":
1141
+ geometry = { type: "MultiPoint", coordinates: coordinates.flat() };
1142
+ break;
1143
+ case "Polygon":
1144
+ geometry = { type: "Polygon", coordinates };
1145
+ break;
1146
+ case "MultiLineString":
1147
+ geometry = { type: "MultiLineString", coordinates };
1148
+ break;
1149
+ case "MultiPolygon":
1150
+ geometry = {
1151
+ type: "MultiPolygon",
1152
+ coordinates: ((_c = state.polygons) == null ? void 0 : _c.length) ? state.polygons : [coordinates]
1153
+ };
1154
+ break;
1155
+ case "GeometryCollection":
1156
+ geometry = { type: "GeometryCollection", geometries: state.children || [] };
1157
+ break;
1158
+ }
1159
+ const parent = this.eventStack[this.eventStack.length - 1];
1160
+ if ((parent == null ? void 0 : parent.type) === "GeometryCollection")
1161
+ parent.children.push(geometry);
1162
+ else
1163
+ this.append(geometry);
1164
+ return this;
1165
+ }
1166
+ writeOffset(target, index, value) {
1167
+ if (!target)
1168
+ return;
1169
+ if (target instanceof BigInt64Array)
1170
+ target[index] = BigInt(value);
1171
+ else
1172
+ target[index] = value;
1173
+ }
1174
+ finishEventRing(state) {
1175
+ var _a, _b;
1176
+ if (!state.direct || !state.ringStarted)
1177
+ return;
1178
+ if (this.encoding === "geoarrow.multipolygon") {
1179
+ this.ringCount++;
1180
+ this.writeOffset((_a = this.target) == null ? void 0 : _a.ringOffsets, this.ringCount, this.coordinateCount);
1181
+ } else if (getBuilderDepth(this.encoding) >= 2) {
1182
+ this.partCount++;
1183
+ this.writeOffset((_b = this.target) == null ? void 0 : _b.partOffsets, this.partCount, this.coordinateCount);
1184
+ }
1185
+ state.ringStarted = false;
1186
+ }
1187
+ finishEventPolygon(state) {
1188
+ var _a;
1189
+ if (!state.direct || !state.polygonStarted)
1190
+ return;
1191
+ if (this.encoding === "geoarrow.multipolygon") {
1192
+ this.partCount++;
1193
+ this.writeOffset((_a = this.target) == null ? void 0 : _a.partOffsets, this.partCount, this.ringCount);
1194
+ }
1195
+ state.polygonStarted = false;
1196
+ }
1197
+ initializeTargetOffsets(target) {
1198
+ this.writeOffset(target.geometryOffsets, 0, 0);
1199
+ this.writeOffset(target.partOffsets, 0, 0);
1200
+ this.writeOffset(target.ringOffsets, 0, 0);
1201
+ }
1202
+ };
1203
+ function allocateGeoArrowBuilderTarget(measurement, options) {
1204
+ const dimension = options.dimension || "xy";
1205
+ const size = getGeoArrowDimensionSize(dimension);
1206
+ const FloatArray = options.coordinateType === "float32" ? Float32Array : Float64Array;
1207
+ const coordinateLayout = options.coordinateLayout || "interleaved";
1208
+ const coordinates = coordinateLayout === "interleaved" ? new FloatArray(measurement.coordinateCount * size) : makeSeparatedCoordinateTarget(FloatArray, measurement.coordinateCount, dimension);
1209
+ const OffsetArray = options.offsetType === "int64" ? BigInt64Array : Int32Array;
1210
+ return {
1211
+ validity: new Uint8Array(Math.ceil(measurement.length / 8)),
1212
+ coordinates,
1213
+ geometryOffsets: measurement.geometryOffsetCount ? new OffsetArray(measurement.geometryOffsetCount) : void 0,
1214
+ partOffsets: measurement.partOffsetCount ? new OffsetArray(measurement.partOffsetCount) : void 0,
1215
+ ringOffsets: measurement.ringOffsetCount ? new OffsetArray(measurement.ringOffsetCount) : void 0
1216
+ };
1217
+ }
1218
+ function makeGeoArrowColumnFromGeometryRows(rows, options = {}) {
1219
+ const geometryTypes = [...new Set(rows.filter(Boolean).map((row) => row.type))];
1220
+ const dimension = options.dimension || inferRowsDimension(rows);
1221
+ if (options.encoding === "geoarrow.geometry") {
1222
+ return {
1223
+ encoding: "geoarrow.geometry",
1224
+ dimension,
1225
+ coordinateLayout: options.coordinateLayout || "interleaved",
1226
+ chunks: [makeDenseUnionArray(rows, options, dimension)]
1227
+ };
1228
+ }
1229
+ if (geometryTypes.length === 0) {
1230
+ return GeoArrowBuilder.build(rows, { ...options, dimension, encoding: "geoarrow.point" });
1231
+ }
1232
+ if (geometryTypes.length === 1 && geometryTypes[0] !== "GeometryCollection") {
1233
+ return GeoArrowBuilder.build(rows, {
1234
+ ...options,
1235
+ dimension,
1236
+ encoding: getGeoArrowEncodingForGeometry(geometryTypes[0])
1237
+ });
1238
+ }
1239
+ if (geometryTypes.length === 1 && geometryTypes[0] === "GeometryCollection") {
1240
+ return {
1241
+ encoding: "geoarrow.geometrycollection",
1242
+ dimension,
1243
+ coordinateLayout: options.coordinateLayout || "interleaved",
1244
+ chunks: [makeGeometryCollectionArray(rows, options, dimension)]
1245
+ };
1246
+ }
1247
+ return {
1248
+ encoding: "geoarrow.geometry",
1249
+ dimension,
1250
+ coordinateLayout: options.coordinateLayout || "interleaved",
1251
+ chunks: [makeDenseUnionArray(rows, options, dimension)]
1252
+ };
1253
+ }
1254
+ function makeDenseUnionArray(rows, options, dimension) {
1255
+ const nonNullTypes = [...new Set(rows.filter(Boolean).map((row) => row.type))];
1256
+ const fallbackType = nonNullTypes[0] || "Point";
1257
+ const childRows = /* @__PURE__ */ new Map();
1258
+ for (const type of nonNullTypes.length ? nonNullTypes : [fallbackType])
1259
+ childRows.set(type, []);
1260
+ const typeIds = new Int8Array(rows.length);
1261
+ const valueOffsets = new Int32Array(rows.length);
1262
+ for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
1263
+ const geometry = rows[rowIndex];
1264
+ const type = (geometry == null ? void 0 : geometry.type) || fallbackType;
1265
+ const values = childRows.get(type) || [];
1266
+ typeIds[rowIndex] = getGeometryTypeId(type, dimension);
1267
+ valueOffsets[rowIndex] = values.length;
1268
+ values.push(geometry);
1269
+ childRows.set(type, values);
1270
+ }
1271
+ const children = [...childRows.entries()].sort(([left], [right]) => getGeometryTypeId(left, dimension) - getGeometryTypeId(right, dimension)).map(([type, values]) => {
1272
+ const data = type === "GeometryCollection" ? makeGeometryCollectionArray(values, options, dimension) : GeoArrowBuilder.build(values, {
1273
+ ...options,
1274
+ dimension,
1275
+ encoding: getGeoArrowEncodingForGeometry(type)
1276
+ }).chunks[0];
1277
+ return {
1278
+ name: type,
1279
+ typeId: getGeometryTypeId(type, dimension),
1280
+ encoding: getGeoArrowEncodingForGeometry(type),
1281
+ dimension,
1282
+ coordinateLayout: options.coordinateLayout || "interleaved",
1283
+ data
1284
+ };
1285
+ });
1286
+ return {
1287
+ kind: "dense-union",
1288
+ length: rows.length,
1289
+ typeIds,
1290
+ valueOffsets,
1291
+ children
1292
+ };
1293
+ }
1294
+ function makeGeometryCollectionArray(rows, options, dimension) {
1295
+ const offsets = new Int32Array(rows.length + 1);
1296
+ const validity = new Uint8Array(Math.ceil(rows.length / 8));
1297
+ const flattened = [];
1298
+ for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
1299
+ const row = rows[rowIndex];
1300
+ if ((row == null ? void 0 : row.type) === "GeometryCollection") {
1301
+ flattened.push(...row.geometries);
1302
+ setValidityBit(validity, rowIndex);
1303
+ }
1304
+ offsets[rowIndex + 1] = flattened.length;
1305
+ }
1306
+ return {
1307
+ kind: "list",
1308
+ length: rows.length,
1309
+ offsets,
1310
+ child: makeDenseUnionArray(flattened, options, dimension),
1311
+ validity: { values: validity }
1312
+ };
1313
+ }
1314
+ function makeCoordinateArray(coordinates, coordinateCount, dimension, layout) {
1315
+ const size = getGeoArrowDimensionSize(dimension);
1316
+ if (layout === "interleaved") {
1317
+ const values = coordinates;
1318
+ return {
1319
+ kind: "fixed-size-list",
1320
+ length: coordinateCount,
1321
+ size,
1322
+ child: { kind: "primitive", length: coordinateCount * size, values }
1323
+ };
1324
+ }
1325
+ const separated = coordinates;
1326
+ const children = {
1327
+ x: { kind: "primitive", length: coordinateCount, values: separated.x },
1328
+ y: { kind: "primitive", length: coordinateCount, values: separated.y }
1329
+ };
1330
+ if (separated.z) {
1331
+ children["z"] = { kind: "primitive", length: coordinateCount, values: separated.z };
1332
+ }
1333
+ if (separated.m) {
1334
+ children["m"] = { kind: "primitive", length: coordinateCount, values: separated.m };
1335
+ }
1336
+ return { kind: "struct", length: coordinateCount, children };
1337
+ }
1338
+ function makeSeparatedCoordinateTarget(FloatArray, count, dimension) {
1339
+ return {
1340
+ x: new FloatArray(count),
1341
+ y: new FloatArray(count),
1342
+ z: dimension === "xyz" || dimension === "xyzm" ? new FloatArray(count) : void 0,
1343
+ m: dimension === "xym" || dimension === "xyzm" ? new FloatArray(count) : void 0
1344
+ };
1345
+ }
1346
+ function writeCoordinate(target, coordinateIndex, coordinate, dimension) {
1347
+ if (target instanceof Float32Array || target instanceof Float64Array) {
1348
+ target.set(coordinate, coordinateIndex * coordinate.length);
1349
+ return;
1350
+ }
1351
+ target.x[coordinateIndex] = coordinate[0];
1352
+ target.y[coordinateIndex] = coordinate[1];
1353
+ if (dimension === "xyz")
1354
+ target.z[coordinateIndex] = coordinate[2];
1355
+ else if (dimension === "xym")
1356
+ target.m[coordinateIndex] = coordinate[2];
1357
+ else if (dimension === "xyzm") {
1358
+ target.z[coordinateIndex] = coordinate[2];
1359
+ target.m[coordinateIndex] = coordinate[3];
1360
+ }
1361
+ }
1362
+ function writeCoordinateComponents(target, coordinateIndex, x, y, z, m, dimension) {
1363
+ if (target instanceof Float32Array || target instanceof Float64Array) {
1364
+ const size = getGeoArrowDimensionSize(dimension);
1365
+ const offset = coordinateIndex * size;
1366
+ target[offset] = x;
1367
+ target[offset + 1] = y;
1368
+ if (dimension === "xyz")
1369
+ target[offset + 2] = z;
1370
+ else if (dimension === "xym")
1371
+ target[offset + 2] = m;
1372
+ else if (dimension === "xyzm") {
1373
+ target[offset + 2] = z;
1374
+ target[offset + 3] = m;
1375
+ }
1376
+ return;
1377
+ }
1378
+ target.x[coordinateIndex] = x;
1379
+ target.y[coordinateIndex] = y;
1380
+ if (dimension === "xyz")
1381
+ target.z[coordinateIndex] = z;
1382
+ else if (dimension === "xym")
1383
+ target.m[coordinateIndex] = m;
1384
+ else if (dimension === "xyzm") {
1385
+ target.z[coordinateIndex] = z;
1386
+ target.m[coordinateIndex] = m;
1387
+ }
1388
+ }
1389
+ function resizeEventCoordinate(coordinate, sourceDimension, targetDimension) {
1390
+ if (sourceDimension === targetDimension)
1391
+ return [...coordinate];
1392
+ const sourceNames = getDimensionNames(sourceDimension);
1393
+ return getDimensionNames(targetDimension).map((name) => {
1394
+ const index = sourceNames.indexOf(name);
1395
+ return index >= 0 ? coordinate[index] ?? 0 : 0;
1396
+ });
1397
+ }
1398
+ function getDimensionNames(dimension) {
1399
+ switch (dimension) {
1400
+ case "xy":
1401
+ return ["x", "y"];
1402
+ case "xyz":
1403
+ return ["x", "y", "z"];
1404
+ case "xym":
1405
+ return ["x", "y", "m"];
1406
+ case "xyzm":
1407
+ return ["x", "y", "z", "m"];
1408
+ }
1409
+ }
1410
+ function setValidityBit(validity, index) {
1411
+ validity[index >> 3] |= 1 << (index & 7);
1412
+ }
1413
+ function getBuilderDepth(encoding) {
1414
+ switch (encoding) {
1415
+ case "geoarrow.point":
1416
+ return 0;
1417
+ case "geoarrow.linestring":
1418
+ case "geoarrow.multipoint":
1419
+ return 1;
1420
+ case "geoarrow.polygon":
1421
+ case "geoarrow.multilinestring":
1422
+ return 2;
1423
+ case "geoarrow.multipolygon":
1424
+ return 3;
1425
+ }
1426
+ }
1427
+ function getGeometryTypeId(type, dimension = "xy") {
1428
+ const family = [
1429
+ "Point",
1430
+ "LineString",
1431
+ "Polygon",
1432
+ "MultiPoint",
1433
+ "MultiLineString",
1434
+ "MultiPolygon",
1435
+ "GeometryCollection"
1436
+ ].indexOf(type);
1437
+ const dimensionIndex = ["xy", "xyz", "xym", "xyzm"].indexOf(dimension);
1438
+ return family < 0 || dimensionIndex < 0 ? 1 : family * 4 + dimensionIndex + 1;
1439
+ }
1440
+ function inferRowsDimension(rows) {
1441
+ let size = 2;
1442
+ const visit = (value) => {
1443
+ if (!Array.isArray(value) || value.length === 0)
1444
+ return;
1445
+ if (typeof value[0] === "number")
1446
+ size = Math.max(size, value.length);
1447
+ else
1448
+ for (const child of value)
1449
+ visit(child);
1450
+ };
1451
+ const visitGeometry2 = (geometry) => {
1452
+ if (geometry.type === "GeometryCollection") {
1453
+ for (const child of geometry.geometries)
1454
+ visitGeometry2(child);
1455
+ } else {
1456
+ visit(geometry.coordinates);
1457
+ }
1458
+ };
1459
+ for (const row of rows) {
1460
+ if (row)
1461
+ visitGeometry2(row);
1462
+ }
1463
+ return size >= 4 ? "xyzm" : size === 3 ? "xyz" : "xy";
1464
+ }
1465
+ function assertTargetCapacity(target, measurement, size) {
1466
+ const coordinateLength = target.coordinates instanceof Float32Array || target.coordinates instanceof Float64Array ? target.coordinates.length / size : target.coordinates.x.length;
1467
+ if (coordinateLength < measurement.coordinateCount || target.validity.length * 8 < measurement.length) {
1468
+ throw new Error("GeoArrowBuilder target is smaller than its measured output");
1469
+ }
1470
+ }
1471
+
1472
+ // dist/geoarrow/kernels.js
1473
+ function getGeoArrowBounds(column) {
1474
+ if (column.encoding === "geoarrow.box")
1475
+ return getGeoArrowBoxBounds(column);
1476
+ let minimumX = Number.POSITIVE_INFINITY;
1477
+ let minimumY = Number.POSITIVE_INFINITY;
1478
+ let maximumX = Number.NEGATIVE_INFINITY;
1479
+ let maximumY = Number.NEGATIVE_INFINITY;
1480
+ visitGeoArrowCoordinates(column, (coordinate) => {
1481
+ const x = coordinate[0];
1482
+ const y = coordinate[1];
1483
+ if (Number.isFinite(x) && Number.isFinite(y)) {
1484
+ minimumX = Math.min(minimumX, x);
1485
+ minimumY = Math.min(minimumY, y);
1486
+ maximumX = Math.max(maximumX, x);
1487
+ maximumY = Math.max(maximumY, y);
1488
+ }
1489
+ return coordinate;
1490
+ });
1491
+ return Number.isFinite(minimumX) ? [minimumX, minimumY, maximumX, maximumY] : null;
1492
+ }
1493
+ function getGeoArrowRowBounds(column) {
1494
+ const rowCount = getGeoArrowRowCount(column);
1495
+ if (column.encoding === "geoarrow.box") {
1496
+ const result = [];
1497
+ for (const chunk of column.chunks) {
1498
+ for (let rowIndex = 0; rowIndex < chunk.length; rowIndex++) {
1499
+ if (chunk.kind !== "struct" || !isGeoArrowValueValid(chunk.validity, rowIndex)) {
1500
+ result.push(null);
1501
+ continue;
1502
+ }
1503
+ const index = (chunk.offset || 0) + rowIndex;
1504
+ const xmin = readPrimitiveNumber(chunk.children["xmin"], index);
1505
+ const ymin = readPrimitiveNumber(chunk.children["ymin"], index);
1506
+ const xmax = readPrimitiveNumber(chunk.children["xmax"], index);
1507
+ const ymax = readPrimitiveNumber(chunk.children["ymax"], index);
1508
+ result.push([xmin, ymin, xmax, ymax].every(Number.isFinite) ? [xmin, ymin, xmax, ymax] : null);
1509
+ }
1510
+ }
1511
+ return result;
1512
+ }
1513
+ const minimumX = new Float64Array(rowCount).fill(Number.POSITIVE_INFINITY);
1514
+ const minimumY = new Float64Array(rowCount).fill(Number.POSITIVE_INFINITY);
1515
+ const maximumX = new Float64Array(rowCount).fill(Number.NEGATIVE_INFINITY);
1516
+ const maximumY = new Float64Array(rowCount).fill(Number.NEGATIVE_INFINITY);
1517
+ visitGeoArrowCoordinates(column, (coordinate, sourceRowIndex) => {
1518
+ const [x, y] = coordinate;
1519
+ if (Number.isFinite(x) && Number.isFinite(y)) {
1520
+ minimumX[sourceRowIndex] = Math.min(minimumX[sourceRowIndex], x);
1521
+ minimumY[sourceRowIndex] = Math.min(minimumY[sourceRowIndex], y);
1522
+ maximumX[sourceRowIndex] = Math.max(maximumX[sourceRowIndex], x);
1523
+ maximumY[sourceRowIndex] = Math.max(maximumY[sourceRowIndex], y);
1524
+ }
1525
+ return coordinate;
1526
+ });
1527
+ const bounds = [];
1528
+ for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
1529
+ bounds.push(Number.isFinite(minimumX[rowIndex]) ? [minimumX[rowIndex], minimumY[rowIndex], maximumX[rowIndex], maximumY[rowIndex]] : null);
1530
+ }
1531
+ return bounds;
1532
+ }
1533
+ function getGeoArrowBoxBounds(column) {
1534
+ let minimumX = Number.POSITIVE_INFINITY;
1535
+ let minimumY = Number.POSITIVE_INFINITY;
1536
+ let maximumX = Number.NEGATIVE_INFINITY;
1537
+ let maximumY = Number.NEGATIVE_INFINITY;
1538
+ for (const chunk of column.chunks) {
1539
+ if (chunk.kind !== "struct")
1540
+ continue;
1541
+ const xmin = chunk.children["xmin"];
1542
+ const ymin = chunk.children["ymin"];
1543
+ const xmax = chunk.children["xmax"];
1544
+ const ymax = chunk.children["ymax"];
1545
+ if (!xmin || !ymin || !xmax || !ymax)
1546
+ continue;
1547
+ for (let rowIndex = 0; rowIndex < chunk.length; rowIndex++) {
1548
+ if (!isGeoArrowValueValid(chunk.validity, rowIndex))
1549
+ continue;
1550
+ const structIndex = (chunk.offset || 0) + rowIndex;
1551
+ const bounds = [
1552
+ readPrimitiveNumber(xmin, structIndex),
1553
+ readPrimitiveNumber(ymin, structIndex),
1554
+ readPrimitiveNumber(xmax, structIndex),
1555
+ readPrimitiveNumber(ymax, structIndex)
1556
+ ];
1557
+ if (bounds.every(Number.isFinite)) {
1558
+ minimumX = Math.min(minimumX, bounds[0]);
1559
+ minimumY = Math.min(minimumY, bounds[1]);
1560
+ maximumX = Math.max(maximumX, bounds[2]);
1561
+ maximumY = Math.max(maximumY, bounds[3]);
1562
+ }
1563
+ }
1564
+ }
1565
+ return Number.isFinite(minimumX) ? [minimumX, minimumY, maximumX, maximumY] : null;
1566
+ }
1567
+ function readPrimitiveNumber(array, index) {
1568
+ if (array.kind !== "primitive" || !isGeoArrowValueValid(array.validity, index))
1569
+ return Number.NaN;
1570
+ const valueIndex = (array.offset || 0) + index * (array.stride || 1);
1571
+ return Number(array.values[valueIndex]);
1572
+ }
1573
+ function mapGeoArrowCoordinates(column, mapper, options = {}, sourceDimension) {
1574
+ assertGeoArrowResourceLimits(column, options.limits);
1575
+ if (column.encoding === "geoarrow.wkb" || column.encoding === "geoarrow.wkt") {
1576
+ throw new Error("Coordinate mapping requires native GeoArrow storage");
1577
+ }
1578
+ const dimension = options.dimension || column.dimension;
1579
+ const layout = options.coordinateLayout || column.coordinateLayout || "interleaved";
1580
+ let rowOffset = 0;
1581
+ const chunks = column.chunks.map((chunk) => {
1582
+ const mapped = mapArrayCoordinates(chunk, column.encoding, rowOffset, dimension, layout, mapper, options.coordinateType || "preserve", options.dimension !== void 0, options.coordinateLayout !== void 0, sourceDimension);
1583
+ rowOffset += chunk.length;
1584
+ return mapped;
1585
+ });
1586
+ return { ...column, dimension, coordinateLayout: layout, chunks };
1587
+ }
1588
+ function mapGeoArrowCoordinatesInto(target, source, mapper, options = {}) {
1589
+ const mapped = mapGeoArrowCoordinates(source, mapper, {
1590
+ ...options,
1591
+ coordinateLayout: target.coordinateLayout || void 0
1592
+ });
1593
+ const sourceLeaves = collectCoordinateLeaves(mapped);
1594
+ const targetLeaves = collectCoordinateLeaves(target);
1595
+ if (sourceLeaves.length !== targetLeaves.length) {
1596
+ throw new Error("GeoArrow destination has different coordinate topology");
1597
+ }
1598
+ for (let index = 0; index < sourceLeaves.length; index++) {
1599
+ const sourceLeaf = sourceLeaves[index];
1600
+ const targetLeaf = targetLeaves[index];
1601
+ if (sourceLeaf.length !== targetLeaf.length) {
1602
+ throw new Error("GeoArrow destination coordinate buffer has a different length");
1603
+ }
1604
+ targetLeaf.set(sourceLeaf);
1605
+ }
1606
+ return target;
1607
+ }
1608
+ function interleaveGeoArrowCoordinates(column) {
1609
+ if (column.coordinateLayout === "interleaved")
1610
+ return column;
1611
+ if (!column.coordinateLayout)
1612
+ return column;
1613
+ return mapGeoArrowCoordinates(column, (coordinate) => coordinate, {
1614
+ coordinateLayout: "interleaved"
1615
+ });
1616
+ }
1617
+ function normalizeGeoArrowUnion(column) {
1618
+ if (column.encoding !== "geoarrow.geometry")
1619
+ return column;
1620
+ let changed = false;
1621
+ const chunks = column.chunks.map((chunk) => {
1622
+ if (chunk.kind !== "dense-union")
1623
+ return chunk;
1624
+ const children = [...chunk.children].sort((left, right) => left.typeId - right.typeId);
1625
+ changed || (changed = children.some((child, index) => child !== chunk.children[index]));
1626
+ return children.every((child, index) => child === chunk.children[index]) ? chunk : { ...chunk, children };
1627
+ });
1628
+ return changed ? { ...column, chunks } : column;
1629
+ }
1630
+ function convertGeoArrowColumn(column, options = {}) {
1631
+ const encoding = options.encoding === "native" || !options.encoding ? column.encoding : options.encoding;
1632
+ const dimension = options.dimension || column.dimension;
1633
+ const coordinateLayout = options.coordinateLayout === "preserve" || !options.coordinateLayout ? column.coordinateLayout : options.coordinateLayout;
1634
+ const requestedOffsetType = options.offsetType || "preserve";
1635
+ const currentOffsetType = getColumnOffsetType(column);
1636
+ if (encoding === column.encoding && dimension === column.dimension && coordinateLayout === column.coordinateLayout && (requestedOffsetType === "preserve" || requestedOffsetType === currentOffsetType) && (!options.coordinateType || options.coordinateType === "preserve")) {
1637
+ return column;
1638
+ }
1639
+ if (encoding === "geoarrow.wkb" || encoding === "geoarrow.wkt") {
1640
+ throw new Error("Use encodeGeoArrowWKB or encodeGeoArrowWKT for serialized output");
1641
+ }
1642
+ assertGeoArrowResourceLimits(column, options.limits);
1643
+ const needsCoordinateMap = dimension !== column.dimension || coordinateLayout !== column.coordinateLayout || options.coordinateType && options.coordinateType !== "preserve";
1644
+ const mapped = needsCoordinateMap ? mapGeoArrowCoordinates(column, (coordinate) => coordinate, {
1645
+ dimension,
1646
+ coordinateLayout: coordinateLayout || void 0,
1647
+ coordinateType: options.coordinateType,
1648
+ limits: options.limits
1649
+ }, column.dimension) : column;
1650
+ const offsetConverted = requestedOffsetType === "preserve" ? mapped : {
1651
+ ...mapped,
1652
+ chunks: mapped.chunks.map((chunk) => convertArrayOffsets(chunk, requestedOffsetType))
1653
+ };
1654
+ if (encoding === column.encoding)
1655
+ return offsetConverted;
1656
+ if (encoding === "geoarrow.geometry")
1657
+ return promoteToDenseUnion(offsetConverted);
1658
+ const promoted = promoteSingleFamily(offsetConverted, encoding, requestedOffsetType);
1659
+ if (promoted)
1660
+ return promoted;
1661
+ if (column.encoding === "geoarrow.geometry")
1662
+ return demoteDenseUnion(offsetConverted, encoding);
1663
+ throw new Error(`Rows cannot be represented as ${encoding}`);
1664
+ }
1665
+ function promoteSingleFamily(column, encoding, offsetType) {
1666
+ const sourceEncoding = column.encoding;
1667
+ const validPair = sourceEncoding === "geoarrow.point" && encoding === "geoarrow.multipoint" || sourceEncoding === "geoarrow.linestring" && encoding === "geoarrow.multilinestring" || sourceEncoding === "geoarrow.polygon" && encoding === "geoarrow.multipolygon";
1668
+ if (!validPair)
1669
+ return null;
1670
+ const chunks = column.chunks.map((chunk) => {
1671
+ const OffsetArray = offsetType === "int64" || offsetType === "preserve" && findOffsetType(chunk) === "int64" ? BigInt64Array : Int32Array;
1672
+ const offsets = new OffsetArray(chunk.length + 1);
1673
+ for (let index = 0; index <= chunk.length; index++) {
1674
+ if (offsets instanceof BigInt64Array)
1675
+ offsets[index] = BigInt(index);
1676
+ else
1677
+ offsets[index] = index;
1678
+ }
1679
+ return {
1680
+ kind: "list",
1681
+ length: chunk.length,
1682
+ offsets,
1683
+ child: chunk,
1684
+ validity: chunk.validity
1685
+ };
1686
+ });
1687
+ return { ...column, encoding, chunks };
1688
+ }
1689
+ function resizeCoordinate(coordinate, sourceDimension, targetDimension) {
1690
+ const sourceNames = getDimensionNames2(sourceDimension);
1691
+ return getDimensionNames2(targetDimension).map((name) => {
1692
+ const sourceIndex = sourceNames.indexOf(name);
1693
+ return sourceIndex >= 0 ? coordinate[sourceIndex] ?? 0 : 0;
1694
+ });
1695
+ }
1696
+ function rewindGeoArrow(column, options = {}) {
1697
+ assertGeoArrowResourceLimits(column, options.limits);
1698
+ if (column.encoding === "geoarrow.wkb" || column.encoding === "geoarrow.wkt") {
1699
+ throw new Error("Rewinding requires native GeoArrow storage");
1700
+ }
1701
+ const outerClockwise = (options.outer || "counter-clockwise") === "clockwise";
1702
+ let changed = false;
1703
+ const chunks = column.chunks.map((chunk) => {
1704
+ const clone = mapArrayCoordinates(chunk, column.encoding, 0, column.dimension, column.coordinateLayout || "interleaved", (coordinate) => coordinate, "preserve");
1705
+ changed || (changed = rewindArrayRings(clone, column.encoding, outerClockwise));
1706
+ return clone;
1707
+ });
1708
+ return changed ? { ...column, chunks } : column;
1709
+ }
1710
+ function assertGeoArrowResourceLimits(column, options = {}) {
1711
+ const rows = getGeoArrowRowCount(column);
1712
+ if (rows > (options.maximumRows ?? Number.POSITIVE_INFINITY)) {
1713
+ throw new Error(`GeoArrow row count ${rows} exceeds maximumRows`);
1714
+ }
1715
+ if (column.chunks.length > (options.maximumChunks ?? Number.POSITIVE_INFINITY)) {
1716
+ throw new Error(`GeoArrow chunk count ${column.chunks.length} exceeds maximumChunks`);
1717
+ }
1718
+ const coordinates = getGeoArrowVertexCount(column);
1719
+ if (coordinates > (options.maximumCoordinates ?? Number.POSITIVE_INFINITY)) {
1720
+ throw new Error(`GeoArrow coordinate count ${coordinates} exceeds maximumCoordinates`);
1721
+ }
1722
+ if (options.maximumNestingDepth !== void 0) {
1723
+ const depth = Math.max(0, ...column.chunks.map(getArrayDepth));
1724
+ if (depth > options.maximumNestingDepth) {
1725
+ throw new Error(`GeoArrow nesting depth ${depth} exceeds maximumNestingDepth`);
1726
+ }
1727
+ }
1728
+ if (options.maximumOutputBytes !== void 0) {
1729
+ const estimatedBytes = coordinates * getGeoArrowDimensionSize(column.dimension) * 8;
1730
+ if (estimatedBytes > options.maximumOutputBytes) {
1731
+ throw new Error(`GeoArrow estimated output ${estimatedBytes} exceeds maximumOutputBytes`);
1732
+ }
1733
+ }
1734
+ }
1735
+ function mapArrayCoordinates(array, encoding, rowOffset, targetDimension, targetLayout, mapper, coordinateType, forceDimension = false, forceLayout = false, sourceDimension, rowIndicesOverride) {
1736
+ if (encoding === "geoarrow.geometry" && array.kind === "dense-union") {
1737
+ const childRowIndices = collectUnionRowIndices(array, rowOffset);
1738
+ return {
1739
+ ...array,
1740
+ children: array.children.map((child, childIndex) => {
1741
+ const childEncoding = child.encoding || getEncodingFromChildName2(child.name);
1742
+ const childDimension = forceDimension ? targetDimension : child.dimension || targetDimension;
1743
+ const childLayout = forceLayout ? targetLayout : child.coordinateLayout || targetLayout;
1744
+ return {
1745
+ ...child,
1746
+ data: mapArrayCoordinates(child.data, childEncoding, rowOffset, childDimension, childLayout, mapper, coordinateType, forceDimension, forceLayout, childDimension, childRowIndices[childIndex]),
1747
+ dimension: childDimension,
1748
+ coordinateLayout: childLayout,
1749
+ encoding: childEncoding
1750
+ };
1751
+ })
1752
+ };
1753
+ }
1754
+ if (encoding === "geoarrow.geometrycollection" && array.kind === "list") {
1755
+ return {
1756
+ ...array,
1757
+ child: mapArrayCoordinates(array.child, "geoarrow.geometry", rowOffset, targetDimension, targetLayout, mapper, coordinateType, forceDimension, forceLayout, sourceDimension, rowIndicesOverride)
1758
+ };
1759
+ }
1760
+ const depth = getEncodingDepth2(encoding);
1761
+ const rowIndices = rowIndicesOverride || collectLeafRowIndices(array, depth, rowOffset);
1762
+ return mapNestedArray(array, depth, rowOffset, targetDimension, targetLayout, mapper, coordinateType, rowIndices, sourceDimension);
1763
+ }
1764
+ function mapNestedArray(array, depth, rowOffset, targetDimension, targetLayout, mapper, coordinateType, rowIndices, sourceDimension) {
1765
+ if (depth === 0) {
1766
+ return mapCoordinateLeaf(array, rowOffset, targetDimension, targetLayout, mapper, coordinateType, rowIndices, sourceDimension);
1767
+ }
1768
+ if (array.kind !== "list")
1769
+ return array;
1770
+ return {
1771
+ ...array,
1772
+ child: mapNestedArray(array.child, depth - 1, rowOffset, targetDimension, targetLayout, mapper, coordinateType, rowIndices, sourceDimension)
1773
+ };
1774
+ }
1775
+ function mapCoordinateLeaf(array, rowOffset, targetDimension, targetLayout, mapper, coordinateType, rowIndices, sourceDimension) {
1776
+ const count = array.length;
1777
+ const targetSize = getGeoArrowDimensionSize(targetDimension);
1778
+ const sourceValues = new Array(count);
1779
+ for (let index = 0; index < count; index++) {
1780
+ const coordinate = readCoordinateAt(array, index);
1781
+ const mapped = coordinate ? mapper(sourceDimension ? resizeCoordinate(coordinate, sourceDimension, targetDimension) : coordinate, (rowIndices == null ? void 0 : rowIndices[index]) ?? rowOffset) : new Array(targetSize).fill(0);
1782
+ if (mapped.length !== targetSize) {
1783
+ throw new Error(`Coordinate mapper returned ${mapped.length} values; expected ${targetSize}`);
1784
+ }
1785
+ sourceValues[index] = [...mapped];
1786
+ }
1787
+ const FloatArray = resolveCoordinateConstructor(array, coordinateType);
1788
+ return makeCoordinateLeaf(sourceValues, targetDimension, targetLayout, FloatArray, array.validity);
1789
+ }
1790
+ function collectLeafRowIndices(array, depth, rowOffset) {
1791
+ const output = new Array(getLeafLength(array, depth)).fill(rowOffset);
1792
+ for (let rowIndex = 0; rowIndex < array.length; rowIndex++) {
1793
+ if (isGeoArrowValueValid(array.validity, rowIndex)) {
1794
+ assignNestedRowIndices(array, rowIndex, depth, rowOffset + rowIndex, output);
1795
+ }
1796
+ }
1797
+ return output;
1798
+ }
1799
+ function assignNestedRowIndices(array, index, depth, rowIndex, output) {
1800
+ if (depth === 0) {
1801
+ if (index >= 0 && index < output.length)
1802
+ output[index] = rowIndex;
1803
+ return;
1804
+ }
1805
+ if (array.kind !== "list")
1806
+ return;
1807
+ const [first, last] = getListRange(array, index);
1808
+ for (let childIndex = first; childIndex < last; childIndex++) {
1809
+ assignNestedRowIndices(array.child, childIndex, depth - 1, rowIndex, output);
1810
+ }
1811
+ }
1812
+ function collectUnionRowIndices(union, rowOffset) {
1813
+ if (union.kind !== "dense-union")
1814
+ return [];
1815
+ const output = union.children.map((child) => {
1816
+ const encoding = child.encoding || getEncodingFromChildName2(child.name);
1817
+ return new Array(getLeafLength(child.data, getEncodingDepth2(encoding))).fill(rowOffset);
1818
+ });
1819
+ for (let rowIndex = 0; rowIndex < union.length; rowIndex++) {
1820
+ if (!isGeoArrowValueValid(union.validity, rowIndex))
1821
+ continue;
1822
+ const physical = (union.offset || 0) + rowIndex;
1823
+ const childIndex = union.children.findIndex((child2) => child2.typeId === union.typeIds[physical]);
1824
+ if (childIndex < 0)
1825
+ continue;
1826
+ const child = union.children[childIndex];
1827
+ assignUnionRowIndices(child.data, child.encoding || getEncodingFromChildName2(child.name), union.valueOffsets[physical], rowOffset + rowIndex, output[childIndex]);
1828
+ }
1829
+ return output;
1830
+ }
1831
+ function assignUnionRowIndices(array, encoding, index, rowIndex, output) {
1832
+ if (encoding === "geoarrow.geometry" && array.kind === "dense-union") {
1833
+ const physical = (array.offset || 0) + index;
1834
+ const childIndex = array.children.findIndex((child) => child.typeId === array.typeIds[physical]);
1835
+ if (childIndex >= 0) {
1836
+ const child = array.children[childIndex];
1837
+ assignUnionRowIndices(child.data, child.encoding || getEncodingFromChildName2(child.name), array.valueOffsets[physical], rowIndex, output);
1838
+ }
1839
+ return;
1840
+ }
1841
+ if (encoding === "geoarrow.geometrycollection" && array.kind === "list") {
1842
+ const [first, last] = getListRange(array, index);
1843
+ if (array.child.kind === "dense-union") {
1844
+ for (let childIndex = first; childIndex < last; childIndex++) {
1845
+ assignUnionRowIndices(array.child, "geoarrow.geometry", childIndex, rowIndex, output);
1846
+ }
1847
+ }
1848
+ return;
1849
+ }
1850
+ assignNestedRowIndices(array, index, getEncodingDepth2(encoding), rowIndex, output);
1851
+ }
1852
+ function getLeafLength(array, depth) {
1853
+ let current = array;
1854
+ for (let level = 0; level < depth; level++) {
1855
+ if (current.kind !== "list")
1856
+ return 0;
1857
+ current = current.child;
1858
+ }
1859
+ return current.length;
1860
+ }
1861
+ function resolveCoordinateConstructor(array, coordinateType) {
1862
+ if (coordinateType === "float32")
1863
+ return Float32Array;
1864
+ if (coordinateType === "float64")
1865
+ return Float64Array;
1866
+ if (array.kind === "fixed-size-list" && array.child.kind === "primitive") {
1867
+ return array.child.values instanceof Float32Array ? Float32Array : Float64Array;
1868
+ }
1869
+ if (array.kind === "struct") {
1870
+ const child = array.children["x"];
1871
+ if ((child == null ? void 0 : child.kind) === "primitive" && child.values instanceof Float32Array)
1872
+ return Float32Array;
1873
+ }
1874
+ return Float64Array;
1875
+ }
1876
+ function makeCoordinateLeaf(coordinates, dimension, layout, FloatArray, validity) {
1877
+ const size = getGeoArrowDimensionSize(dimension);
1878
+ if (layout === "interleaved") {
1879
+ const values = new FloatArray(coordinates.length * size);
1880
+ for (let index = 0; index < coordinates.length; index++) {
1881
+ values.set(coordinates[index], index * size);
1882
+ }
1883
+ return {
1884
+ kind: "fixed-size-list",
1885
+ length: coordinates.length,
1886
+ size,
1887
+ child: { kind: "primitive", length: values.length, values },
1888
+ validity
1889
+ };
1890
+ }
1891
+ const children = {
1892
+ x: { kind: "primitive", length: coordinates.length, values: new FloatArray(coordinates.length) },
1893
+ y: { kind: "primitive", length: coordinates.length, values: new FloatArray(coordinates.length) }
1894
+ };
1895
+ const names = getDimensionNames2(dimension);
1896
+ for (let component = 2; component < names.length; component++) {
1897
+ children[names[component]] = {
1898
+ kind: "primitive",
1899
+ length: coordinates.length,
1900
+ values: new FloatArray(coordinates.length)
1901
+ };
1902
+ }
1903
+ for (let index = 0; index < coordinates.length; index++) {
1904
+ const coordinate = coordinates[index];
1905
+ for (let component = 0; component < names.length; component++) {
1906
+ const child = children[names[component]];
1907
+ if (child.kind === "primitive")
1908
+ child.values[index] = coordinate[component];
1909
+ }
1910
+ }
1911
+ return { kind: "struct", length: coordinates.length, children, validity };
1912
+ }
1913
+ function readCoordinateAt(array, index) {
1914
+ if (!isGeoArrowValueValid(array.validity, index))
1915
+ return null;
1916
+ if (array.kind === "fixed-size-list") {
1917
+ const logicalIndex = (array.offset || 0) + index;
1918
+ if (array.child.kind !== "primitive")
1919
+ return null;
1920
+ const values = [];
1921
+ for (let component = 0; component < array.size; component++) {
1922
+ const scalarIndex = logicalIndex * array.size + component;
1923
+ values.push(Number(array.child.values[(array.child.offset || 0) + scalarIndex * (array.child.stride || 1)]));
1924
+ }
1925
+ return values;
1926
+ }
1927
+ if (array.kind === "struct") {
1928
+ const logicalIndex = (array.offset || 0) + index;
1929
+ const values = [];
1930
+ for (const name of ["x", "y", "z", "m"]) {
1931
+ const child = array.children[name];
1932
+ if ((child == null ? void 0 : child.kind) === "primitive") {
1933
+ values.push(Number(child.values[(child.offset || 0) + logicalIndex * (child.stride || 1)]));
1934
+ }
1935
+ }
1936
+ return values.length >= 2 ? values : null;
1937
+ }
1938
+ return null;
1939
+ }
1940
+ function getDimensionNames2(dimension) {
1941
+ switch (dimension) {
1942
+ case "xy":
1943
+ return ["x", "y"];
1944
+ case "xyz":
1945
+ return ["x", "y", "z"];
1946
+ case "xym":
1947
+ return ["x", "y", "m"];
1948
+ case "xyzm":
1949
+ return ["x", "y", "z", "m"];
1950
+ }
1951
+ }
1952
+ function getEncodingFromChildName2(name) {
1953
+ const normalized = name.replace(/[^a-z]/gi, "").toLowerCase();
1954
+ const encoding = `geoarrow.${normalized}`;
1955
+ if (encoding === "geoarrow.point" || encoding === "geoarrow.linestring" || encoding === "geoarrow.polygon" || encoding === "geoarrow.multipoint" || encoding === "geoarrow.multilinestring" || encoding === "geoarrow.multipolygon" || encoding === "geoarrow.geometrycollection") {
1956
+ return encoding;
1957
+ }
1958
+ throw new Error(`Unknown GeoArrow dense-union child ${name}`);
1959
+ }
1960
+ function getEncodingDepth2(encoding) {
1961
+ switch (encoding) {
1962
+ case "geoarrow.point":
1963
+ return 0;
1964
+ case "geoarrow.linestring":
1965
+ case "geoarrow.multipoint":
1966
+ return 1;
1967
+ case "geoarrow.polygon":
1968
+ case "geoarrow.multilinestring":
1969
+ return 2;
1970
+ case "geoarrow.multipolygon":
1971
+ return 3;
1972
+ default:
1973
+ return 0;
1974
+ }
1975
+ }
1976
+ function promoteToDenseUnion(column) {
1977
+ if (column.encoding === "geoarrow.geometry")
1978
+ return column;
1979
+ const chunks = column.chunks.map((chunk) => {
1980
+ const typeId = getCanonicalTypeId(column.encoding, column.dimension);
1981
+ const typeIds = new Int8Array(chunk.length);
1982
+ typeIds.fill(typeId);
1983
+ const valueOffsets = new Int32Array(chunk.length);
1984
+ for (let index = 0; index < chunk.length; index++)
1985
+ valueOffsets[index] = index;
1986
+ return {
1987
+ kind: "dense-union",
1988
+ length: chunk.length,
1989
+ typeIds,
1990
+ valueOffsets,
1991
+ children: [
1992
+ {
1993
+ name: getGeoArrowGeometryTypeName(column.encoding),
1994
+ typeId,
1995
+ encoding: column.encoding,
1996
+ dimension: column.dimension,
1997
+ coordinateLayout: column.coordinateLayout,
1998
+ data: chunk
1999
+ }
2000
+ ]
2001
+ };
2002
+ });
2003
+ return { ...column, encoding: "geoarrow.geometry", chunks };
2004
+ }
2005
+ function demoteDenseUnion(column, encoding) {
2006
+ if (encoding === "geoarrow.geometry" || encoding === "geoarrow.geometrycollection")
2007
+ return column;
2008
+ if (!isConcreteEncoding(encoding))
2009
+ throw new Error(`Rows cannot be represented as ${encoding}`);
2010
+ const builderOptions = {
2011
+ encoding,
2012
+ dimension: column.dimension,
2013
+ coordinateLayout: column.coordinateLayout || "interleaved",
2014
+ offsetType: getColumnOffsetType(column)
2015
+ };
2016
+ const chunks = column.chunks.map((chunk) => {
2017
+ if (chunk.kind !== "dense-union")
2018
+ throw new Error("Expected dense-union storage");
2019
+ const replay = (builder) => {
2020
+ for (let index = 0; index < chunk.length; index++) {
2021
+ if (!isGeoArrowValueValid(chunk.validity, index)) {
2022
+ builder.append(null);
2023
+ continue;
2024
+ }
2025
+ const physical = (chunk.offset || 0) + index;
2026
+ const child = chunk.children.find((candidate) => candidate.typeId === chunk.typeIds[physical]);
2027
+ const childEncoding = child && (child.encoding || getEncodingFromChildName2(child.name));
2028
+ const childIndex = chunk.valueOffsets[physical];
2029
+ if (!child || !childEncoding || !isGeoArrowValueValid(child.data.validity, childIndex)) {
2030
+ builder.append(null);
2031
+ continue;
2032
+ }
2033
+ if (!isConcreteEncoding(childEncoding) || !canPromoteEncoding(childEncoding, encoding)) {
2034
+ throw new Error(`Rows cannot be represented as ${encoding}`);
2035
+ }
2036
+ replayPhysicalGeometryIntoBuilder(builder, child.data, childIndex, childEncoding, child.dimension || column.dimension, encoding);
2037
+ }
2038
+ };
2039
+ const measure = new GeoArrowBuilder({ ...builderOptions, mode: "measure" });
2040
+ replay(measure);
2041
+ const write = new GeoArrowBuilder({
2042
+ ...builderOptions,
2043
+ mode: "write",
2044
+ target: measure.allocateTarget()
2045
+ });
2046
+ replay(write);
2047
+ return write.finish().chunks[0];
2048
+ });
2049
+ return { ...column, encoding, coordinateLayout: builderOptions.coordinateLayout, chunks };
2050
+ }
2051
+ function replayPhysicalGeometryIntoBuilder(builder, array, rowIndex, sourceEncoding, sourceDimension, targetEncoding) {
2052
+ const targetType = getGeoArrowGeometryTypeName(targetEncoding);
2053
+ builder.beginGeometry(targetType, sourceDimension);
2054
+ if (sourceEncoding === "geoarrow.point") {
2055
+ writePhysicalCoordinateIntoBuilder(builder, array, rowIndex, sourceDimension);
2056
+ } else if (sourceEncoding === "geoarrow.linestring" || sourceEncoding === "geoarrow.multipoint") {
2057
+ const [first, last] = requireListRange(array, rowIndex);
2058
+ if (targetEncoding === "geoarrow.multilinestring")
2059
+ builder.beginRing(last - first);
2060
+ const leaf = array.child;
2061
+ for (let index = first; index < last; index++) {
2062
+ writePhysicalCoordinateIntoBuilder(builder, leaf, index, sourceDimension);
2063
+ }
2064
+ } else if (sourceEncoding === "geoarrow.polygon" || sourceEncoding === "geoarrow.multilinestring") {
2065
+ const [first, last] = requireListRange(array, rowIndex);
2066
+ if (targetEncoding === "geoarrow.multipolygon")
2067
+ builder.beginPolygon();
2068
+ const parts = array.child;
2069
+ for (let partIndex = first; partIndex < last; partIndex++) {
2070
+ const [partFirst, partLast] = requireListRange(parts, partIndex);
2071
+ builder.beginRing(partLast - partFirst);
2072
+ const leaf = parts.child;
2073
+ for (let index = partFirst; index < partLast; index++) {
2074
+ writePhysicalCoordinateIntoBuilder(builder, leaf, index, sourceDimension);
2075
+ }
2076
+ }
2077
+ } else {
2078
+ const [first, last] = requireListRange(array, rowIndex);
2079
+ const polygons = array.child;
2080
+ for (let polygonIndex = first; polygonIndex < last; polygonIndex++) {
2081
+ builder.beginPolygon();
2082
+ const [partFirst, partLast] = requireListRange(polygons, polygonIndex);
2083
+ const parts = polygons.child;
2084
+ for (let partIndex = partFirst; partIndex < partLast; partIndex++) {
2085
+ const [ringFirst, ringLast] = requireListRange(parts, partIndex);
2086
+ builder.beginRing(ringLast - ringFirst);
2087
+ const leaf = parts.child;
2088
+ for (let index = ringFirst; index < ringLast; index++) {
2089
+ writePhysicalCoordinateIntoBuilder(builder, leaf, index, sourceDimension);
2090
+ }
2091
+ }
2092
+ }
2093
+ }
2094
+ builder.endGeometry();
2095
+ }
2096
+ function writePhysicalCoordinateIntoBuilder(builder, array, index, dimension) {
2097
+ if (array.kind === "fixed-size-list" && array.child.kind === "primitive") {
2098
+ const logical = (array.offset || 0) + index;
2099
+ const stride = array.child.stride || 1;
2100
+ const scalarOffset = (array.child.offset || 0) + logical * array.size * stride;
2101
+ const x = Number(array.child.values[scalarOffset]);
2102
+ const y = Number(array.child.values[scalarOffset + stride]);
2103
+ const third = array.size > 2 ? Number(array.child.values[scalarOffset + 2 * stride]) : void 0;
2104
+ const fourth = array.size > 3 ? Number(array.child.values[scalarOffset + 3 * stride]) : void 0;
2105
+ builder.writeCoordinateFromDimension(x, y, dimension === "xyz" || dimension === "xyzm" ? third : void 0, dimension === "xym" ? third : fourth, dimension);
2106
+ return;
2107
+ }
2108
+ if (array.kind === "struct") {
2109
+ const logical = (array.offset || 0) + index;
2110
+ const read = (name) => {
2111
+ const child = array.children[name];
2112
+ return (child == null ? void 0 : child.kind) === "primitive" ? Number(child.values[(child.offset || 0) + logical * (child.stride || 1)]) : void 0;
2113
+ };
2114
+ builder.writeCoordinateFromDimension(read("x"), read("y"), read("z"), read("m"), dimension);
2115
+ return;
2116
+ }
2117
+ throw new Error("Invalid GeoArrow coordinate storage");
2118
+ }
2119
+ function requireListRange(array, index) {
2120
+ if (array.kind !== "list")
2121
+ throw new Error("Invalid GeoArrow list storage");
2122
+ return getListRange(array, index);
2123
+ }
2124
+ function canPromoteEncoding(source, target) {
2125
+ return source === target || source === "geoarrow.point" && target === "geoarrow.multipoint" || source === "geoarrow.linestring" && target === "geoarrow.multilinestring" || source === "geoarrow.polygon" && target === "geoarrow.multipolygon";
2126
+ }
2127
+ function isConcreteEncoding(encoding) {
2128
+ return encoding === "geoarrow.point" || encoding === "geoarrow.linestring" || encoding === "geoarrow.polygon" || encoding === "geoarrow.multipoint" || encoding === "geoarrow.multilinestring" || encoding === "geoarrow.multipolygon";
2129
+ }
2130
+ function getCanonicalTypeId(encoding, dimension) {
2131
+ const families = [
2132
+ "point",
2133
+ "linestring",
2134
+ "polygon",
2135
+ "multipoint",
2136
+ "multilinestring",
2137
+ "multipolygon",
2138
+ "geometrycollection"
2139
+ ];
2140
+ const dimensions = ["xy", "xyz", "xym", "xyzm"];
2141
+ const family = encoding.replace("geoarrow.", "");
2142
+ const familyIndex = families.indexOf(family);
2143
+ const dimensionIndex = dimensions.indexOf(dimension);
2144
+ return familyIndex < 0 || dimensionIndex < 0 ? 1 : familyIndex * 4 + dimensionIndex + 1;
2145
+ }
2146
+ function getColumnOffsetType(column) {
2147
+ for (const chunk of column.chunks) {
2148
+ const found = findOffsetType(chunk);
2149
+ if (found)
2150
+ return found;
2151
+ }
2152
+ return "int32";
2153
+ }
2154
+ function findOffsetType(array) {
2155
+ switch (array.kind) {
2156
+ case "list":
2157
+ case "serialized":
2158
+ return array.offsets instanceof BigInt64Array ? "int64" : "int32";
2159
+ case "fixed-size-list":
2160
+ return findOffsetType(array.child);
2161
+ case "struct": {
2162
+ for (const child of Object.values(array.children)) {
2163
+ const found = findOffsetType(child);
2164
+ if (found)
2165
+ return found;
2166
+ }
2167
+ return null;
2168
+ }
2169
+ case "dense-union":
2170
+ for (const child of array.children) {
2171
+ const found = findOffsetType(child.data);
2172
+ if (found)
2173
+ return found;
2174
+ }
2175
+ return null;
2176
+ default:
2177
+ return null;
2178
+ }
2179
+ }
2180
+ function convertArrayOffsets(array, offsetType) {
2181
+ const toOffsets = (offsets, offsetBase) => {
2182
+ if (offsetType === "int64") {
2183
+ const result2 = new BigInt64Array(offsets.length);
2184
+ for (let index = 0; index < offsets.length; index++)
2185
+ result2[index] = BigInt(offsets[index]);
2186
+ return { offsets: result2, ...offsetBase === void 0 ? {} : { offsetBase } };
2187
+ }
2188
+ const result = new Int32Array(offsets.length);
2189
+ const base = BigInt(offsetBase ?? 0);
2190
+ for (let index = 0; index < offsets.length; index++) {
2191
+ const value = BigInt(offsets[index]) - base;
2192
+ if (value < -2147483648n || value > 2147483647n) {
2193
+ throw new Error("GeoArrow offset cannot be represented as Int32");
2194
+ }
2195
+ result[index] = Number(value);
2196
+ }
2197
+ return { offsets: result, offsetBase: 0 };
2198
+ };
2199
+ switch (array.kind) {
2200
+ case "list":
2201
+ if (array.offsets instanceof (offsetType === "int64" ? BigInt64Array : Int32Array)) {
2202
+ return { ...array, child: convertArrayOffsets(array.child, offsetType) };
2203
+ }
2204
+ return {
2205
+ ...array,
2206
+ ...toOffsets(array.offsets, array.offsetBase),
2207
+ child: convertArrayOffsets(array.child, offsetType)
2208
+ };
2209
+ case "serialized":
2210
+ if (array.offsets instanceof (offsetType === "int64" ? BigInt64Array : Int32Array))
2211
+ return array;
2212
+ return { ...array, ...toOffsets(array.offsets, array.offsetBase) };
2213
+ case "fixed-size-list":
2214
+ return { ...array, child: convertArrayOffsets(array.child, offsetType) };
2215
+ case "struct":
2216
+ return {
2217
+ ...array,
2218
+ children: Object.fromEntries(Object.entries(array.children).map(([name, child]) => [
2219
+ name,
2220
+ convertArrayOffsets(child, offsetType)
2221
+ ]))
2222
+ };
2223
+ case "dense-union":
2224
+ return {
2225
+ ...array,
2226
+ children: array.children.map((child) => ({
2227
+ ...child,
2228
+ data: convertArrayOffsets(child.data, offsetType)
2229
+ }))
2230
+ };
2231
+ default:
2232
+ return array;
2233
+ }
2234
+ }
2235
+ function getGeoArrowGeometryTypeName(encoding) {
2236
+ return getGeoArrowGeometryType(encoding) || encoding.replace("geoarrow.", "");
2237
+ }
2238
+ function rewindArrayRings(array, encoding, outerClockwise) {
2239
+ if (encoding === "geoarrow.geometry" && array.kind === "dense-union") {
2240
+ let changed2 = false;
2241
+ for (const child of array.children) {
2242
+ if (rewindArrayRings(child.data, child.encoding || getEncodingFromChildName2(child.name), outerClockwise))
2243
+ changed2 = true;
2244
+ }
2245
+ return changed2;
2246
+ }
2247
+ if (encoding === "geoarrow.geometrycollection" && array.kind === "list") {
2248
+ if (array.child.kind !== "dense-union")
2249
+ return false;
2250
+ let changed2 = false;
2251
+ for (const child of array.child.children) {
2252
+ if (rewindArrayRings(child.data, child.encoding || getEncodingFromChildName2(child.name), outerClockwise))
2253
+ changed2 = true;
2254
+ }
2255
+ return changed2;
2256
+ }
2257
+ if (encoding !== "geoarrow.polygon" && encoding !== "geoarrow.multipolygon")
2258
+ return false;
2259
+ if (array.kind !== "list" || array.child.kind !== "list")
2260
+ return false;
2261
+ let changed = false;
2262
+ for (let rowIndex = 0; rowIndex < array.length; rowIndex++) {
2263
+ if (!isGeoArrowValueValid(array.validity, rowIndex))
2264
+ continue;
2265
+ const [, rowEnd] = getListRange(array, rowIndex);
2266
+ const rowStart = getListRange(array, rowIndex)[0];
2267
+ if (encoding === "geoarrow.polygon") {
2268
+ const rings = array.child;
2269
+ if (rewindRingGroup(rings, rowStart, rowEnd, outerClockwise))
2270
+ changed = true;
2271
+ } else {
2272
+ const polygons = array.child;
2273
+ for (let polygonIndex = rowStart; polygonIndex < rowEnd; polygonIndex++) {
2274
+ const [ringStart, ringEnd] = getListRange(polygons, polygonIndex);
2275
+ if (rewindRingGroup(polygons.child, ringStart, ringEnd, outerClockwise))
2276
+ changed = true;
2277
+ }
2278
+ }
2279
+ }
2280
+ return changed;
2281
+ }
2282
+ function rewindRingGroup(rings, firstRing, lastRing, outerClockwise) {
2283
+ if (rings.kind !== "list")
2284
+ return false;
2285
+ const leaf = rings.child;
2286
+ if (leaf.kind !== "fixed-size-list" && leaf.kind !== "struct")
2287
+ return false;
2288
+ let changed = false;
2289
+ for (let ringIndex = firstRing; ringIndex < lastRing; ringIndex++) {
2290
+ const [first, last] = getListRange(rings, ringIndex);
2291
+ const area = getRingArea(leaf, first, last);
2292
+ if (!Number.isFinite(area) || area === 0)
2293
+ continue;
2294
+ const shouldClockwise = ringIndex === firstRing ? outerClockwise : !outerClockwise;
2295
+ if (area < 0 !== shouldClockwise) {
2296
+ reverseCoordinateRange(leaf, first, last);
2297
+ changed = true;
2298
+ }
2299
+ }
2300
+ return changed;
2301
+ }
2302
+ function getRingArea(leaf, first, last) {
2303
+ let area = 0;
2304
+ for (let index = first; index < last; index++) {
2305
+ const current = readCoordinateAt(leaf, index);
2306
+ const next = readCoordinateAt(leaf, index + 1 < last ? index + 1 : first);
2307
+ if (!current || !next)
2308
+ return Number.NaN;
2309
+ area += current[0] * next[1] - next[0] * current[1];
2310
+ }
2311
+ return area / 2;
2312
+ }
2313
+ function reverseCoordinateRange(leaf, first, last) {
2314
+ const values = [];
2315
+ for (let index = first; index < last; index++)
2316
+ values.push(readCoordinateAt(leaf, index));
2317
+ values.reverse();
2318
+ for (let index = first; index < last; index++)
2319
+ writeCoordinateAt(leaf, index, values[index - first]);
2320
+ }
2321
+ function writeCoordinateAt(array, index, coordinate) {
2322
+ if (array.kind === "fixed-size-list" && array.child.kind === "primitive") {
2323
+ const logical = (array.offset || 0) + index;
2324
+ for (let component = 0; component < array.size; component++) {
2325
+ const scalar = (array.child.offset || 0) + logical * array.size + component;
2326
+ array.child.values[scalar] = coordinate[component];
2327
+ }
2328
+ } else if (array.kind === "struct") {
2329
+ const logical = (array.offset || 0) + index;
2330
+ const names = ["x", "y", "z", "m"];
2331
+ for (let component = 0; component < names.length; component++) {
2332
+ const child = array.children[names[component]];
2333
+ if ((child == null ? void 0 : child.kind) === "primitive")
2334
+ child.values[(child.offset || 0) + logical * (child.stride || 1)] = coordinate[component];
2335
+ }
2336
+ }
2337
+ }
2338
+ function collectCoordinateLeaves(column) {
2339
+ const leaves = [];
2340
+ for (const chunk of column.chunks)
2341
+ collectArrayCoordinateLeaves(chunk, leaves);
2342
+ return leaves;
2343
+ }
2344
+ function collectArrayCoordinateLeaves(array, leaves) {
2345
+ switch (array.kind) {
2346
+ case "primitive":
2347
+ if (array.values instanceof Float32Array || array.values instanceof Float64Array) {
2348
+ leaves.push(array.values);
2349
+ }
2350
+ break;
2351
+ case "fixed-size-list":
2352
+ case "list":
2353
+ collectArrayCoordinateLeaves(array.child, leaves);
2354
+ break;
2355
+ case "struct":
2356
+ for (const name of ["x", "y", "z", "m"]) {
2357
+ const child = array.children[name];
2358
+ if (child)
2359
+ collectArrayCoordinateLeaves(child, leaves);
2360
+ }
2361
+ break;
2362
+ case "dense-union":
2363
+ for (const child of array.children)
2364
+ collectArrayCoordinateLeaves(child.data, leaves);
2365
+ break;
2366
+ default:
2367
+ break;
2368
+ }
2369
+ }
2370
+ function getArrayDepth(array) {
2371
+ switch (array.kind) {
2372
+ case "list":
2373
+ case "fixed-size-list":
2374
+ return 1 + getArrayDepth(array.child);
2375
+ case "struct":
2376
+ return 1 + Math.max(0, ...Object.values(array.children).map(getArrayDepth));
2377
+ case "dense-union":
2378
+ return 1 + Math.max(0, ...array.children.map((child) => getArrayDepth(child.data)));
2379
+ default:
2380
+ return 1;
2381
+ }
2382
+ }
2383
+
2384
+ // dist/wkb/types.js
2385
+ function getWellKnownDimensionSize(dimension) {
2386
+ switch (dimension) {
2387
+ case "xy":
2388
+ return 2;
2389
+ case "xyz":
2390
+ case "xym":
2391
+ return 3;
2392
+ case "xyzm":
2393
+ return 4;
2394
+ }
2395
+ }
2396
+ function inferWellKnownGeometryDimension(geometry) {
2397
+ const size = getGeometryDimensionSize(geometry);
2398
+ return size >= 4 ? "xyzm" : size === 3 ? "xyz" : "xy";
2399
+ }
2400
+ function getGeometryDimensionSize(geometry) {
2401
+ if (geometry.type === "GeometryCollection") {
2402
+ return Math.max(2, ...geometry.geometries.map(getGeometryDimensionSize));
2403
+ }
2404
+ return getCoordinateDimension(geometry.coordinates);
2405
+ }
2406
+ function getCoordinateDimension(value) {
2407
+ if (value.length === 0)
2408
+ return 2;
2409
+ if (typeof value[0] === "number")
2410
+ return value.length;
2411
+ return Math.max(2, ...value.map((child) => getCoordinateDimension(child)));
2412
+ }
2413
+
2414
+ // dist/wkb/wkb-reader.js
2415
+ var GEOMETRY_TYPES = [
2416
+ "Point",
2417
+ "LineString",
2418
+ "Polygon",
2419
+ "MultiPoint",
2420
+ "MultiLineString",
2421
+ "MultiPolygon",
2422
+ "GeometryCollection"
2423
+ ];
2424
+ function inspectWKBHeader(input, byteOffset = 0) {
2425
+ return inspectWKBHeaderView(getDataView(input), byteOffset);
2426
+ }
2427
+ function visitWKB(input, visitor, options = {}) {
2428
+ const view = getDataView(input);
2429
+ const state = {
2430
+ maximumDepth: validateLimit(options.maximumDepth, 64, "maximumDepth"),
2431
+ maximumElements: validateLimit(options.maximumElements, 1e8, "maximumElements"),
2432
+ elementCount: 0,
2433
+ visitor
2434
+ };
2435
+ const byteLength = visitGeometry(view, 0, state, 0).byteOffset;
2436
+ if (byteLength !== view.byteLength)
2437
+ throw new Error("WKB contains trailing bytes");
2438
+ return byteLength;
2439
+ }
2440
+ function visitGeometry(view, byteOffset, state, depth, expectedType) {
2441
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2442
+ if (depth > state.maximumDepth)
2443
+ throw new Error("WKB geometry nesting exceeds maximumDepth");
2444
+ const header = inspectWKBHeaderView(view, byteOffset);
2445
+ if (expectedType && header.geometryType !== expectedType) {
2446
+ throw new Error(`WKB ${expectedType} collection contains a ${header.geometryType} child`);
2447
+ }
2448
+ byteOffset = header.bodyByteOffset;
2449
+ switch (header.geometryType) {
2450
+ case "Point":
2451
+ (_b = (_a = state.visitor).geometry) == null ? void 0 : _b.call(_a, header, void 0, depth);
2452
+ byteOffset = visitCoordinate(view, byteOffset, header, state.visitor, depth);
2453
+ break;
2454
+ case "LineString": {
2455
+ const pointCount = readCount(view, byteOffset, header.littleEndian, state);
2456
+ byteOffset += 4;
2457
+ (_d = (_c = state.visitor).geometry) == null ? void 0 : _d.call(_c, header, pointCount, depth);
2458
+ byteOffset = visitCoordinateSequence(view, byteOffset, pointCount, header, state, depth);
2459
+ break;
2460
+ }
2461
+ case "Polygon": {
2462
+ const ringCount = readCount(view, byteOffset, header.littleEndian, state);
2463
+ byteOffset += 4;
2464
+ (_f = (_e = state.visitor).geometry) == null ? void 0 : _f.call(_e, header, ringCount, depth);
2465
+ for (let ringIndex = 0; ringIndex < ringCount; ringIndex++) {
2466
+ const pointCount = readCount(view, byteOffset, header.littleEndian, state);
2467
+ byteOffset += 4;
2468
+ (_h = (_g = state.visitor).ring) == null ? void 0 : _h.call(_g, pointCount, ringIndex, depth);
2469
+ byteOffset = visitCoordinateSequence(view, byteOffset, pointCount, header, state, depth);
2470
+ }
2471
+ break;
2472
+ }
2473
+ case "MultiPoint":
2474
+ case "MultiLineString":
2475
+ case "MultiPolygon":
2476
+ case "GeometryCollection": {
2477
+ const childCount = readCount(view, byteOffset, header.littleEndian, state);
2478
+ byteOffset += 4;
2479
+ (_j = (_i = state.visitor).geometry) == null ? void 0 : _j.call(_i, header, childCount, depth);
2480
+ const childType = header.geometryType === "MultiPoint" ? "Point" : header.geometryType === "MultiLineString" ? "LineString" : header.geometryType === "MultiPolygon" ? "Polygon" : void 0;
2481
+ for (let childIndex = 0; childIndex < childCount; childIndex++) {
2482
+ byteOffset = visitGeometry(view, byteOffset, state, depth + 1, childType).byteOffset;
2483
+ }
2484
+ break;
2485
+ }
2486
+ }
2487
+ return { byteOffset, header };
2488
+ }
2489
+ function visitCoordinateSequence(view, byteOffset, pointCount, header, state, depth) {
2490
+ for (let pointIndex = 0; pointIndex < pointCount; pointIndex++) {
2491
+ byteOffset = visitCoordinate(view, byteOffset, header, state.visitor, depth);
2492
+ }
2493
+ return byteOffset;
2494
+ }
2495
+ function visitCoordinate(view, byteOffset, header, visitor, depth) {
2496
+ var _a;
2497
+ const coordinateByteLength = getWellKnownDimensionSize(header.dimension) * 8;
2498
+ assertRemaining(view, byteOffset, coordinateByteLength);
2499
+ if (!visitor.coordinate)
2500
+ return byteOffset + coordinateByteLength;
2501
+ const x = view.getFloat64(byteOffset, header.littleEndian);
2502
+ const y = view.getFloat64(byteOffset + 8, header.littleEndian);
2503
+ const third = header.dimension === "xy" ? void 0 : view.getFloat64(byteOffset + 16, header.littleEndian);
2504
+ const fourth = header.dimension === "xyzm" ? view.getFloat64(byteOffset + 24, header.littleEndian) : void 0;
2505
+ const z = header.dimension === "xyz" || header.dimension === "xyzm" ? third : void 0;
2506
+ const m = header.dimension === "xym" ? third : fourth;
2507
+ (_a = visitor.coordinate) == null ? void 0 : _a.call(visitor, x, y, z, m, header.dimension, byteOffset, depth);
2508
+ return byteOffset + coordinateByteLength;
2509
+ }
2510
+ function inspectWKBHeaderView(view, byteOffset) {
2511
+ const startByteOffset = byteOffset;
2512
+ assertRemaining(view, byteOffset, 5);
2513
+ const byteOrder = view.getUint8(byteOffset++);
2514
+ if (byteOrder !== 0 && byteOrder !== 1)
2515
+ throw new Error("Invalid WKB byte order");
2516
+ const littleEndian = byteOrder === 1;
2517
+ const typeCode = view.getUint32(byteOffset, littleEndian);
2518
+ byteOffset += 4;
2519
+ const hasZ = Boolean(typeCode & 2147483648);
2520
+ const hasM = Boolean(typeCode & 1073741824);
2521
+ const hasSrid = Boolean(typeCode & 536870912);
2522
+ let geometryCode = typeCode & 536870911;
2523
+ let dimension;
2524
+ if (geometryCode >= 3e3 && geometryCode < 4e3) {
2525
+ dimension = "xyzm";
2526
+ geometryCode -= 3e3;
2527
+ } else if (geometryCode >= 2e3 && geometryCode < 3e3) {
2528
+ dimension = "xym";
2529
+ geometryCode -= 2e3;
2530
+ } else if (geometryCode >= 1e3 && geometryCode < 2e3) {
2531
+ dimension = "xyz";
2532
+ geometryCode -= 1e3;
2533
+ } else {
2534
+ dimension = hasZ && hasM ? "xyzm" : hasZ ? "xyz" : hasM ? "xym" : "xy";
2535
+ }
2536
+ const geometryType = GEOMETRY_TYPES[geometryCode - 1];
2537
+ if (!geometryType)
2538
+ throw new Error(`Unsupported WKB geometry type ${geometryCode}`);
2539
+ let srid;
2540
+ if (hasSrid) {
2541
+ assertRemaining(view, byteOffset, 4);
2542
+ srid = view.getUint32(byteOffset, littleEndian);
2543
+ byteOffset += 4;
2544
+ }
2545
+ const dialect = hasZ || hasM || hasSrid ? "ewkb" : dimension === "xy" ? "wkb" : "iso-wkb";
2546
+ return {
2547
+ geometryType,
2548
+ dimension,
2549
+ dialect,
2550
+ littleEndian,
2551
+ byteOffset: startByteOffset,
2552
+ bodyByteOffset: byteOffset,
2553
+ byteLength: byteOffset - startByteOffset,
2554
+ ...srid === void 0 ? {} : { srid }
2555
+ };
2556
+ }
2557
+ function readCount(view, byteOffset, littleEndian, state) {
2558
+ assertRemaining(view, byteOffset, 4);
2559
+ const count = view.getUint32(byteOffset, littleEndian);
2560
+ state.elementCount += count;
2561
+ if (state.elementCount > state.maximumElements) {
2562
+ throw new Error("WKB element count exceeds maximumElements");
2563
+ }
2564
+ return count;
2565
+ }
2566
+ function getDataView(input) {
2567
+ return ArrayBuffer.isView(input) ? new DataView(input.buffer, input.byteOffset, input.byteLength) : new DataView(input);
2568
+ }
2569
+ function assertRemaining(view, byteOffset, byteLength) {
2570
+ if (byteOffset < 0 || byteOffset + byteLength > view.byteLength) {
2571
+ throw new Error("Unexpected end of WKB");
2572
+ }
2573
+ }
2574
+ function validateLimit(value, fallback, name) {
2575
+ const limit = value ?? fallback;
2576
+ if (!Number.isSafeInteger(limit) || limit < 0) {
2577
+ throw new Error(`${name} must be a non-negative safe integer`);
2578
+ }
2579
+ return limit;
2580
+ }
2581
+
2582
+ // dist/wkb/wkb-builder.js
2583
+ var GEOMETRY_TYPE_CODES = {
2584
+ Point: 1,
2585
+ LineString: 2,
2586
+ Polygon: 3,
2587
+ MultiPoint: 4,
2588
+ MultiLineString: 5,
2589
+ MultiPolygon: 6,
2590
+ GeometryCollection: 7
2591
+ };
2592
+ var WKBBuilder = class _WKBBuilder {
2593
+ constructor(options) {
2594
+ this.mode = options.mode;
2595
+ this.dimension = options.dimension ?? "xy";
2596
+ this.littleEndian = options.byteOrder !== "big-endian";
2597
+ this.srid = options.srid;
2598
+ this.transform = options.transform;
2599
+ validateSrid(this.srid);
2600
+ if (options.mode === "write") {
2601
+ const dataView = getTargetDataView(options.target);
2602
+ const byteOffset = options.byteOffset ?? 0;
2603
+ if (!Number.isSafeInteger(byteOffset) || byteOffset < 0 || byteOffset > dataView.byteLength) {
2604
+ throw new Error("WKBBuilder byteOffset is outside the target");
2605
+ }
2606
+ this.dataView = dataView;
2607
+ this.startByteOffset = byteOffset;
2608
+ this.endByteOffset = dataView.byteLength;
2609
+ this.byteOffset = byteOffset;
2610
+ } else {
2611
+ this.dataView = null;
2612
+ this.startByteOffset = 0;
2613
+ this.endByteOffset = Number.POSITIVE_INFINITY;
2614
+ this.byteOffset = 0;
2615
+ }
2616
+ }
2617
+ /** Begins a geometry and writes its count field when required. */
2618
+ beginGeometry(type, count) {
2619
+ switch (type) {
2620
+ case "Point":
2621
+ this.beginPoint();
2622
+ break;
2623
+ case "LineString":
2624
+ this.beginLineString(count ?? 0);
2625
+ break;
2626
+ case "Polygon":
2627
+ this.beginPolygon(count ?? 0);
2628
+ break;
2629
+ case "MultiPoint":
2630
+ this.beginMultiPoint(count ?? 0);
2631
+ break;
2632
+ case "MultiLineString":
2633
+ this.beginMultiLineString(count ?? 0);
2634
+ break;
2635
+ case "MultiPolygon":
2636
+ this.beginMultiPolygon(count ?? 0);
2637
+ break;
2638
+ case "GeometryCollection":
2639
+ this.writeHeader("GeometryCollection");
2640
+ this.writeUint32(count ?? 0);
2641
+ break;
2642
+ }
2643
+ }
2644
+ /** Begins one point geometry. */
2645
+ beginPoint() {
2646
+ this.writeHeader("Point");
2647
+ }
2648
+ /** Begins one linestring geometry. */
2649
+ beginLineString(pointCount) {
2650
+ this.writeHeader("LineString");
2651
+ this.writeUint32(pointCount);
2652
+ }
2653
+ /** Begins one polygon geometry. */
2654
+ beginPolygon(ringCount) {
2655
+ this.writeHeader("Polygon");
2656
+ this.writeUint32(ringCount);
2657
+ }
2658
+ /** Begins one linear ring inside a polygon. */
2659
+ beginLinearRing(pointCount) {
2660
+ this.writeUint32(pointCount);
2661
+ }
2662
+ /** Begins one multipoint geometry. */
2663
+ beginMultiPoint(pointCount) {
2664
+ this.writeHeader("MultiPoint");
2665
+ this.writeUint32(pointCount);
2666
+ }
2667
+ /** Begins one multilinestring geometry. */
2668
+ beginMultiLineString(lineCount) {
2669
+ this.writeHeader("MultiLineString");
2670
+ this.writeUint32(lineCount);
2671
+ }
2672
+ /** Begins one multipolygon geometry. */
2673
+ beginMultiPolygon(polygonCount) {
2674
+ this.writeHeader("MultiPolygon");
2675
+ this.writeUint32(polygonCount);
2676
+ }
2677
+ /** Writes one coordinate using the builder's semantic dimension. */
2678
+ writeCoordinate(x, y, z, m) {
2679
+ let coordinate = makeCoordinate(this.dimension, x, y, z, m);
2680
+ if (this.transform)
2681
+ coordinate = this.transform(coordinate, this.dimension);
2682
+ const coordinateSize = getDimensionSize(this.dimension);
2683
+ for (let index = 0; index < coordinateSize; index++) {
2684
+ this.writeFloat64(coordinate[index] ?? Number.NaN);
2685
+ }
2686
+ }
2687
+ /** Temporarily changes the semantic dimension for a nested geometry. */
2688
+ withDimension(dimension, callback) {
2689
+ const previous = this.dimension;
2690
+ this.dimension = dimension;
2691
+ try {
2692
+ return callback();
2693
+ } finally {
2694
+ this.dimension = previous;
2695
+ }
2696
+ }
2697
+ /** Returns the number of bytes measured or written. */
2698
+ finishGeometry() {
2699
+ return this.byteOffset - this.startByteOffset;
2700
+ }
2701
+ /** Measures geometry callbacks and returns contiguous Binary offsets. */
2702
+ static measureGeometryArray(geometryWriters, options = {}) {
2703
+ var _a;
2704
+ const valueOffsets = new Int32Array(geometryWriters.length + 1);
2705
+ for (let geometryIndex = 0; geometryIndex < geometryWriters.length; geometryIndex++) {
2706
+ const geometryWriter = geometryWriters[geometryIndex];
2707
+ const byteLength = geometryWriter ? measureGeometry(geometryWriter, {
2708
+ ...options,
2709
+ dimension: ((_a = options.dimensionResolver) == null ? void 0 : _a.call(options, geometryIndex)) ?? options.dimension
2710
+ }) : 0;
2711
+ const nextOffset = valueOffsets[geometryIndex] + byteLength;
2712
+ if (nextOffset > 2147483647)
2713
+ throw new Error("WKB geometry array exceeds Int32 offsets");
2714
+ valueOffsets[geometryIndex + 1] = nextOffset;
2715
+ }
2716
+ return valueOffsets;
2717
+ }
2718
+ /** Writes geometry callbacks into an existing contiguous values buffer. */
2719
+ static writeGeometryArray(geometryWriters, valueOffsets, values, options = {}) {
2720
+ var _a;
2721
+ if (valueOffsets.length !== geometryWriters.length + 1) {
2722
+ throw new Error("WKB valueOffsets length must equal geometry count plus one");
2723
+ }
2724
+ if (valueOffsets[valueOffsets.length - 1] > values.byteLength) {
2725
+ throw new Error("WKB values buffer is smaller than its final offset");
2726
+ }
2727
+ for (let geometryIndex = 0; geometryIndex < geometryWriters.length; geometryIndex++) {
2728
+ const geometryWriter = geometryWriters[geometryIndex];
2729
+ if (!geometryWriter)
2730
+ continue;
2731
+ const builder = new _WKBBuilder({
2732
+ mode: "write",
2733
+ target: values,
2734
+ byteOffset: valueOffsets[geometryIndex],
2735
+ ...options,
2736
+ dimension: ((_a = options.dimensionResolver) == null ? void 0 : _a.call(options, geometryIndex)) ?? options.dimension
2737
+ });
2738
+ geometryWriter(builder);
2739
+ const byteLength = builder.finishGeometry();
2740
+ if (valueOffsets[geometryIndex] + byteLength !== valueOffsets[geometryIndex + 1]) {
2741
+ throw new Error("WKB measure and write passes produced different byte lengths");
2742
+ }
2743
+ }
2744
+ return values;
2745
+ }
2746
+ /** Builds plain offsets, values, and validity buffers in two passes. */
2747
+ static buildGeometryArray(geometryWriters, options = {}) {
2748
+ const valueOffsets = _WKBBuilder.measureGeometryArray(geometryWriters, options);
2749
+ const values = new Uint8Array(valueOffsets[valueOffsets.length - 1]);
2750
+ _WKBBuilder.writeGeometryArray(geometryWriters, valueOffsets, values, options);
2751
+ const { nullBitmap, nullCount } = makeNullBitmap(geometryWriters);
2752
+ return {
2753
+ valueOffsets,
2754
+ values,
2755
+ ...nullCount > 0 ? { nullBitmap } : {},
2756
+ nullCount
2757
+ };
2758
+ }
2759
+ writeHeader(geometryType) {
2760
+ this.writeUint8(this.littleEndian ? 1 : 0);
2761
+ this.writeUint32(getWKBTypeCode(geometryType, this.dimension, this.srid !== void 0));
2762
+ if (this.srid !== void 0)
2763
+ this.writeUint32(this.srid);
2764
+ }
2765
+ writeUint8(value) {
2766
+ var _a;
2767
+ this.ensureSize(1);
2768
+ (_a = this.dataView) == null ? void 0 : _a.setUint8(this.byteOffset, value);
2769
+ this.byteOffset++;
2770
+ }
2771
+ writeUint32(value) {
2772
+ var _a;
2773
+ if (!Number.isSafeInteger(value) || value < 0 || value > 4294967295) {
2774
+ throw new Error("WKB count must be an unsigned 32-bit integer");
2775
+ }
2776
+ this.ensureSize(4);
2777
+ (_a = this.dataView) == null ? void 0 : _a.setUint32(this.byteOffset, value, this.littleEndian);
2778
+ this.byteOffset += 4;
2779
+ }
2780
+ writeFloat64(value) {
2781
+ var _a;
2782
+ this.ensureSize(8);
2783
+ (_a = this.dataView) == null ? void 0 : _a.setFloat64(this.byteOffset, value, this.littleEndian);
2784
+ this.byteOffset += 8;
2785
+ }
2786
+ ensureSize(byteLength) {
2787
+ if (this.byteOffset + byteLength > this.endByteOffset) {
2788
+ throw new Error("WKBBuilder target buffer overflow");
2789
+ }
2790
+ }
2791
+ };
2792
+ function measureGeometry(geometryWriter, options) {
2793
+ const builder = new WKBBuilder({ mode: "measure", ...options });
2794
+ geometryWriter(builder);
2795
+ return builder.finishGeometry();
2796
+ }
2797
+ function getTargetDataView(target) {
2798
+ return ArrayBuffer.isView(target) ? new DataView(target.buffer, target.byteOffset, target.byteLength) : new DataView(target);
2799
+ }
2800
+ function getWKBTypeCode(geometryType, dimension, hasSrid) {
2801
+ const geometryCode = GEOMETRY_TYPE_CODES[geometryType];
2802
+ if (hasSrid) {
2803
+ const dimensionFlags = dimension === "xyz" ? 2147483648 : dimension === "xym" ? 1073741824 : dimension === "xyzm" ? 3221225472 : 0;
2804
+ return (geometryCode | dimensionFlags | 536870912) >>> 0;
2805
+ }
2806
+ const dimensionOffset = dimension === "xyz" ? 1e3 : dimension === "xym" ? 2e3 : dimension === "xyzm" ? 3e3 : 0;
2807
+ return geometryCode + dimensionOffset;
2808
+ }
2809
+ function makeCoordinate(dimension, x, y, z, m) {
2810
+ switch (dimension) {
2811
+ case "xy":
2812
+ return [x, y];
2813
+ case "xyz":
2814
+ return [x, y, z ?? Number.NaN];
2815
+ case "xym":
2816
+ return [x, y, m ?? Number.NaN];
2817
+ case "xyzm":
2818
+ return [x, y, z ?? Number.NaN, m ?? Number.NaN];
2819
+ }
2820
+ }
2821
+ function getDimensionSize(dimension) {
2822
+ return dimension === "xy" ? 2 : dimension === "xyzm" ? 4 : 3;
2823
+ }
2824
+ function validateSrid(srid) {
2825
+ if (srid !== void 0 && (!Number.isSafeInteger(srid) || srid < 0 || srid > 4294967295)) {
2826
+ throw new Error("WKBBuilder srid must be an unsigned 32-bit integer");
2827
+ }
2828
+ }
2829
+ function makeNullBitmap(geometryWriters) {
2830
+ const nullBitmap = new Uint8Array(Math.ceil(geometryWriters.length / 8));
2831
+ let nullCount = 0;
2832
+ for (let geometryIndex = 0; geometryIndex < geometryWriters.length; geometryIndex++) {
2833
+ if (geometryWriters[geometryIndex]) {
2834
+ nullBitmap[geometryIndex >> 3] |= 1 << (geometryIndex & 7);
2835
+ } else {
2836
+ nullCount++;
2837
+ }
2838
+ }
2839
+ return { nullBitmap, nullCount };
2840
+ }
2841
+
2842
+ // dist/wkb/wkt.js
2843
+ function parseWKT(text, options) {
2844
+ const parser = new WKTParser(text);
2845
+ const result = parser.parseGeometry("xy", options ?? {}, false);
2846
+ parser.assertComplete();
2847
+ return result.geometry;
2848
+ }
2849
+ function formatWKT(geometry, dimension) {
2850
+ if (isWKTParseResult(geometry)) {
2851
+ return dimension === void 0 ? formatWKTResult(geometry) : formatWKTGeometry(geometry.geometry, dimension);
2852
+ }
2853
+ return formatWKTGeometry(geometry, dimension ?? inferWellKnownGeometryDimension(geometry));
2854
+ }
2855
+ function formatWKTResult(result) {
2856
+ return formatWKTGeometry(result.geometry, result.dimension, result.children);
2857
+ }
2858
+ function formatWKTGeometry(geometry, dimension, children) {
2859
+ const dimensionToken = dimension === "xy" ? "" : " " + dimension.slice(2).toUpperCase();
2860
+ if (geometry.type === "GeometryCollection") {
2861
+ if (geometry.geometries.length === 0)
2862
+ return "GEOMETRYCOLLECTION" + dimensionToken + " EMPTY";
2863
+ const formattedChildren = children ? children.map(formatWKTResult) : geometry.geometries.map((child) => formatWKTGeometry(child, dimension));
2864
+ return "GEOMETRYCOLLECTION" + dimensionToken + " (" + formattedChildren.join(", ") + ")";
2865
+ }
2866
+ const type = geometry.type.toUpperCase();
2867
+ const isEmpty = geometry.type === "MultiPoint" ? geometry.coordinates.length === 0 : isEmptyCoordinates(geometry.coordinates);
2868
+ if (isEmpty)
2869
+ return type + dimensionToken + " EMPTY";
2870
+ return type + dimensionToken + " " + formatCoordinateNesting(geometry.coordinates, getGeometryDepth(geometry.type), geometry.type === "MultiPoint");
2871
+ }
2872
+ function isWKTParseResult(value) {
2873
+ return "geometry" in value && "dimension" in value;
2874
+ }
2875
+ var WKTParser = class {
2876
+ constructor(text) {
2877
+ this.index = 0;
2878
+ this.tokens = tokenizeWKT(text);
2879
+ }
2880
+ parseGeometry(inheritedDimension, options, validateInheritedDimensions) {
2881
+ const type = this.takeWord().toUpperCase();
2882
+ let dimension = inheritedDimension;
2883
+ let hasExplicitDimension = false;
2884
+ if (["Z", "M", "ZM"].includes(this.peek().toUpperCase())) {
2885
+ const token = this.take().toUpperCase();
2886
+ dimension = token === "Z" ? "xyz" : token === "M" ? "xym" : "xyzm";
2887
+ hasExplicitDimension = true;
2888
+ }
2889
+ const dimensionSize = getWellKnownDimensionSize(dimension);
2890
+ if (this.peek().toUpperCase() === "EMPTY") {
2891
+ this.take();
2892
+ return { geometry: makeEmptyGeometry(type, dimensionSize), dimension };
2893
+ }
2894
+ if (type === "GEOMETRYCOLLECTION") {
2895
+ this.expect("(");
2896
+ const children = [];
2897
+ if (this.peek() !== ")") {
2898
+ do
2899
+ children.push(this.parseGeometry(dimension, options, validateInheritedDimensions));
2900
+ while (this.takeIf(","));
2901
+ }
2902
+ this.expect(")");
2903
+ return {
2904
+ geometry: { type: "GeometryCollection", geometries: children.map((child) => child.geometry) },
2905
+ dimension,
2906
+ children
2907
+ };
2908
+ }
2909
+ const inferDimension = Boolean(options.inferDimensions && !hasExplicitDimension && inheritedDimension === "xy");
2910
+ const coordinates = this.parseCoordinateNesting(getWKTDepth(type), inferDimension ? null : dimensionSize, type === "MULTIPOINT");
2911
+ const coordinateValues = coordinates;
2912
+ if (inferDimension) {
2913
+ const inferredSize = inferCoordinateSize(coordinateValues);
2914
+ if (inferredSize !== null)
2915
+ dimension = getDimensionForSize(inferredSize);
2916
+ } else if (hasExplicitDimension || validateInheritedDimensions) {
2917
+ assertCoordinateSize(coordinateValues, dimensionSize);
2918
+ }
2919
+ return { geometry: makeGeometry(type, coordinates), dimension };
2920
+ }
2921
+ assertComplete() {
2922
+ if (this.index !== this.tokens.length)
2923
+ throw new Error(`Unexpected WKT token ${this.peek()}`);
2924
+ }
2925
+ parseCoordinateNesting(depth, dimensionSize, allowEmptyPoints = false) {
2926
+ this.expect("(");
2927
+ if (depth === 0) {
2928
+ const coordinate = this.readCoordinate(dimensionSize);
2929
+ this.expect(")");
2930
+ return coordinate;
2931
+ }
2932
+ const values = [];
2933
+ if (this.peek() !== ")") {
2934
+ do {
2935
+ if (allowEmptyPoints && depth === 1 && this.peek().toUpperCase() === "EMPTY") {
2936
+ this.take();
2937
+ values.push([]);
2938
+ } else if (depth === 1 && this.peek() !== "(") {
2939
+ values.push(this.readCoordinate(dimensionSize));
2940
+ } else {
2941
+ values.push(this.parseCoordinateNesting(depth - 1, dimensionSize));
2942
+ }
2943
+ } while (this.takeIf(","));
2944
+ }
2945
+ this.expect(")");
2946
+ return values;
2947
+ }
2948
+ readCoordinate(dimensionSize) {
2949
+ const values = [];
2950
+ while ((dimensionSize === null || values.length < dimensionSize) && isNumberToken(this.peek())) {
2951
+ values.push(Number(this.take()));
2952
+ }
2953
+ if (values.length < 2)
2954
+ throw new Error("WKT coordinate requires at least two numbers");
2955
+ if (values.length > 4)
2956
+ throw new Error("WKT coordinates cannot contain more than four numbers");
2957
+ return values;
2958
+ }
2959
+ peek() {
2960
+ return this.tokens[this.index] || "";
2961
+ }
2962
+ take() {
2963
+ if (this.index >= this.tokens.length)
2964
+ throw new Error("Unexpected end of WKT");
2965
+ return this.tokens[this.index++];
2966
+ }
2967
+ takeWord() {
2968
+ const token = this.take();
2969
+ if (!/^[A-Za-z_]+$/.test(token))
2970
+ throw new Error(`Expected WKT geometry type, found ${token}`);
2971
+ return token;
2972
+ }
2973
+ takeIf(token) {
2974
+ if (this.peek() !== token)
2975
+ return false;
2976
+ this.index++;
2977
+ return true;
2978
+ }
2979
+ expect(token) {
2980
+ const actual = this.take();
2981
+ if (actual !== token)
2982
+ throw new Error(`Expected WKT token ${token}, found ${actual}`);
2983
+ }
2984
+ };
2985
+ function inferCoordinateSize(value) {
2986
+ let coordinateSize = null;
2987
+ const visit = (coordinates) => {
2988
+ if (coordinates.length === 0)
2989
+ return;
2990
+ if (typeof coordinates[0] === "number") {
2991
+ if (coordinates.length < 2 || coordinates.length > 4) {
2992
+ throw new Error("WKT coordinates must contain between two and four numbers");
2993
+ }
2994
+ if (coordinateSize !== null && coordinateSize !== coordinates.length) {
2995
+ throw new Error("WKT geometry contains inconsistent coordinate dimensions");
2996
+ }
2997
+ coordinateSize = coordinates.length;
2998
+ return;
2999
+ }
3000
+ for (const child of coordinates)
3001
+ visit(child);
3002
+ };
3003
+ visit(value);
3004
+ return coordinateSize;
3005
+ }
3006
+ function assertCoordinateSize(value, expectedSize) {
3007
+ const actualSize = inferCoordinateSize(value);
3008
+ if (actualSize !== null && actualSize !== expectedSize) {
3009
+ throw new Error("WKT coordinate dimension does not match declared dimension " + expectedSize);
3010
+ }
3011
+ }
3012
+ function getDimensionForSize(size) {
3013
+ switch (size) {
3014
+ case 2:
3015
+ return "xy";
3016
+ case 3:
3017
+ return "xyz";
3018
+ case 4:
3019
+ return "xyzm";
3020
+ default:
3021
+ throw new Error("Unsupported WKT coordinate dimension " + size);
3022
+ }
3023
+ }
3024
+ function tokenizeWKT(text) {
3025
+ const tokens = [];
3026
+ const tokenPattern = /[A-Za-z_]+|[(),]|[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?/gy;
3027
+ let index = 0;
3028
+ while (index < text.length) {
3029
+ while (index < text.length && /\s/.test(text[index]))
3030
+ index++;
3031
+ if (index === text.length)
3032
+ break;
3033
+ tokenPattern.lastIndex = index;
3034
+ const match = tokenPattern.exec(text);
3035
+ if (!match) {
3036
+ throw new Error(`Unexpected WKT character ${JSON.stringify(text[index])} at ${index}`);
3037
+ }
3038
+ tokens.push(match[0]);
3039
+ index = tokenPattern.lastIndex;
3040
+ }
3041
+ return tokens;
3042
+ }
3043
+ function formatCoordinateNesting(value, depth, allowEmptyPoints = false) {
3044
+ if (depth === 0)
3045
+ return `(${value.map(formatNumber).join(" ")})`;
3046
+ return `(${value.map((child) => {
3047
+ if (depth === 1) {
3048
+ const coordinate = child;
3049
+ if (allowEmptyPoints && isEmptyCoordinates(coordinate))
3050
+ return "EMPTY";
3051
+ return coordinate.map(formatNumber).join(" ");
3052
+ }
3053
+ return formatCoordinateNesting(child, depth - 1);
3054
+ }).join(", ")})`;
3055
+ }
3056
+ function formatNumber(value) {
3057
+ if (!Number.isFinite(value))
3058
+ return "NaN";
3059
+ return String(value);
3060
+ }
3061
+ function getGeometryDepth(type) {
3062
+ switch (type) {
3063
+ case "Point":
3064
+ return 0;
3065
+ case "LineString":
3066
+ case "MultiPoint":
3067
+ return 1;
3068
+ case "Polygon":
3069
+ case "MultiLineString":
3070
+ return 2;
3071
+ case "MultiPolygon":
3072
+ return 3;
3073
+ }
3074
+ }
3075
+ function getWKTDepth(type) {
3076
+ switch (type) {
3077
+ case "POINT":
3078
+ return 0;
3079
+ case "LINESTRING":
3080
+ return 1;
3081
+ case "POLYGON":
3082
+ return 2;
3083
+ case "MULTIPOINT":
3084
+ return 1;
3085
+ case "MULTILINESTRING":
3086
+ return 2;
3087
+ case "MULTIPOLYGON":
3088
+ return 3;
3089
+ default:
3090
+ throw new Error(`Unsupported WKT geometry type ${type}`);
3091
+ }
3092
+ }
3093
+ function makeGeometry(type, coordinates) {
3094
+ const canonical = type[0] + type.slice(1).toLowerCase();
3095
+ const names = {
3096
+ Point: "Point",
3097
+ Linestring: "LineString",
3098
+ Polygon: "Polygon",
3099
+ Multipoint: "MultiPoint",
3100
+ Multilinestring: "MultiLineString",
3101
+ Multipolygon: "MultiPolygon"
3102
+ };
3103
+ const geometryType = names[canonical];
3104
+ if (!geometryType)
3105
+ throw new Error(`Unsupported WKT geometry type ${type}`);
3106
+ return { type: geometryType, coordinates };
3107
+ }
3108
+ function makeEmptyGeometry(type, dimensionSize) {
3109
+ if (type === "GEOMETRYCOLLECTION")
3110
+ return { type: "GeometryCollection", geometries: [] };
3111
+ if (type === "POINT") {
3112
+ return {
3113
+ type: "Point",
3114
+ coordinates: new Array(getValidDimensionSize(dimensionSize)).fill(Number.NaN)
3115
+ };
3116
+ }
3117
+ return makeGeometry(type, []);
3118
+ }
3119
+ function getValidDimensionSize(size) {
3120
+ if (size === 2 || size === 3 || size === 4)
3121
+ return size;
3122
+ return getWellKnownDimensionSize("xy");
3123
+ }
3124
+ function isEmptyCoordinates(value) {
3125
+ if (value.length === 0)
3126
+ return true;
3127
+ if (typeof value[0] === "number") {
3128
+ return value.every((component) => !Number.isFinite(component));
3129
+ }
3130
+ return value.every((child) => isEmptyCoordinates(child));
3131
+ }
3132
+ function isNumberToken(token) {
3133
+ return token !== "" && Number.isFinite(Number(token));
3134
+ }
3135
+
3136
+ // dist/geoarrow/codecs.js
3137
+ var textEncoder = new TextEncoder();
3138
+ var textDecoder = new TextDecoder();
3139
+ var NULL_FAMILY = 255;
3140
+ function decodeGeoArrowWKB(column, options = {}) {
3141
+ if (column.encoding !== "geoarrow.wkb")
3142
+ throw new Error("Expected a geoarrow.wkb column");
3143
+ const classifications = [];
3144
+ const schemaKeys = /* @__PURE__ */ new Set();
3145
+ const collectionSchemas = [];
3146
+ const rootFamilies = /* @__PURE__ */ new Set();
3147
+ let hasNulls = false;
3148
+ let inferredDimension = "xy";
3149
+ for (const chunk of column.chunks) {
3150
+ if (chunk.kind !== "serialized")
3151
+ throw new Error("Serialized column contains native storage");
3152
+ const families = new Uint8Array(chunk.length).fill(NULL_FAMILY);
3153
+ const dimensions = new Uint8Array(chunk.length);
3154
+ for (let rowIndex = 0; rowIndex < chunk.length; rowIndex++) {
3155
+ if (!isGeoArrowValueValid(chunk.validity, rowIndex)) {
3156
+ hasNulls = true;
3157
+ continue;
3158
+ }
3159
+ const bytes = getSerializedBytes(chunk, rowIndex);
3160
+ const rootHeader = inspectWKBHeader(bytes);
3161
+ const rootFamily = getGeometryFamilyIndex(rootHeader.geometryType);
3162
+ let rowDimension = rootHeader.dimension;
3163
+ if (rootHeader.geometryType === "GeometryCollection") {
3164
+ const collectionStack = [];
3165
+ let concreteRootDepth = -1;
3166
+ visitWKB(bytes, {
3167
+ geometry: (header, _count, depth) => {
3168
+ var _a;
3169
+ rowDimension = mergeDimensions(rowDimension, header.dimension);
3170
+ if (concreteRootDepth >= 0 && depth > concreteRootDepth)
3171
+ return;
3172
+ concreteRootDepth = -1;
3173
+ while (collectionStack.length && depth <= collectionStack[collectionStack.length - 1].depth) {
3174
+ collectionStack.pop();
3175
+ }
3176
+ const parent = collectionStack[collectionStack.length - 1];
3177
+ if (parent) {
3178
+ collectionSchemas[_a = parent.level] || (collectionSchemas[_a] = /* @__PURE__ */ new Set());
3179
+ collectionSchemas[parent.level].add(getGeometryTypeId2(header.geometryType, header.dimension));
3180
+ }
3181
+ if (header.geometryType === "GeometryCollection") {
3182
+ collectionStack.push({ depth, level: parent ? parent.level + 1 : 0 });
3183
+ } else if (parent) {
3184
+ concreteRootDepth = depth;
3185
+ }
3186
+ }
3187
+ }, options.traversal);
3188
+ }
3189
+ families[rowIndex] = rootFamily;
3190
+ dimensions[rowIndex] = getDimensionIndex(rowDimension);
3191
+ rootFamilies.add(rootFamily);
3192
+ schemaKeys.add(getGeometryTypeIdFromIndices(rootFamily, dimensions[rowIndex]));
3193
+ inferredDimension = mergeDimensions(inferredDimension, rowDimension);
3194
+ }
3195
+ classifications.push({ families, dimensions });
3196
+ }
3197
+ const dimension = resolveDecodeDimension(options.dimension, column.dimension, inferredDimension);
3198
+ const forceDimension = Boolean(options.dimension && options.dimension !== "infer");
3199
+ if (forceDimension) {
3200
+ schemaKeys.clear();
3201
+ for (const classification of classifications) {
3202
+ for (let rowIndex = 0; rowIndex < classification.families.length; rowIndex++) {
3203
+ const family = classification.families[rowIndex];
3204
+ if (family === NULL_FAMILY)
3205
+ continue;
3206
+ classification.dimensions[rowIndex] = getDimensionIndex(dimension);
3207
+ schemaKeys.add(getGeometryTypeIdFromIndices(family, getDimensionIndex(dimension)));
3208
+ }
3209
+ }
3210
+ }
3211
+ const encoding = resolveDecodeEncoding(options.encoding, rootFamilies);
3212
+ validateDecodeEncoding(encoding, rootFamilies);
3213
+ const builderOptions = {
3214
+ dimension,
3215
+ coordinateLayout: options.coordinateLayout || "interleaved",
3216
+ coordinateType: options.coordinateType || "float64",
3217
+ offsetType: options.offsetType || "int32"
3218
+ };
3219
+ if (encoding !== "geoarrow.geometry" && encoding !== "geoarrow.geometrycollection") {
3220
+ const chunks2 = column.chunks.map((chunk, chunkIndex) => decodeConcreteWKBChunk(chunk, classifications[chunkIndex], encoding, builderOptions, options.traversal));
3221
+ return copyMetadata(column, {
3222
+ encoding,
3223
+ dimension,
3224
+ coordinateLayout: builderOptions.coordinateLayout,
3225
+ chunks: chunks2
3226
+ });
3227
+ }
3228
+ if (encoding === "geoarrow.geometrycollection") {
3229
+ const stableCollectionSchemas = normalizeCollectionSchemas(collectionSchemas, dimension, forceDimension);
3230
+ const chunks2 = column.chunks.map((chunk, chunkIndex) => decodeGeometryCollectionWKBChunk(chunk, classifications[chunkIndex], void 0, stableCollectionSchemas, builderOptions, options.traversal, forceDimension ? dimension : void 0));
3231
+ return copyMetadata(column, {
3232
+ encoding,
3233
+ dimension,
3234
+ coordinateLayout: builderOptions.coordinateLayout,
3235
+ chunks: chunks2
3236
+ });
3237
+ }
3238
+ if (schemaKeys.size === 0)
3239
+ schemaKeys.add(getGeometryTypeId2("Point", dimension));
3240
+ if (hasNulls)
3241
+ schemaKeys.add(getGeometryTypeId2("Point", dimension));
3242
+ const stableSchema = [...schemaKeys].sort((left, right) => left - right);
3243
+ const chunks = column.chunks.map((chunk, chunkIndex) => decodeUnionWKBChunk(chunk, classifications[chunkIndex], stableSchema, normalizeCollectionSchemas(collectionSchemas, dimension, forceDimension), builderOptions, options.traversal, forceDimension ? dimension : void 0));
3244
+ return copyMetadata(column, {
3245
+ encoding: "geoarrow.geometry",
3246
+ dimension,
3247
+ coordinateLayout: builderOptions.coordinateLayout,
3248
+ chunks
3249
+ });
3250
+ }
3251
+ function getGeoArrowWKBVertexCount(column, traversal) {
3252
+ if (column.encoding !== "geoarrow.wkb")
3253
+ throw new Error("Expected a geoarrow.wkb column");
3254
+ let vertexCount = 0;
3255
+ for (const chunk of column.chunks) {
3256
+ if (chunk.kind !== "serialized")
3257
+ throw new Error("Serialized column contains native storage");
3258
+ for (let rowIndex = 0; rowIndex < chunk.length; rowIndex++) {
3259
+ if (!isGeoArrowValueValid(chunk.validity, rowIndex))
3260
+ continue;
3261
+ visitWKB(getSerializedBytes(chunk, rowIndex), {
3262
+ geometry: (header, count) => {
3263
+ if (header.geometryType === "Point")
3264
+ vertexCount++;
3265
+ else if (header.geometryType === "LineString")
3266
+ vertexCount += count || 0;
3267
+ },
3268
+ ring: (pointCount) => {
3269
+ vertexCount += pointCount;
3270
+ }
3271
+ }, traversal);
3272
+ }
3273
+ }
3274
+ return vertexCount;
3275
+ }
3276
+ function decodeConcreteWKBChunk(chunk, classification, encoding, options, traversal) {
3277
+ const measure = new GeoArrowBuilder({ ...options, encoding, mode: "measure" });
3278
+ replaySerializedChunk(chunk, classification, encoding, measure, traversal);
3279
+ const write = new GeoArrowBuilder({
3280
+ ...options,
3281
+ encoding,
3282
+ mode: "write",
3283
+ target: measure.allocateTarget()
3284
+ });
3285
+ replaySerializedChunk(chunk, classification, encoding, write, traversal);
3286
+ return write.finish().chunks[0];
3287
+ }
3288
+ function replaySerializedChunk(chunk, classification, encoding, builder, traversal) {
3289
+ const targetType = geometryTypeFromEncoding(encoding);
3290
+ for (let rowIndex = 0; rowIndex < chunk.length; rowIndex++) {
3291
+ if (classification.families[rowIndex] === NULL_FAMILY)
3292
+ builder.append(null);
3293
+ else
3294
+ visitWKBIntoBuilder(getSerializedBytes(chunk, rowIndex), builder, targetType, traversal);
3295
+ }
3296
+ }
3297
+ function decodeUnionWKBChunk(chunk, classification, stableSchema, collectionSchemas, options, traversal, childDimensionOverride) {
3298
+ const measureBuilders = /* @__PURE__ */ new Map();
3299
+ for (const key of stableSchema) {
3300
+ const type = getGeometryTypeFromId(key);
3301
+ if (type !== "GeometryCollection") {
3302
+ const encoding = encodingFromGeometryType(type);
3303
+ measureBuilders.set(key, new GeoArrowBuilder({
3304
+ ...options,
3305
+ encoding,
3306
+ dimension: getDimensionFromId(key),
3307
+ mode: "measure"
3308
+ }));
3309
+ }
3310
+ }
3311
+ const typeIds = new Int8Array(chunk.length);
3312
+ const valueOffsets = new Int32Array(chunk.length);
3313
+ const childCounts = /* @__PURE__ */ new Map();
3314
+ const nullKey = stableSchema[0];
3315
+ for (let rowIndex = 0; rowIndex < chunk.length; rowIndex++) {
3316
+ const family = classification.families[rowIndex];
3317
+ const key = family === NULL_FAMILY ? nullKey : getGeometryTypeIdFromIndices(family, classification.dimensions[rowIndex]);
3318
+ typeIds[rowIndex] = key;
3319
+ valueOffsets[rowIndex] = childCounts.get(key) || 0;
3320
+ childCounts.set(key, valueOffsets[rowIndex] + 1);
3321
+ const builder = measureBuilders.get(key);
3322
+ if (builder) {
3323
+ if (family === NULL_FAMILY)
3324
+ builder.append(null);
3325
+ else
3326
+ visitWKBIntoBuilder(getSerializedBytes(chunk, rowIndex), builder, getConcreteGeometryTypeFromId(key), traversal);
3327
+ }
3328
+ }
3329
+ const writeBuilders = /* @__PURE__ */ new Map();
3330
+ for (const key of stableSchema) {
3331
+ if (getGeometryTypeFromId(key) === "GeometryCollection")
3332
+ continue;
3333
+ const measure = measureBuilders.get(key);
3334
+ writeBuilders.set(key, new GeoArrowBuilder({
3335
+ ...options,
3336
+ encoding: encodingFromGeometryType(getConcreteGeometryTypeFromId(key)),
3337
+ dimension: getDimensionFromId(key),
3338
+ mode: "write",
3339
+ target: measure.allocateTarget()
3340
+ }));
3341
+ }
3342
+ for (let rowIndex = 0; rowIndex < chunk.length; rowIndex++) {
3343
+ const family = classification.families[rowIndex];
3344
+ const key = family === NULL_FAMILY ? nullKey : getGeometryTypeIdFromIndices(family, classification.dimensions[rowIndex]);
3345
+ const builder = writeBuilders.get(key);
3346
+ if (builder) {
3347
+ if (family === NULL_FAMILY)
3348
+ builder.append(null);
3349
+ else
3350
+ visitWKBIntoBuilder(getSerializedBytes(chunk, rowIndex), builder, getConcreteGeometryTypeFromId(key), traversal);
3351
+ }
3352
+ }
3353
+ const children = stableSchema.map((key) => {
3354
+ const type = getGeometryTypeFromId(key);
3355
+ if (type === "GeometryCollection") {
3356
+ return {
3357
+ name: type,
3358
+ typeId: key,
3359
+ encoding: "geoarrow.geometrycollection",
3360
+ dimension: getDimensionFromId(key),
3361
+ coordinateLayout: options.coordinateLayout,
3362
+ data: decodeGeometryCollectionWKBChunk(chunk, classification, key, collectionSchemas, { ...options, dimension: getDimensionFromId(key) }, traversal, childDimensionOverride)
3363
+ };
3364
+ }
3365
+ const built = writeBuilders.get(key).finish();
3366
+ return {
3367
+ name: getGeometryTypeFromId(key),
3368
+ typeId: key,
3369
+ encoding: built.encoding,
3370
+ dimension: built.dimension,
3371
+ coordinateLayout: built.coordinateLayout,
3372
+ data: built.chunks[0]
3373
+ };
3374
+ });
3375
+ return { kind: "dense-union", length: chunk.length, typeIds, valueOffsets, children };
3376
+ }
3377
+ function decodeGeometryCollectionWKBChunk(chunk, classification, selectorKey, schemas, options, traversal, childDimensionOverride) {
3378
+ const measureLevels = schemas.map((schema) => makeCollectionMeasureLevel(schema, options));
3379
+ if (measureLevels.length === 0)
3380
+ measureLevels.push(makeCollectionMeasureLevel([], options));
3381
+ forEachSelectedCollectionRow(chunk, classification, selectorKey, (bytes, valid) => {
3382
+ if (!valid) {
3383
+ measureLevels[0].rowCount++;
3384
+ return;
3385
+ }
3386
+ replayWKBCollection(bytes, measureLevels, void 0, options.dimension, traversal, childDimensionOverride);
3387
+ });
3388
+ const writeLevels = measureLevels.map((level) => makeCollectionWriteLevel(level, options));
3389
+ forEachSelectedCollectionRow(chunk, classification, selectorKey, (bytes, valid) => {
3390
+ if (!valid) {
3391
+ writeCollectionRow(writeLevels[0], 0);
3392
+ return;
3393
+ }
3394
+ replayWKBCollection(bytes, measureLevels, writeLevels, options.dimension, traversal, childDimensionOverride);
3395
+ });
3396
+ const root = makeCollectionLevelArray(0, measureLevels, writeLevels, options);
3397
+ if (selectorKey !== void 0)
3398
+ return root;
3399
+ const validity = new Uint8Array(Math.ceil(root.length / 8));
3400
+ for (let rowIndex = 0; rowIndex < classification.families.length; rowIndex++) {
3401
+ if (classification.families[rowIndex] === getGeometryFamilyIndex("GeometryCollection")) {
3402
+ validity[rowIndex >> 3] |= 1 << (rowIndex & 7);
3403
+ }
3404
+ }
3405
+ return { ...root, validity: { values: validity } };
3406
+ }
3407
+ function forEachSelectedCollectionRow(chunk, classification, selectorKey, visitor) {
3408
+ const collectionFamily = getGeometryFamilyIndex("GeometryCollection");
3409
+ for (let rowIndex = 0; rowIndex < chunk.length; rowIndex++) {
3410
+ const family = classification.families[rowIndex];
3411
+ if (selectorKey === void 0) {
3412
+ if (family === NULL_FAMILY)
3413
+ visitor(void 0, false);
3414
+ else if (family === collectionFamily)
3415
+ visitor(getSerializedBytes(chunk, rowIndex), true);
3416
+ else
3417
+ throw new Error("Rows cannot be represented as geoarrow.geometrycollection");
3418
+ } else if (family === collectionFamily && getGeometryTypeIdFromIndices(family, classification.dimensions[rowIndex]) === selectorKey) {
3419
+ visitor(getSerializedBytes(chunk, rowIndex), true);
3420
+ }
3421
+ }
3422
+ }
3423
+ function makeCollectionMeasureLevel(schema, options) {
3424
+ const builders = /* @__PURE__ */ new Map();
3425
+ for (const key of schema) {
3426
+ const type = getGeometryTypeFromId(key);
3427
+ if (type !== "GeometryCollection") {
3428
+ builders.set(key, new GeoArrowBuilder({
3429
+ ...options,
3430
+ encoding: encodingFromGeometryType(type),
3431
+ dimension: getDimensionFromId(key),
3432
+ mode: "measure"
3433
+ }));
3434
+ }
3435
+ }
3436
+ return { schema, rowCount: 0, childCount: 0, builders };
3437
+ }
3438
+ function makeCollectionWriteLevel(measure, options) {
3439
+ const OffsetArray = options.offsetType === "int64" ? BigInt64Array : Int32Array;
3440
+ const builders = /* @__PURE__ */ new Map();
3441
+ for (const [key, builder] of measure.builders) {
3442
+ builders.set(key, new GeoArrowBuilder({
3443
+ ...options,
3444
+ encoding: encodingFromGeometryType(getConcreteGeometryTypeFromId(key)),
3445
+ dimension: getDimensionFromId(key),
3446
+ mode: "write",
3447
+ target: builder.allocateTarget()
3448
+ }));
3449
+ }
3450
+ return {
3451
+ schema: measure.schema,
3452
+ rowCursor: 0,
3453
+ childCursor: 0,
3454
+ offsets: new OffsetArray(measure.rowCount + 1),
3455
+ typeIds: new Int8Array(measure.childCount),
3456
+ valueOffsets: new Int32Array(measure.childCount),
3457
+ childCounts: /* @__PURE__ */ new Map(),
3458
+ builders
3459
+ };
3460
+ }
3461
+ function replayWKBCollection(bytes, measureLevels, writeLevels, collectionDimension, traversal, childDimensionOverride) {
3462
+ const collectionStack = [];
3463
+ let active;
3464
+ const finishActive = () => {
3465
+ active == null ? void 0 : active.builder.endGeometry();
3466
+ active = void 0;
3467
+ };
3468
+ visitWKB(bytes, {
3469
+ geometry: (header, count, depth) => {
3470
+ if (active && depth > active.rootDepth) {
3471
+ if (active.rootType === "MultiLineString" && header.geometryType === "LineString") {
3472
+ active.builder.beginRing(count);
3473
+ } else if (active.rootType === "MultiPolygon" && header.geometryType === "Polygon") {
3474
+ active.builder.beginPolygon();
3475
+ }
3476
+ return;
3477
+ }
3478
+ finishActive();
3479
+ while (collectionStack.length && depth <= collectionStack[collectionStack.length - 1].depth) {
3480
+ collectionStack.pop();
3481
+ }
3482
+ const parent = collectionStack[collectionStack.length - 1];
3483
+ if (header.geometryType === "GeometryCollection") {
3484
+ if (parent) {
3485
+ addCollectionChild(measureLevels[parent.level], writeLevels == null ? void 0 : writeLevels[parent.level], getGeometryTypeId2("GeometryCollection", collectionDimension));
3486
+ }
3487
+ const level = parent ? parent.level + 1 : 0;
3488
+ if (!measureLevels[level]) {
3489
+ measureLevels[level] = makeCollectionMeasureLevel([], {
3490
+ dimension: collectionDimension,
3491
+ coordinateLayout: "interleaved",
3492
+ coordinateType: "float64",
3493
+ offsetType: "int32"
3494
+ });
3495
+ }
3496
+ if (writeLevels)
3497
+ writeCollectionRow(writeLevels[level], count || 0);
3498
+ else
3499
+ measureLevels[level].rowCount++;
3500
+ collectionStack.push({ depth, level });
3501
+ return;
3502
+ }
3503
+ if (!parent)
3504
+ throw new Error("Expected a GeometryCollection root");
3505
+ const key = getGeometryTypeId2(header.geometryType, childDimensionOverride || header.dimension);
3506
+ addCollectionChild(measureLevels[parent.level], writeLevels == null ? void 0 : writeLevels[parent.level], key);
3507
+ const builder = writeLevels ? writeLevels[parent.level].builders.get(key) : measureLevels[parent.level].builders.get(key);
3508
+ if (!builder)
3509
+ throw new Error(`Missing GeometryCollection child schema for type ID ${key}`);
3510
+ builder.beginGeometry(header.geometryType, header.dimension, count);
3511
+ active = { builder, rootDepth: depth, rootType: header.geometryType };
3512
+ },
3513
+ ring: (pointCount) => active == null ? void 0 : active.builder.beginRing(pointCount),
3514
+ coordinate: (x, y, z, m, dimension) => active == null ? void 0 : active.builder.writeCoordinateFromDimension(x, y, z, m, dimension)
3515
+ }, traversal);
3516
+ finishActive();
3517
+ }
3518
+ function addCollectionChild(measure, write, key) {
3519
+ if (!write) {
3520
+ measure.childCount++;
3521
+ return;
3522
+ }
3523
+ const index = write.childCursor++;
3524
+ write.typeIds[index] = key;
3525
+ write.valueOffsets[index] = write.childCounts.get(key) || 0;
3526
+ write.childCounts.set(key, write.valueOffsets[index] + 1);
3527
+ }
3528
+ function writeCollectionRow(level, childCount) {
3529
+ level.rowCursor++;
3530
+ setGeoArrowOffset(level.offsets, level.rowCursor, level.childCursor + childCount);
3531
+ }
3532
+ function makeCollectionLevelArray(levelIndex, measureLevels, writeLevels, options) {
3533
+ const measure = measureLevels[levelIndex];
3534
+ const write = writeLevels[levelIndex];
3535
+ const children = measure.schema.map((key) => {
3536
+ const type = getGeometryTypeFromId(key);
3537
+ if (type === "GeometryCollection") {
3538
+ return {
3539
+ name: type,
3540
+ typeId: key,
3541
+ encoding: "geoarrow.geometrycollection",
3542
+ dimension: getDimensionFromId(key),
3543
+ coordinateLayout: options.coordinateLayout,
3544
+ data: makeCollectionLevelArray(levelIndex + 1, measureLevels, writeLevels, options)
3545
+ };
3546
+ }
3547
+ const built = write.builders.get(key).finish();
3548
+ return {
3549
+ name: type,
3550
+ typeId: key,
3551
+ encoding: built.encoding,
3552
+ dimension: built.dimension,
3553
+ coordinateLayout: built.coordinateLayout,
3554
+ data: built.chunks[0]
3555
+ };
3556
+ });
3557
+ return {
3558
+ kind: "list",
3559
+ length: measure.rowCount,
3560
+ offsets: write.offsets,
3561
+ child: {
3562
+ kind: "dense-union",
3563
+ length: measure.childCount,
3564
+ typeIds: write.typeIds,
3565
+ valueOffsets: write.valueOffsets,
3566
+ children
3567
+ }
3568
+ };
3569
+ }
3570
+ function setGeoArrowOffset(offsets, index, value) {
3571
+ if (offsets instanceof BigInt64Array)
3572
+ offsets[index] = BigInt(value);
3573
+ else
3574
+ offsets[index] = value;
3575
+ }
3576
+ function normalizeCollectionSchemas(schemas, dimension, forceDimension) {
3577
+ return schemas.map((schema) => [...schema].map((key) => forceDimension || getGeometryTypeFromId(key) === "GeometryCollection" ? getGeometryTypeId2(getGeometryTypeFromId(key), dimension) : key).filter((key, index, values) => values.indexOf(key) === index).sort((left, right) => left - right));
3578
+ }
3579
+ function visitWKBIntoBuilder(bytes, builder, targetType, traversal) {
3580
+ let rootType;
3581
+ visitWKB(bytes, {
3582
+ geometry: (header, _count, depth) => {
3583
+ if (depth === 0) {
3584
+ rootType = header.geometryType;
3585
+ builder.beginGeometry(targetType, header.dimension, _count);
3586
+ if (rootType === "LineString" && targetType === "MultiLineString")
3587
+ builder.beginRing(_count);
3588
+ if (rootType === "Polygon" && targetType === "MultiPolygon")
3589
+ builder.beginPolygon();
3590
+ } else if (rootType === "MultiLineString" && header.geometryType === "LineString") {
3591
+ builder.beginRing(_count);
3592
+ } else if (rootType === "MultiPolygon" && header.geometryType === "Polygon") {
3593
+ builder.beginPolygon();
3594
+ }
3595
+ },
3596
+ ring: (pointCount) => {
3597
+ if (rootType === "Polygon" || rootType === "MultiPolygon")
3598
+ builder.beginRing(pointCount);
3599
+ },
3600
+ coordinate: (x, y, z, m, dimension) => {
3601
+ builder.writeCoordinateFromDimension(x, y, z, m, dimension);
3602
+ }
3603
+ }, traversal);
3604
+ builder.endGeometry();
3605
+ }
3606
+ function encodingFromGeometryType(type) {
3607
+ if (type === "GeometryCollection")
3608
+ throw new Error("GeometryCollection requires collection storage");
3609
+ return `geoarrow.${type.toLowerCase()}`;
3610
+ }
3611
+ function getGeometryTypeId2(type, dimension) {
3612
+ return getGeometryTypeIdFromIndices(getGeometryFamilyIndex(type), getDimensionIndex(dimension));
3613
+ }
3614
+ var GEOMETRY_TYPES2 = [
3615
+ "Point",
3616
+ "LineString",
3617
+ "Polygon",
3618
+ "MultiPoint",
3619
+ "MultiLineString",
3620
+ "MultiPolygon",
3621
+ "GeometryCollection"
3622
+ ];
3623
+ var DIMENSIONS = ["xy", "xyz", "xym", "xyzm"];
3624
+ function getGeometryFamilyIndex(type) {
3625
+ return GEOMETRY_TYPES2.indexOf(type);
3626
+ }
3627
+ function getDimensionIndex(dimension) {
3628
+ return DIMENSIONS.indexOf(dimension);
3629
+ }
3630
+ function getGeometryTypeIdFromIndices(family, dimension) {
3631
+ return family * 4 + dimension + 1;
3632
+ }
3633
+ function getGeometryTypeFromId(typeId) {
3634
+ return GEOMETRY_TYPES2[Math.floor((typeId - 1) / 4)];
3635
+ }
3636
+ function getConcreteGeometryTypeFromId(typeId) {
3637
+ const type = getGeometryTypeFromId(typeId);
3638
+ if (type === "GeometryCollection")
3639
+ throw new Error("GeometryCollection requires collection storage");
3640
+ return type;
3641
+ }
3642
+ function getDimensionFromId(typeId) {
3643
+ return DIMENSIONS[(typeId - 1) % 4];
3644
+ }
3645
+ function mergeDimensions(left, right) {
3646
+ const hasZ = left === "xyz" || left === "xyzm" || right === "xyz" || right === "xyzm";
3647
+ const hasM = left === "xym" || left === "xyzm" || right === "xym" || right === "xyzm";
3648
+ return hasZ && hasM ? "xyzm" : hasZ ? "xyz" : hasM ? "xym" : "xy";
3649
+ }
3650
+ function resolveDecodeDimension(requested, declared, inferred) {
3651
+ if (!requested || requested === "infer")
3652
+ return inferred;
3653
+ return requested === "preserve" ? declared : requested;
3654
+ }
3655
+ function resolveDecodeEncoding(requested, families) {
3656
+ if (requested && requested !== "native")
3657
+ return requested;
3658
+ if (families.size !== 1)
3659
+ return "geoarrow.geometry";
3660
+ const type = GEOMETRY_TYPES2[[...families][0]];
3661
+ return type === "GeometryCollection" ? "geoarrow.geometrycollection" : encodingFromGeometryType(type);
3662
+ }
3663
+ function validateDecodeEncoding(encoding, families) {
3664
+ if (encoding === "geoarrow.geometry")
3665
+ return;
3666
+ if (encoding === "geoarrow.geometrycollection") {
3667
+ const collectionFamily = getGeometryFamilyIndex("GeometryCollection");
3668
+ if ([...families].some((family) => family !== collectionFamily)) {
3669
+ throw new Error("Rows cannot be represented as geoarrow.geometrycollection");
3670
+ }
3671
+ return;
3672
+ }
3673
+ const targetType = geometryTypeFromEncoding(encoding);
3674
+ for (const family of families) {
3675
+ const sourceType = GEOMETRY_TYPES2[family];
3676
+ const promotable = sourceType === targetType || sourceType === "Point" && targetType === "MultiPoint" || sourceType === "LineString" && targetType === "MultiLineString" || sourceType === "Polygon" && targetType === "MultiPolygon";
3677
+ if (!promotable)
3678
+ throw new Error(`Rows cannot be represented as ${encoding}`);
3679
+ }
3680
+ }
3681
+ function geometryTypeFromEncoding(encoding) {
3682
+ const type = GEOMETRY_TYPES2.find((candidate) => `geoarrow.${candidate.toLowerCase()}` === encoding);
3683
+ if (!type || type === "GeometryCollection")
3684
+ throw new Error(`Unsupported target encoding ${encoding}`);
3685
+ return type;
3686
+ }
3687
+ function encodeGeoArrowWKB(column) {
3688
+ if (column.encoding === "geoarrow.wkb")
3689
+ return column;
3690
+ return copyMetadata(column, {
3691
+ encoding: "geoarrow.wkb",
3692
+ dimension: column.dimension,
3693
+ coordinateLayout: null,
3694
+ chunks: column.chunks.map((chunk) => encodeWKBChunk(column, chunk))
3695
+ });
3696
+ }
3697
+ function encodeWKBChunk(column, chunk) {
3698
+ const offsets = new Int32Array(chunk.length + 1);
3699
+ const validity = new Uint8Array(Math.ceil(chunk.length / 8));
3700
+ let nullCount = 0;
3701
+ for (let rowIndex = 0; rowIndex < chunk.length; rowIndex++) {
3702
+ let byteLength = 0;
3703
+ if (isPhysicalGeometryRowValid(chunk, rowIndex, column.encoding)) {
3704
+ const dimension = getPhysicalGeometryDimension(chunk, rowIndex, column.encoding, column.dimension);
3705
+ const builder = new WKBBuilder({ mode: "measure", dimension });
3706
+ writePhysicalGeometry(builder, chunk, rowIndex, column.encoding, dimension);
3707
+ byteLength = builder.finishGeometry();
3708
+ validity[rowIndex >> 3] |= 1 << (rowIndex & 7);
3709
+ } else {
3710
+ nullCount++;
3711
+ }
3712
+ const nextOffset = offsets[rowIndex] + byteLength;
3713
+ if (nextOffset > 2147483647)
3714
+ throw new Error("WKB geometry chunk exceeds Int32 offsets");
3715
+ offsets[rowIndex + 1] = nextOffset;
3716
+ }
3717
+ const values = new Uint8Array(offsets[offsets.length - 1]);
3718
+ for (let rowIndex = 0; rowIndex < chunk.length; rowIndex++) {
3719
+ if (!isPhysicalGeometryRowValid(chunk, rowIndex, column.encoding))
3720
+ continue;
3721
+ const dimension = getPhysicalGeometryDimension(chunk, rowIndex, column.encoding, column.dimension);
3722
+ const builder = new WKBBuilder({
3723
+ mode: "write",
3724
+ target: values,
3725
+ byteOffset: offsets[rowIndex],
3726
+ dimension
3727
+ });
3728
+ writePhysicalGeometry(builder, chunk, rowIndex, column.encoding, dimension);
3729
+ if (offsets[rowIndex] + builder.finishGeometry() !== offsets[rowIndex + 1]) {
3730
+ throw new Error("WKB measure and write passes produced different byte lengths");
3731
+ }
3732
+ }
3733
+ return {
3734
+ kind: "serialized",
3735
+ encoding: "binary",
3736
+ length: chunk.length,
3737
+ offsets,
3738
+ values,
3739
+ ...nullCount ? { validity: { values: validity } } : {}
3740
+ };
3741
+ }
3742
+ function isPhysicalGeometryRowValid(array, rowIndex, encoding) {
3743
+ if (!isGeoArrowValueValid(array.validity, rowIndex))
3744
+ return false;
3745
+ if (encoding !== "geoarrow.geometry" || array.kind !== "dense-union")
3746
+ return true;
3747
+ const physical = (array.offset || 0) + rowIndex;
3748
+ const child = array.children.find((candidate) => candidate.typeId === array.typeIds[physical]);
3749
+ const childIndex = array.valueOffsets[physical];
3750
+ return Boolean(child && childIndex >= 0 && childIndex < child.data.length && isGeoArrowValueValid(child.data.validity, childIndex));
3751
+ }
3752
+ function decodeGeoArrowWKT(column) {
3753
+ if (column.encoding !== "geoarrow.wkt")
3754
+ throw new Error("Expected a geoarrow.wkt column");
3755
+ const rows = normalizeRowsToDimension(decodeSerializedRows(column, (bytes) => parseWKT(textDecoder.decode(bytes))), column.dimension);
3756
+ return copyMetadata(column, makeGeoArrowColumnFromGeometryRows(rows, { dimension: column.dimension }));
3757
+ }
3758
+ function encodeGeoArrowWKT(column) {
3759
+ if (column.encoding === "geoarrow.wkt")
3760
+ return column;
3761
+ const values = [];
3762
+ for (const chunk of column.chunks) {
3763
+ for (let rowIndex = 0; rowIndex < chunk.length; rowIndex++) {
3764
+ const row = isGeoArrowValueValid(chunk.validity, rowIndex) ? materializeGeometryRow(chunk, rowIndex, column.encoding) : null;
3765
+ values.push(row ? textEncoder.encode(formatWKT(row, column.dimension)) : null);
3766
+ }
3767
+ }
3768
+ return copyMetadata(column, makeSerializedColumn(values, "geoarrow.wkt", column.dimension));
3769
+ }
3770
+ function writePhysicalGeometry(builder, array, rowIndex, encoding, dimension) {
3771
+ const depth = getEncodingDepth3(encoding);
3772
+ if (encoding === "geoarrow.geometry" && array.kind === "dense-union") {
3773
+ const physical = (array.offset || 0) + rowIndex;
3774
+ const typeId = array.typeIds[physical];
3775
+ const child = array.children.find((candidate) => candidate.typeId === typeId);
3776
+ if (!child)
3777
+ throw new Error("Dense-union row references an unknown child");
3778
+ const childDimension = child.dimension || dimension;
3779
+ builder.withDimension(childDimension, () => writePhysicalGeometry(builder, child.data, array.valueOffsets[physical], child.encoding || encodingFromName(child.name), childDimension));
3780
+ return;
3781
+ }
3782
+ if (encoding === "geoarrow.geometrycollection" && array.kind === "list") {
3783
+ const [first, last] = getListRange2(array, rowIndex);
3784
+ builder.beginGeometry("GeometryCollection", last - first);
3785
+ if (array.child.kind !== "dense-union")
3786
+ throw new Error("GeometryCollection requires dense union child");
3787
+ const union = array.child;
3788
+ for (let index = first; index < last; index++) {
3789
+ const physical = (union.offset || 0) + index;
3790
+ const child = union.children.find((candidate) => candidate.typeId === union.typeIds[physical]);
3791
+ if (child) {
3792
+ const childDimension = child.dimension || dimension;
3793
+ builder.withDimension(childDimension, () => writePhysicalGeometry(builder, child.data, union.valueOffsets[physical], child.encoding || encodingFromName(child.name), childDimension));
3794
+ }
3795
+ }
3796
+ return;
3797
+ }
3798
+ if (array.kind !== "list" && depth > 0)
3799
+ throw new Error(`Invalid ${encoding} storage`);
3800
+ const writeCoordinate2 = (leaf, index) => {
3801
+ const coordinate = readPhysicalCoordinate(leaf, index);
3802
+ if (!coordinate)
3803
+ throw new Error("Invalid GeoArrow coordinate storage");
3804
+ if (dimension === "xym")
3805
+ builder.writeCoordinate(coordinate[0], coordinate[1], void 0, coordinate[2]);
3806
+ else if (dimension === "xyzm")
3807
+ builder.writeCoordinate(coordinate[0], coordinate[1], coordinate[2], coordinate[3]);
3808
+ else
3809
+ builder.writeCoordinate(coordinate[0], coordinate[1], coordinate[2]);
3810
+ };
3811
+ const writeSequence = (leaf, first, last) => {
3812
+ for (let index = first; index < last; index++)
3813
+ writeCoordinate2(leaf, index);
3814
+ };
3815
+ if (encoding === "geoarrow.point") {
3816
+ builder.beginPoint();
3817
+ writeCoordinate2(array, rowIndex);
3818
+ } else if (encoding === "geoarrow.linestring" || encoding === "geoarrow.multipoint") {
3819
+ const [first, last] = getListRange2(array, rowIndex);
3820
+ if (encoding === "geoarrow.linestring") {
3821
+ builder.beginLineString(last - first);
3822
+ writeSequence(array.child, first, last);
3823
+ } else {
3824
+ builder.beginMultiPoint(last - first);
3825
+ const leaf = array.child;
3826
+ for (let index = first; index < last; index++) {
3827
+ builder.beginPoint();
3828
+ writeCoordinate2(leaf, index);
3829
+ }
3830
+ }
3831
+ } else if (encoding === "geoarrow.polygon" || encoding === "geoarrow.multilinestring") {
3832
+ const [first, last] = getListRange2(array, rowIndex);
3833
+ const parts = array.child;
3834
+ if (encoding === "geoarrow.polygon")
3835
+ builder.beginPolygon(last - first);
3836
+ else
3837
+ builder.beginMultiLineString(last - first);
3838
+ for (let partIndex = first; partIndex < last; partIndex++) {
3839
+ const [ringFirst, ringLast] = getListRange2(parts, partIndex);
3840
+ const leaf = parts.child;
3841
+ if (encoding === "geoarrow.polygon")
3842
+ builder.beginLinearRing(ringLast - ringFirst);
3843
+ else
3844
+ builder.beginLineString(ringLast - ringFirst);
3845
+ writeSequence(leaf, ringFirst, ringLast);
3846
+ }
3847
+ } else if (encoding === "geoarrow.multipolygon") {
3848
+ const [first, last] = getListRange2(array, rowIndex);
3849
+ const polygons = array.child;
3850
+ builder.beginMultiPolygon(last - first);
3851
+ for (let polygonIndex = first; polygonIndex < last; polygonIndex++) {
3852
+ const [partFirst, partLast] = getListRange2(polygons, polygonIndex);
3853
+ const parts = polygons.child;
3854
+ builder.beginPolygon(partLast - partFirst);
3855
+ for (let partIndex = partFirst; partIndex < partLast; partIndex++) {
3856
+ const [ringFirst, ringLast] = getListRange2(parts, partIndex);
3857
+ builder.beginLinearRing(ringLast - ringFirst);
3858
+ writeSequence(parts.child, ringFirst, ringLast);
3859
+ }
3860
+ }
3861
+ }
3862
+ }
3863
+ function getPhysicalGeometryDimension(array, rowIndex, encoding, dimension) {
3864
+ if (encoding !== "geoarrow.geometry" || array.kind !== "dense-union")
3865
+ return dimension;
3866
+ const physical = (array.offset || 0) + rowIndex;
3867
+ const child = array.children.find((candidate) => candidate.typeId === array.typeIds[physical]);
3868
+ return (child == null ? void 0 : child.dimension) || dimension;
3869
+ }
3870
+ function readPhysicalCoordinate(array, index) {
3871
+ if (array.kind === "fixed-size-list" && array.child.kind === "primitive") {
3872
+ const logical = (array.offset || 0) + index;
3873
+ const values = [];
3874
+ for (let component = 0; component < array.size; component++)
3875
+ values.push(Number(array.child.values[(array.child.offset || 0) + (logical * array.size + component) * (array.child.stride || 1)]));
3876
+ return values;
3877
+ }
3878
+ if (array.kind === "struct") {
3879
+ const logical = (array.offset || 0) + index;
3880
+ return ["x", "y", "z", "m"].flatMap((name) => {
3881
+ const child = array.children[name];
3882
+ return (child == null ? void 0 : child.kind) === "primitive" ? [Number(child.values[(child.offset || 0) + logical * (child.stride || 1)])] : [];
3883
+ });
3884
+ }
3885
+ return null;
3886
+ }
3887
+ function getListRange2(list, index) {
3888
+ const offset = (list.offset || 0) + index;
3889
+ const base = typeof (list.offsetBase ?? 0) === "bigint" ? Number(list.offsetBase) : Number(list.offsetBase ?? 0);
3890
+ return [
3891
+ getGeoArrowOffset(list.offsets, offset) - base,
3892
+ getGeoArrowOffset(list.offsets, offset + 1) - base
3893
+ ];
3894
+ }
3895
+ function getEncodingDepth3(encoding) {
3896
+ return encoding === "geoarrow.point" ? 0 : encoding === "geoarrow.linestring" || encoding === "geoarrow.multipoint" ? 1 : encoding === "geoarrow.polygon" || encoding === "geoarrow.multilinestring" ? 2 : 3;
3897
+ }
3898
+ function encodingFromName(name) {
3899
+ return `geoarrow.${name.toLowerCase()}`;
3900
+ }
3901
+ function normalizeRowsToDimension(rows, dimension) {
3902
+ const size = getGeoArrowDimensionSize(dimension);
3903
+ const normalizeGeometry = (geometry) => {
3904
+ if (geometry.type === "GeometryCollection") {
3905
+ return { ...geometry, geometries: geometry.geometries.map(normalizeGeometry) };
3906
+ }
3907
+ return {
3908
+ ...geometry,
3909
+ coordinates: normalizeCoordinateNesting(geometry.coordinates, size)
3910
+ };
3911
+ };
3912
+ return rows.map((row) => row ? normalizeGeometry(row) : null);
3913
+ }
3914
+ function normalizeCoordinateNesting(value, size) {
3915
+ if (value.length === 0)
3916
+ return [];
3917
+ if (typeof value[0] === "number") {
3918
+ const coordinate = value.slice(0, size);
3919
+ while (coordinate.length < size)
3920
+ coordinate.push(0);
3921
+ return coordinate;
3922
+ }
3923
+ return value.map((child) => normalizeCoordinateNesting(child, size));
3924
+ }
3925
+ function decodeSerializedRows(column, decoder) {
3926
+ const rows = [];
3927
+ for (const chunk of column.chunks) {
3928
+ if (chunk.kind !== "serialized")
3929
+ throw new Error("Serialized column contains native storage");
3930
+ for (let rowIndex = 0; rowIndex < chunk.length; rowIndex++) {
3931
+ if (!isGeoArrowValueValid(chunk.validity, rowIndex)) {
3932
+ rows.push(null);
3933
+ continue;
3934
+ }
3935
+ rows.push(decoder(getSerializedBytes(chunk, rowIndex)));
3936
+ }
3937
+ }
3938
+ return rows;
3939
+ }
3940
+ function getSerializedBytes(array, rowIndex) {
3941
+ var _a;
3942
+ if (array.views) {
3943
+ const viewIndex = ((array.offset || 0) + rowIndex) * 4;
3944
+ const length = array.views[viewIndex];
3945
+ if (length <= 12) {
3946
+ const byteOffset2 = array.views.byteOffset + viewIndex * 4 + 4;
3947
+ return new Uint8Array(array.views.buffer, byteOffset2, length);
3948
+ }
3949
+ const bufferIndex = array.views[viewIndex + 2];
3950
+ const byteOffset = array.views[viewIndex + 3];
3951
+ const data = (_a = array.dataBuffers) == null ? void 0 : _a[bufferIndex];
3952
+ if (!data)
3953
+ throw new Error(`Serialized view references missing data buffer ${bufferIndex}`);
3954
+ return data.subarray(byteOffset, byteOffset + length);
3955
+ }
3956
+ const offsetIndex = (array.offset || 0) + rowIndex;
3957
+ const baseValue = array.offsetBase ?? 0;
3958
+ const base = typeof baseValue === "bigint" ? Number(baseValue) : baseValue;
3959
+ const first = getGeoArrowOffset(array.offsets, offsetIndex) - base;
3960
+ const last = getGeoArrowOffset(array.offsets, offsetIndex + 1) - base;
3961
+ return array.values.subarray(first, last);
3962
+ }
3963
+ function makeSerializedColumn(rows, encoding, dimension) {
3964
+ let byteLength = 0;
3965
+ for (const row of rows)
3966
+ byteLength += (row == null ? void 0 : row.byteLength) || 0;
3967
+ const values = new Uint8Array(byteLength);
3968
+ const offsets = new Int32Array(rows.length + 1);
3969
+ const validity = new Uint8Array(Math.ceil(rows.length / 8));
3970
+ let byteOffset = 0;
3971
+ for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
3972
+ const row = rows[rowIndex];
3973
+ if (row) {
3974
+ values.set(row, byteOffset);
3975
+ byteOffset += row.byteLength;
3976
+ validity[rowIndex >> 3] |= 1 << (rowIndex & 7);
3977
+ }
3978
+ offsets[rowIndex + 1] = byteOffset;
3979
+ }
3980
+ const chunk = {
3981
+ kind: "serialized",
3982
+ encoding: encoding === "geoarrow.wkb" ? "binary" : "utf8",
3983
+ length: rows.length,
3984
+ offsets,
3985
+ values,
3986
+ validity: { values: validity }
3987
+ };
3988
+ return { encoding, dimension, coordinateLayout: null, chunks: [chunk] };
3989
+ }
3990
+ function copyMetadata(source, target) {
3991
+ return {
3992
+ ...target,
3993
+ spatialReference: source.spatialReference,
3994
+ edges: source.edges,
3995
+ metadata: source.metadata
3996
+ };
3997
+ }
3998
+
3999
+ // dist/geoarrow/tessellate.js
4000
+ var import_polygon = require("@math.gl/geometry/polygon");
4001
+ function tessellateGeoArrowPolygons(column, options = {}) {
4002
+ assertGeoArrowResourceLimits(column, options.limits);
4003
+ const rows = materializeGeoArrowRows(column);
4004
+ const sourceDimension = getGeoArrowDimensionSize(column.dimension);
4005
+ const positionSize = options.positionSize || sourceDimension;
4006
+ const sourceRowOffset = options.sourceRowOffset || 0;
4007
+ const positions = [];
4008
+ const sourceRowIndices = [];
4009
+ const indices = [];
4010
+ let polygonCount = 0;
4011
+ for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
4012
+ const row = rows[rowIndex];
4013
+ if (row) {
4014
+ visitPolygons(row, (polygon) => {
4015
+ const vertexOffset = positions.length / positionSize;
4016
+ const flatCoordinates = [];
4017
+ const holeIndices = [];
4018
+ let localVertexCount = 0;
4019
+ for (let ringIndex = 0; ringIndex < polygon.length; ringIndex++) {
4020
+ const ring = removeClosingCoordinate(polygon[ringIndex]);
4021
+ if (ring.length < 3)
4022
+ continue;
4023
+ if (localVertexCount > 0)
4024
+ holeIndices.push(localVertexCount);
4025
+ for (const coordinate of ring) {
4026
+ for (let component = 0; component < sourceDimension; component++) {
4027
+ flatCoordinates.push(coordinate[component] ?? 0);
4028
+ }
4029
+ for (let component = 0; component < positionSize; component++) {
4030
+ positions.push(coordinate[component] ?? 0);
4031
+ }
4032
+ sourceRowIndices.push(sourceRowOffset + rowIndex);
4033
+ localVertexCount++;
4034
+ }
4035
+ }
4036
+ if (localVertexCount >= 3) {
4037
+ const localIndices = (0, import_polygon.earcut)(flatCoordinates, holeIndices, sourceDimension);
4038
+ for (const index of localIndices)
4039
+ indices.push(vertexOffset + index);
4040
+ polygonCount++;
4041
+ }
4042
+ });
4043
+ }
4044
+ }
4045
+ const vertexCount = positions.length / positionSize;
4046
+ const IndexArray = vertexCount <= 65535 ? Uint16Array : Uint32Array;
4047
+ return {
4048
+ positions: Float32Array.from(positions),
4049
+ sourceRowIndices: Uint32Array.from(sourceRowIndices),
4050
+ indices: IndexArray.from(indices),
4051
+ sourceDimension,
4052
+ positionSize,
4053
+ rowCount: rows.length,
4054
+ polygonCount,
4055
+ vertexCount,
4056
+ triangleCount: indices.length / 3
4057
+ };
4058
+ }
4059
+ function visitPolygons(geometry, visitor) {
4060
+ switch (geometry.type) {
4061
+ case "Polygon":
4062
+ visitor(geometry.coordinates);
4063
+ break;
4064
+ case "MultiPolygon":
4065
+ for (const polygon of geometry.coordinates)
4066
+ visitor(polygon);
4067
+ break;
4068
+ case "GeometryCollection":
4069
+ for (const child of geometry.geometries)
4070
+ visitPolygons(child, visitor);
4071
+ break;
4072
+ default:
4073
+ break;
4074
+ }
4075
+ }
4076
+ function removeClosingCoordinate(ring) {
4077
+ if (ring.length < 2)
4078
+ return ring;
4079
+ const first = ring[0];
4080
+ const last = ring[ring.length - 1];
4081
+ if (first.length !== last.length)
4082
+ return ring;
4083
+ for (let index = 0; index < first.length; index++) {
4084
+ if (first[index] !== last[index])
4085
+ return ring;
4086
+ }
4087
+ return ring.slice(0, -1);
4088
+ }
4089
+ //# sourceMappingURL=index.cjs.map