webdggrid 1.4.0 → 1.6.0

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 (263) hide show
  1. package/dist/webdggrid.js +1 -1
  2. package/dist/webdggrid.js.map +1 -1
  3. package/dist/webdggrid.umd.js +1 -1
  4. package/dist/webdggrid.umd.js.map +1 -1
  5. package/lib-esm/libdggrid.wasm.js +1 -1
  6. package/lib-esm/tsconfig.tsbuildinfo +1 -0
  7. package/lib-esm/webdggrid.js +1180 -23
  8. package/lib-esm/webdggrid.js.map +1 -1
  9. package/lib-wasm/CMakeCache.txt +349 -0
  10. package/lib-wasm/CMakeFiles/3.31.6/CMakeCCompiler.cmake +81 -0
  11. package/lib-wasm/CMakeFiles/3.31.6/CMakeCXXCompiler.cmake +97 -0
  12. package/lib-wasm/CMakeFiles/3.31.6/CMakeSystem.cmake +15 -0
  13. package/lib-wasm/CMakeFiles/CMakeConfigureLog.yaml +12 -0
  14. package/lib-wasm/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
  15. package/lib-wasm/CMakeFiles/Makefile.cmake +62 -0
  16. package/lib-wasm/CMakeFiles/Makefile2 +122 -0
  17. package/lib-wasm/CMakeFiles/TargetDirectories.txt +3 -0
  18. package/lib-wasm/CMakeFiles/cmake.check_cache +1 -0
  19. package/lib-wasm/CMakeFiles/libdggrid.dir/DependInfo.cmake +135 -0
  20. package/lib-wasm/CMakeFiles/libdggrid.dir/build.make +1905 -0
  21. package/lib-wasm/CMakeFiles/libdggrid.dir/cmake_clean.cmake +235 -0
  22. package/lib-wasm/CMakeFiles/libdggrid.dir/compiler_depend.make +2 -0
  23. package/lib-wasm/CMakeFiles/libdggrid.dir/compiler_depend.ts +2 -0
  24. package/lib-wasm/CMakeFiles/libdggrid.dir/depend.make +2 -0
  25. package/lib-wasm/CMakeFiles/libdggrid.dir/flags.make +17 -0
  26. package/lib-wasm/CMakeFiles/libdggrid.dir/link.txt +1 -0
  27. package/lib-wasm/CMakeFiles/libdggrid.dir/progress.make +115 -0
  28. package/lib-wasm/CMakeFiles/libdggrid.dir/src-cpp/dggrid_transform.cpp.o +0 -0
  29. package/lib-wasm/CMakeFiles/libdggrid.dir/src-cpp/dggrid_transform.cpp.o.d +730 -0
  30. package/lib-wasm/CMakeFiles/libdggrid.dir/src-cpp/webdggrid.cpp.o +0 -0
  31. package/lib-wasm/CMakeFiles/libdggrid.dir/src-cpp/webdggrid.cpp.o.d +742 -0
  32. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgAddressBase.cpp.o +0 -0
  33. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgAddressBase.cpp.o.d +666 -0
  34. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgAddressType.cpp.o +0 -0
  35. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgAddressType.cpp.o.d +666 -0
  36. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgApSeq.cpp.o +0 -0
  37. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgApSeq.cpp.o.d +675 -0
  38. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgBase.cpp.o +0 -0
  39. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgBase.cpp.o.d +666 -0
  40. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgBoundedHexC2RF2D.cpp.o +0 -0
  41. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgBoundedHexC2RF2D.cpp.o.d +704 -0
  42. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgBoundedHexC3C2RF2D.cpp.o +0 -0
  43. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgBoundedHexC3C2RF2D.cpp.o.d +705 -0
  44. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgBoundedHexC3RF2D.cpp.o +0 -0
  45. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgBoundedHexC3RF2D.cpp.o.d +704 -0
  46. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgBoundedIDGG.cpp.o +0 -0
  47. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgBoundedIDGG.cpp.o.d +723 -0
  48. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgBoundedIDGGS.cpp.o +0 -0
  49. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgBoundedIDGGS.cpp.o.d +726 -0
  50. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgBoundedRF2D.cpp.o +0 -0
  51. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgBoundedRF2D.cpp.o.d +703 -0
  52. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgBoundedRFBase0.cpp.o +0 -0
  53. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgBoundedRFBase0.cpp.o.d +698 -0
  54. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgBoundedRFS2D.cpp.o +0 -0
  55. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgBoundedRFS2D.cpp.o.d +711 -0
  56. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgCell.cpp.o +0 -0
  57. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgCell.cpp.o.d +689 -0
  58. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgColor.cpp.o +0 -0
  59. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgColor.cpp.o.d +675 -0
  60. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgConverterBase.cpp.o +0 -0
  61. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgConverterBase.cpp.o.d +687 -0
  62. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgDVec2D.cpp.o +0 -0
  63. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgDVec2D.cpp.o.d +680 -0
  64. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgDVec3D.cpp.o +0 -0
  65. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgDVec3D.cpp.o.d +679 -0
  66. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgDataFieldBase.cpp.o +0 -0
  67. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgDataFieldBase.cpp.o.d +667 -0
  68. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgDataList.cpp.o +0 -0
  69. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgDataList.cpp.o.d +667 -0
  70. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgDiscRFS2D.cpp.o +0 -0
  71. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgDiscRFS2D.cpp.o.d +710 -0
  72. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgDistanceBase.cpp.o +0 -0
  73. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgDistanceBase.cpp.o.d +683 -0
  74. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgDmdD4Grid2D.cpp.o +0 -0
  75. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgDmdD4Grid2D.cpp.o.d +700 -0
  76. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgDmdD4Grid2DS.cpp.o +0 -0
  77. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgDmdD4Grid2DS.cpp.o.d +707 -0
  78. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgDmdD8Grid2D.cpp.o +0 -0
  79. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgDmdD8Grid2D.cpp.o.d +701 -0
  80. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgDmdD8Grid2DS.cpp.o +0 -0
  81. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgDmdD8Grid2DS.cpp.o.d +708 -0
  82. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgDmdIDGG.cpp.o +0 -0
  83. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgDmdIDGG.cpp.o.d +731 -0
  84. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgEllipsoidRF.cpp.o +0 -0
  85. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgEllipsoidRF.cpp.o.d +699 -0
  86. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgGeoSphRF.cpp.o +0 -0
  87. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgGeoSphRF.cpp.o.d +715 -0
  88. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgGridTopo.cpp.o +0 -0
  89. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgGridTopo.cpp.o.d +666 -0
  90. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgHexC1Grid2D.cpp.o +0 -0
  91. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgHexC1Grid2D.cpp.o.d +700 -0
  92. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgHexC2Grid2D.cpp.o +0 -0
  93. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgHexC2Grid2D.cpp.o.d +704 -0
  94. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgHexC3Grid2D.cpp.o +0 -0
  95. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgHexC3Grid2D.cpp.o.d +705 -0
  96. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgHexGrid2DS.cpp.o +0 -0
  97. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgHexGrid2DS.cpp.o.d +709 -0
  98. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgHexIDGG.cpp.o +0 -0
  99. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgHexIDGG.cpp.o.d +728 -0
  100. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgHexIDGGS.cpp.o +0 -0
  101. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgHexIDGGS.cpp.o.d +720 -0
  102. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIDGG.cpp.o +0 -0
  103. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIDGG.cpp.o.d +727 -0
  104. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIDGGBase.cpp.o +0 -0
  105. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIDGGBase.cpp.o.d +734 -0
  106. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIDGGS.cpp.o +0 -0
  107. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIDGGS.cpp.o.d +728 -0
  108. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIDGGS3H.cpp.o +0 -0
  109. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIDGGS3H.cpp.o.d +721 -0
  110. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIDGGS43H.cpp.o +0 -0
  111. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIDGGS43H.cpp.o.d +721 -0
  112. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIDGGS4D.cpp.o +0 -0
  113. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIDGGS4D.cpp.o.d +721 -0
  114. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIDGGS4H.cpp.o +0 -0
  115. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIDGGS4H.cpp.o.d +721 -0
  116. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIDGGS4T.cpp.o +0 -0
  117. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIDGGS4T.cpp.o.d +720 -0
  118. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIDGGS7H.cpp.o +0 -0
  119. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIDGGS7H.cpp.o.d +721 -0
  120. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIDGGSBase.cpp.o +0 -0
  121. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIDGGSBase.cpp.o.d +719 -0
  122. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIDGGutil.cpp.o +0 -0
  123. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIDGGutil.cpp.o.d +728 -0
  124. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIVec2D.cpp.o +0 -0
  125. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIVec2D.cpp.o.d +680 -0
  126. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIVec3D.cpp.o +0 -0
  127. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIVec3D.cpp.o.d +681 -0
  128. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIcosaMap.cpp.o +0 -0
  129. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgIcosaMap.cpp.o.d +679 -0
  130. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgInAIGenFile.cpp.o +0 -0
  131. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgInAIGenFile.cpp.o.d +723 -0
  132. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgInGdalFile.cpp.o +0 -0
  133. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgInGdalFile.cpp.o.d +2 -0
  134. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgInLocStreamFile.cpp.o +0 -0
  135. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgInLocStreamFile.cpp.o.d +688 -0
  136. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgInLocTextFile.cpp.o +0 -0
  137. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgInLocTextFile.cpp.o.d +725 -0
  138. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgInShapefile.cpp.o +0 -0
  139. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgInShapefile.cpp.o.d +724 -0
  140. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgInShapefileAtt.cpp.o +0 -0
  141. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgInShapefileAtt.cpp.o.d +726 -0
  142. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgInputStream.cpp.o +0 -0
  143. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgInputStream.cpp.o.d +687 -0
  144. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgLocBase.cpp.o +0 -0
  145. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgLocBase.cpp.o.d +666 -0
  146. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgLocList.cpp.o +0 -0
  147. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgLocList.cpp.o.d +688 -0
  148. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgLocVector.cpp.o +0 -0
  149. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgLocVector.cpp.o.d +687 -0
  150. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgLocation.cpp.o +0 -0
  151. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgLocation.cpp.o.d +686 -0
  152. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutAIGenFile.cpp.o +0 -0
  153. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutAIGenFile.cpp.o.d +714 -0
  154. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutChildrenFile.cpp.o +0 -0
  155. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutChildrenFile.cpp.o.d +745 -0
  156. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutGdalFile.cpp.o +0 -0
  157. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutGdalFile.cpp.o.d +2 -0
  158. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutGeoJSONFile.cpp.o +0 -0
  159. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutGeoJSONFile.cpp.o.d +725 -0
  160. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutKMLfile.cpp.o +0 -0
  161. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutKMLfile.cpp.o.d +725 -0
  162. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutLocFile.cpp.o +0 -0
  163. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutLocFile.cpp.o.d +755 -0
  164. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutLocTextFile.cpp.o +0 -0
  165. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutLocTextFile.cpp.o.d +697 -0
  166. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutNeighborsFile.cpp.o +0 -0
  167. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutNeighborsFile.cpp.o.d +742 -0
  168. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutPRCellsFile.cpp.o +0 -0
  169. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutPRCellsFile.cpp.o.d +714 -0
  170. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutPRPtsFile.cpp.o +0 -0
  171. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutPRPtsFile.cpp.o.d +714 -0
  172. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutPtsText.cpp.o +0 -0
  173. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutPtsText.cpp.o.d +714 -0
  174. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutRandPtsText.cpp.o +0 -0
  175. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutRandPtsText.cpp.o.d +714 -0
  176. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutShapefile.cpp.o +0 -0
  177. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutShapefile.cpp.o.d +734 -0
  178. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutputStream.cpp.o +0 -0
  179. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgOutputStream.cpp.o.d +687 -0
  180. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgPolygon.cpp.o +0 -0
  181. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgPolygon.cpp.o.d +696 -0
  182. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgProjFuller.cpp.o +0 -0
  183. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgProjFuller.cpp.o.d +703 -0
  184. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgProjGnomonicRF.cpp.o +0 -0
  185. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgProjGnomonicRF.cpp.o.d +698 -0
  186. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgProjISEA.cpp.o +0 -0
  187. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgProjISEA.cpp.o.d +703 -0
  188. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgProjTriRF.cpp.o +0 -0
  189. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgProjTriRF.cpp.o.d +699 -0
  190. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgRFBase.cpp.o +0 -0
  191. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgRFBase.cpp.o.d +690 -0
  192. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgRFNetwork.cpp.o +0 -0
  193. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgRFNetwork.cpp.o.d +688 -0
  194. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgRandom.cpp.o +0 -0
  195. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgRandom.cpp.o.d +696 -0
  196. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgSeriesConverter.cpp.o +0 -0
  197. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgSeriesConverter.cpp.o.d +689 -0
  198. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgSqrD4Grid2D.cpp.o +0 -0
  199. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgSqrD4Grid2D.cpp.o.d +700 -0
  200. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgSqrD4Grid2DS.cpp.o +0 -0
  201. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgSqrD4Grid2DS.cpp.o.d +708 -0
  202. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgSqrD8Grid2D.cpp.o +0 -0
  203. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgSqrD8Grid2D.cpp.o.d +701 -0
  204. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgSqrD8Grid2DS.cpp.o +0 -0
  205. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgSqrD8Grid2DS.cpp.o.d +708 -0
  206. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgSuperfund.cpp.o +0 -0
  207. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgSuperfund.cpp.o.d +667 -0
  208. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgTriGrid2D.cpp.o +0 -0
  209. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgTriGrid2D.cpp.o.d +700 -0
  210. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgTriGrid2DS.cpp.o +0 -0
  211. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgTriGrid2DS.cpp.o.d +707 -0
  212. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgTriIDGG.cpp.o +0 -0
  213. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgTriIDGG.cpp.o.d +728 -0
  214. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgUtil.cpp.o +0 -0
  215. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgUtil.cpp.o.d +673 -0
  216. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgZ3RF.cpp.o +0 -0
  217. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgZ3RF.cpp.o.d +720 -0
  218. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgZ3StringRF.cpp.o +0 -0
  219. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgZ3StringRF.cpp.o.d +717 -0
  220. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgZ7RF.cpp.o +0 -0
  221. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgZ7RF.cpp.o.d +720 -0
  222. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgZ7StringRF.cpp.o +0 -0
  223. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgZ7StringRF.cpp.o.d +717 -0
  224. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgZOrderRF.cpp.o +0 -0
  225. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgZOrderRF.cpp.o.d +720 -0
  226. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgZOrderStringRF.cpp.o +0 -0
  227. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/dglib/lib/DgZOrderStringRF.cpp.o.d +716 -0
  228. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/proj4lib/lib/adjlon.cpp.o +0 -0
  229. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/proj4lib/lib/adjlon.cpp.o.d +131 -0
  230. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/proj4lib/lib/pj_auth.cpp.o +0 -0
  231. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/proj4lib/lib/pj_auth.cpp.o.d +136 -0
  232. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/proj4lib/lib/pj_mlfn.cpp.o +0 -0
  233. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/proj4lib/lib/pj_mlfn.cpp.o.d +136 -0
  234. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/proj4lib/lib/pj_msfn.cpp.o +0 -0
  235. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/proj4lib/lib/pj_msfn.cpp.o.d +134 -0
  236. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/proj4lib/lib/pj_phi2.cpp.o +0 -0
  237. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/proj4lib/lib/pj_phi2.cpp.o.d +136 -0
  238. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/proj4lib/lib/pj_qsfn.cpp.o +0 -0
  239. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/proj4lib/lib/pj_qsfn.cpp.o.d +131 -0
  240. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/proj4lib/lib/pj_tsfn.cpp.o +0 -0
  241. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/proj4lib/lib/pj_tsfn.cpp.o.d +131 -0
  242. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/shapelib/lib/dbfopen.c.o +0 -0
  243. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/shapelib/lib/dbfopen.c.o.d +28 -0
  244. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/shapelib/lib/safileio.c.o +0 -0
  245. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/shapelib/lib/safileio.c.o.d +31 -0
  246. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/shapelib/lib/sbnsearch.c.o +0 -0
  247. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/shapelib/lib/sbnsearch.c.o.d +28 -0
  248. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/shapelib/lib/shpopen.c.o +0 -0
  249. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/shapelib/lib/shpopen.c.o.d +33 -0
  250. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/shapelib/lib/shptree.c.o +0 -0
  251. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/shapelib/lib/shptree.c.o.d +31 -0
  252. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/shapelib/lib/shputils.c.o +0 -0
  253. package/lib-wasm/CMakeFiles/libdggrid.dir/submodules/DGGRID/src/lib/shapelib/lib/shputils.c.o.d +25 -0
  254. package/lib-wasm/CMakeFiles/progress.marks +1 -0
  255. package/lib-wasm/Makefile +9 -9
  256. package/lib-wasm/cmake_install.cmake +61 -0
  257. package/lib-wasm/libdggrid.js +2 -15
  258. package/lib-wasm/libdggrid.wasm +0 -0
  259. package/package.json +5 -4
  260. package/readme.md +64 -3
  261. package/src-ts/webdggrid.ts +1511 -14
  262. package/types/webdggrid.d.ts +765 -1
  263. package/types/webdggrid.d.ts.map +1 -1
@@ -69,6 +69,25 @@ export interface Coordinate {
69
69
  lng: number;
70
70
  }
71
71
 
72
+ /**
73
+ * VERTEX2DD coordinate representation.
74
+ *
75
+ * Represents a position relative to the icosahedron vertices and triangular
76
+ * faces in DGGRID's coordinate system.
77
+ */
78
+ export interface Vertex2DDCoordinate {
79
+ /** Whether to keep this vertex. */
80
+ keep: boolean;
81
+ /** Vertex number (0-11 for icosahedron). */
82
+ vertNum: number;
83
+ /** Triangle number on the icosahedron. */
84
+ triNum: number;
85
+ /** X coordinate within the triangle. */
86
+ x: number;
87
+ /** Y coordinate within the triangle. */
88
+ y: number;
89
+ }
90
+
72
91
  /**
73
92
  * GeoJSON `properties` object attached to every cell feature returned by
74
93
  * {@link Webdggrid.sequenceNumToGridFeatureCollection}.
@@ -138,8 +157,28 @@ export interface IDGGSProps {
138
157
  * | 7 | 2 + 10 × 7^r |
139
158
  *
140
159
  * Aperture `4` is the most common choice and is the default.
160
+ * Ignored if `apertureSequence` is specified.
161
+ */
162
+ aperture?: 3 | 4 | 5 | 7;
163
+ /**
164
+ * Mixed aperture sequence (e.g., `"434747"`).
165
+ *
166
+ * When specified, each character defines the aperture for that resolution level.
167
+ * The maximum resolution is limited to the length of the sequence string.
168
+ *
169
+ * **Constraints:**
170
+ * - Only valid for `HEXAGON` topology
171
+ * - Only characters `'3'`, `'4'`, and `'7'` are allowed
172
+ * - SEQNUM addressing is not supported (operations will fail)
173
+ * - Z3/Z7 hierarchical indexing is not supported
174
+ *
175
+ * @example
176
+ * ```ts
177
+ * // Resolution 1 uses aperture 4, res 2 uses aperture 3, etc.
178
+ * apertureSequence: "434747"
179
+ * ```
141
180
  */
142
- aperture: 3 | 4 | 5 | 7;
181
+ apertureSequence?: string;
143
182
  /** Shape of each cell. See {@link Topology}. */
144
183
  topology: Topology;
145
184
  /** Projection used to map the polyhedron faces onto the sphere. See {@link Projection}. */
@@ -154,9 +193,13 @@ export interface IDGGSProps {
154
193
  * output from {@link Webdggrid.sequenceNumToGrid} directly.
155
194
  */
156
195
  export function unwrapAntimeridianRing(ring: Position[]): Position[] {
157
- const lons = ring.map((p) => p[0]);
158
- const minLon = Math.min(...lons);
159
- const maxLon = Math.max(...lons);
196
+ let minLon = ring[0][0];
197
+ let maxLon = ring[0][0];
198
+ for (let i = 1; i < ring.length; i++) {
199
+ const lon = ring[i][0];
200
+ if (lon < minLon) minLon = lon;
201
+ else if (lon > maxLon) maxLon = lon;
202
+ }
160
203
  if (maxLon - minLon <= 180) return ring;
161
204
  return ring.map(([lon, lat]) => [lon < 0 ? lon + 360 : lon, lat]);
162
205
  }
@@ -375,8 +418,12 @@ export class Webdggrid {
375
418
  topology,
376
419
  projection,
377
420
  aperture,
421
+ apertureSequence,
378
422
  } = this.dggs;
379
423
 
424
+ const isApertureSequence = !!apertureSequence;
425
+ const apSeq = apertureSequence || "";
426
+
380
427
  const cellCount = this._module.nCells(
381
428
  lng,
382
429
  lat,
@@ -384,7 +431,9 @@ export class Webdggrid {
384
431
  aperture,
385
432
  resolution,
386
433
  topology,
387
- projection
434
+ projection,
435
+ isApertureSequence,
436
+ apSeq
388
437
  );
389
438
 
390
439
  return cellCount as number;
@@ -412,8 +461,12 @@ export class Webdggrid {
412
461
  topology,
413
462
  projection,
414
463
  aperture,
464
+ apertureSequence,
415
465
  } = this.dggs;
416
466
 
467
+ const isApertureSequence = !!apertureSequence;
468
+ const apSeq = apertureSequence || "";
469
+
417
470
  const cellCount = this._module.cellAreaKM(
418
471
  lng,
419
472
  lat,
@@ -421,7 +474,9 @@ export class Webdggrid {
421
474
  aperture,
422
475
  resolution,
423
476
  topology,
424
- projection
477
+ projection,
478
+ isApertureSequence,
479
+ apSeq
425
480
  );
426
481
 
427
482
  return cellCount as number;
@@ -449,8 +504,12 @@ export class Webdggrid {
449
504
  topology,
450
505
  projection,
451
506
  aperture,
507
+ apertureSequence,
452
508
  } = this.dggs;
453
509
 
510
+ const isApertureSequence = !!apertureSequence;
511
+ const apSeq = apertureSequence || "";
512
+
454
513
  const cellCount = this._module.cellDistKM(
455
514
  lng,
456
515
  lat,
@@ -458,7 +517,9 @@ export class Webdggrid {
458
517
  aperture,
459
518
  resolution,
460
519
  topology,
461
- projection
520
+ projection,
521
+ isApertureSequence,
522
+ apSeq
462
523
  );
463
524
 
464
525
  return cellCount as number;
@@ -487,8 +548,12 @@ export class Webdggrid {
487
548
  topology,
488
549
  projection,
489
550
  aperture,
551
+ apertureSequence,
490
552
  } = this.dggs;
491
553
 
554
+ const isApertureSequence = !!apertureSequence;
555
+ const apSeq = apertureSequence || "";
556
+
492
557
  const cellCount = this._module.gridStatCLS(
493
558
  lng,
494
559
  lat,
@@ -496,7 +561,9 @@ export class Webdggrid {
496
561
  aperture,
497
562
  resolution,
498
563
  topology,
499
- projection
564
+ projection,
565
+ isApertureSequence,
566
+ apSeq
500
567
  );
501
568
 
502
569
  return cellCount as number;
@@ -541,8 +608,12 @@ export class Webdggrid {
541
608
  topology,
542
609
  projection,
543
610
  aperture,
611
+ apertureSequence,
544
612
  } = this.dggs;
545
613
 
614
+ const isApertureSequence = !!apertureSequence;
615
+ const apSeq = apertureSequence || "";
616
+
546
617
  const xCoords = coordinates.map((coord) => coord[0]);
547
618
  const yCoords = coordinates.map((coord) => coord[1]);
548
619
 
@@ -554,6 +625,8 @@ export class Webdggrid {
554
625
  resolution,
555
626
  topology,
556
627
  projection,
628
+ isApertureSequence,
629
+ apSeq,
557
630
  xCoords,
558
631
  yCoords
559
632
  );
@@ -589,8 +662,12 @@ export class Webdggrid {
589
662
  topology,
590
663
  projection,
591
664
  aperture,
665
+ apertureSequence,
592
666
  } = this.dggs;
593
667
 
668
+ const isApertureSequence = !!apertureSequence;
669
+ const apSeq = apertureSequence || "";
670
+
594
671
  const resultArray = this._module.SEQNUM_to_GEO(
595
672
  lng,
596
673
  lat,
@@ -599,6 +676,8 @@ export class Webdggrid {
599
676
  resolution,
600
677
  topology,
601
678
  projection,
679
+ isApertureSequence,
680
+ apSeq,
602
681
  sequenceNum
603
682
  );
604
683
 
@@ -648,8 +727,12 @@ export class Webdggrid {
648
727
  topology,
649
728
  projection,
650
729
  aperture,
730
+ apertureSequence,
651
731
  } = this.dggs;
652
732
 
733
+ const isApertureSequence = !!apertureSequence;
734
+ const apSeq = apertureSequence || "";
735
+
653
736
  const xCoords = coordinates.map((coord) => coord[0]);
654
737
  const yCoords = coordinates.map((coord) => coord[1]);
655
738
 
@@ -661,6 +744,8 @@ export class Webdggrid {
661
744
  resolution,
662
745
  topology,
663
746
  projection,
747
+ isApertureSequence,
748
+ apSeq,
664
749
  xCoords,
665
750
  yCoords
666
751
  );
@@ -707,8 +792,12 @@ export class Webdggrid {
707
792
  topology,
708
793
  projection,
709
794
  aperture,
795
+ apertureSequence,
710
796
  } = this.dggs;
711
797
 
798
+ const isApertureSequence = !!apertureSequence;
799
+ const apSeq = apertureSequence || "";
800
+
712
801
  const inputSize = sequenceNum.length;
713
802
 
714
803
  let resultArray = [];
@@ -721,11 +810,13 @@ export class Webdggrid {
721
810
  resolution,
722
811
  topology,
723
812
  projection,
813
+ isApertureSequence,
814
+ apSeq,
724
815
  sequenceNum
725
816
  );
726
817
  } catch (e) {
727
818
  console.error(this._module.getExceptionMessage(e).toString());
728
- throw(e);
819
+ throw (e);
729
820
  }
730
821
 
731
822
  const allShapeVertexes = resultArray.slice(0, inputSize);
@@ -741,12 +832,9 @@ export class Webdggrid {
741
832
  for (let i = 0; i < allShapeVertexes.length; i += 1) {
742
833
  const numVertexes = allShapeVertexes[i];
743
834
 
744
- const currentShapeXVertexes = resultArray.slice(xOffset, xOffset + numVertexes);
745
- const currentShapeYVertexes = resultArray.slice(yOffset, yOffset + numVertexes);
746
-
747
835
  const coordinates: Position[] = [];
748
- for (let i = 0; i < numVertexes; i += 1) {
749
- coordinates.push([currentShapeXVertexes[i], currentShapeYVertexes[i]]);
836
+ for (let j = 0; j < numVertexes; j += 1) {
837
+ coordinates.push([resultArray[xOffset + j], resultArray[yOffset + j]]);
750
838
  }
751
839
  featureSet.push(unwrapAntimeridianRing(coordinates));
752
840
  xOffset += numVertexes;
@@ -816,4 +904,1413 @@ export class Webdggrid {
816
904
  features,
817
905
  };
818
906
  }
907
+
908
+ /**
909
+ * Returns all neighboring cells (sharing an edge) for each input cell.
910
+ *
911
+ * For hexagonal grids, each interior cell typically has 6 neighbors.
912
+ * Pentagon cells and boundary cells may have fewer. Triangle topology
913
+ * is not supported by the underlying DGGRID library.
914
+ *
915
+ * The output is a 2-D array: `result[i]` contains all neighbors of
916
+ * `sequenceNum[i]`.
917
+ *
918
+ * ```ts
919
+ * const neighbors = dggs.sequenceNumNeighbors([123n], 5);
920
+ * // neighbors[0] = [122n, 124n, 125n, 126n, 127n, 128n]
921
+ * ```
922
+ *
923
+ * ::: warning
924
+ * Triangle topology is **not supported**. Attempting to retrieve neighbors
925
+ * for a TRIANGLE grid will throw an error.
926
+ * :::
927
+ *
928
+ * @param sequenceNum - Array of `BigInt` cell IDs whose neighbors to find.
929
+ * @param resolution - Resolution at which the IDs were generated. Defaults
930
+ * to the instance's current {@link resolution}.
931
+ * @returns A 2-D array of `BigInt[]`: `result[i]` is the array of neighbor
932
+ * IDs for `sequenceNum[i]`.
933
+ * @throws If Triangle topology is used or if an invalid cell ID is provided.
934
+ */
935
+ sequenceNumNeighbors(
936
+ sequenceNum: bigint[],
937
+ resolution: number = DEFAULT_RESOLUTION
938
+ ): bigint[][] {
939
+ const {
940
+ poleCoordinates: { lat, lng },
941
+ azimuth,
942
+ topology,
943
+ projection,
944
+ aperture,
945
+ apertureSequence,
946
+ } = this.dggs;
947
+
948
+ if (topology === Topology.TRIANGLE) {
949
+ throw new Error('Neighbor detection is not supported for TRIANGLE topology');
950
+ }
951
+
952
+ const isApertureSequence = !!apertureSequence;
953
+ const apSeq = apertureSequence || "";
954
+
955
+ try {
956
+ const resultArray = this._module.SEQNUMS_neighbors(
957
+ lng,
958
+ lat,
959
+ azimuth,
960
+ aperture,
961
+ resolution,
962
+ topology,
963
+ projection,
964
+ isApertureSequence,
965
+ apSeq,
966
+ sequenceNum
967
+ );
968
+
969
+ // The result is a flat array with format:
970
+ // [count0, count1, ..., countN, neighbor0_0, neighbor0_1, ..., neighbor0_(count0-1), neighbor1_0, ...]
971
+ const inputSize = sequenceNum.length;
972
+ const counts = resultArray.slice(0, inputSize);
973
+ const neighbors: bigint[][] = [];
974
+
975
+ let offset = inputSize;
976
+ for (let i = 0; i < inputSize; i++) {
977
+ const count = Number(counts[i]);
978
+ neighbors.push(resultArray.slice(offset, offset + count));
979
+ offset += count;
980
+ }
981
+
982
+ return neighbors;
983
+ } catch (e) {
984
+ console.error(this._module.getExceptionMessage(e).toString());
985
+ throw e;
986
+ }
987
+ }
988
+
989
+ /**
990
+ * Returns the parent cell at the next coarser resolution (resolution - 1)
991
+ * for each input cell.
992
+ *
993
+ * The parent-child relationship forms a hierarchical index structure. For
994
+ * aperture 4 grids, each parent contains 4 children; for aperture 7, each
995
+ * parent contains 7 children.
996
+ *
997
+ * ```ts
998
+ * const parents = dggs.sequenceNumParent([123n, 456n], 5);
999
+ * // parents = [30n, 114n] (at resolution 4)
1000
+ * ```
1001
+ *
1002
+ * ::: info
1003
+ * Calling this method at resolution 0 will throw an error because there
1004
+ * are no cells at resolution -1.
1005
+ * :::
1006
+ *
1007
+ * @param sequenceNum - Array of `BigInt` cell IDs whose parents to find.
1008
+ * @param resolution - Resolution at which the input IDs were generated.
1009
+ * Must be > 0. Defaults to the instance's current {@link resolution}.
1010
+ * @returns Array of `BigInt` parent cell IDs at resolution - 1, one per
1011
+ * input cell, in the same order.
1012
+ * @throws If resolution is 0 or if an invalid cell ID is provided.
1013
+ */
1014
+ sequenceNumParent(
1015
+ sequenceNum: bigint[],
1016
+ resolution: number = DEFAULT_RESOLUTION
1017
+ ): bigint[] {
1018
+ if (resolution <= 0) {
1019
+ throw new Error('Cannot get parent at resolution 0 or below');
1020
+ }
1021
+
1022
+ const {
1023
+ poleCoordinates: { lat, lng },
1024
+ azimuth,
1025
+ topology,
1026
+ projection,
1027
+ aperture,
1028
+ apertureSequence,
1029
+ } = this.dggs;
1030
+
1031
+ const isApertureSequence = !!apertureSequence;
1032
+ const apSeq = apertureSequence || "";
1033
+
1034
+ try {
1035
+ const resultArray = this._module.SEQNUMS_parents(
1036
+ lng,
1037
+ lat,
1038
+ azimuth,
1039
+ aperture,
1040
+ resolution,
1041
+ topology,
1042
+ projection,
1043
+ isApertureSequence,
1044
+ apSeq,
1045
+ sequenceNum
1046
+ );
1047
+
1048
+ return resultArray;
1049
+ } catch (e) {
1050
+ console.error(this._module.getExceptionMessage(e).toString());
1051
+ throw e;
1052
+ }
1053
+ }
1054
+
1055
+ /**
1056
+ * Returns all child cells at the next finer resolution (resolution + 1)
1057
+ * for each input cell.
1058
+ *
1059
+ * The number of children depends on the aperture:
1060
+ * - Aperture 3: 3 children per parent
1061
+ * - Aperture 4: 4 children per parent
1062
+ * - Aperture 7: 7 children per parent
1063
+ *
1064
+ * The output is a 2-D array: `result[i]` contains all children of
1065
+ * `sequenceNum[i]`.
1066
+ *
1067
+ * ```ts
1068
+ * const children = dggs.sequenceNumChildren([30n], 4);
1069
+ * // children[0] = [120n, 121n, 122n, 123n] (at resolution 5, aperture 4)
1070
+ * ```
1071
+ *
1072
+ * ::: info
1073
+ * Children always include both boundary and interior cells. The returned
1074
+ * cells completely cover the parent cell's area.
1075
+ * :::
1076
+ *
1077
+ * @param sequenceNum - Array of `BigInt` cell IDs whose children to find.
1078
+ * @param resolution - Resolution at which the input IDs were generated.
1079
+ * Defaults to the instance's current {@link resolution}.
1080
+ * @returns A 2-D array of `BigInt[]`: `result[i]` is the array of child
1081
+ * IDs for `sequenceNum[i]` at resolution + 1.
1082
+ * @throws If an invalid cell ID is provided or if the maximum resolution
1083
+ * is exceeded.
1084
+ */
1085
+ sequenceNumChildren(
1086
+ sequenceNum: bigint[],
1087
+ resolution: number = DEFAULT_RESOLUTION
1088
+ ): bigint[][] {
1089
+ const {
1090
+ poleCoordinates: { lat, lng },
1091
+ azimuth,
1092
+ topology,
1093
+ projection,
1094
+ aperture,
1095
+ apertureSequence,
1096
+ } = this.dggs;
1097
+
1098
+ const isApertureSequence = !!apertureSequence;
1099
+ const apSeq = apertureSequence || "";
1100
+
1101
+ try {
1102
+ const resultArray = this._module.SEQNUMS_children(
1103
+ lng,
1104
+ lat,
1105
+ azimuth,
1106
+ aperture,
1107
+ resolution,
1108
+ topology,
1109
+ projection,
1110
+ isApertureSequence,
1111
+ apSeq,
1112
+ sequenceNum
1113
+ );
1114
+
1115
+ // The result is a flat array with format:
1116
+ // [count0, count1, ..., countN, child0_0, child0_1, ..., child0_(count0-1), child1_0, ...]
1117
+ const inputSize = sequenceNum.length;
1118
+ const counts = resultArray.slice(0, inputSize);
1119
+ const children: bigint[][] = [];
1120
+
1121
+ let offset = inputSize;
1122
+ for (let i = 0; i < inputSize; i++) {
1123
+ const count = Number(counts[i]);
1124
+ children.push(resultArray.slice(offset, offset + count));
1125
+ offset += count;
1126
+ }
1127
+
1128
+ return children;
1129
+ } catch (e) {
1130
+ console.error(this._module.getExceptionMessage(e).toString());
1131
+ throw e;
1132
+ }
1133
+ }
1134
+
1135
+ // =========================================================================
1136
+ // Hierarchical Address Type Conversions
1137
+ // These methods convert between SEQNUM and hierarchical indexing systems
1138
+ // =========================================================================
1139
+
1140
+ /**
1141
+ * Convert a SEQNUM cell ID to VERTEX2DD (icosahedral vertex) coordinates.
1142
+ *
1143
+ * VERTEX2DD addresses represent positions relative to the vertices and
1144
+ * triangular faces of the underlying icosahedron.
1145
+ *
1146
+ * ```ts
1147
+ * const vertex = dggs.sequenceNumToVertex2DD(100n, 5);
1148
+ * // vertex = { keep: true, vertNum: 1, triNum: 1, x: 0.0625, y: 0.054... }
1149
+ * ```
1150
+ *
1151
+ * @param sequenceNum - The cell sequence number to convert.
1152
+ * @param resolution - Resolution of the input cell. Defaults to the
1153
+ * instance's current {@link resolution}.
1154
+ * @returns An object with `{keep, vertNum, triNum, x, y}` representing
1155
+ * the vertex coordinate.
1156
+ */
1157
+ sequenceNumToVertex2DD(
1158
+ sequenceNum: bigint,
1159
+ resolution: number = DEFAULT_RESOLUTION
1160
+ ): Vertex2DDCoordinate {
1161
+ try {
1162
+ const result = this._module.SEQNUM_to_VERTEX2DD(
1163
+ ...this._getParams(resolution),
1164
+ sequenceNum
1165
+ );
1166
+ return result;
1167
+ } catch (e) {
1168
+ console.error(this._module.getExceptionMessage(e).toString());
1169
+ throw e;
1170
+ }
1171
+ }
1172
+
1173
+ /**
1174
+ * Convert VERTEX2DD (icosahedral vertex) coordinates to a SEQNUM cell ID.
1175
+ *
1176
+ * ```ts
1177
+ * const seqnum = dggs.vertex2DDToSequenceNum(true, 1, 1, 0.0625, 0.054, 5);
1178
+ * // seqnum = 100n
1179
+ * ```
1180
+ *
1181
+ * @param keep - Whether to keep this vertex.
1182
+ * @param vertNum - Vertex number (0-11 for icosahedron).
1183
+ * @param triNum - Triangle number on the icosahedron.
1184
+ * @param x - X coordinate within the triangle.
1185
+ * @param y - Y coordinate within the triangle.
1186
+ * @param resolution - Resolution at which to compute the cell ID. Defaults
1187
+ * to the instance's current {@link resolution}.
1188
+ * @returns The sequence number (BigInt) of the cell containing this coordinate.
1189
+ */
1190
+ vertex2DDToSequenceNum(
1191
+ keep: boolean,
1192
+ vertNum: number,
1193
+ triNum: number,
1194
+ x: number,
1195
+ y: number,
1196
+ resolution: number = DEFAULT_RESOLUTION
1197
+ ): bigint {
1198
+ try {
1199
+ return this._module.VERTEX2DD_to_SEQNUM(
1200
+ ...this._getParams(resolution),
1201
+ keep,
1202
+ vertNum,
1203
+ triNum,
1204
+ x,
1205
+ y
1206
+ );
1207
+ } catch (e) {
1208
+ console.error(this._module.getExceptionMessage(e).toString());
1209
+ throw e;
1210
+ }
1211
+ }
1212
+
1213
+ /**
1214
+ * Convert a SEQNUM cell ID to ZORDER (Z-order curve) coordinate.
1215
+ *
1216
+ * ZORDER uses digit-interleaved coordinates to create a space-filling
1217
+ * curve index. This provides good spatial locality for range queries.
1218
+ *
1219
+ * **Compatibility:** ZORDER is only available for **aperture 3 and 4**
1220
+ * hexagon grids. It is **NOT supported** for aperture 7.
1221
+ *
1222
+ * ```ts
1223
+ * // With aperture 4:
1224
+ * const zorder = dggs.sequenceNumToZOrder(100n, 5);
1225
+ * // zorder = 1168684103302643712n
1226
+ * ```
1227
+ *
1228
+ * @param sequenceNum - The cell sequence number to convert.
1229
+ * @param resolution - Resolution of the input cell. Defaults to the
1230
+ * instance's current {@link resolution}.
1231
+ * @returns A BigInt representing the Z-order coordinate.
1232
+ * @throws If used with an incompatible aperture (7) or topology.
1233
+ */
1234
+ sequenceNumToZOrder(
1235
+ sequenceNum: bigint,
1236
+ resolution: number = DEFAULT_RESOLUTION
1237
+ ): bigint {
1238
+ const { aperture, apertureSequence } = this.dggs;
1239
+
1240
+ // Check aperture compatibility
1241
+ if (aperture === 7 && !apertureSequence) {
1242
+ throw new Error(
1243
+ 'ZORDER is not available for aperture 7. ' +
1244
+ 'Use Z7 hierarchical indexing instead, or switch to aperture 3 or 4.'
1245
+ );
1246
+ }
1247
+
1248
+ try {
1249
+ return this._module.SEQNUM_to_ZORDER(
1250
+ ...this._getParams(resolution),
1251
+ sequenceNum
1252
+ );
1253
+ } catch (e) {
1254
+ const errMsg = this._module.getExceptionMessage(e).toString();
1255
+ if (errMsg.includes('aperture')) {
1256
+ throw new Error(
1257
+ `ZORDER error: ${errMsg}. ZORDER requires aperture 3 or 4 (not 7).`
1258
+ );
1259
+ }
1260
+ console.error(errMsg);
1261
+ throw e;
1262
+ }
1263
+ }
1264
+
1265
+ /**
1266
+ * Convert a ZORDER (Z-order curve) coordinate to a SEQNUM cell ID.
1267
+ *
1268
+ * ```ts
1269
+ * const seqnum = dggs.zOrderToSequenceNum(1168684103302643712n, 5);
1270
+ * // seqnum = 100n
1271
+ * ```
1272
+ *
1273
+ * @param zorderValue - The Z-order coordinate value (BigInt).
1274
+ * @param resolution - Resolution at which to compute the cell ID. Defaults
1275
+ * to the instance's current {@link resolution}.
1276
+ * @returns The sequence number (BigInt) corresponding to this Z-order value.
1277
+ * @throws If used with an incompatible aperture (7) or topology.
1278
+ */
1279
+ zOrderToSequenceNum(
1280
+ zorderValue: bigint,
1281
+ resolution: number = DEFAULT_RESOLUTION
1282
+ ): bigint {
1283
+ const { aperture, apertureSequence } = this.dggs;
1284
+
1285
+ if (aperture === 7 && !apertureSequence) {
1286
+ throw new Error(
1287
+ 'ZORDER is not available for aperture 7. ' +
1288
+ 'Use Z7 hierarchical indexing instead, or switch to aperture 3 or 4.'
1289
+ );
1290
+ }
1291
+
1292
+ try {
1293
+ return this._module.ZORDER_to_SEQNUM(
1294
+ ...this._getParams(resolution),
1295
+ zorderValue
1296
+ );
1297
+ } catch (e) {
1298
+ const errMsg = this._module.getExceptionMessage(e).toString();
1299
+ if (errMsg.includes('aperture')) {
1300
+ throw new Error(
1301
+ `ZORDER error: ${errMsg}. ZORDER requires aperture 3 or 4 (not 7).`
1302
+ );
1303
+ }
1304
+ console.error(errMsg);
1305
+ throw e;
1306
+ }
1307
+ }
1308
+
1309
+ /**
1310
+ * Convert a SEQNUM cell ID to Z3 (base-3 Central Place Indexing) coordinate.
1311
+ *
1312
+ * Z3 uses base-3 digit encoding optimized for aperture 3 hexagon grids.
1313
+ * Each parent cell contains exactly 3 children in the hierarchy.
1314
+ *
1315
+ * **Compatibility:** Z3 is **only available for aperture 3** hexagon grids.
1316
+ *
1317
+ * ```ts
1318
+ * // With aperture 3:
1319
+ * const z3 = dggs.sequenceNumToZ3(100n, 5);
1320
+ * // z3 = 1773292353277132799n
1321
+ * ```
1322
+ *
1323
+ * @param sequenceNum - The cell sequence number to convert.
1324
+ * @param resolution - Resolution of the input cell. Defaults to the
1325
+ * instance's current {@link resolution}.
1326
+ * @returns A BigInt representing the Z3 coordinate (INT64 format).
1327
+ * @throws If used with an incompatible aperture (not 3) or topology.
1328
+ */
1329
+ sequenceNumToZ3(
1330
+ sequenceNum: bigint,
1331
+ resolution: number = DEFAULT_RESOLUTION
1332
+ ): bigint {
1333
+ const { aperture, topology, apertureSequence } = this.dggs;
1334
+
1335
+ if ((aperture !== 3 || topology !== 'HEXAGON') && !apertureSequence) {
1336
+ throw new Error(
1337
+ 'Z3 is only available for aperture 3 hexagon grids. ' +
1338
+ `Current configuration: aperture ${aperture}, topology ${topology}.`
1339
+ );
1340
+ }
1341
+
1342
+ try {
1343
+ return this._module.SEQNUM_to_Z3(
1344
+ ...this._getParams(resolution),
1345
+ sequenceNum
1346
+ );
1347
+ } catch (e) {
1348
+ const errMsg = this._module.getExceptionMessage(e).toString();
1349
+ if (errMsg.includes('aperture') || errMsg.includes('Z3')) {
1350
+ throw new Error(
1351
+ `Z3 error: ${errMsg}. Z3 requires aperture 3 hexagon grids.`
1352
+ );
1353
+ }
1354
+ console.error(errMsg);
1355
+ throw e;
1356
+ }
1357
+ }
1358
+
1359
+ /**
1360
+ * Convert a Z3 (base-3 Central Place Indexing) coordinate to a SEQNUM cell ID.
1361
+ *
1362
+ * ```ts
1363
+ * const seqnum = dggs.z3ToSequenceNum(1773292353277132799n, 5);
1364
+ * // seqnum = 100n
1365
+ * ```
1366
+ *
1367
+ * @param z3Value - The Z3 coordinate value (BigInt, INT64 format).
1368
+ * @param resolution - Resolution at which to compute the cell ID. Defaults
1369
+ * to the instance's current {@link resolution}.
1370
+ * @returns The sequence number (BigInt) corresponding to this Z3 value.
1371
+ * @throws If used with an incompatible aperture (not 3) or topology.
1372
+ */
1373
+ z3ToSequenceNum(
1374
+ z3Value: bigint,
1375
+ resolution: number = DEFAULT_RESOLUTION
1376
+ ): bigint {
1377
+ const { aperture, topology, apertureSequence } = this.dggs;
1378
+
1379
+ if ((aperture !== 3 || topology !== 'HEXAGON') && !apertureSequence) {
1380
+ throw new Error(
1381
+ 'Z3 is only available for aperture 3 hexagon grids. ' +
1382
+ `Current configuration: aperture ${aperture}, topology ${topology}.`
1383
+ );
1384
+ }
1385
+
1386
+ try {
1387
+ return this._module.Z3_to_SEQNUM(
1388
+ ...this._getParams(resolution),
1389
+ z3Value
1390
+ );
1391
+ } catch (e) {
1392
+ const errMsg = this._module.getExceptionMessage(e).toString();
1393
+ if (errMsg.includes('aperture') || errMsg.includes('Z3')) {
1394
+ throw new Error(
1395
+ `Z3 error: ${errMsg}. Z3 requires aperture 3 hexagon grids.`
1396
+ );
1397
+ }
1398
+ console.error(errMsg);
1399
+ throw e;
1400
+ }
1401
+ }
1402
+
1403
+ /**
1404
+ * Convert a SEQNUM cell ID to Z7 (base-7 Central Place Indexing) coordinate.
1405
+ *
1406
+ * Z7 uses base-7 digit encoding with pure bitarithmetic operations,
1407
+ * optimized for aperture 7 hexagon grids. Each parent cell contains
1408
+ * exactly 7 children in the hierarchy.
1409
+ *
1410
+ * **Compatibility:** Z7 is **only available for aperture 7** hexagon grids.
1411
+ *
1412
+ * ```ts
1413
+ * // With aperture 7:
1414
+ * const z7 = dggs.sequenceNumToZ7(100n, 5);
1415
+ * // z7 = 1153167795211468799n (displayed as hex: 0x1000000000000fff)
1416
+ * ```
1417
+ *
1418
+ * @param sequenceNum - The cell sequence number to convert.
1419
+ * @param resolution - Resolution of the input cell. Defaults to the
1420
+ * instance's current {@link resolution}.
1421
+ * @returns A BigInt representing the Z7 coordinate (INT64/hex format).
1422
+ * @throws If used with an incompatible aperture (not 7) or topology.
1423
+ */
1424
+ sequenceNumToZ7(
1425
+ sequenceNum: bigint,
1426
+ resolution: number = DEFAULT_RESOLUTION
1427
+ ): bigint {
1428
+ const { aperture, topology, apertureSequence } = this.dggs;
1429
+
1430
+ if ((aperture !== 7 || topology !== 'HEXAGON') && !apertureSequence) {
1431
+ throw new Error(
1432
+ 'Z7 is only available for aperture 7 hexagon grids. ' +
1433
+ `Current configuration: aperture ${aperture}, topology ${topology}.`
1434
+ );
1435
+ }
1436
+
1437
+ try {
1438
+ return this._module.SEQNUM_to_Z7(
1439
+ ...this._getParams(resolution),
1440
+ sequenceNum
1441
+ );
1442
+ } catch (e) {
1443
+ const errMsg = this._module.getExceptionMessage(e).toString();
1444
+ if (errMsg.includes('aperture') || errMsg.includes('Z7')) {
1445
+ throw new Error(
1446
+ `Z7 error: ${errMsg}. Z7 requires aperture 7 hexagon grids.`
1447
+ );
1448
+ }
1449
+ console.error(errMsg);
1450
+ throw e;
1451
+ }
1452
+ }
1453
+
1454
+ /**
1455
+ * Convert a Z7 (base-7 Central Place Indexing) coordinate to a SEQNUM cell ID.
1456
+ *
1457
+ * ```ts
1458
+ * const seqnum = dggs.z7ToSequenceNum(1153167795211468799n, 5);
1459
+ * // seqnum = 100n
1460
+ * ```
1461
+ *
1462
+ * @param z7Value - The Z7 coordinate value (BigInt, INT64/hex format).
1463
+ * @param resolution - Resolution at which to compute the cell ID. Defaults
1464
+ * to the instance's current {@link resolution}.
1465
+ * @returns The sequence number (BigInt) corresponding to this Z7 value.
1466
+ * @throws If used with an incompatible aperture (not 7) or topology.
1467
+ */
1468
+ z7ToSequenceNum(
1469
+ z7Value: bigint,
1470
+ resolution: number = DEFAULT_RESOLUTION
1471
+ ): bigint {
1472
+ const { aperture, topology, apertureSequence } = this.dggs;
1473
+
1474
+ if ((aperture !== 7 || topology !== 'HEXAGON') && !apertureSequence) {
1475
+ throw new Error(
1476
+ 'Z7 is only available for aperture 7 hexagon grids. ' +
1477
+ `Current configuration: aperture ${aperture}, topology ${topology}.`
1478
+ );
1479
+ }
1480
+
1481
+ try {
1482
+ return this._module.Z7_to_SEQNUM(
1483
+ ...this._getParams(resolution),
1484
+ z7Value
1485
+ );
1486
+ } catch (e) {
1487
+ const errMsg = this._module.getExceptionMessage(e).toString();
1488
+ if (errMsg.includes('aperture') || errMsg.includes('Z7')) {
1489
+ throw new Error(
1490
+ `Z7 error: ${errMsg}. Z7 requires aperture 7 hexagon grids.`
1491
+ );
1492
+ }
1493
+ console.error(errMsg);
1494
+ throw e;
1495
+ }
1496
+ }
1497
+
1498
+ // =========================================================================
1499
+ // Index digit manipulation
1500
+ // Pure bitwise operations on Z7, Z3, and ZORDER packed indices.
1501
+ // These match DGGRID's internal macros (Z7_GET_INDEX_DIGIT, etc.)
1502
+ // and do NOT require WASM calls.
1503
+ // =========================================================================
1504
+
1505
+ // --- Z7 constants (3 bits per digit, max 20 resolutions) ---
1506
+ /** @internal */ static readonly Z7_MAX_RES = 20;
1507
+ /** @internal */ static readonly Z7_BITS_PER_DIGIT = 3n;
1508
+ /** @internal */ static readonly Z7_DIGIT_MASK = 7n;
1509
+ /** @internal */ static readonly Z7_QUAD_OFFSET = 60n;
1510
+ /** @internal */ static readonly Z7_QUAD_MASK = 0xF000000000000000n;
1511
+
1512
+ // --- Z3 constants (2 bits per digit, max 30 resolutions) ---
1513
+ /** @internal */ static readonly Z3_MAX_RES = 30;
1514
+ /** @internal */ static readonly Z3_BITS_PER_DIGIT = 2n;
1515
+ /** @internal */ static readonly Z3_DIGIT_MASK = 3n;
1516
+ /** @internal */ static readonly Z3_QUAD_OFFSET = 60n;
1517
+ /** @internal */ static readonly Z3_QUAD_MASK = 0xF000000000000000n;
1518
+
1519
+ // --- ZORDER constants (2 bits per digit, max 30 resolutions) ---
1520
+ /** @internal */ static readonly ZORDER_MAX_RES = 30;
1521
+ /** @internal */ static readonly ZORDER_BITS_PER_DIGIT = 2n;
1522
+ /** @internal */ static readonly ZORDER_DIGIT_MASK = 3n;
1523
+ /** @internal */ static readonly ZORDER_QUAD_OFFSET = 60n;
1524
+ /** @internal */ static readonly ZORDER_QUAD_MASK = 0xF000000000000000n;
1525
+
1526
+ /**
1527
+ * Get the quad (icosahedron face) number from a Z7 index.
1528
+ *
1529
+ * The quad occupies bits 63–60 of the 64-bit packed value.
1530
+ *
1531
+ * ```ts
1532
+ * const quad = dggs.z7GetQuad(z7Value); // 0–11
1533
+ * ```
1534
+ *
1535
+ * @param z7Value - A Z7 packed index (BigInt).
1536
+ * @returns The quad number (0–11).
1537
+ */
1538
+ z7GetQuad(z7Value: bigint): number {
1539
+ return Number((z7Value & Webdggrid.Z7_QUAD_MASK) >> Webdggrid.Z7_QUAD_OFFSET);
1540
+ }
1541
+
1542
+ /**
1543
+ * Get the digit at a specific resolution level from a Z7 index.
1544
+ *
1545
+ * Each digit is 3 bits wide and occupies a fixed position in the 64-bit value.
1546
+ * Valid digits are 0–6; the value 7 is the invalid/padding marker.
1547
+ *
1548
+ * ```ts
1549
+ * const digit = dggs.z7GetDigit(z7Value, 3); // 0–6 (or 7 = invalid)
1550
+ * ```
1551
+ *
1552
+ * @param z7Value - A Z7 packed index (BigInt).
1553
+ * @param res - Resolution level (1-based, 1 to 20).
1554
+ * @returns The digit value (0–7).
1555
+ */
1556
+ z7GetDigit(z7Value: bigint, res: number): number {
1557
+ const shift = BigInt(Webdggrid.Z7_MAX_RES - res) * Webdggrid.Z7_BITS_PER_DIGIT;
1558
+ return Number((z7Value >> shift) & Webdggrid.Z7_DIGIT_MASK);
1559
+ }
1560
+
1561
+ /**
1562
+ * Set the digit at a specific resolution level in a Z7 index.
1563
+ *
1564
+ * Returns a new Z7 value with the digit at position `res` replaced.
1565
+ *
1566
+ * ```ts
1567
+ * const child = dggs.z7SetDigit(z7Value, 6, 3); // set res-6 digit to 3
1568
+ * ```
1569
+ *
1570
+ * @param z7Value - A Z7 packed index (BigInt).
1571
+ * @param res - Resolution level (1-based, 1 to 20).
1572
+ * @param digit - The digit value to set (0–6, or 7 for invalid).
1573
+ * @returns A new Z7 value with the digit replaced.
1574
+ */
1575
+ z7SetDigit(z7Value: bigint, res: number, digit: number): bigint {
1576
+ const shift = BigInt(Webdggrid.Z7_MAX_RES - res) * Webdggrid.Z7_BITS_PER_DIGIT;
1577
+ return (z7Value & ~(Webdggrid.Z7_DIGIT_MASK << shift)) | (BigInt(digit) << shift);
1578
+ }
1579
+
1580
+ /**
1581
+ * Extract all digits from a Z7 index up to a given resolution.
1582
+ *
1583
+ * ```ts
1584
+ * const { quad, digits } = dggs.z7ExtractDigits(z7Value, 5);
1585
+ * // quad: 1, digits: [2, 0, 3, 4, 1]
1586
+ * ```
1587
+ *
1588
+ * @param z7Value - A Z7 packed index (BigInt).
1589
+ * @param resolution - Number of digits to extract (1-based).
1590
+ * @returns Object with `quad` (number) and `digits` (number array).
1591
+ */
1592
+ z7ExtractDigits(z7Value: bigint, resolution: number): { quad: number; digits: number[] } {
1593
+ const quad = this.z7GetQuad(z7Value);
1594
+ const digits: number[] = [];
1595
+ for (let r = 1; r <= resolution; r++) {
1596
+ digits.push(this.z7GetDigit(z7Value, r));
1597
+ }
1598
+ return { quad, digits };
1599
+ }
1600
+
1601
+ /**
1602
+ * Get the quad (icosahedron face) number from a Z3 index.
1603
+ *
1604
+ * ```ts
1605
+ * const quad = dggs.z3GetQuad(z3Value); // 0–11
1606
+ * ```
1607
+ *
1608
+ * @param z3Value - A Z3 packed index (BigInt).
1609
+ * @returns The quad number (0–11).
1610
+ */
1611
+ z3GetQuad(z3Value: bigint): number {
1612
+ return Number((z3Value & Webdggrid.Z3_QUAD_MASK) >> Webdggrid.Z3_QUAD_OFFSET);
1613
+ }
1614
+
1615
+ /**
1616
+ * Get the digit at a specific resolution level from a Z3 index.
1617
+ *
1618
+ * Each digit is 2 bits wide. Valid digits are 0–2; the value 3 is the
1619
+ * invalid/padding marker.
1620
+ *
1621
+ * ```ts
1622
+ * const digit = dggs.z3GetDigit(z3Value, 3); // 0–2 (or 3 = invalid)
1623
+ * ```
1624
+ *
1625
+ * @param z3Value - A Z3 packed index (BigInt).
1626
+ * @param res - Resolution level (1-based, 1 to 30).
1627
+ * @returns The digit value (0–3).
1628
+ */
1629
+ z3GetDigit(z3Value: bigint, res: number): number {
1630
+ const shift = BigInt(Webdggrid.Z3_MAX_RES - res) * Webdggrid.Z3_BITS_PER_DIGIT;
1631
+ return Number((z3Value >> shift) & Webdggrid.Z3_DIGIT_MASK);
1632
+ }
1633
+
1634
+ /**
1635
+ * Set the digit at a specific resolution level in a Z3 index.
1636
+ *
1637
+ * ```ts
1638
+ * const child = dggs.z3SetDigit(z3Value, 6, 1); // set res-6 digit to 1
1639
+ * ```
1640
+ *
1641
+ * @param z3Value - A Z3 packed index (BigInt).
1642
+ * @param res - Resolution level (1-based, 1 to 30).
1643
+ * @param digit - The digit value to set (0–2, or 3 for invalid).
1644
+ * @returns A new Z3 value with the digit replaced.
1645
+ */
1646
+ z3SetDigit(z3Value: bigint, res: number, digit: number): bigint {
1647
+ const shift = BigInt(Webdggrid.Z3_MAX_RES - res) * Webdggrid.Z3_BITS_PER_DIGIT;
1648
+ return (z3Value & ~(Webdggrid.Z3_DIGIT_MASK << shift)) | (BigInt(digit) << shift);
1649
+ }
1650
+
1651
+ /**
1652
+ * Extract all digits from a Z3 index up to a given resolution.
1653
+ *
1654
+ * ```ts
1655
+ * const { quad, digits } = dggs.z3ExtractDigits(z3Value, 5);
1656
+ * // quad: 1, digits: [1, 0, 2, 1, 0]
1657
+ * ```
1658
+ *
1659
+ * @param z3Value - A Z3 packed index (BigInt).
1660
+ * @param resolution - Number of digits to extract (1-based).
1661
+ * @returns Object with `quad` (number) and `digits` (number array).
1662
+ */
1663
+ z3ExtractDigits(z3Value: bigint, resolution: number): { quad: number; digits: number[] } {
1664
+ const quad = this.z3GetQuad(z3Value);
1665
+ const digits: number[] = [];
1666
+ for (let r = 1; r <= resolution; r++) {
1667
+ digits.push(this.z3GetDigit(z3Value, r));
1668
+ }
1669
+ return { quad, digits };
1670
+ }
1671
+
1672
+ /**
1673
+ * Get the quad (icosahedron face) number from a ZORDER index.
1674
+ *
1675
+ * ```ts
1676
+ * const quad = dggs.zOrderGetQuad(zorderValue); // 0–11
1677
+ * ```
1678
+ *
1679
+ * @param zorderValue - A ZORDER packed index (BigInt).
1680
+ * @returns The quad number (0–11).
1681
+ */
1682
+ zOrderGetQuad(zorderValue: bigint): number {
1683
+ return Number((zorderValue & Webdggrid.ZORDER_QUAD_MASK) >> Webdggrid.ZORDER_QUAD_OFFSET);
1684
+ }
1685
+
1686
+ /**
1687
+ * Get the digit at a specific resolution level from a ZORDER index.
1688
+ *
1689
+ * Each digit is 2 bits wide (values 0–3).
1690
+ *
1691
+ * ```ts
1692
+ * const digit = dggs.zOrderGetDigit(zorderValue, 3); // 0–3
1693
+ * ```
1694
+ *
1695
+ * @param zorderValue - A ZORDER packed index (BigInt).
1696
+ * @param res - Resolution level (1-based, 1 to 30).
1697
+ * @returns The digit value (0–3).
1698
+ */
1699
+ zOrderGetDigit(zorderValue: bigint, res: number): number {
1700
+ const shift = BigInt(Webdggrid.ZORDER_MAX_RES - res) * Webdggrid.ZORDER_BITS_PER_DIGIT;
1701
+ return Number((zorderValue >> shift) & Webdggrid.ZORDER_DIGIT_MASK);
1702
+ }
1703
+
1704
+ /**
1705
+ * Set the digit at a specific resolution level in a ZORDER index.
1706
+ *
1707
+ * ```ts
1708
+ * const modified = dggs.zOrderSetDigit(zorderValue, 3, 2);
1709
+ * ```
1710
+ *
1711
+ * @param zorderValue - A ZORDER packed index (BigInt).
1712
+ * @param res - Resolution level (1-based, 1 to 30).
1713
+ * @param digit - The digit value to set (0–3).
1714
+ * @returns A new ZORDER value with the digit replaced.
1715
+ */
1716
+ zOrderSetDigit(zorderValue: bigint, res: number, digit: number): bigint {
1717
+ const shift = BigInt(Webdggrid.ZORDER_MAX_RES - res) * Webdggrid.ZORDER_BITS_PER_DIGIT;
1718
+ return (zorderValue & ~(Webdggrid.ZORDER_DIGIT_MASK << shift)) | (BigInt(digit) << shift);
1719
+ }
1720
+
1721
+ /**
1722
+ * Extract all digits from a ZORDER index up to a given resolution.
1723
+ *
1724
+ * ```ts
1725
+ * const { quad, digits } = dggs.zOrderExtractDigits(zorderValue, 5);
1726
+ * // quad: 1, digits: [2, 0, 3, 1, 0]
1727
+ * ```
1728
+ *
1729
+ * @param zorderValue - A ZORDER packed index (BigInt).
1730
+ * @param resolution - Number of digits to extract (1-based).
1731
+ * @returns Object with `quad` (number) and `digits` (number array).
1732
+ */
1733
+ zOrderExtractDigits(zorderValue: bigint, resolution: number): { quad: number; digits: number[] } {
1734
+ const quad = this.zOrderGetQuad(zorderValue);
1735
+ const digits: number[] = [];
1736
+ for (let r = 1; r <= resolution; r++) {
1737
+ digits.push(this.zOrderGetDigit(zorderValue, r));
1738
+ }
1739
+ return { quad, digits };
1740
+ }
1741
+
1742
+ // =========================================================================
1743
+ // Low-level coordinate transformation methods
1744
+ // These methods expose all DGGRID coordinate systems beyond GEO/SEQNUM
1745
+ // =========================================================================
1746
+
1747
+ /**
1748
+ * Helper to build the DGGS parameter array for WASM calls.
1749
+ * @private
1750
+ */
1751
+ private _getParams(resolution: number = DEFAULT_RESOLUTION): any[] {
1752
+ const {
1753
+ poleCoordinates: { lat, lng },
1754
+ azimuth,
1755
+ topology,
1756
+ projection,
1757
+ aperture,
1758
+ apertureSequence,
1759
+ } = this.dggs;
1760
+
1761
+ const isApertureSequence = !!apertureSequence;
1762
+ const apSeq = apertureSequence || "";
1763
+
1764
+ return [
1765
+ lng,
1766
+ lat,
1767
+ azimuth,
1768
+ aperture,
1769
+ resolution,
1770
+ topology,
1771
+ projection,
1772
+ isApertureSequence,
1773
+ apSeq
1774
+ ];
1775
+ }
1776
+
1777
+ // -------------------------------------------------------------------------
1778
+ // GEO transformations (beyond the high-level methods above)
1779
+ // -------------------------------------------------------------------------
1780
+
1781
+ /**
1782
+ * Converts geographic coordinates to PLANE coordinates.
1783
+ *
1784
+ * @param coordinates - Array of `[lng, lat]` pairs
1785
+ * @param resolution - Resolution level
1786
+ * @returns Array of `{x, y}` plane coordinates
1787
+ */
1788
+ geoToPlane(coordinates: number[][], resolution: number = DEFAULT_RESOLUTION): Array<{ x: number, y: number }> {
1789
+ const xCoords = coordinates.map(c => c[0]);
1790
+ const yCoords = coordinates.map(c => c[1]);
1791
+
1792
+ const result = this._module.GEO_to_PLANE(...this._getParams(resolution), xCoords, yCoords);
1793
+
1794
+ const size = result.length / 2;
1795
+ const output: any[] = [];
1796
+ for (let i = 0; i < size; i++) {
1797
+ output.push({ x: result[i], y: result[i + size] });
1798
+ }
1799
+ return output;
1800
+ }
1801
+
1802
+ /**
1803
+ * Converts geographic coordinates to PROJTRI coordinates.
1804
+ *
1805
+ * @param coordinates - Array of `[lng, lat]` pairs
1806
+ * @param resolution - Resolution level
1807
+ * @returns Array of `{tnum, x, y}` projection triangle coordinates
1808
+ */
1809
+ geoToProjtri(coordinates: number[][], resolution: number = DEFAULT_RESOLUTION): Array<{ tnum: number, x: number, y: number }> {
1810
+ const xCoords = coordinates.map(c => c[0]);
1811
+ const yCoords = coordinates.map(c => c[1]);
1812
+
1813
+ const result = this._module.GEO_to_PROJTRI(...this._getParams(resolution), xCoords, yCoords);
1814
+
1815
+ const size = result.length / 3;
1816
+ const output: any[] = [];
1817
+ for (let i = 0; i < size; i++) {
1818
+ output.push({
1819
+ tnum: result[i],
1820
+ x: result[i + size],
1821
+ y: result[i + 2 * size]
1822
+ });
1823
+ }
1824
+ return output;
1825
+ }
1826
+
1827
+ /**
1828
+ * Converts geographic coordinates to Q2DD coordinates.
1829
+ *
1830
+ * @param coordinates - Array of `[lng, lat]` pairs
1831
+ * @param resolution - Resolution level
1832
+ * @returns Array of `{quad, x, y}` quad 2D double coordinates
1833
+ */
1834
+ geoToQ2dd(coordinates: number[][], resolution: number = DEFAULT_RESOLUTION): Array<{ quad: number, x: number, y: number }> {
1835
+ const xCoords = coordinates.map(c => c[0]);
1836
+ const yCoords = coordinates.map(c => c[1]);
1837
+
1838
+ const result = this._module.GEO_to_Q2DD(...this._getParams(resolution), xCoords, yCoords);
1839
+
1840
+ const size = result.length / 3;
1841
+ const output: any[] = [];
1842
+ for (let i = 0; i < size; i++) {
1843
+ output.push({
1844
+ quad: result[i],
1845
+ x: result[i + size],
1846
+ y: result[i + 2 * size]
1847
+ });
1848
+ }
1849
+ return output;
1850
+ }
1851
+
1852
+ /**
1853
+ * Converts geographic coordinates to Q2DI coordinates.
1854
+ *
1855
+ * @param coordinates - Array of `[lng, lat]` pairs
1856
+ * @param resolution - Resolution level
1857
+ * @returns Array of `{quad, i, j}` quad 2D integer coordinates
1858
+ */
1859
+ geoToQ2di(coordinates: number[][], resolution: number = DEFAULT_RESOLUTION): Array<{ quad: number, i: bigint, j: bigint }> {
1860
+ const xCoords = coordinates.map(c => c[0]);
1861
+ const yCoords = coordinates.map(c => c[1]);
1862
+
1863
+ const result = this._module.GEO_to_Q2DI(...this._getParams(resolution), xCoords, yCoords);
1864
+
1865
+ const size = result.length / 3;
1866
+ const output: any[] = [];
1867
+ for (let i = 0; i < size; i++) {
1868
+ output.push({
1869
+ quad: result[i],
1870
+ i: BigInt(result[i + size]),
1871
+ j: BigInt(result[i + 2 * size])
1872
+ });
1873
+ }
1874
+ return output;
1875
+ }
1876
+
1877
+ // -------------------------------------------------------------------------
1878
+ // SEQNUM transformations (beyond the high-level methods above)
1879
+ // -------------------------------------------------------------------------
1880
+
1881
+ /**
1882
+ * Converts sequence numbers to PLANE coordinates.
1883
+ *
1884
+ * @param sequenceNum - Array of cell IDs
1885
+ * @param resolution - Resolution level
1886
+ * @returns Array of `{x, y}` plane coordinates
1887
+ */
1888
+ sequenceNumToPlane(sequenceNum: bigint[], resolution: number = DEFAULT_RESOLUTION): Array<{ x: number, y: number }> {
1889
+ const result = this._module.SEQNUM_to_PLANE(...this._getParams(resolution), sequenceNum);
1890
+
1891
+ const size = result.length / 2;
1892
+ const output: any[] = [];
1893
+ for (let i = 0; i < size; i++) {
1894
+ output.push({ x: result[i], y: result[i + size] });
1895
+ }
1896
+ return output;
1897
+ }
1898
+
1899
+ /**
1900
+ * Converts sequence numbers to PROJTRI coordinates.
1901
+ *
1902
+ * @param sequenceNum - Array of cell IDs
1903
+ * @param resolution - Resolution level
1904
+ * @returns Array of `{tnum, x, y}` projection triangle coordinates
1905
+ */
1906
+ sequenceNumToProjtri(sequenceNum: bigint[], resolution: number = DEFAULT_RESOLUTION): Array<{ tnum: number, x: number, y: number }> {
1907
+ const result = this._module.SEQNUM_to_PROJTRI(...this._getParams(resolution), sequenceNum);
1908
+
1909
+ const size = result.length / 3;
1910
+ const output: any[] = [];
1911
+ for (let i = 0; i < size; i++) {
1912
+ output.push({
1913
+ tnum: result[i],
1914
+ x: result[i + size],
1915
+ y: result[i + 2 * size]
1916
+ });
1917
+ }
1918
+ return output;
1919
+ }
1920
+
1921
+ /**
1922
+ * Converts sequence numbers to Q2DD coordinates.
1923
+ *
1924
+ * @param sequenceNum - Array of cell IDs
1925
+ * @param resolution - Resolution level
1926
+ * @returns Array of `{quad, x, y}` quad 2D double coordinates
1927
+ */
1928
+ sequenceNumToQ2dd(sequenceNum: bigint[], resolution: number = DEFAULT_RESOLUTION): Array<{ quad: number, x: number, y: number }> {
1929
+ const result = this._module.SEQNUM_to_Q2DD(...this._getParams(resolution), sequenceNum);
1930
+
1931
+ const size = result.length / 3;
1932
+ const output: any[] = [];
1933
+ for (let i = 0; i < size; i++) {
1934
+ output.push({
1935
+ quad: result[i],
1936
+ x: result[i + size],
1937
+ y: result[i + 2 * size]
1938
+ });
1939
+ }
1940
+ return output;
1941
+ }
1942
+
1943
+ /**
1944
+ * Converts sequence numbers to Q2DI coordinates.
1945
+ *
1946
+ * @param sequenceNum - Array of cell IDs
1947
+ * @param resolution - Resolution level
1948
+ * @returns Array of `{quad, i, j}` quad 2D integer coordinates
1949
+ */
1950
+ sequenceNumToQ2di(sequenceNum: bigint[], resolution: number = DEFAULT_RESOLUTION): Array<{ quad: number, i: bigint, j: bigint }> {
1951
+ const result = this._module.SEQNUM_to_Q2DI(...this._getParams(resolution), sequenceNum);
1952
+
1953
+ const size = result.length / 3;
1954
+ const output: any[] = [];
1955
+ for (let i = 0; i < size; i++) {
1956
+ output.push({
1957
+ quad: result[i],
1958
+ i: BigInt(result[i + size]),
1959
+ j: BigInt(result[i + 2 * size])
1960
+ });
1961
+ }
1962
+ return output;
1963
+ }
1964
+
1965
+ // -------------------------------------------------------------------------
1966
+ // Q2DI transformations
1967
+ // -------------------------------------------------------------------------
1968
+
1969
+ /**
1970
+ * Converts Q2DI coordinates to geographic coordinates.
1971
+ *
1972
+ * @param coords - Array of `{quad, i, j}` coordinates
1973
+ * @param resolution - Resolution level
1974
+ * @returns Array of `[lng, lat]` positions
1975
+ */
1976
+ q2diToGeo(coords: Array<{ quad: number, i: bigint, j: bigint }>, resolution: number = DEFAULT_RESOLUTION): Position[] {
1977
+ const quads = coords.map(c => c.quad);
1978
+ const is = coords.map(c => Number(c.i));
1979
+ const js = coords.map(c => Number(c.j));
1980
+
1981
+ const result = this._module.Q2DI_to_GEO(...this._getParams(resolution), quads, is, js);
1982
+
1983
+ const size = result.length / 2;
1984
+ const output: Position[] = [];
1985
+ for (let i = 0; i < size; i++) {
1986
+ output.push([result[i], result[i + size]]);
1987
+ }
1988
+ return output;
1989
+ }
1990
+
1991
+ /**
1992
+ * Converts Q2DI coordinates to sequence numbers.
1993
+ *
1994
+ * @param coords - Array of `{quad, i, j}` coordinates
1995
+ * @param resolution - Resolution level
1996
+ * @returns Array of cell IDs
1997
+ */
1998
+ q2diToSequenceNum(coords: Array<{ quad: number, i: bigint, j: bigint }>, resolution: number = DEFAULT_RESOLUTION): bigint[] {
1999
+ const quads = coords.map(c => c.quad);
2000
+ const is = coords.map(c => Number(c.i));
2001
+ const js = coords.map(c => Number(c.j));
2002
+
2003
+ return this._module.Q2DI_to_SEQNUM(...this._getParams(resolution), quads, is, js);
2004
+ }
2005
+
2006
+ /**
2007
+ * Converts Q2DI coordinates to PLANE coordinates.
2008
+ *
2009
+ * @param coords - Array of `{quad, i, j}` coordinates
2010
+ * @param resolution - Resolution level
2011
+ * @returns Array of `{x, y}` plane coordinates
2012
+ */
2013
+ q2diToPlane(coords: Array<{ quad: number, i: bigint, j: bigint }>, resolution: number = DEFAULT_RESOLUTION): Array<{ x: number, y: number }> {
2014
+ const quads = coords.map(c => c.quad);
2015
+ const is = coords.map(c => Number(c.i));
2016
+ const js = coords.map(c => Number(c.j));
2017
+
2018
+ const result = this._module.Q2DI_to_PLANE(...this._getParams(resolution), quads, is, js);
2019
+
2020
+ const size = result.length / 2;
2021
+ const output: any[] = [];
2022
+ for (let i = 0; i < size; i++) {
2023
+ output.push({ x: result[i], y: result[i + size] });
2024
+ }
2025
+ return output;
2026
+ }
2027
+
2028
+ /**
2029
+ * Converts Q2DI coordinates to PROJTRI coordinates.
2030
+ *
2031
+ * @param coords - Array of `{quad, i, j}` coordinates
2032
+ * @param resolution - Resolution level
2033
+ * @returns Array of `{tnum, x, y}` projection triangle coordinates
2034
+ */
2035
+ q2diToProjtri(coords: Array<{ quad: number, i: bigint, j: bigint }>, resolution: number = DEFAULT_RESOLUTION): Array<{ tnum: number, x: number, y: number }> {
2036
+ const quads = coords.map(c => c.quad);
2037
+ const is = coords.map(c => Number(c.i));
2038
+ const js = coords.map(c => Number(c.j));
2039
+
2040
+ const result = this._module.Q2DI_to_PROJTRI(...this._getParams(resolution), quads, is, js);
2041
+
2042
+ const size = result.length / 3;
2043
+ const output: any[] = [];
2044
+ for (let i = 0; i < size; i++) {
2045
+ output.push({
2046
+ tnum: result[i],
2047
+ x: result[i + size],
2048
+ y: result[i + 2 * size]
2049
+ });
2050
+ }
2051
+ return output;
2052
+ }
2053
+
2054
+ /**
2055
+ * Converts Q2DI coordinates to Q2DD coordinates.
2056
+ *
2057
+ * @param coords - Array of `{quad, i, j}` coordinates
2058
+ * @param resolution - Resolution level
2059
+ * @returns Array of `{quad, x, y}` quad 2D double coordinates
2060
+ */
2061
+ q2diToQ2dd(coords: Array<{ quad: number, i: bigint, j: bigint }>, resolution: number = DEFAULT_RESOLUTION): Array<{ quad: number, x: number, y: number }> {
2062
+ const quads = coords.map(c => c.quad);
2063
+ const is = coords.map(c => Number(c.i));
2064
+ const js = coords.map(c => Number(c.j));
2065
+
2066
+ const result = this._module.Q2DI_to_Q2DD(...this._getParams(resolution), quads, is, js);
2067
+
2068
+ const size = result.length / 3;
2069
+ const output: any[] = [];
2070
+ for (let i = 0; i < size; i++) {
2071
+ output.push({
2072
+ quad: result[i],
2073
+ x: result[i + size],
2074
+ y: result[i + 2 * size]
2075
+ });
2076
+ }
2077
+ return output;
2078
+ }
2079
+
2080
+ // -------------------------------------------------------------------------
2081
+ // Q2DD transformations
2082
+ // -------------------------------------------------------------------------
2083
+
2084
+ /**
2085
+ * Converts Q2DD coordinates to geographic coordinates.
2086
+ *
2087
+ * @param coords - Array of `{quad, x, y}` coordinates
2088
+ * @param resolution - Resolution level
2089
+ * @returns Array of `[lng, lat]` positions
2090
+ */
2091
+ q2ddToGeo(coords: Array<{ quad: number, x: number, y: number }>, resolution: number = DEFAULT_RESOLUTION): Position[] {
2092
+ const quads = coords.map(c => c.quad);
2093
+ const xs = coords.map(c => c.x);
2094
+ const ys = coords.map(c => c.y);
2095
+
2096
+ const result = this._module.Q2DD_to_GEO(...this._getParams(resolution), quads, xs, ys);
2097
+
2098
+ const size = result.length / 2;
2099
+ const output: Position[] = [];
2100
+ for (let i = 0; i < size; i++) {
2101
+ output.push([result[i], result[i + size]]);
2102
+ }
2103
+ return output;
2104
+ }
2105
+
2106
+ /**
2107
+ * Converts Q2DD coordinates to sequence numbers.
2108
+ *
2109
+ * @param coords - Array of `{quad, x, y}` coordinates
2110
+ * @param resolution - Resolution level
2111
+ * @returns Array of cell IDs
2112
+ */
2113
+ q2ddToSequenceNum(coords: Array<{ quad: number, x: number, y: number }>, resolution: number = DEFAULT_RESOLUTION): bigint[] {
2114
+ const quads = coords.map(c => c.quad);
2115
+ const xs = coords.map(c => c.x);
2116
+ const ys = coords.map(c => c.y);
2117
+
2118
+ return this._module.Q2DD_to_SEQNUM(...this._getParams(resolution), quads, xs, ys);
2119
+ }
2120
+
2121
+ /**
2122
+ * Converts Q2DD coordinates to PLANE coordinates.
2123
+ *
2124
+ * @param coords - Array of `{quad, x, y}` coordinates
2125
+ * @param resolution - Resolution level
2126
+ * @returns Array of `{x, y}` plane coordinates
2127
+ */
2128
+ q2ddToPlane(coords: Array<{ quad: number, x: number, y: number }>, resolution: number = DEFAULT_RESOLUTION): Array<{ x: number, y: number }> {
2129
+ const quads = coords.map(c => c.quad);
2130
+ const xs = coords.map(c => c.x);
2131
+ const ys = coords.map(c => c.y);
2132
+
2133
+ const result = this._module.Q2DD_to_PLANE(...this._getParams(resolution), quads, xs, ys);
2134
+
2135
+ const size = result.length / 2;
2136
+ const output: any[] = [];
2137
+ for (let i = 0; i < size; i++) {
2138
+ output.push({ x: result[i], y: result[i + size] });
2139
+ }
2140
+ return output;
2141
+ }
2142
+
2143
+ /**
2144
+ * Converts Q2DD coordinates to PROJTRI coordinates.
2145
+ *
2146
+ * @param coords - Array of `{quad, x, y}` coordinates
2147
+ * @param resolution - Resolution level
2148
+ * @returns Array of `{tnum, x, y}` projection triangle coordinates
2149
+ */
2150
+ q2ddToProjtri(coords: Array<{ quad: number, x: number, y: number }>, resolution: number = DEFAULT_RESOLUTION): Array<{ tnum: number, x: number, y: number }> {
2151
+ const quads = coords.map(c => c.quad);
2152
+ const xs = coords.map(c => c.x);
2153
+ const ys = coords.map(c => c.y);
2154
+
2155
+ const result = this._module.Q2DD_to_PROJTRI(...this._getParams(resolution), quads, xs, ys);
2156
+
2157
+ const size = result.length / 3;
2158
+ const output: any[] = [];
2159
+ for (let i = 0; i < size; i++) {
2160
+ output.push({
2161
+ tnum: result[i],
2162
+ x: result[i + size],
2163
+ y: result[i + 2 * size]
2164
+ });
2165
+ }
2166
+ return output;
2167
+ }
2168
+
2169
+ /**
2170
+ * Converts Q2DD coordinates to Q2DI coordinates.
2171
+ *
2172
+ * @param coords - Array of `{quad, x, y}` coordinates
2173
+ * @param resolution - Resolution level
2174
+ * @returns Array of `{quad, i, j}` quad 2D integer coordinates
2175
+ */
2176
+ q2ddToQ2di(coords: Array<{ quad: number, x: number, y: number }>, resolution: number = DEFAULT_RESOLUTION): Array<{ quad: number, i: bigint, j: bigint }> {
2177
+ const quads = coords.map(c => c.quad);
2178
+ const xs = coords.map(c => c.x);
2179
+ const ys = coords.map(c => c.y);
2180
+
2181
+ const result = this._module.Q2DD_to_Q2DI(...this._getParams(resolution), quads, xs, ys);
2182
+
2183
+ const size = result.length / 3;
2184
+ const output: any[] = [];
2185
+ for (let i = 0; i < size; i++) {
2186
+ output.push({
2187
+ quad: result[i],
2188
+ i: BigInt(result[i + size]),
2189
+ j: BigInt(result[i + 2 * size])
2190
+ });
2191
+ }
2192
+ return output;
2193
+ }
2194
+
2195
+ // -------------------------------------------------------------------------
2196
+ // PROJTRI transformations
2197
+ // -------------------------------------------------------------------------
2198
+
2199
+ /**
2200
+ * Converts PROJTRI coordinates to geographic coordinates.
2201
+ *
2202
+ * @param coords - Array of `{tnum, x, y}` coordinates
2203
+ * @param resolution - Resolution level
2204
+ * @returns Array of `[lng, lat]` positions
2205
+ */
2206
+ projtriToGeo(coords: Array<{ tnum: number, x: number, y: number }>, resolution: number = DEFAULT_RESOLUTION): Position[] {
2207
+ const tnums = coords.map(c => c.tnum);
2208
+ const xs = coords.map(c => c.x);
2209
+ const ys = coords.map(c => c.y);
2210
+
2211
+ const result = this._module.PROJTRI_to_GEO(...this._getParams(resolution), tnums, xs, ys);
2212
+
2213
+ const size = result.length / 2;
2214
+ const output: Position[] = [];
2215
+ for (let i = 0; i < size; i++) {
2216
+ output.push([result[i], result[i + size]]);
2217
+ }
2218
+ return output;
2219
+ }
2220
+
2221
+ /**
2222
+ * Converts PROJTRI coordinates to sequence numbers.
2223
+ *
2224
+ * @param coords - Array of `{tnum, x, y}` coordinates
2225
+ * @param resolution - Resolution level
2226
+ * @returns Array of cell IDs
2227
+ */
2228
+ projtriToSequenceNum(coords: Array<{ tnum: number, x: number, y: number }>, resolution: number = DEFAULT_RESOLUTION): bigint[] {
2229
+ const tnums = coords.map(c => c.tnum);
2230
+ const xs = coords.map(c => c.x);
2231
+ const ys = coords.map(c => c.y);
2232
+
2233
+ return this._module.PROJTRI_to_SEQNUM(...this._getParams(resolution), tnums, xs, ys);
2234
+ }
2235
+
2236
+ /**
2237
+ * Converts PROJTRI coordinates to PLANE coordinates.
2238
+ *
2239
+ * @param coords - Array of `{tnum, x, y}` coordinates
2240
+ * @param resolution - Resolution level
2241
+ * @returns Array of `{x, y}` plane coordinates
2242
+ */
2243
+ projtriToPlane(coords: Array<{ tnum: number, x: number, y: number }>, resolution: number = DEFAULT_RESOLUTION): Array<{ x: number, y: number }> {
2244
+ const tnums = coords.map(c => c.tnum);
2245
+ const xs = coords.map(c => c.x);
2246
+ const ys = coords.map(c => c.y);
2247
+
2248
+ const result = this._module.PROJTRI_to_PLANE(...this._getParams(resolution), tnums, xs, ys);
2249
+
2250
+ const size = result.length / 2;
2251
+ const output: any[] = [];
2252
+ for (let i = 0; i < size; i++) {
2253
+ output.push({ x: result[i], y: result[i + size] });
2254
+ }
2255
+ return output;
2256
+ }
2257
+
2258
+ /**
2259
+ * Converts PROJTRI coordinates to Q2DD coordinates.
2260
+ *
2261
+ * @param coords - Array of `{tnum, x, y}` coordinates
2262
+ * @param resolution - Resolution level
2263
+ * @returns Array of `{quad, x, y}` quad 2D double coordinates
2264
+ */
2265
+ projtriToQ2dd(coords: Array<{ tnum: number, x: number, y: number }>, resolution: number = DEFAULT_RESOLUTION): Array<{ quad: number, x: number, y: number }> {
2266
+ const tnums = coords.map(c => c.tnum);
2267
+ const xs = coords.map(c => c.x);
2268
+ const ys = coords.map(c => c.y);
2269
+
2270
+ const result = this._module.PROJTRI_to_Q2DD(...this._getParams(resolution), tnums, xs, ys);
2271
+
2272
+ const size = result.length / 3;
2273
+ const output: any[] = [];
2274
+ for (let i = 0; i < size; i++) {
2275
+ output.push({
2276
+ quad: result[i],
2277
+ x: result[i + size],
2278
+ y: result[i + 2 * size]
2279
+ });
2280
+ }
2281
+ return output;
2282
+ }
2283
+
2284
+ /**
2285
+ * Converts PROJTRI coordinates to Q2DI coordinates.
2286
+ *
2287
+ * @param coords - Array of `{tnum, x, y}` coordinates
2288
+ * @param resolution - Resolution level
2289
+ * @returns Array of `{quad, i, j}` quad 2D integer coordinates
2290
+ */
2291
+ projtriToQ2di(coords: Array<{ tnum: number, x: number, y: number }>, resolution: number = DEFAULT_RESOLUTION): Array<{ quad: number, i: bigint, j: bigint }> {
2292
+ const tnums = coords.map(c => c.tnum);
2293
+ const xs = coords.map(c => c.x);
2294
+ const ys = coords.map(c => c.y);
2295
+
2296
+ const result = this._module.PROJTRI_to_Q2DI(...this._getParams(resolution), tnums, xs, ys);
2297
+
2298
+ const size = result.length / 3;
2299
+ const output: any[] = [];
2300
+ for (let i = 0; i < size; i++) {
2301
+ output.push({
2302
+ quad: result[i],
2303
+ i: BigInt(result[i + size]),
2304
+ j: BigInt(result[i + 2 * size])
2305
+ });
2306
+ }
2307
+ return output;
2308
+ }
2309
+
2310
+ // -------------------------------------------------------------------------
2311
+ // PLANE transformations
2312
+ // Note: PLANE is an output-only coordinate system in DGGRID.
2313
+ // There are no PLANE_to_* transformations available.
2314
+ // Use other coordinate systems (GEO, SEQNUM, Q2DI, Q2DD, PROJTRI) as input.
2315
+ // -------------------------------------------------------------------------
819
2316
  }