node-red-contrib-tak-registration 0.16.1 → 0.16.3

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 (799) hide show
  1. package/node_modules/@turf/along/README.md +3 -1
  2. package/node_modules/@turf/along/dist/cjs/index.cjs +2 -2
  3. package/node_modules/@turf/along/dist/cjs/index.cjs.map +1 -1
  4. package/node_modules/@turf/along/dist/cjs/index.d.cts +1 -1
  5. package/node_modules/@turf/along/dist/esm/index.d.ts +1 -1
  6. package/node_modules/@turf/along/dist/esm/index.js +2 -2
  7. package/node_modules/@turf/along/dist/esm/index.js.map +1 -1
  8. package/node_modules/@turf/along/package.json +12 -12
  9. package/node_modules/@turf/angle/dist/cjs/index.cjs +2 -2
  10. package/node_modules/@turf/angle/dist/cjs/index.cjs.map +1 -1
  11. package/node_modules/@turf/angle/dist/esm/index.js +2 -2
  12. package/node_modules/@turf/angle/dist/esm/index.js.map +1 -1
  13. package/node_modules/@turf/angle/package.json +16 -16
  14. package/node_modules/@turf/area/dist/cjs/index.cjs +2 -2
  15. package/node_modules/@turf/area/dist/cjs/index.cjs.map +1 -1
  16. package/node_modules/@turf/area/dist/esm/index.js +2 -2
  17. package/node_modules/@turf/area/dist/esm/index.js.map +1 -1
  18. package/node_modules/@turf/area/package.json +10 -10
  19. package/node_modules/@turf/bbox/dist/cjs/index.cjs +2 -2
  20. package/node_modules/@turf/bbox/dist/cjs/index.cjs.map +1 -1
  21. package/node_modules/@turf/bbox/dist/esm/index.js +2 -2
  22. package/node_modules/@turf/bbox/dist/esm/index.js.map +1 -1
  23. package/node_modules/@turf/bbox/package.json +9 -9
  24. package/node_modules/@turf/bbox-clip/dist/cjs/index.cjs +2 -2
  25. package/node_modules/@turf/bbox-clip/dist/cjs/index.cjs.map +1 -1
  26. package/node_modules/@turf/bbox-clip/dist/esm/index.js +2 -2
  27. package/node_modules/@turf/bbox-clip/dist/esm/index.js.map +1 -1
  28. package/node_modules/@turf/bbox-clip/package.json +11 -11
  29. package/node_modules/@turf/bbox-polygon/dist/cjs/index.cjs +2 -2
  30. package/node_modules/@turf/bbox-polygon/dist/cjs/index.cjs.map +1 -1
  31. package/node_modules/@turf/bbox-polygon/dist/esm/index.js +2 -2
  32. package/node_modules/@turf/bbox-polygon/dist/esm/index.js.map +1 -1
  33. package/node_modules/@turf/bbox-polygon/package.json +8 -8
  34. package/node_modules/@turf/bearing/dist/cjs/index.cjs +2 -2
  35. package/node_modules/@turf/bearing/dist/cjs/index.cjs.map +1 -1
  36. package/node_modules/@turf/bearing/dist/esm/index.js +2 -2
  37. package/node_modules/@turf/bearing/dist/esm/index.js.map +1 -1
  38. package/node_modules/@turf/bearing/package.json +11 -11
  39. package/node_modules/@turf/bezier-spline/dist/cjs/index.cjs +2 -2
  40. package/node_modules/@turf/bezier-spline/dist/cjs/index.cjs.map +1 -1
  41. package/node_modules/@turf/bezier-spline/dist/esm/index.js +2 -2
  42. package/node_modules/@turf/bezier-spline/dist/esm/index.js.map +1 -1
  43. package/node_modules/@turf/bezier-spline/package.json +10 -10
  44. package/node_modules/@turf/boolean-clockwise/dist/cjs/index.cjs +2 -2
  45. package/node_modules/@turf/boolean-clockwise/dist/cjs/index.cjs.map +1 -1
  46. package/node_modules/@turf/boolean-clockwise/dist/esm/index.js +2 -2
  47. package/node_modules/@turf/boolean-clockwise/dist/esm/index.js.map +1 -1
  48. package/node_modules/@turf/boolean-clockwise/package.json +10 -10
  49. package/node_modules/@turf/boolean-concave/dist/cjs/index.cjs +2 -2
  50. package/node_modules/@turf/boolean-concave/dist/cjs/index.cjs.map +1 -1
  51. package/node_modules/@turf/boolean-concave/dist/esm/index.js +2 -2
  52. package/node_modules/@turf/boolean-concave/dist/esm/index.js.map +1 -1
  53. package/node_modules/@turf/boolean-concave/package.json +10 -10
  54. package/node_modules/@turf/boolean-contains/dist/cjs/index.cjs +2 -2
  55. package/node_modules/@turf/boolean-contains/dist/cjs/index.cjs.map +1 -1
  56. package/node_modules/@turf/boolean-contains/dist/esm/index.js +2 -2
  57. package/node_modules/@turf/boolean-contains/dist/esm/index.js.map +1 -1
  58. package/node_modules/@turf/boolean-contains/package.json +13 -13
  59. package/node_modules/@turf/boolean-crosses/dist/cjs/index.cjs +2 -2
  60. package/node_modules/@turf/boolean-crosses/dist/cjs/index.cjs.map +1 -1
  61. package/node_modules/@turf/boolean-crosses/dist/esm/index.js +2 -2
  62. package/node_modules/@turf/boolean-crosses/dist/esm/index.js.map +1 -1
  63. package/node_modules/@turf/boolean-crosses/package.json +13 -13
  64. package/node_modules/@turf/boolean-disjoint/dist/cjs/index.cjs +2 -2
  65. package/node_modules/@turf/boolean-disjoint/dist/cjs/index.cjs.map +1 -1
  66. package/node_modules/@turf/boolean-disjoint/dist/esm/index.js +2 -2
  67. package/node_modules/@turf/boolean-disjoint/dist/esm/index.js.map +1 -1
  68. package/node_modules/@turf/boolean-disjoint/package.json +12 -12
  69. package/node_modules/@turf/boolean-equal/dist/cjs/index.cjs +2 -2
  70. package/node_modules/@turf/boolean-equal/dist/cjs/index.cjs.map +1 -1
  71. package/node_modules/@turf/boolean-equal/dist/esm/index.js +2 -2
  72. package/node_modules/@turf/boolean-equal/dist/esm/index.js.map +1 -1
  73. package/node_modules/@turf/boolean-equal/package.json +11 -11
  74. package/node_modules/@turf/boolean-intersects/README.md +1 -1
  75. package/node_modules/@turf/boolean-intersects/dist/cjs/index.cjs +2 -2
  76. package/node_modules/@turf/boolean-intersects/dist/cjs/index.cjs.map +1 -1
  77. package/node_modules/@turf/boolean-intersects/dist/esm/index.js +2 -2
  78. package/node_modules/@turf/boolean-intersects/dist/esm/index.js.map +1 -1
  79. package/node_modules/@turf/boolean-intersects/package.json +10 -10
  80. package/node_modules/@turf/boolean-overlap/dist/cjs/index.cjs +2 -2
  81. package/node_modules/@turf/boolean-overlap/dist/cjs/index.cjs.map +1 -1
  82. package/node_modules/@turf/boolean-overlap/dist/esm/index.js +2 -2
  83. package/node_modules/@turf/boolean-overlap/dist/esm/index.js.map +1 -1
  84. package/node_modules/@turf/boolean-overlap/package.json +13 -13
  85. package/node_modules/@turf/boolean-parallel/dist/cjs/index.cjs +2 -2
  86. package/node_modules/@turf/boolean-parallel/dist/cjs/index.cjs.map +1 -1
  87. package/node_modules/@turf/boolean-parallel/dist/esm/index.js +2 -2
  88. package/node_modules/@turf/boolean-parallel/dist/esm/index.js.map +1 -1
  89. package/node_modules/@turf/boolean-parallel/package.json +12 -12
  90. package/node_modules/@turf/boolean-point-in-polygon/dist/cjs/index.cjs +2 -2
  91. package/node_modules/@turf/boolean-point-in-polygon/dist/cjs/index.cjs.map +1 -1
  92. package/node_modules/@turf/boolean-point-in-polygon/dist/esm/index.js +2 -2
  93. package/node_modules/@turf/boolean-point-in-polygon/dist/esm/index.js.map +1 -1
  94. package/node_modules/@turf/boolean-point-in-polygon/package.json +9 -9
  95. package/node_modules/@turf/boolean-point-on-line/dist/cjs/index.cjs +2 -2
  96. package/node_modules/@turf/boolean-point-on-line/dist/cjs/index.cjs.map +1 -1
  97. package/node_modules/@turf/boolean-point-on-line/dist/esm/index.js +2 -2
  98. package/node_modules/@turf/boolean-point-on-line/dist/esm/index.js.map +1 -1
  99. package/node_modules/@turf/boolean-point-on-line/package.json +11 -11
  100. package/node_modules/@turf/boolean-touches/dist/cjs/index.cjs +2 -2
  101. package/node_modules/@turf/boolean-touches/dist/cjs/index.cjs.map +1 -1
  102. package/node_modules/@turf/boolean-touches/dist/esm/index.js +2 -2
  103. package/node_modules/@turf/boolean-touches/dist/esm/index.js.map +1 -1
  104. package/node_modules/@turf/boolean-touches/package.json +12 -12
  105. package/node_modules/@turf/boolean-valid/dist/cjs/index.cjs +2 -2
  106. package/node_modules/@turf/boolean-valid/dist/cjs/index.cjs.map +1 -1
  107. package/node_modules/@turf/boolean-valid/dist/esm/index.js +2 -2
  108. package/node_modules/@turf/boolean-valid/dist/esm/index.js.map +1 -1
  109. package/node_modules/@turf/boolean-valid/package.json +17 -17
  110. package/node_modules/@turf/boolean-within/dist/cjs/index.cjs +2 -2
  111. package/node_modules/@turf/boolean-within/dist/cjs/index.cjs.map +1 -1
  112. package/node_modules/@turf/boolean-within/dist/esm/index.js +2 -2
  113. package/node_modules/@turf/boolean-within/dist/esm/index.js.map +1 -1
  114. package/node_modules/@turf/boolean-within/package.json +13 -13
  115. package/node_modules/@turf/buffer/README.md +3 -3
  116. package/node_modules/@turf/buffer/dist/cjs/index.cjs +2 -2
  117. package/node_modules/@turf/buffer/dist/cjs/index.cjs.map +1 -1
  118. package/node_modules/@turf/buffer/dist/esm/index.js +2 -2
  119. package/node_modules/@turf/buffer/dist/esm/index.js.map +1 -1
  120. package/node_modules/@turf/buffer/package.json +13 -13
  121. package/node_modules/@turf/center/dist/cjs/index.cjs +2 -2
  122. package/node_modules/@turf/center/dist/cjs/index.cjs.map +1 -1
  123. package/node_modules/@turf/center/dist/esm/index.js +2 -2
  124. package/node_modules/@turf/center/dist/esm/index.js.map +1 -1
  125. package/node_modules/@turf/center/package.json +13 -13
  126. package/node_modules/@turf/center-mean/dist/cjs/index.cjs +2 -2
  127. package/node_modules/@turf/center-mean/dist/cjs/index.cjs.map +1 -1
  128. package/node_modules/@turf/center-mean/dist/esm/index.js +2 -2
  129. package/node_modules/@turf/center-mean/dist/esm/index.js.map +1 -1
  130. package/node_modules/@turf/center-mean/package.json +14 -14
  131. package/node_modules/@turf/center-median/dist/cjs/index.cjs +2 -2
  132. package/node_modules/@turf/center-median/dist/cjs/index.cjs.map +1 -1
  133. package/node_modules/@turf/center-median/dist/esm/index.js +2 -2
  134. package/node_modules/@turf/center-median/dist/esm/index.js.map +1 -1
  135. package/node_modules/@turf/center-median/package.json +17 -17
  136. package/node_modules/@turf/center-of-mass/dist/cjs/index.cjs +2 -2
  137. package/node_modules/@turf/center-of-mass/dist/cjs/index.cjs.map +1 -1
  138. package/node_modules/@turf/center-of-mass/dist/esm/index.js +2 -2
  139. package/node_modules/@turf/center-of-mass/dist/esm/index.js.map +1 -1
  140. package/node_modules/@turf/center-of-mass/package.json +14 -14
  141. package/node_modules/@turf/centroid/dist/cjs/index.cjs +2 -2
  142. package/node_modules/@turf/centroid/dist/cjs/index.cjs.map +1 -1
  143. package/node_modules/@turf/centroid/dist/esm/index.js +2 -2
  144. package/node_modules/@turf/centroid/dist/esm/index.js.map +1 -1
  145. package/node_modules/@turf/centroid/package.json +11 -11
  146. package/node_modules/@turf/circle/README.md +13 -13
  147. package/node_modules/@turf/circle/dist/cjs/index.cjs +2 -2
  148. package/node_modules/@turf/circle/dist/cjs/index.cjs.map +1 -1
  149. package/node_modules/@turf/circle/dist/cjs/index.d.cts +2 -2
  150. package/node_modules/@turf/circle/dist/esm/index.d.ts +2 -2
  151. package/node_modules/@turf/circle/dist/esm/index.js +2 -2
  152. package/node_modules/@turf/circle/dist/esm/index.js.map +1 -1
  153. package/node_modules/@turf/circle/package.json +11 -11
  154. package/node_modules/@turf/clean-coords/dist/cjs/index.cjs +33 -49
  155. package/node_modules/@turf/clean-coords/dist/cjs/index.cjs.map +1 -1
  156. package/node_modules/@turf/clean-coords/dist/esm/index.js +33 -49
  157. package/node_modules/@turf/clean-coords/dist/esm/index.js.map +1 -1
  158. package/node_modules/@turf/clean-coords/package.json +15 -12
  159. package/node_modules/@turf/clone/dist/cjs/index.cjs +2 -2
  160. package/node_modules/@turf/clone/dist/cjs/index.cjs.map +1 -1
  161. package/node_modules/@turf/clone/dist/esm/index.js +2 -2
  162. package/node_modules/@turf/clone/dist/esm/index.js.map +1 -1
  163. package/node_modules/@turf/clone/package.json +9 -9
  164. package/node_modules/@turf/clusters/package.json +9 -9
  165. package/node_modules/@turf/clusters-dbscan/README.md +2 -2
  166. package/node_modules/@turf/clusters-dbscan/dist/cjs/index.cjs +3 -8
  167. package/node_modules/@turf/clusters-dbscan/dist/cjs/index.cjs.map +1 -1
  168. package/node_modules/@turf/clusters-dbscan/dist/cjs/index.d.cts +1 -1
  169. package/node_modules/@turf/clusters-dbscan/dist/esm/index.d.ts +1 -1
  170. package/node_modules/@turf/clusters-dbscan/dist/esm/index.js +4 -9
  171. package/node_modules/@turf/clusters-dbscan/dist/esm/index.js.map +1 -1
  172. package/node_modules/@turf/clusters-dbscan/package.json +15 -15
  173. package/node_modules/@turf/clusters-kmeans/dist/cjs/index.cjs +2 -2
  174. package/node_modules/@turf/clusters-kmeans/dist/cjs/index.cjs.map +1 -1
  175. package/node_modules/@turf/clusters-kmeans/dist/cjs/index.d.cts +1 -1
  176. package/node_modules/@turf/clusters-kmeans/dist/esm/index.d.ts +1 -1
  177. package/node_modules/@turf/clusters-kmeans/dist/esm/index.js +2 -2
  178. package/node_modules/@turf/clusters-kmeans/dist/esm/index.js.map +1 -1
  179. package/node_modules/@turf/clusters-kmeans/package.json +15 -15
  180. package/node_modules/@turf/collect/dist/cjs/index.cjs +3 -8
  181. package/node_modules/@turf/collect/dist/cjs/index.cjs.map +1 -1
  182. package/node_modules/@turf/collect/dist/esm/index.js +3 -8
  183. package/node_modules/@turf/collect/dist/esm/index.js.map +1 -1
  184. package/node_modules/@turf/collect/package.json +11 -11
  185. package/node_modules/@turf/combine/dist/cjs/index.cjs +2 -2
  186. package/node_modules/@turf/combine/dist/cjs/index.cjs.map +1 -1
  187. package/node_modules/@turf/combine/dist/esm/index.js +2 -2
  188. package/node_modules/@turf/combine/dist/esm/index.js.map +1 -1
  189. package/node_modules/@turf/combine/package.json +9 -9
  190. package/node_modules/@turf/concave/README.md +2 -2
  191. package/node_modules/@turf/concave/dist/cjs/index.cjs +2 -2
  192. package/node_modules/@turf/concave/dist/cjs/index.cjs.map +1 -1
  193. package/node_modules/@turf/concave/dist/cjs/index.d.cts +1 -1
  194. package/node_modules/@turf/concave/dist/esm/index.d.ts +1 -1
  195. package/node_modules/@turf/concave/dist/esm/index.js +2 -2
  196. package/node_modules/@turf/concave/dist/esm/index.js.map +1 -1
  197. package/node_modules/@turf/concave/package.json +14 -14
  198. package/node_modules/@turf/convex/dist/cjs/index.cjs +2 -2
  199. package/node_modules/@turf/convex/dist/cjs/index.cjs.map +1 -1
  200. package/node_modules/@turf/convex/dist/esm/index.js +2 -2
  201. package/node_modules/@turf/convex/dist/esm/index.js.map +1 -1
  202. package/node_modules/@turf/convex/package.json +11 -11
  203. package/node_modules/@turf/destination/README.md +2 -2
  204. package/node_modules/@turf/destination/dist/cjs/index.cjs +5 -2
  205. package/node_modules/@turf/destination/dist/cjs/index.cjs.map +1 -1
  206. package/node_modules/@turf/destination/dist/cjs/index.d.cts +1 -1
  207. package/node_modules/@turf/destination/dist/esm/index.d.ts +1 -1
  208. package/node_modules/@turf/destination/dist/esm/index.js +5 -2
  209. package/node_modules/@turf/destination/dist/esm/index.js.map +1 -1
  210. package/node_modules/@turf/destination/package.json +14 -11
  211. package/node_modules/@turf/difference/dist/cjs/index.cjs +2 -2
  212. package/node_modules/@turf/difference/dist/cjs/index.cjs.map +1 -1
  213. package/node_modules/@turf/difference/dist/esm/index.js +2 -2
  214. package/node_modules/@turf/difference/dist/esm/index.js.map +1 -1
  215. package/node_modules/@turf/difference/package.json +11 -11
  216. package/node_modules/@turf/dissolve/dist/cjs/index.cjs +2 -2
  217. package/node_modules/@turf/dissolve/dist/cjs/index.cjs.map +1 -1
  218. package/node_modules/@turf/dissolve/dist/esm/index.js +2 -2
  219. package/node_modules/@turf/dissolve/dist/esm/index.js.map +1 -1
  220. package/node_modules/@turf/dissolve/package.json +12 -12
  221. package/node_modules/@turf/distance/README.md +2 -2
  222. package/node_modules/@turf/distance/dist/cjs/index.cjs +2 -2
  223. package/node_modules/@turf/distance/dist/cjs/index.cjs.map +1 -1
  224. package/node_modules/@turf/distance/dist/cjs/index.d.cts +1 -1
  225. package/node_modules/@turf/distance/dist/esm/index.d.ts +1 -1
  226. package/node_modules/@turf/distance/dist/esm/index.js +2 -2
  227. package/node_modules/@turf/distance/dist/esm/index.js.map +1 -1
  228. package/node_modules/@turf/distance/package.json +10 -10
  229. package/node_modules/@turf/distance-weight/dist/cjs/index.cjs +2 -2
  230. package/node_modules/@turf/distance-weight/dist/cjs/index.cjs.map +1 -1
  231. package/node_modules/@turf/distance-weight/dist/esm/index.js +2 -2
  232. package/node_modules/@turf/distance-weight/dist/esm/index.js.map +1 -1
  233. package/node_modules/@turf/distance-weight/package.json +12 -12
  234. package/node_modules/@turf/ellipse/README.md +2 -2
  235. package/node_modules/@turf/ellipse/dist/cjs/index.cjs +62 -39
  236. package/node_modules/@turf/ellipse/dist/cjs/index.cjs.map +1 -1
  237. package/node_modules/@turf/ellipse/dist/cjs/index.d.cts +1 -1
  238. package/node_modules/@turf/ellipse/dist/esm/index.d.ts +1 -1
  239. package/node_modules/@turf/ellipse/dist/esm/index.js +64 -41
  240. package/node_modules/@turf/ellipse/dist/esm/index.js.map +1 -1
  241. package/node_modules/@turf/ellipse/package.json +21 -18
  242. package/node_modules/@turf/envelope/dist/cjs/index.cjs +2 -2
  243. package/node_modules/@turf/envelope/dist/cjs/index.cjs.map +1 -1
  244. package/node_modules/@turf/envelope/dist/esm/index.js +2 -2
  245. package/node_modules/@turf/envelope/dist/esm/index.js.map +1 -1
  246. package/node_modules/@turf/envelope/package.json +10 -10
  247. package/node_modules/@turf/explode/dist/cjs/index.cjs +2 -2
  248. package/node_modules/@turf/explode/dist/cjs/index.cjs.map +1 -1
  249. package/node_modules/@turf/explode/dist/esm/index.js +2 -2
  250. package/node_modules/@turf/explode/dist/esm/index.js.map +1 -1
  251. package/node_modules/@turf/explode/package.json +10 -10
  252. package/node_modules/@turf/flatten/dist/cjs/index.cjs +2 -2
  253. package/node_modules/@turf/flatten/dist/cjs/index.cjs.map +1 -1
  254. package/node_modules/@turf/flatten/dist/esm/index.js +2 -2
  255. package/node_modules/@turf/flatten/dist/esm/index.js.map +1 -1
  256. package/node_modules/@turf/flatten/package.json +10 -10
  257. package/node_modules/@turf/flip/dist/cjs/index.cjs +2 -2
  258. package/node_modules/@turf/flip/dist/cjs/index.cjs.map +1 -1
  259. package/node_modules/@turf/flip/dist/esm/index.js +2 -2
  260. package/node_modules/@turf/flip/dist/esm/index.js.map +1 -1
  261. package/node_modules/@turf/flip/package.json +11 -11
  262. package/node_modules/@turf/geojson-rbush/dist/cjs/index.cjs +2 -2
  263. package/node_modules/@turf/geojson-rbush/dist/cjs/index.cjs.map +1 -1
  264. package/node_modules/@turf/geojson-rbush/dist/esm/index.js +2 -2
  265. package/node_modules/@turf/geojson-rbush/dist/esm/index.js.map +1 -1
  266. package/node_modules/@turf/geojson-rbush/package.json +12 -12
  267. package/node_modules/@turf/great-circle/dist/cjs/index.cjs +3 -3
  268. package/node_modules/@turf/great-circle/dist/cjs/index.cjs.map +1 -1
  269. package/node_modules/@turf/great-circle/dist/esm/index.js +3 -3
  270. package/node_modules/@turf/great-circle/dist/esm/index.js.map +1 -1
  271. package/node_modules/@turf/great-circle/package.json +10 -10
  272. package/node_modules/@turf/helpers/README.md +1 -1
  273. package/node_modules/@turf/helpers/dist/cjs/index.cjs.map +1 -1
  274. package/node_modules/@turf/helpers/dist/cjs/index.d.cts +1 -1
  275. package/node_modules/@turf/helpers/dist/esm/index.d.ts +1 -1
  276. package/node_modules/@turf/helpers/dist/esm/index.js.map +1 -1
  277. package/node_modules/@turf/helpers/package.json +7 -7
  278. package/node_modules/@turf/hex-grid/README.md +7 -5
  279. package/node_modules/@turf/hex-grid/dist/cjs/index.cjs +2 -2
  280. package/node_modules/@turf/hex-grid/dist/cjs/index.cjs.map +1 -1
  281. package/node_modules/@turf/hex-grid/dist/cjs/index.d.cts +4 -4
  282. package/node_modules/@turf/hex-grid/dist/esm/index.d.ts +4 -4
  283. package/node_modules/@turf/hex-grid/dist/esm/index.js +2 -2
  284. package/node_modules/@turf/hex-grid/dist/esm/index.js.map +1 -1
  285. package/node_modules/@turf/hex-grid/package.json +14 -14
  286. package/node_modules/@turf/interpolate/README.md +7 -5
  287. package/node_modules/@turf/interpolate/dist/cjs/index.cjs +2 -2
  288. package/node_modules/@turf/interpolate/dist/cjs/index.cjs.map +1 -1
  289. package/node_modules/@turf/interpolate/dist/esm/index.js +2 -2
  290. package/node_modules/@turf/interpolate/dist/esm/index.js.map +1 -1
  291. package/node_modules/@turf/interpolate/package.json +19 -19
  292. package/node_modules/@turf/intersect/dist/cjs/index.cjs +2 -2
  293. package/node_modules/@turf/intersect/dist/cjs/index.cjs.map +1 -1
  294. package/node_modules/@turf/intersect/dist/esm/index.js +2 -2
  295. package/node_modules/@turf/intersect/dist/esm/index.js.map +1 -1
  296. package/node_modules/@turf/intersect/package.json +11 -11
  297. package/node_modules/@turf/invariant/package.json +8 -8
  298. package/node_modules/@turf/isobands/README.md +1 -1
  299. package/node_modules/@turf/isobands/dist/cjs/index.cjs +313 -9
  300. package/node_modules/@turf/isobands/dist/cjs/index.cjs.map +1 -1
  301. package/node_modules/@turf/isobands/dist/cjs/index.d.cts +1 -1
  302. package/node_modules/@turf/isobands/dist/esm/index.d.ts +1 -1
  303. package/node_modules/@turf/isobands/dist/esm/index.js +313 -9
  304. package/node_modules/@turf/isobands/dist/esm/index.js.map +1 -1
  305. package/node_modules/@turf/isobands/package.json +22 -22
  306. package/node_modules/@turf/isolines/README.md +1 -1
  307. package/node_modules/@turf/isolines/dist/cjs/index.cjs +192 -7
  308. package/node_modules/@turf/isolines/dist/cjs/index.cjs.map +1 -1
  309. package/node_modules/@turf/isolines/dist/cjs/index.d.cts +1 -1
  310. package/node_modules/@turf/isolines/dist/esm/index.d.ts +1 -1
  311. package/node_modules/@turf/isolines/dist/esm/index.js +192 -7
  312. package/node_modules/@turf/isolines/dist/esm/index.js.map +1 -1
  313. package/node_modules/@turf/isolines/package.json +19 -19
  314. package/node_modules/@turf/kinks/dist/cjs/index.cjs +2 -2
  315. package/node_modules/@turf/kinks/dist/cjs/index.cjs.map +1 -1
  316. package/node_modules/@turf/kinks/dist/esm/index.js +2 -2
  317. package/node_modules/@turf/kinks/dist/esm/index.js.map +1 -1
  318. package/node_modules/@turf/kinks/package.json +10 -10
  319. package/node_modules/@turf/length/README.md +2 -2
  320. package/node_modules/@turf/length/dist/cjs/index.cjs +2 -2
  321. package/node_modules/@turf/length/dist/cjs/index.cjs.map +1 -1
  322. package/node_modules/@turf/length/dist/cjs/index.d.cts +1 -1
  323. package/node_modules/@turf/length/dist/esm/index.d.ts +1 -1
  324. package/node_modules/@turf/length/dist/esm/index.js +2 -2
  325. package/node_modules/@turf/length/dist/esm/index.js.map +1 -1
  326. package/node_modules/@turf/length/package.json +11 -11
  327. package/node_modules/@turf/line-arc/README.md +2 -2
  328. package/node_modules/@turf/line-arc/dist/cjs/index.cjs +2 -2
  329. package/node_modules/@turf/line-arc/dist/cjs/index.cjs.map +1 -1
  330. package/node_modules/@turf/line-arc/dist/cjs/index.d.cts +1 -1
  331. package/node_modules/@turf/line-arc/dist/esm/index.d.ts +1 -1
  332. package/node_modules/@turf/line-arc/dist/esm/index.js +2 -2
  333. package/node_modules/@turf/line-arc/dist/esm/index.js.map +1 -1
  334. package/node_modules/@turf/line-arc/package.json +12 -12
  335. package/node_modules/@turf/line-chunk/README.md +2 -2
  336. package/node_modules/@turf/line-chunk/dist/cjs/index.cjs +2 -2
  337. package/node_modules/@turf/line-chunk/dist/cjs/index.cjs.map +1 -1
  338. package/node_modules/@turf/line-chunk/dist/esm/index.js +2 -2
  339. package/node_modules/@turf/line-chunk/dist/esm/index.js.map +1 -1
  340. package/node_modules/@turf/line-chunk/package.json +12 -12
  341. package/node_modules/@turf/line-intersect/dist/cjs/index.cjs +2 -2
  342. package/node_modules/@turf/line-intersect/dist/cjs/index.cjs.map +1 -1
  343. package/node_modules/@turf/line-intersect/dist/esm/index.js +2 -2
  344. package/node_modules/@turf/line-intersect/dist/esm/index.js.map +1 -1
  345. package/node_modules/@turf/line-intersect/package.json +10 -10
  346. package/node_modules/@turf/line-offset/README.md +2 -2
  347. package/node_modules/@turf/line-offset/dist/cjs/index.cjs +2 -2
  348. package/node_modules/@turf/line-offset/dist/cjs/index.cjs.map +1 -1
  349. package/node_modules/@turf/line-offset/dist/esm/index.js +2 -2
  350. package/node_modules/@turf/line-offset/dist/esm/index.js.map +1 -1
  351. package/node_modules/@turf/line-offset/package.json +11 -11
  352. package/node_modules/@turf/line-overlap/dist/cjs/index.cjs +2 -2
  353. package/node_modules/@turf/line-overlap/dist/cjs/index.cjs.map +1 -1
  354. package/node_modules/@turf/line-overlap/dist/esm/index.js +2 -2
  355. package/node_modules/@turf/line-overlap/dist/esm/index.js.map +1 -1
  356. package/node_modules/@turf/line-overlap/package.json +15 -15
  357. package/node_modules/@turf/line-segment/dist/cjs/index.cjs +2 -2
  358. package/node_modules/@turf/line-segment/dist/cjs/index.cjs.map +1 -1
  359. package/node_modules/@turf/line-segment/dist/esm/index.js +2 -2
  360. package/node_modules/@turf/line-segment/dist/esm/index.js.map +1 -1
  361. package/node_modules/@turf/line-segment/package.json +11 -11
  362. package/node_modules/@turf/line-slice/dist/cjs/index.cjs +2 -2
  363. package/node_modules/@turf/line-slice/dist/cjs/index.cjs.map +1 -1
  364. package/node_modules/@turf/line-slice/dist/esm/index.js +2 -2
  365. package/node_modules/@turf/line-slice/dist/esm/index.js.map +1 -1
  366. package/node_modules/@turf/line-slice/package.json +11 -11
  367. package/node_modules/@turf/line-slice-along/README.md +2 -2
  368. package/node_modules/@turf/line-slice-along/dist/cjs/index.cjs +2 -2
  369. package/node_modules/@turf/line-slice-along/dist/cjs/index.cjs.map +1 -1
  370. package/node_modules/@turf/line-slice-along/dist/esm/index.js +2 -2
  371. package/node_modules/@turf/line-slice-along/dist/esm/index.js.map +1 -1
  372. package/node_modules/@turf/line-slice-along/package.json +12 -12
  373. package/node_modules/@turf/line-split/README.md +4 -1
  374. package/node_modules/@turf/line-split/dist/cjs/index.cjs +2 -7
  375. package/node_modules/@turf/line-split/dist/cjs/index.cjs.map +1 -1
  376. package/node_modules/@turf/line-split/dist/esm/index.js +2 -7
  377. package/node_modules/@turf/line-split/dist/esm/index.js.map +1 -1
  378. package/node_modules/@turf/line-split/package.json +16 -17
  379. package/node_modules/@turf/line-to-polygon/dist/cjs/index.cjs +2 -2
  380. package/node_modules/@turf/line-to-polygon/dist/cjs/index.cjs.map +1 -1
  381. package/node_modules/@turf/line-to-polygon/dist/esm/index.js +2 -2
  382. package/node_modules/@turf/line-to-polygon/dist/esm/index.js.map +1 -1
  383. package/node_modules/@turf/line-to-polygon/package.json +12 -12
  384. package/node_modules/@turf/mask/dist/cjs/index.cjs +2 -2
  385. package/node_modules/@turf/mask/dist/cjs/index.cjs.map +1 -1
  386. package/node_modules/@turf/mask/dist/esm/index.js +2 -2
  387. package/node_modules/@turf/mask/dist/esm/index.js.map +1 -1
  388. package/node_modules/@turf/mask/package.json +10 -10
  389. package/node_modules/@turf/meta/package.json +7 -7
  390. package/node_modules/@turf/midpoint/dist/cjs/index.cjs +2 -2
  391. package/node_modules/@turf/midpoint/dist/cjs/index.cjs.map +1 -1
  392. package/node_modules/@turf/midpoint/dist/esm/index.js +2 -2
  393. package/node_modules/@turf/midpoint/dist/esm/index.js.map +1 -1
  394. package/node_modules/@turf/midpoint/package.json +11 -11
  395. package/node_modules/@turf/moran-index/dist/cjs/index.cjs +2 -2
  396. package/node_modules/@turf/moran-index/dist/cjs/index.cjs.map +1 -1
  397. package/node_modules/@turf/moran-index/dist/esm/index.js +2 -2
  398. package/node_modules/@turf/moran-index/dist/esm/index.js.map +1 -1
  399. package/node_modules/@turf/moran-index/package.json +11 -11
  400. package/node_modules/@turf/nearest-neighbor-analysis/README.md +1 -1
  401. package/node_modules/@turf/nearest-neighbor-analysis/dist/cjs/index.cjs +2 -2
  402. package/node_modules/@turf/nearest-neighbor-analysis/dist/cjs/index.cjs.map +1 -1
  403. package/node_modules/@turf/nearest-neighbor-analysis/dist/cjs/index.d.cts +2 -2
  404. package/node_modules/@turf/nearest-neighbor-analysis/dist/esm/index.d.ts +2 -2
  405. package/node_modules/@turf/nearest-neighbor-analysis/dist/esm/index.js +2 -2
  406. package/node_modules/@turf/nearest-neighbor-analysis/dist/esm/index.js.map +1 -1
  407. package/node_modules/@turf/nearest-neighbor-analysis/package.json +17 -17
  408. package/node_modules/@turf/nearest-point/README.md +2 -2
  409. package/node_modules/@turf/nearest-point/dist/cjs/index.cjs +2 -2
  410. package/node_modules/@turf/nearest-point/dist/cjs/index.cjs.map +1 -1
  411. package/node_modules/@turf/nearest-point/dist/cjs/index.d.cts +6 -7
  412. package/node_modules/@turf/nearest-point/dist/esm/index.d.ts +6 -7
  413. package/node_modules/@turf/nearest-point/dist/esm/index.js +2 -2
  414. package/node_modules/@turf/nearest-point/dist/esm/index.js.map +1 -1
  415. package/node_modules/@turf/nearest-point/package.json +12 -12
  416. package/node_modules/@turf/nearest-point-on-line/README.md +6 -2
  417. package/node_modules/@turf/nearest-point-on-line/dist/cjs/index.cjs +45 -52
  418. package/node_modules/@turf/nearest-point-on-line/dist/cjs/index.cjs.map +1 -1
  419. package/node_modules/@turf/nearest-point-on-line/dist/cjs/index.d.cts +5 -1
  420. package/node_modules/@turf/nearest-point-on-line/dist/esm/index.d.ts +5 -1
  421. package/node_modules/@turf/nearest-point-on-line/dist/esm/index.js +45 -52
  422. package/node_modules/@turf/nearest-point-on-line/dist/esm/index.js.map +1 -1
  423. package/node_modules/@turf/nearest-point-on-line/package.json +20 -15
  424. package/node_modules/@turf/nearest-point-to-line/README.md +2 -2
  425. package/node_modules/@turf/nearest-point-to-line/dist/cjs/index.cjs +2 -2
  426. package/node_modules/@turf/nearest-point-to-line/dist/cjs/index.cjs.map +1 -1
  427. package/node_modules/@turf/nearest-point-to-line/dist/cjs/index.d.cts +1 -1
  428. package/node_modules/@turf/nearest-point-to-line/dist/esm/index.d.ts +1 -1
  429. package/node_modules/@turf/nearest-point-to-line/dist/esm/index.js +2 -2
  430. package/node_modules/@turf/nearest-point-to-line/dist/esm/index.js.map +1 -1
  431. package/node_modules/@turf/nearest-point-to-line/package.json +14 -14
  432. package/node_modules/@turf/planepoint/dist/cjs/index.cjs +2 -2
  433. package/node_modules/@turf/planepoint/dist/cjs/index.cjs.map +1 -1
  434. package/node_modules/@turf/planepoint/dist/esm/index.js +2 -2
  435. package/node_modules/@turf/planepoint/dist/esm/index.js.map +1 -1
  436. package/node_modules/@turf/planepoint/package.json +9 -9
  437. package/node_modules/@turf/point-grid/dist/cjs/index.cjs +2 -2
  438. package/node_modules/@turf/point-grid/dist/cjs/index.cjs.map +1 -1
  439. package/node_modules/@turf/point-grid/dist/esm/index.js +2 -2
  440. package/node_modules/@turf/point-grid/dist/esm/index.js.map +1 -1
  441. package/node_modules/@turf/point-grid/package.json +14 -14
  442. package/node_modules/@turf/point-on-feature/dist/cjs/index.cjs +2 -2
  443. package/node_modules/@turf/point-on-feature/dist/cjs/index.cjs.map +1 -1
  444. package/node_modules/@turf/point-on-feature/dist/esm/index.js +2 -2
  445. package/node_modules/@turf/point-on-feature/dist/esm/index.js.map +1 -1
  446. package/node_modules/@turf/point-on-feature/package.json +15 -15
  447. package/node_modules/@turf/point-to-line-distance/README.md +5 -4
  448. package/node_modules/@turf/point-to-line-distance/dist/cjs/index.cjs +2 -2
  449. package/node_modules/@turf/point-to-line-distance/dist/cjs/index.cjs.map +1 -1
  450. package/node_modules/@turf/point-to-line-distance/dist/cjs/index.d.cts +1 -2
  451. package/node_modules/@turf/point-to-line-distance/dist/esm/index.d.ts +1 -2
  452. package/node_modules/@turf/point-to-line-distance/dist/esm/index.js +2 -2
  453. package/node_modules/@turf/point-to-line-distance/dist/esm/index.js.map +1 -1
  454. package/node_modules/@turf/point-to-line-distance/package.json +18 -18
  455. package/node_modules/@turf/point-to-polygon-distance/dist/cjs/index.cjs +3 -3
  456. package/node_modules/@turf/point-to-polygon-distance/dist/cjs/index.cjs.map +1 -1
  457. package/node_modules/@turf/point-to-polygon-distance/dist/esm/index.js +3 -3
  458. package/node_modules/@turf/point-to-polygon-distance/dist/esm/index.js.map +1 -1
  459. package/node_modules/@turf/point-to-polygon-distance/package.json +14 -14
  460. package/node_modules/@turf/points-within-polygon/dist/cjs/index.cjs +2 -2
  461. package/node_modules/@turf/points-within-polygon/dist/cjs/index.cjs.map +1 -1
  462. package/node_modules/@turf/points-within-polygon/dist/esm/index.js +2 -2
  463. package/node_modules/@turf/points-within-polygon/dist/esm/index.js.map +1 -1
  464. package/node_modules/@turf/points-within-polygon/package.json +10 -10
  465. package/node_modules/@turf/polygon-smooth/README.md +1 -1
  466. package/node_modules/@turf/polygon-smooth/dist/cjs/index.cjs +2 -2
  467. package/node_modules/@turf/polygon-smooth/dist/cjs/index.cjs.map +1 -1
  468. package/node_modules/@turf/polygon-smooth/dist/cjs/index.d.cts +1 -1
  469. package/node_modules/@turf/polygon-smooth/dist/esm/index.d.ts +1 -1
  470. package/node_modules/@turf/polygon-smooth/dist/esm/index.js +2 -2
  471. package/node_modules/@turf/polygon-smooth/dist/esm/index.js.map +1 -1
  472. package/node_modules/@turf/polygon-smooth/package.json +11 -11
  473. package/node_modules/@turf/polygon-tangents/dist/cjs/index.cjs +2 -2
  474. package/node_modules/@turf/polygon-tangents/dist/cjs/index.cjs.map +1 -1
  475. package/node_modules/@turf/polygon-tangents/dist/esm/index.js +2 -2
  476. package/node_modules/@turf/polygon-tangents/dist/esm/index.js.map +1 -1
  477. package/node_modules/@turf/polygon-tangents/package.json +14 -14
  478. package/node_modules/@turf/polygon-to-line/dist/cjs/index.cjs +2 -2
  479. package/node_modules/@turf/polygon-to-line/dist/cjs/index.cjs.map +1 -1
  480. package/node_modules/@turf/polygon-to-line/dist/esm/index.js +2 -2
  481. package/node_modules/@turf/polygon-to-line/dist/esm/index.js.map +1 -1
  482. package/node_modules/@turf/polygon-to-line/package.json +10 -10
  483. package/node_modules/@turf/polygonize/dist/cjs/index.cjs +2 -2
  484. package/node_modules/@turf/polygonize/dist/cjs/index.cjs.map +1 -1
  485. package/node_modules/@turf/polygonize/dist/esm/index.js +2 -2
  486. package/node_modules/@turf/polygonize/dist/esm/index.js.map +1 -1
  487. package/node_modules/@turf/polygonize/package.json +13 -13
  488. package/node_modules/@turf/projection/package.json +12 -12
  489. package/node_modules/@turf/quadrat-analysis/dist/cjs/index.cjs +2 -2
  490. package/node_modules/@turf/quadrat-analysis/dist/cjs/index.cjs.map +1 -1
  491. package/node_modules/@turf/quadrat-analysis/dist/esm/index.js +2 -2
  492. package/node_modules/@turf/quadrat-analysis/dist/esm/index.js.map +1 -1
  493. package/node_modules/@turf/quadrat-analysis/package.json +18 -18
  494. package/node_modules/@turf/random/package.json +9 -9
  495. package/node_modules/@turf/rectangle-grid/dist/cjs/index.cjs +2 -2
  496. package/node_modules/@turf/rectangle-grid/dist/cjs/index.cjs.map +1 -1
  497. package/node_modules/@turf/rectangle-grid/dist/esm/index.js +2 -2
  498. package/node_modules/@turf/rectangle-grid/dist/esm/index.js.map +1 -1
  499. package/node_modules/@turf/rectangle-grid/package.json +13 -13
  500. package/node_modules/@turf/rewind/dist/cjs/index.cjs +2 -2
  501. package/node_modules/@turf/rewind/dist/cjs/index.cjs.map +1 -1
  502. package/node_modules/@turf/rewind/dist/esm/index.js +2 -2
  503. package/node_modules/@turf/rewind/dist/esm/index.js.map +1 -1
  504. package/node_modules/@turf/rewind/package.json +13 -13
  505. package/node_modules/@turf/rhumb-bearing/dist/cjs/index.cjs +2 -2
  506. package/node_modules/@turf/rhumb-bearing/dist/cjs/index.cjs.map +1 -1
  507. package/node_modules/@turf/rhumb-bearing/dist/esm/index.js +2 -2
  508. package/node_modules/@turf/rhumb-bearing/dist/esm/index.js.map +1 -1
  509. package/node_modules/@turf/rhumb-bearing/package.json +11 -11
  510. package/node_modules/@turf/rhumb-destination/README.md +2 -2
  511. package/node_modules/@turf/rhumb-destination/dist/cjs/index.cjs +2 -2
  512. package/node_modules/@turf/rhumb-destination/dist/cjs/index.cjs.map +1 -1
  513. package/node_modules/@turf/rhumb-destination/dist/cjs/index.d.cts +1 -1
  514. package/node_modules/@turf/rhumb-destination/dist/esm/index.d.ts +1 -1
  515. package/node_modules/@turf/rhumb-destination/dist/esm/index.js +2 -2
  516. package/node_modules/@turf/rhumb-destination/dist/esm/index.js.map +1 -1
  517. package/node_modules/@turf/rhumb-destination/package.json +11 -11
  518. package/node_modules/@turf/rhumb-distance/README.md +8 -9
  519. package/node_modules/@turf/rhumb-distance/dist/cjs/index.cjs +2 -2
  520. package/node_modules/@turf/rhumb-distance/dist/cjs/index.cjs.map +1 -1
  521. package/node_modules/@turf/rhumb-distance/dist/cjs/index.d.cts +2 -3
  522. package/node_modules/@turf/rhumb-distance/dist/esm/index.d.ts +2 -3
  523. package/node_modules/@turf/rhumb-distance/dist/esm/index.js +2 -2
  524. package/node_modules/@turf/rhumb-distance/dist/esm/index.js.map +1 -1
  525. package/node_modules/@turf/rhumb-distance/package.json +11 -11
  526. package/node_modules/@turf/sample/dist/cjs/index.cjs +2 -2
  527. package/node_modules/@turf/sample/dist/cjs/index.cjs.map +1 -1
  528. package/node_modules/@turf/sample/dist/esm/index.js +2 -2
  529. package/node_modules/@turf/sample/dist/esm/index.js.map +1 -1
  530. package/node_modules/@turf/sample/package.json +8 -8
  531. package/node_modules/@turf/sector/README.md +2 -2
  532. package/node_modules/@turf/sector/dist/cjs/index.cjs +2 -2
  533. package/node_modules/@turf/sector/dist/cjs/index.cjs.map +1 -1
  534. package/node_modules/@turf/sector/dist/cjs/index.d.cts +1 -1
  535. package/node_modules/@turf/sector/dist/esm/index.d.ts +1 -1
  536. package/node_modules/@turf/sector/dist/esm/index.js +2 -2
  537. package/node_modules/@turf/sector/dist/esm/index.js.map +1 -1
  538. package/node_modules/@turf/sector/package.json +14 -14
  539. package/node_modules/@turf/shortest-path/README.md +5 -3
  540. package/node_modules/@turf/shortest-path/dist/cjs/index.cjs +10 -14
  541. package/node_modules/@turf/shortest-path/dist/cjs/index.cjs.map +1 -1
  542. package/node_modules/@turf/shortest-path/dist/cjs/index.d.cts +1 -1
  543. package/node_modules/@turf/shortest-path/dist/esm/index.d.ts +1 -1
  544. package/node_modules/@turf/shortest-path/dist/esm/index.js +10 -14
  545. package/node_modules/@turf/shortest-path/dist/esm/index.js.map +1 -1
  546. package/node_modules/@turf/shortest-path/package.json +20 -19
  547. package/node_modules/@turf/simplify/README.md +13 -13
  548. package/node_modules/@turf/simplify/dist/cjs/index.cjs +6 -3
  549. package/node_modules/@turf/simplify/dist/cjs/index.cjs.map +1 -1
  550. package/node_modules/@turf/simplify/dist/cjs/index.d.cts +11 -12
  551. package/node_modules/@turf/simplify/dist/esm/index.d.ts +11 -12
  552. package/node_modules/@turf/simplify/dist/esm/index.js +6 -3
  553. package/node_modules/@turf/simplify/dist/esm/index.js.map +1 -1
  554. package/node_modules/@turf/simplify/package.json +13 -13
  555. package/node_modules/@turf/square/dist/cjs/index.cjs +2 -2
  556. package/node_modules/@turf/square/dist/cjs/index.cjs.map +1 -1
  557. package/node_modules/@turf/square/dist/esm/index.js +2 -2
  558. package/node_modules/@turf/square/dist/esm/index.js.map +1 -1
  559. package/node_modules/@turf/square/package.json +9 -9
  560. package/node_modules/@turf/square-grid/dist/cjs/index.cjs +2 -2
  561. package/node_modules/@turf/square-grid/dist/cjs/index.cjs.map +1 -1
  562. package/node_modules/@turf/square-grid/dist/esm/index.js +2 -2
  563. package/node_modules/@turf/square-grid/dist/esm/index.js.map +1 -1
  564. package/node_modules/@turf/square-grid/package.json +12 -12
  565. package/node_modules/@turf/standard-deviational-ellipse/dist/cjs/index.cjs +2 -2
  566. package/node_modules/@turf/standard-deviational-ellipse/dist/cjs/index.cjs.map +1 -1
  567. package/node_modules/@turf/standard-deviational-ellipse/dist/cjs/index.d.cts +1 -1
  568. package/node_modules/@turf/standard-deviational-ellipse/dist/esm/index.d.ts +1 -1
  569. package/node_modules/@turf/standard-deviational-ellipse/dist/esm/index.js +2 -2
  570. package/node_modules/@turf/standard-deviational-ellipse/dist/esm/index.js.map +1 -1
  571. package/node_modules/@turf/standard-deviational-ellipse/package.json +16 -16
  572. package/node_modules/@turf/tag/dist/cjs/index.cjs +2 -2
  573. package/node_modules/@turf/tag/dist/cjs/index.cjs.map +1 -1
  574. package/node_modules/@turf/tag/dist/esm/index.js +2 -2
  575. package/node_modules/@turf/tag/dist/esm/index.js.map +1 -1
  576. package/node_modules/@turf/tag/package.json +11 -11
  577. package/node_modules/@turf/tesselate/dist/cjs/index.cjs +2 -2
  578. package/node_modules/@turf/tesselate/dist/cjs/index.cjs.map +1 -1
  579. package/node_modules/@turf/tesselate/dist/esm/index.js +2 -2
  580. package/node_modules/@turf/tesselate/dist/esm/index.js.map +1 -1
  581. package/node_modules/@turf/tesselate/package.json +8 -8
  582. package/node_modules/@turf/tin/dist/cjs/index.cjs +2 -2
  583. package/node_modules/@turf/tin/dist/cjs/index.cjs.map +1 -1
  584. package/node_modules/@turf/tin/dist/esm/index.js +2 -2
  585. package/node_modules/@turf/tin/dist/esm/index.js.map +1 -1
  586. package/node_modules/@turf/tin/package.json +8 -8
  587. package/node_modules/@turf/transform-rotate/dist/cjs/index.cjs +2 -2
  588. package/node_modules/@turf/transform-rotate/dist/cjs/index.cjs.map +1 -1
  589. package/node_modules/@turf/transform-rotate/dist/esm/index.js +2 -2
  590. package/node_modules/@turf/transform-rotate/dist/esm/index.js.map +1 -1
  591. package/node_modules/@turf/transform-rotate/package.json +17 -17
  592. package/node_modules/@turf/transform-scale/dist/cjs/index.cjs +2 -2
  593. package/node_modules/@turf/transform-scale/dist/cjs/index.cjs.map +1 -1
  594. package/node_modules/@turf/transform-scale/dist/esm/index.js +2 -2
  595. package/node_modules/@turf/transform-scale/dist/esm/index.js.map +1 -1
  596. package/node_modules/@turf/transform-scale/package.json +21 -21
  597. package/node_modules/@turf/transform-translate/README.md +8 -3
  598. package/node_modules/@turf/transform-translate/dist/cjs/index.cjs +2 -2
  599. package/node_modules/@turf/transform-translate/dist/cjs/index.cjs.map +1 -1
  600. package/node_modules/@turf/transform-translate/dist/cjs/index.d.cts +4 -1
  601. package/node_modules/@turf/transform-translate/dist/esm/index.d.ts +4 -1
  602. package/node_modules/@turf/transform-translate/dist/esm/index.js +2 -2
  603. package/node_modules/@turf/transform-translate/dist/esm/index.js.map +1 -1
  604. package/node_modules/@turf/transform-translate/package.json +14 -14
  605. package/node_modules/@turf/triangle-grid/dist/cjs/index.cjs +2 -2
  606. package/node_modules/@turf/triangle-grid/dist/cjs/index.cjs.map +1 -1
  607. package/node_modules/@turf/triangle-grid/dist/esm/index.js +2 -2
  608. package/node_modules/@turf/triangle-grid/dist/esm/index.js.map +1 -1
  609. package/node_modules/@turf/triangle-grid/package.json +13 -13
  610. package/node_modules/@turf/truncate/dist/cjs/index.cjs +2 -2
  611. package/node_modules/@turf/truncate/dist/cjs/index.cjs.map +1 -1
  612. package/node_modules/@turf/truncate/dist/esm/index.js +2 -2
  613. package/node_modules/@turf/truncate/dist/esm/index.js.map +1 -1
  614. package/node_modules/@turf/truncate/package.json +10 -10
  615. package/node_modules/@turf/turf/package.json +125 -125
  616. package/node_modules/@turf/turf/turf.min.js +2 -11
  617. package/node_modules/@turf/union/dist/cjs/index.cjs +2 -2
  618. package/node_modules/@turf/union/dist/cjs/index.cjs.map +1 -1
  619. package/node_modules/@turf/union/dist/esm/index.js +2 -2
  620. package/node_modules/@turf/union/dist/esm/index.js.map +1 -1
  621. package/node_modules/@turf/union/package.json +11 -11
  622. package/node_modules/@turf/unkink-polygon/dist/cjs/index.cjs +2 -2
  623. package/node_modules/@turf/unkink-polygon/dist/cjs/index.cjs.map +1 -1
  624. package/node_modules/@turf/unkink-polygon/dist/esm/index.js +2 -2
  625. package/node_modules/@turf/unkink-polygon/dist/esm/index.js.map +1 -1
  626. package/node_modules/@turf/unkink-polygon/package.json +13 -13
  627. package/node_modules/@turf/voronoi/dist/cjs/index.cjs +2 -2
  628. package/node_modules/@turf/voronoi/dist/cjs/index.cjs.map +1 -1
  629. package/node_modules/@turf/voronoi/dist/esm/index.js +2 -2
  630. package/node_modules/@turf/voronoi/dist/esm/index.js.map +1 -1
  631. package/node_modules/@turf/voronoi/package.json +12 -12
  632. package/node_modules/@types/node/README.md +1 -1
  633. package/node_modules/@types/node/assert/strict.d.ts +105 -2
  634. package/node_modules/@types/node/assert.d.ts +154 -95
  635. package/node_modules/@types/node/buffer.buffer.d.ts +9 -0
  636. package/node_modules/@types/node/buffer.d.ts +8 -4
  637. package/node_modules/@types/node/child_process.d.ts +65 -42
  638. package/node_modules/@types/node/cluster.d.ts +4 -5
  639. package/node_modules/@types/node/console.d.ts +3 -2
  640. package/node_modules/@types/node/crypto.d.ts +1173 -322
  641. package/node_modules/@types/node/dgram.d.ts +9 -8
  642. package/node_modules/@types/node/diagnostics_channel.d.ts +0 -2
  643. package/node_modules/@types/node/dns.d.ts +6 -1
  644. package/node_modules/@types/node/events.d.ts +80 -34
  645. package/node_modules/@types/node/fs/promises.d.ts +39 -21
  646. package/node_modules/@types/node/fs.d.ts +328 -87
  647. package/node_modules/@types/node/globals.d.ts +2 -0
  648. package/node_modules/@types/node/globals.typedarray.d.ts +19 -0
  649. package/node_modules/@types/node/http.d.ts +119 -31
  650. package/node_modules/@types/node/http2.d.ts +178 -52
  651. package/node_modules/@types/node/https.d.ts +96 -62
  652. package/node_modules/@types/node/index.d.ts +3 -1
  653. package/node_modules/@types/node/inspector.d.ts +205 -4139
  654. package/node_modules/@types/node/inspector.generated.d.ts +4233 -0
  655. package/node_modules/@types/node/net.d.ts +33 -11
  656. package/node_modules/@types/node/os.d.ts +14 -3
  657. package/node_modules/@types/node/package.json +3 -3
  658. package/node_modules/@types/node/perf_hooks.d.ts +6 -8
  659. package/node_modules/@types/node/process.d.ts +19 -23
  660. package/node_modules/@types/node/readline/promises.d.ts +1 -1
  661. package/node_modules/@types/node/sea.d.ts +9 -0
  662. package/node_modules/@types/node/sqlite.d.ts +233 -10
  663. package/node_modules/@types/node/stream/consumers.d.ts +2 -2
  664. package/node_modules/@types/node/stream/web.d.ts +6 -55
  665. package/node_modules/@types/node/stream.d.ts +38 -23
  666. package/node_modules/@types/node/string_decoder.d.ts +2 -2
  667. package/node_modules/@types/node/test.d.ts +31 -26
  668. package/node_modules/@types/node/tls.d.ts +122 -66
  669. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +10 -2
  670. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +16 -0
  671. package/node_modules/@types/node/ts5.6/index.d.ts +3 -1
  672. package/node_modules/@types/node/ts5.7/index.d.ts +3 -1
  673. package/node_modules/@types/node/url.d.ts +48 -16
  674. package/node_modules/@types/node/util.d.ts +23 -7
  675. package/node_modules/@types/node/v8.d.ts +38 -5
  676. package/node_modules/@types/node/vm.d.ts +169 -88
  677. package/node_modules/@types/node/wasi.d.ts +1 -1
  678. package/node_modules/@types/node/web-globals/crypto.d.ts +32 -0
  679. package/node_modules/@types/node/web-globals/events.d.ts +3 -0
  680. package/node_modules/@types/node/web-globals/navigator.d.ts +3 -0
  681. package/node_modules/@types/node/web-globals/streams.d.ts +22 -0
  682. package/node_modules/@types/node/worker_threads.d.ts +142 -51
  683. package/node_modules/@types/node/zlib.d.ts +31 -24
  684. package/node_modules/axios/CHANGELOG.md +410 -346
  685. package/node_modules/axios/README.md +79 -51
  686. package/node_modules/axios/dist/axios.js +121 -46
  687. package/node_modules/axios/dist/axios.js.map +1 -1
  688. package/node_modules/axios/dist/axios.min.js +2 -2
  689. package/node_modules/axios/dist/axios.min.js.map +1 -1
  690. package/node_modules/axios/dist/browser/axios.cjs +126 -57
  691. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  692. package/node_modules/axios/dist/esm/axios.js +126 -57
  693. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  694. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  695. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  696. package/node_modules/axios/dist/node/axios.cjs +351 -97
  697. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  698. package/node_modules/axios/index.d.cts +4 -0
  699. package/node_modules/axios/index.d.ts +4 -0
  700. package/node_modules/axios/lib/adapters/adapters.js +85 -40
  701. package/node_modules/axios/lib/adapters/fetch.js +1 -1
  702. package/node_modules/axios/lib/adapters/http.js +224 -42
  703. package/node_modules/axios/lib/core/InterceptorManager.js +1 -1
  704. package/node_modules/axios/lib/core/mergeConfig.js +4 -4
  705. package/node_modules/axios/lib/env/data.js +1 -1
  706. package/node_modules/axios/lib/helpers/HttpStatusCode.js +6 -0
  707. package/node_modules/axios/lib/helpers/bind.js +7 -0
  708. package/node_modules/axios/lib/helpers/cookies.js +24 -13
  709. package/node_modules/axios/package.json +9 -4
  710. package/node_modules/fast-xml-parser/CHANGELOG.md +9 -0
  711. package/node_modules/fast-xml-parser/README.md +1 -1
  712. package/node_modules/fast-xml-parser/lib/fxp.cjs +1 -1
  713. package/node_modules/fast-xml-parser/lib/fxp.d.cts +1 -1
  714. package/node_modules/fast-xml-parser/lib/fxp.min.js +1 -1
  715. package/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -1
  716. package/node_modules/fast-xml-parser/lib/fxparser.min.js +1 -1
  717. package/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -1
  718. package/node_modules/fast-xml-parser/package.json +1 -1
  719. package/node_modules/fast-xml-parser/src/fxp.d.ts +2 -2
  720. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsMinArrBuilder.js +1 -1
  721. package/node_modules/fast-xml-parser/src/v6/OutputBuilders/ParserOptionsBuilder.js +4 -4
  722. package/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +297 -287
  723. package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +24 -12
  724. package/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +4 -4
  725. package/node_modules/form-data/CHANGELOG.md +60 -2
  726. package/node_modules/form-data/README.md +4 -4
  727. package/node_modules/form-data/lib/form_data.js +2 -2
  728. package/node_modules/form-data/package.json +4 -4
  729. package/node_modules/undici-types/agent.d.ts +1 -4
  730. package/node_modules/undici-types/client.d.ts +0 -2
  731. package/node_modules/undici-types/diagnostics-channel.d.ts +0 -1
  732. package/node_modules/undici-types/dispatcher.d.ts +0 -6
  733. package/node_modules/undici-types/errors.d.ts +5 -15
  734. package/node_modules/undici-types/eventsource.d.ts +6 -1
  735. package/node_modules/undici-types/h2c-client.d.ts +0 -2
  736. package/node_modules/undici-types/index.d.ts +6 -1
  737. package/node_modules/undici-types/interceptors.d.ts +5 -0
  738. package/node_modules/undici-types/mock-interceptor.d.ts +0 -1
  739. package/node_modules/undici-types/package.json +1 -1
  740. package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
  741. package/node_modules/undici-types/webidl.d.ts +92 -21
  742. package/node_modules/undici-types/websocket.d.ts +2 -0
  743. package/package.json +5 -5
  744. package/tak-registration.js +11 -11
  745. package/node_modules/marchingsquares/.eslintrc.json +0 -81
  746. package/node_modules/marchingsquares/Changelog.md +0 -81
  747. package/node_modules/marchingsquares/LICENSE.md +0 -37
  748. package/node_modules/marchingsquares/README.md +0 -312
  749. package/node_modules/marchingsquares/VERSION +0 -1
  750. package/node_modules/marchingsquares/agpl-3.0.txt +0 -661
  751. package/node_modules/marchingsquares/dist/marchingsquares-esm.js +0 -3410
  752. package/node_modules/marchingsquares/dist/marchingsquares-isobands.js +0 -2513
  753. package/node_modules/marchingsquares/dist/marchingsquares-isobands.min.js +0 -9
  754. package/node_modules/marchingsquares/dist/marchingsquares-isocontours.js +0 -1209
  755. package/node_modules/marchingsquares/dist/marchingsquares-isocontours.min.js +0 -9
  756. package/node_modules/marchingsquares/dist/marchingsquares-isolines.js +0 -1209
  757. package/node_modules/marchingsquares/dist/marchingsquares-isolines.min.js +0 -9
  758. package/node_modules/marchingsquares/dist/marchingsquares.js +0 -3424
  759. package/node_modules/marchingsquares/dist/marchingsquares.min.js +0 -9
  760. package/node_modules/marchingsquares/examples/contour/index.html +0 -117
  761. package/node_modules/marchingsquares/examples/editor/draw-lines.js +0 -60
  762. package/node_modules/marchingsquares/examples/editor/index.html +0 -39
  763. package/node_modules/marchingsquares/examples/editor/script.js +0 -110
  764. package/node_modules/marchingsquares/examples/editor/styles.css +0 -37
  765. package/node_modules/marchingsquares/examples/require/app.js +0 -9
  766. package/node_modules/marchingsquares/examples/require/index.html +0 -14
  767. package/node_modules/marchingsquares/examples/require/main.js +0 -98
  768. package/node_modules/marchingsquares/examples/require/require.js +0 -5
  769. package/node_modules/marchingsquares/examples/simple/index.html +0 -115
  770. package/node_modules/marchingsquares/examples/vienna/index.html +0 -229
  771. package/node_modules/marchingsquares/examples/vienna/vienna_basin.png +0 -0
  772. package/node_modules/marchingsquares/examples/vienna/vienna_data.js +0 -514
  773. package/node_modules/marchingsquares/package.json +0 -47
  774. package/node_modules/marchingsquares/rollup.config.js +0 -122
  775. package/node_modules/marchingsquares/rollup.config.test.js +0 -14
  776. package/node_modules/marchingsquares/src/interpolation.js +0 -84
  777. package/node_modules/marchingsquares/src/isobands.js +0 -1883
  778. package/node_modules/marchingsquares/src/isolines.js +0 -638
  779. package/node_modules/marchingsquares/src/main.js +0 -4
  780. package/node_modules/marchingsquares/src/options.js +0 -80
  781. package/node_modules/marchingsquares/src/polygons.js +0 -531
  782. package/node_modules/marchingsquares/src/quadtree.js +0 -228
  783. package/node_modules/marchingsquares/test/data/in/isoBands-example-case.json +0 -14
  784. package/node_modules/marchingsquares/test/data/in/isoBands-issue#6-0_3.json +0 -12
  785. package/node_modules/marchingsquares/test/data/in/isoBands-issue#6-3_5.json +0 -12
  786. package/node_modules/marchingsquares/test/data/in/isoBands-issue#6-5_7.json +0 -12
  787. package/node_modules/marchingsquares/test/data/in/isoBands-minimal.json +0 -8
  788. package/node_modules/marchingsquares/test/data/in/isoBands-simple.json +0 -9
  789. package/node_modules/marchingsquares/test/data/in/isoLines-example-case.json +0 -13
  790. package/node_modules/marchingsquares/test/data/in/isoLines-simple.json +0 -8
  791. package/node_modules/marchingsquares/test/data/out/isoBands-example-case.json +0 -72
  792. package/node_modules/marchingsquares/test/data/out/isoBands-issue#6-0_3.json +0 -9
  793. package/node_modules/marchingsquares/test/data/out/isoBands-issue#6-3_5.json +0 -36
  794. package/node_modules/marchingsquares/test/data/out/isoBands-issue#6-5_7.json +0 -8
  795. package/node_modules/marchingsquares/test/data/out/isoBands-minimal.json +0 -10
  796. package/node_modules/marchingsquares/test/data/out/isoBands-simple.json +0 -25
  797. package/node_modules/marchingsquares/test/data/out/isoLines-example-case.json +0 -481
  798. package/node_modules/marchingsquares/test/data/out/isoLines-simple.json +0 -8
  799. package/node_modules/marchingsquares/test/test.js +0 -152
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts","../../lib/util.ts","../../lib/Node.ts","../../lib/Edge.ts","../../lib/EdgeRing.ts","../../lib/Graph.ts"],"sourcesContent":["import {\n Feature,\n FeatureCollection,\n LineString,\n MultiLineString,\n Polygon,\n} from \"geojson\";\nimport { featureCollection } from \"@turf/helpers\";\nimport { Graph } from \"./lib/Graph.js\";\nimport { EdgeRing } from \"./lib/EdgeRing.js\";\n\n/**\n * Polygonizes {@link LineString|(Multi)LineString(s)} into {@link Polygons}.\n *\n * Implementation of GEOSPolygonize function (`geos::operation::polygonize::Polygonizer`).\n *\n * Polygonizes a set of lines that represents edges in a planar graph. Edges must be correctly\n * noded, i.e., they must only meet at their endpoints.\n *\n * The implementation correctly handles:\n *\n * - Dangles: edges which have one or both ends which are not incident on another edge endpoint.\n * - Cut Edges (bridges): edges that are connected at both ends but which do not form part of a polygon.\n *\n * @function\n * @param {FeatureCollection|Geometry|Feature<LineString|MultiLineString>} geoJson Lines in order to polygonize\n * @returns {FeatureCollection<Polygon>} Polygons created\n * @throws {Error} if geoJson is invalid.\n */\nfunction polygonize<T extends LineString | MultiLineString>(\n geoJson: Feature<T> | FeatureCollection<T> | T\n): FeatureCollection<Polygon> {\n const graph = Graph.fromGeoJson(geoJson);\n\n // 1. Remove dangle node\n graph.deleteDangles();\n\n // 2. Remove cut-edges (bridge edges)\n graph.deleteCutEdges();\n\n // 3. Get all holes and shells\n const holes: EdgeRing[] = [],\n shells: EdgeRing[] = [];\n\n graph\n .getEdgeRings()\n .filter((edgeRing) => edgeRing.isValid())\n .forEach((edgeRing) => {\n if (edgeRing.isHole()) holes.push(edgeRing);\n else shells.push(edgeRing);\n });\n\n // 4. Assign Holes to Shells\n holes.forEach((hole) => {\n if (EdgeRing.findEdgeRingContaining(hole, shells)) shells.push(hole);\n });\n\n // 5. EdgeRings to Polygons\n return featureCollection(shells.map((shell) => shell.toPolygon()));\n}\n\nexport { polygonize };\nexport default polygonize;\n","import { Feature, Polygon } from \"geojson\";\nimport { booleanPointInPolygon } from \"@turf/boolean-point-in-polygon\";\nimport { point } from \"@turf/helpers\";\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign#Polyfill\nfunction mathSign(x: number) {\n return ((x > 0) as unknown as number) - ((x < 0) as unknown as number) || +x;\n}\n\n/**\n * Returns the direction of the point q relative to the vector p1 -> p2.\n *\n * Implementation of geos::algorithm::CGAlgorithm::orientationIndex()\n * (same as geos::algorithm::CGAlgorithm::computeOrientation())\n *\n * @param {number[]} p1 - the origin point of the vector\n * @param {number[]} p2 - the final point of the vector\n * @param {number[]} q - the point to compute the direction to\n *\n * @returns {number} - 1 if q is ccw (left) from p1->p2,\n * -1 if q is cw (right) from p1->p2,\n * 0 if q is colinear with p1->p2\n */\nexport function orientationIndex(p1: number[], p2: number[], q: number[]) {\n const dx1 = p2[0] - p1[0],\n dy1 = p2[1] - p1[1],\n dx2 = q[0] - p2[0],\n dy2 = q[1] - p2[1];\n\n return mathSign(dx1 * dy2 - dx2 * dy1);\n}\n\n/**\n * Checks if two envelopes are equal.\n *\n * The function assumes that the arguments are envelopes, i.e.: Rectangular polygon\n *\n * @param {Feature<Polygon>} env1 - Envelope\n * @param {Feature<Polygon>} env2 - Envelope\n * @returns {boolean} - True if the envelopes are equal\n */\nexport function envelopeIsEqual(\n env1: Feature<Polygon>,\n env2: Feature<Polygon>\n) {\n const envX1 = env1.geometry.coordinates[0].map((c) => c[0]),\n envY1 = env1.geometry.coordinates[0].map((c) => c[1]),\n envX2 = env2.geometry.coordinates[0].map((c) => c[0]),\n envY2 = env2.geometry.coordinates[0].map((c) => c[1]);\n\n return (\n Math.max.apply(null, envX1) === Math.max.apply(null, envX2) &&\n Math.max.apply(null, envY1) === Math.max.apply(null, envY2) &&\n Math.min.apply(null, envX1) === Math.min.apply(null, envX2) &&\n Math.min.apply(null, envY1) === Math.min.apply(null, envY2)\n );\n}\n\n/**\n * Check if a envelope is contained in other one.\n *\n * The function assumes that the arguments are envelopes, i.e.: Convex polygon\n * XXX: Envelopes are rectangular, checking if a point is inside a rectangule is something easy,\n * this could be further improved.\n *\n * @param {Feature<Polygon>} self - Envelope\n * @param {Feature<Polygon>} env - Envelope\n * @returns {boolean} - True if env is contained in self\n */\nexport function envelopeContains(\n self: Feature<Polygon>,\n env: Feature<Polygon>\n) {\n return env.geometry.coordinates[0].every((c) =>\n booleanPointInPolygon(point(c), self)\n );\n}\n\n/**\n * Checks if two coordinates are equal.\n *\n * @param {number[]} coord1 - First coordinate\n * @param {number[]} coord2 - Second coordinate\n * @returns {boolean} - True if coordinates are equal\n */\nexport function coordinatesEqual(coord1: number[], coord2: number[]) {\n return coord1[0] === coord2[0] && coord1[1] === coord2[1];\n}\n","import { orientationIndex } from \"./util.js\";\nimport { Edge } from \"./Edge.js\";\n\n/**\n * Node\n */\nclass Node {\n static buildId(coordinates: number[]) {\n return coordinates.join(\",\");\n }\n\n public id: string;\n public coordinates: number[];\n public innerEdges: Edge[];\n private outerEdges: Edge[];\n private outerEdgesSorted: boolean;\n\n constructor(coordinates: number[]) {\n this.id = Node.buildId(coordinates);\n this.coordinates = coordinates; //< {Number[]}\n this.innerEdges = []; //< {Edge[]}\n\n // We wil store to (out) edges in an CCW order as geos::planargraph::DirectedEdgeStar does\n this.outerEdges = []; //< {Edge[]}\n this.outerEdgesSorted = false; //< {Boolean} flag that stores if the outer Edges had been sorted\n }\n\n removeInnerEdge(edge: Edge) {\n this.innerEdges = this.innerEdges.filter((e) => e.from.id !== edge.from.id);\n }\n\n removeOuterEdge(edge: Edge) {\n this.outerEdges = this.outerEdges.filter((e) => e.to.id !== edge.to.id);\n }\n\n /**\n * Outer edges are stored CCW order.\n *\n * @memberof Node\n * @param {Edge} edge - Edge to add as an outerEdge.\n */\n addOuterEdge(edge: Edge) {\n this.outerEdges.push(edge);\n this.outerEdgesSorted = false;\n }\n\n /**\n * Sorts outer edges in CCW way.\n *\n * @memberof Node\n * @private\n */\n sortOuterEdges() {\n if (!this.outerEdgesSorted) {\n //this.outerEdges.sort((a, b) => a.compareTo(b));\n // Using this comparator in order to be deterministic\n this.outerEdges.sort((a, b) => {\n const aNode = a.to,\n bNode = b.to;\n\n if (\n aNode.coordinates[0] - this.coordinates[0] >= 0 &&\n bNode.coordinates[0] - this.coordinates[0] < 0\n )\n return 1;\n if (\n aNode.coordinates[0] - this.coordinates[0] < 0 &&\n bNode.coordinates[0] - this.coordinates[0] >= 0\n )\n return -1;\n\n if (\n aNode.coordinates[0] - this.coordinates[0] === 0 &&\n bNode.coordinates[0] - this.coordinates[0] === 0\n ) {\n if (\n aNode.coordinates[1] - this.coordinates[1] >= 0 ||\n bNode.coordinates[1] - this.coordinates[1] >= 0\n )\n return aNode.coordinates[1] - bNode.coordinates[1];\n return bNode.coordinates[1] - aNode.coordinates[1];\n }\n\n const det = orientationIndex(\n this.coordinates,\n aNode.coordinates,\n bNode.coordinates\n );\n if (det < 0) return 1;\n if (det > 0) return -1;\n\n const d1 =\n Math.pow(aNode.coordinates[0] - this.coordinates[0], 2) +\n Math.pow(aNode.coordinates[1] - this.coordinates[1], 2),\n d2 =\n Math.pow(bNode.coordinates[0] - this.coordinates[0], 2) +\n Math.pow(bNode.coordinates[1] - this.coordinates[1], 2);\n\n return d1 - d2;\n });\n this.outerEdgesSorted = true;\n }\n }\n\n /**\n * Retrieves outer edges.\n *\n * They are sorted if they aren't in the CCW order.\n *\n * @memberof Node\n * @returns {Edge[]} - List of outer edges sorted in a CCW order.\n */\n getOuterEdges() {\n this.sortOuterEdges();\n return this.outerEdges;\n }\n\n getOuterEdge(i: number) {\n this.sortOuterEdges();\n return this.outerEdges[i];\n }\n\n addInnerEdge(edge: Edge) {\n this.innerEdges.push(edge);\n }\n}\n\nexport { Node };\nexport default Node;\n","import { lineString } from \"@turf/helpers\";\nimport { orientationIndex } from \"./util.js\";\nimport { Node } from \"./Node.js\";\nimport { EdgeRing } from \"./EdgeRing.js\";\n\n/**\n * This class is inspired by GEOS's geos::operation::polygonize::PolygonizeDirectedEdge\n */\nclass Edge {\n public label?: number;\n public symetric?: Edge;\n public from: Node;\n public to: Node;\n public next?: Edge;\n public ring?: EdgeRing;\n\n /**\n * Creates or get the symetric Edge.\n *\n * @returns {Edge} - Symetric Edge.\n */\n getSymetric() {\n if (!this.symetric) {\n this.symetric = new Edge(this.to, this.from);\n this.symetric.symetric = this;\n }\n\n return this.symetric;\n }\n\n /**\n * @param {Node} from - start node of the Edge\n * @param {Node} to - end node of the edge\n */\n constructor(from: Node, to: Node) {\n this.from = from; //< start\n this.to = to; //< End\n\n this.next = undefined; //< The edge to be computed after\n this.label = undefined; //< Used in order to detect Cut Edges (Bridges)\n this.symetric = undefined; //< The symetric edge of this\n this.ring = undefined; //< EdgeRing in which the Edge is\n\n this.from.addOuterEdge(this);\n this.to.addInnerEdge(this);\n }\n\n /**\n * Removes edge from from and to nodes.\n */\n deleteEdge() {\n this.from.removeOuterEdge(this);\n this.to.removeInnerEdge(this);\n }\n\n /**\n * Compares Edge equallity.\n *\n * An edge is equal to another, if the from and to nodes are the same.\n *\n * @param {Edge} edge - Another Edge\n * @returns {boolean} - True if Edges are equal, False otherwise\n */\n isEqual(edge: Edge) {\n return this.from.id === edge.from.id && this.to.id === edge.to.id;\n }\n\n toString() {\n return `Edge { ${this.from.id} -> ${this.to.id} }`;\n }\n\n /**\n * Returns a LineString representation of the Edge\n *\n * @returns {Feature<LineString>} - LineString representation of the Edge\n */\n toLineString() {\n return lineString([this.from.coordinates, this.to.coordinates]);\n }\n\n /**\n * Comparator of two edges.\n *\n * Implementation of geos::planargraph::DirectedEdge::compareTo.\n *\n * @param {Edge} edge - Another edge to compare with this one\n * @returns {number} -1 if this Edge has a greater angle with the positive x-axis than b,\n * 0 if the Edges are colinear,\n * 1 otherwise\n */\n compareTo(edge: Edge) {\n return orientationIndex(\n edge.from.coordinates,\n edge.to.coordinates,\n this.to.coordinates\n );\n }\n}\n\nexport { Edge };\nexport default Edge;\n","import { Polygon, Feature, Point, Position } from \"geojson\";\nimport {\n orientationIndex,\n envelopeIsEqual,\n envelopeContains,\n coordinatesEqual,\n} from \"./util.js\";\nimport { multiPoint, polygon, point } from \"@turf/helpers\";\nimport { envelope } from \"@turf/envelope\";\nimport { booleanPointInPolygon } from \"@turf/boolean-point-in-polygon\";\nimport { Edge } from \"./Edge.js\";\n\n/**\n * Ring of edges which form a polygon.\n *\n * The ring may be either an outer shell or a hole.\n *\n * This class is inspired in GEOS's geos::operation::polygonize::EdgeRing\n */\nclass EdgeRing {\n private edges: Edge[];\n private polygon?: Feature<\n Polygon,\n {\n [name: string]: any;\n }\n >;\n private envelope?: Feature<\n Polygon,\n {\n [name: string]: any;\n }\n >;\n\n constructor() {\n this.edges = [];\n this.polygon = undefined; //< Caches Polygon representation\n this.envelope = undefined; //< Caches Envelope representation\n }\n\n /**\n * Add an edge to the ring, inserting it in the last position.\n *\n * @memberof EdgeRing\n * @param {Edge} edge - Edge to be inserted\n */\n push(edge: Edge) {\n this.edges.push(edge);\n this.polygon = this.envelope = undefined;\n }\n\n /**\n * Get Edge.\n *\n * @memberof EdgeRing\n * @param {number} i - Index\n * @returns {Edge} - Edge in the i position\n */\n get(i: number) {\n return this.edges[i];\n }\n\n /**\n * Getter of length property.\n *\n * @memberof EdgeRing\n * @returns {number} - Length of the edge ring.\n */\n get length() {\n return this.edges.length;\n }\n\n /**\n * Similar to Array.prototype.forEach for the list of Edges in the EdgeRing.\n *\n * @memberof EdgeRing\n * @param {Function} f - The same function to be passed to Array.prototype.forEach\n */\n forEach(f: (edge: Edge, index: number, array: Edge[]) => void) {\n this.edges.forEach(f);\n }\n\n /**\n * Similar to Array.prototype.map for the list of Edges in the EdgeRing.\n *\n * @memberof EdgeRing\n * @param {Function} f - The same function to be passed to Array.prototype.map\n * @returns {Array} - The mapped values in the function\n */\n map<T>(f: (edge: Edge, index: number, array: Edge[]) => T): T[] {\n return this.edges.map(f);\n }\n\n /**\n * Similar to Array.prototype.some for the list of Edges in the EdgeRing.\n *\n * @memberof EdgeRing\n * @param {Function} f - The same function to be passed to Array.prototype.some\n * @returns {boolean} - True if an Edge check the condition\n */\n some(f: (edge: Edge, index: number, array: Edge[]) => boolean) {\n return this.edges.some(f);\n }\n\n /**\n * Check if the ring is valid in geomtry terms.\n *\n * A ring must have either 0 or 4 or more points. The first and the last must be\n * equal (in 2D)\n * geos::geom::LinearRing::validateConstruction\n *\n * @memberof EdgeRing\n * @returns {boolean} - Validity of the EdgeRing\n */\n isValid() {\n // TODO: stub\n return true;\n }\n\n /**\n * Tests whether this ring is a hole.\n *\n * A ring is a hole if it is oriented counter-clockwise.\n * Similar implementation of geos::algorithm::CGAlgorithms::isCCW\n *\n * @memberof EdgeRing\n * @returns {boolean} - true: if it is a hole\n */\n isHole() {\n // XXX: Assuming Ring is valid\n // Find highest point\n const hiIndex = this.edges.reduce((high, edge, i) => {\n if (edge.from.coordinates[1] > this.edges[high].from.coordinates[1])\n high = i;\n return high;\n }, 0),\n iPrev = (hiIndex === 0 ? this.length : hiIndex) - 1,\n iNext = (hiIndex + 1) % this.length,\n disc = orientationIndex(\n this.edges[iPrev].from.coordinates,\n this.edges[hiIndex].from.coordinates,\n this.edges[iNext].from.coordinates\n );\n\n if (disc === 0)\n return (\n this.edges[iPrev].from.coordinates[0] >\n this.edges[iNext].from.coordinates[0]\n );\n return disc > 0;\n }\n\n /**\n * Creates a MultiPoint representing the EdgeRing (discarts edges directions).\n *\n * @memberof EdgeRing\n * @returns {Feature<MultiPoint>} - Multipoint representation of the EdgeRing\n */\n toMultiPoint() {\n return multiPoint(this.edges.map((edge) => edge.from.coordinates));\n }\n\n /**\n * Creates a Polygon representing the EdgeRing.\n *\n * @memberof EdgeRing\n * @returns {Feature<Polygon>} - Polygon representation of the Edge Ring\n */\n toPolygon() {\n if (this.polygon) return this.polygon;\n const coordinates = this.edges.map((edge) => edge.from.coordinates);\n coordinates.push(this.edges[0].from.coordinates);\n return (this.polygon = polygon([coordinates]));\n }\n\n /**\n * Calculates the envelope of the EdgeRing.\n *\n * @memberof EdgeRing\n * @returns {Feature<Polygon>} - envelope\n */\n getEnvelope() {\n if (this.envelope) return this.envelope;\n return (this.envelope = envelope(this.toPolygon()) as Feature<\n Polygon,\n { [name: string]: any }\n >);\n }\n\n /**\n * `geos::operation::polygonize::EdgeRing::findEdgeRingContaining`\n *\n * @param {EdgeRing} testEdgeRing - EdgeRing to look in the list\n * @param {EdgeRing[]} shellList - List of EdgeRing in which to search\n *\n * @returns {EdgeRing} - EdgeRing which contains the testEdgeRing\n */\n static findEdgeRingContaining(\n testEdgeRing: EdgeRing,\n shellList: EdgeRing[]\n ): EdgeRing | undefined {\n const testEnvelope = testEdgeRing.getEnvelope();\n\n let minEnvelope: Feature<Polygon>, minShell: EdgeRing | undefined;\n shellList.forEach((shell) => {\n const tryEnvelope = shell.getEnvelope();\n\n if (minShell) minEnvelope = minShell.getEnvelope();\n\n // the hole envelope cannot equal the shell envelope\n if (envelopeIsEqual(tryEnvelope, testEnvelope)) return;\n\n if (envelopeContains(tryEnvelope, testEnvelope)) {\n const testEdgeRingCoordinates = testEdgeRing.map(\n (edge) => edge.from.coordinates\n );\n\n let testPoint: Position | undefined;\n for (const pt of testEdgeRingCoordinates) {\n if (\n !shell.some((edge) => coordinatesEqual(pt, edge.from.coordinates))\n ) {\n testPoint = pt;\n }\n }\n\n if (testPoint && shell.inside(point(testPoint))) {\n if (!minShell || envelopeContains(minEnvelope, tryEnvelope))\n minShell = shell;\n }\n }\n });\n\n return minShell;\n }\n\n /**\n * Checks if the point is inside the edgeRing\n *\n * @param {Feature<Point>} pt - Point to check if it is inside the edgeRing\n * @returns {boolean} - True if it is inside, False otherwise\n */\n inside(pt: Feature<Point>) {\n return booleanPointInPolygon(pt, this.toPolygon());\n }\n}\n\nexport { EdgeRing };\nexport default EdgeRing;\n","import { Node } from \"./Node.js\";\nimport { Edge } from \"./Edge.js\";\nimport { EdgeRing } from \"./EdgeRing.js\";\nimport { flattenEach, coordReduce } from \"@turf/meta\";\nimport { featureOf } from \"@turf/invariant\";\nimport {\n FeatureCollection,\n LineString,\n MultiLineString,\n Feature,\n} from \"geojson\";\nimport { AllGeoJSON } from \"@turf/helpers\";\n\n/**\n * Validates the geoJson.\n *\n * @param {GeoJSON} geoJson - input geoJson.\n * @throws {Error} if geoJson is invalid.\n */\nfunction validateGeoJson(geoJson: AllGeoJSON) {\n if (!geoJson) throw new Error(\"No geojson passed\");\n\n if (\n geoJson.type !== \"FeatureCollection\" &&\n geoJson.type !== \"GeometryCollection\" &&\n geoJson.type !== \"MultiLineString\" &&\n geoJson.type !== \"LineString\" &&\n geoJson.type !== \"Feature\"\n )\n throw new Error(\n `Invalid input type '${geoJson.type}'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature`\n );\n}\n\n/**\n * Represents a planar graph of edges and nodes that can be used to compute a polygonization.\n *\n * Although, this class is inspired by GEOS's `geos::operation::polygonize::PolygonizeGraph`,\n * it isn't a rewrite. As regards algorithm, this class implements the same logic, but it\n * isn't a javascript transcription of the C++ source.\n *\n * This graph is directed (both directions are created)\n */\nclass Graph {\n private nodes: { [id: string]: Node };\n private edges: Edge[];\n\n /**\n * Creates a graph from a GeoJSON.\n *\n * @param {FeatureCollection<LineString>} geoJson - it must comply with the restrictions detailed in the index\n * @returns {Graph} - The newly created graph\n * @throws {Error} if geoJson is invalid.\n */\n static fromGeoJson(\n geoJson:\n | FeatureCollection<LineString | MultiLineString>\n | LineString\n | MultiLineString\n | Feature<LineString | MultiLineString>\n ) {\n validateGeoJson(geoJson);\n\n const graph = new Graph();\n flattenEach(geoJson, (feature) => {\n featureOf(feature, \"LineString\", \"Graph::fromGeoJson\");\n // When a LineString if formed by many segments, split them\n coordReduce<number[]>(feature, (prev, cur) => {\n if (prev) {\n const start = graph.getNode(prev),\n end = graph.getNode(cur);\n\n graph.addEdge(start, end);\n }\n return cur;\n });\n });\n\n return graph;\n }\n\n /**\n * Creates or get a Node.\n *\n * @param {number[]} coordinates - Coordinates of the node\n * @returns {Node} - The created or stored node\n */\n getNode(coordinates: number[]) {\n const id = Node.buildId(coordinates);\n let node = this.nodes[id];\n if (!node) node = this.nodes[id] = new Node(coordinates);\n\n return node;\n }\n\n /**\n * Adds an Edge and its symetricall.\n *\n * Edges are added symetrically, i.e.: we also add its symetric\n *\n * @param {Node} from - Node which starts the Edge\n * @param {Node} to - Node which ends the Edge\n */\n addEdge(from: Node, to: Node) {\n const edge = new Edge(from, to),\n symetricEdge = edge.getSymetric();\n\n this.edges.push(edge);\n this.edges.push(symetricEdge);\n }\n\n constructor() {\n this.edges = []; //< {Edge[]} dirEdges\n\n // The key is the `id` of the Node (ie: coordinates.join(','))\n this.nodes = {};\n }\n\n /**\n * Removes Dangle Nodes (nodes with grade 1).\n */\n deleteDangles() {\n Object.keys(this.nodes)\n .map((id) => this.nodes[id])\n .forEach((node) => this._removeIfDangle(node));\n }\n\n /**\n * Check if node is dangle, if so, remove it.\n *\n * It calls itself recursively, removing a dangling node might cause another dangling node\n *\n * @param {Node} node - Node to check if it's a dangle\n */\n _removeIfDangle(node: Node) {\n // As edges are directed and symetrical, we count only innerEdges\n if (node.innerEdges.length <= 1) {\n const outerNodes = node.getOuterEdges().map((e) => e.to);\n this.removeNode(node);\n outerNodes.forEach((n) => this._removeIfDangle(n));\n }\n }\n\n /**\n * Delete cut-edges (bridge edges).\n *\n * The graph will be traversed, all the edges will be labeled according the ring\n * in which they are. (The label is a number incremented by 1). Edges with the same\n * label are cut-edges.\n */\n deleteCutEdges() {\n this._computeNextCWEdges();\n this._findLabeledEdgeRings();\n\n // Cut-edges (bridges) are edges where both edges have the same label\n this.edges.forEach((edge) => {\n if (edge.label === edge.symetric!.label) {\n this.removeEdge(edge.symetric!);\n this.removeEdge(edge);\n }\n });\n }\n\n /**\n * Set the `next` property of each Edge.\n *\n * The graph will be transversed in a CW form, so, we set the next of the symetrical edge as the previous one.\n * OuterEdges are sorted CCW.\n *\n * @param {Node} [node] - If no node is passed, the function calls itself for every node in the Graph\n */\n _computeNextCWEdges(node?: Node) {\n if (typeof node === \"undefined\") {\n Object.keys(this.nodes).forEach((id) =>\n this._computeNextCWEdges(this.nodes[id])\n );\n } else {\n node.getOuterEdges().forEach((edge, i) => {\n node.getOuterEdge(\n (i === 0 ? node.getOuterEdges().length : i) - 1\n ).symetric!.next = edge;\n });\n }\n }\n\n /**\n * Computes the next edge pointers going CCW around the given node, for the given edgering label.\n *\n * This algorithm has the effect of converting maximal edgerings into minimal edgerings\n *\n * XXX: method literally transcribed from `geos::operation::polygonize::PolygonizeGraph::computeNextCCWEdges`,\n * could be written in a more javascript way.\n *\n * @param {Node} node - Node\n * @param {number} label - Ring's label\n */\n _computeNextCCWEdges(node: Node, label: number) {\n const edges = node.getOuterEdges();\n let firstOutDE, prevInDE;\n\n for (let i = edges.length - 1; i >= 0; --i) {\n let de = edges[i],\n sym = de.symetric,\n outDE,\n inDE;\n\n if (de.label === label) outDE = de;\n\n if (sym!.label === label) inDE = sym;\n\n if (!outDE || !inDE)\n // This edge is not in edgering\n continue;\n\n if (inDE) prevInDE = inDE;\n\n if (outDE) {\n if (prevInDE) {\n prevInDE.next = outDE;\n prevInDE = undefined;\n }\n\n if (!firstOutDE) firstOutDE = outDE;\n }\n }\n\n if (prevInDE) prevInDE.next = firstOutDE;\n }\n\n /**\n * Finds rings and labels edges according to which rings are.\n *\n * The label is a number which is increased for each ring.\n *\n * @returns {Edge[]} edges that start rings\n */\n _findLabeledEdgeRings() {\n const edgeRingStarts: Edge[] = [];\n let label = 0;\n this.edges.forEach((edge) => {\n if (edge.label! >= 0) return;\n\n edgeRingStarts.push(edge);\n\n let e = edge;\n do {\n e.label = label;\n e = e.next!;\n } while (!edge.isEqual(e));\n\n label++;\n });\n\n return edgeRingStarts;\n }\n\n /**\n * Computes the EdgeRings formed by the edges in this graph.\n *\n * @returns {EdgeRing[]} - A list of all the EdgeRings in the graph.\n */\n getEdgeRings() {\n this._computeNextCWEdges();\n\n // Clear labels\n this.edges.forEach((edge) => {\n edge.label = undefined;\n });\n\n this._findLabeledEdgeRings().forEach((edge) => {\n // convertMaximalToMinimalEdgeRings\n this._findIntersectionNodes(edge).forEach((node) => {\n this._computeNextCCWEdges(node, edge.label!);\n });\n });\n\n const edgeRingList: EdgeRing[] = [];\n\n // find all edgerings\n this.edges.forEach((edge) => {\n if (edge.ring) return;\n edgeRingList.push(this._findEdgeRing(edge));\n });\n\n return edgeRingList;\n }\n\n /**\n * Find all nodes in a Maxima EdgeRing which are self-intersection nodes.\n *\n * @param {Node} startEdge - Start Edge of the Ring\n * @returns {Node[]} - intersection nodes\n */\n _findIntersectionNodes(startEdge: Edge) {\n const intersectionNodes = [];\n let edge = startEdge;\n do {\n // getDegree\n let degree = 0;\n edge.from.getOuterEdges().forEach((e) => {\n if (e.label === startEdge.label) ++degree;\n });\n\n if (degree > 1) intersectionNodes.push(edge.from);\n\n edge = edge.next!;\n } while (!startEdge.isEqual(edge));\n\n return intersectionNodes;\n }\n\n /**\n * Get the edge-ring which starts from the provided Edge.\n *\n * @param {Edge} startEdge - starting edge of the edge ring\n * @returns {EdgeRing} - EdgeRing which start Edge is the provided one.\n */\n _findEdgeRing(startEdge: Edge) {\n let edge = startEdge;\n const edgeRing = new EdgeRing();\n\n do {\n edgeRing.push(edge);\n edge.ring = edgeRing;\n edge = edge.next!;\n } while (!startEdge.isEqual(edge));\n\n return edgeRing;\n }\n\n /**\n * Removes a node from the Graph.\n *\n * It also removes edges asociated to that node\n * @param {Node} node - Node to be removed\n */\n removeNode(node: Node) {\n node.getOuterEdges().forEach((edge) => this.removeEdge(edge));\n node.innerEdges.forEach((edge) => this.removeEdge(edge));\n delete this.nodes[node.id];\n }\n\n /**\n * Remove edge from the graph and deletes the edge.\n *\n * @param {Edge} edge - Edge to be removed\n */\n removeEdge(edge: Edge) {\n this.edges = this.edges.filter((e) => !e.isEqual(edge));\n edge.deleteEdge();\n }\n}\n\nexport { Graph };\nexport default Graph;\n"],"mappings":";AAOA,SAAS,yBAAyB;;;ACNlC,SAAS,6BAA6B;AACtC,SAAS,aAAa;AAGtB,SAAS,SAAS,GAAW;AAC3B,UAAS,IAAI,MAA6B,IAAI,MAA4B,CAAC;AAC7E;AAgBO,SAAS,iBAAiB,IAAc,IAAc,GAAa;AACxE,QAAM,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,GACtB,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,GAClB,MAAM,EAAE,CAAC,IAAI,GAAG,CAAC,GACjB,MAAM,EAAE,CAAC,IAAI,GAAG,CAAC;AAEnB,SAAO,SAAS,MAAM,MAAM,MAAM,GAAG;AACvC;AAWO,SAAS,gBACd,MACA,MACA;AACA,QAAM,QAAQ,KAAK,SAAS,YAAY,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,GACxD,QAAQ,KAAK,SAAS,YAAY,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,GACpD,QAAQ,KAAK,SAAS,YAAY,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,GACpD,QAAQ,KAAK,SAAS,YAAY,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;AAEtD,SACE,KAAK,IAAI,MAAM,MAAM,KAAK,MAAM,KAAK,IAAI,MAAM,MAAM,KAAK,KAC1D,KAAK,IAAI,MAAM,MAAM,KAAK,MAAM,KAAK,IAAI,MAAM,MAAM,KAAK,KAC1D,KAAK,IAAI,MAAM,MAAM,KAAK,MAAM,KAAK,IAAI,MAAM,MAAM,KAAK,KAC1D,KAAK,IAAI,MAAM,MAAM,KAAK,MAAM,KAAK,IAAI,MAAM,MAAM,KAAK;AAE9D;AAaO,SAAS,iB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AK,OAAO;AACZ,aAAO,KAAK;AAAA,IACd,SAAS,CAAC,UAAU,QAAQ,IAAI;AAEhC,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,WAAW,MAAY;AACrB,SAAK,cAAc,EAAE,QAAQ,CAAC,SAAS,KAAK,WAAW,IAAI,CAAC;AAC5D,SAAK,WAAW,QAAQ,CAAC,SAAS,KAAK,WAAW,IAAI,CAAC;AACvD,WAAO,KAAK,MAAM,KAAK,EAAE;AAAA,EAC3B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,WAAW,MAAY;AACrB,SAAK,QAAQ,KAAK,MAAM,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,IAAI,CAAC;AACtD,SAAK,WAAW;AAAA,EAClB;AACF;;;ALlUA,SAAS,WACP,SAC4B;AAC5B,QAAM,QAAQ,MAAM,YAAY,OAAO;AAGvC,QAAM,cAAc;AAGpB,QAAM,eAAe;AAGrB,QAAM,QAAoB,CAAC,GACzB,SAAqB,CAAC;AAExB,QACG,aAAa,EACb,OAAO,CAAC,aAAa,SAAS,QAAQ,CAAC,EACvC,QAAQ,CAAC,aAAa;AACrB,QAAI,SAAS,OAAO,EAAG,OAAM,KAAK,QAAQ;AAAA,QACrC,QAAO,KAAK,QAAQ;AAAA,EAC3B,CAAC;AAGH,QAAM,QAAQ,CAAC,SAAS;AACtB,QAAI,SAAS,uBAAuB,MAAM,MAAM,EAAG,QAAO,KAAK,IAAI;AAAA,EACrE,CAAC;AAGD,SAAO,kBAAkB,OAAO,IAAI,CAAC,UAAU,MAAM,UAAU,CAAC,CAAC;AACnE;AAGA,IAAO,0BAAQ;","names":["point","booleanPointInPolygon"]}
1
+ {"version":3,"sources":["../../index.ts","../../lib/util.ts","../../lib/Node.ts","../../lib/Edge.ts","../../lib/EdgeRing.ts","../../lib/Graph.ts"],"sourcesContent":["import {\n Feature,\n FeatureCollection,\n LineString,\n MultiLineString,\n Polygon,\n} from \"geojson\";\nimport { featureCollection } from \"@turf/helpers\";\nimport { Graph } from \"./lib/Graph.js\";\nimport { EdgeRing } from \"./lib/EdgeRing.js\";\n\n/**\n * Polygonizes {@link LineString|(Multi)LineString(s)} into {@link Polygons}.\n *\n * Implementation of GEOSPolygonize function (`geos::operation::polygonize::Polygonizer`).\n *\n * Polygonizes a set of lines that represents edges in a planar graph. Edges must be correctly\n * noded, i.e., they must only meet at their endpoints.\n *\n * The implementation correctly handles:\n *\n * - Dangles: edges which have one or both ends which are not incident on another edge endpoint.\n * - Cut Edges (bridges): edges that are connected at both ends but which do not form part of a polygon.\n *\n * @function\n * @param {FeatureCollection|Geometry|Feature<LineString|MultiLineString>} geoJson Lines in order to polygonize\n * @returns {FeatureCollection<Polygon>} Polygons created\n * @throws {Error} if geoJson is invalid.\n */\nfunction polygonize<T extends LineString | MultiLineString>(\n geoJson: Feature<T> | FeatureCollection<T> | T\n): FeatureCollection<Polygon> {\n const graph = Graph.fromGeoJson(geoJson);\n\n // 1. Remove dangle node\n graph.deleteDangles();\n\n // 2. Remove cut-edges (bridge edges)\n graph.deleteCutEdges();\n\n // 3. Get all holes and shells\n const holes: EdgeRing[] = [],\n shells: EdgeRing[] = [];\n\n graph\n .getEdgeRings()\n .filter((edgeRing) => edgeRing.isValid())\n .forEach((edgeRing) => {\n if (edgeRing.isHole()) holes.push(edgeRing);\n else shells.push(edgeRing);\n });\n\n // 4. Assign Holes to Shells\n holes.forEach((hole) => {\n if (EdgeRing.findEdgeRingContaining(hole, shells)) shells.push(hole);\n });\n\n // 5. EdgeRings to Polygons\n return featureCollection(shells.map((shell) => shell.toPolygon()));\n}\n\nexport { polygonize };\nexport default polygonize;\n","import { Feature, Polygon } from \"geojson\";\nimport { booleanPointInPolygon } from \"@turf/boolean-point-in-polygon\";\nimport { point } from \"@turf/helpers\";\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign#Polyfill\nfunction mathSign(x: number) {\n return ((x > 0) as unknown as number) - ((x < 0) as unknown as number) || +x;\n}\n\n/**\n * Returns the direction of the point q relative to the vector p1 -> p2.\n *\n * Implementation of geos::algorithm::CGAlgorithm::orientationIndex()\n * (same as geos::algorithm::CGAlgorithm::computeOrientation())\n *\n * @param {number[]} p1 - the origin point of the vector\n * @param {number[]} p2 - the final point of the vector\n * @param {number[]} q - the point to compute the direction to\n *\n * @returns {number} - 1 if q is ccw (left) from p1->p2,\n * -1 if q is cw (right) from p1->p2,\n * 0 if q is colinear with p1->p2\n */\nexport function orientationIndex(p1: number[], p2: number[], q: number[]) {\n const dx1 = p2[0] - p1[0],\n dy1 = p2[1] - p1[1],\n dx2 = q[0] - p2[0],\n dy2 = q[1] - p2[1];\n\n return mathSign(dx1 * dy2 - dx2 * dy1);\n}\n\n/**\n * Checks if two envelopes are equal.\n *\n * The function assumes that the arguments are envelopes, i.e.: Rectangular polygon\n *\n * @param {Feature<Polygon>} env1 - Envelope\n * @param {Feature<Polygon>} env2 - Envelope\n * @returns {boolean} - True if the envelopes are equal\n */\nexport function envelopeIsEqual(\n env1: Feature<Polygon>,\n env2: Feature<Polygon>\n) {\n const envX1 = env1.geometry.coordinates[0].map((c) => c[0]),\n envY1 = env1.geometry.coordinates[0].map((c) => c[1]),\n envX2 = env2.geometry.coordinates[0].map((c) => c[0]),\n envY2 = env2.geometry.coordinates[0].map((c) => c[1]);\n\n return (\n Math.max.apply(null, envX1) === Math.max.apply(null, envX2) &&\n Math.max.apply(null, envY1) === Math.max.apply(null, envY2) &&\n Math.min.apply(null, envX1) === Math.min.apply(null, envX2) &&\n Math.min.apply(null, envY1) === Math.min.apply(null, envY2)\n );\n}\n\n/**\n * Check if a envelope is contained in other one.\n *\n * The function assumes that the arguments are envelopes, i.e.: Convex polygon\n * XXX: Envelopes are rectangular, checking if a point is inside a rectangule is something easy,\n * this could be further improved.\n *\n * @param {Feature<Polygon>} self - Envelope\n * @param {Feature<Polygon>} env - Envelope\n * @returns {boolean} - True if env is contained in self\n */\nexport function envelopeContains(\n self: Feature<Polygon>,\n env: Feature<Polygon>\n) {\n return env.geometry.coordinates[0].every((c) =>\n booleanPointInPolygon(point(c), self)\n );\n}\n\n/**\n * Checks if two coordinates are equal.\n *\n * @param {number[]} coord1 - First coordinate\n * @param {number[]} coord2 - Second coordinate\n * @returns {boolean} - True if coordinates are equal\n */\nexport function coordinatesEqual(coord1: number[], coord2: number[]) {\n return coord1[0] === coord2[0] && coord1[1] === coord2[1];\n}\n","import { orientationIndex } from \"./util.js\";\nimport { Edge } from \"./Edge.js\";\n\n/**\n * Node\n */\nclass Node {\n static buildId(coordinates: number[]) {\n return coordinates.join(\",\");\n }\n\n public id: string;\n public coordinates: number[];\n public innerEdges: Edge[];\n private outerEdges: Edge[];\n private outerEdgesSorted: boolean;\n\n constructor(coordinates: number[]) {\n this.id = Node.buildId(coordinates);\n this.coordinates = coordinates; //< {Number[]}\n this.innerEdges = []; //< {Edge[]}\n\n // We wil store to (out) edges in an CCW order as geos::planargraph::DirectedEdgeStar does\n this.outerEdges = []; //< {Edge[]}\n this.outerEdgesSorted = false; //< {Boolean} flag that stores if the outer Edges had been sorted\n }\n\n removeInnerEdge(edge: Edge) {\n this.innerEdges = this.innerEdges.filter((e) => e.from.id !== edge.from.id);\n }\n\n removeOuterEdge(edge: Edge) {\n this.outerEdges = this.outerEdges.filter((e) => e.to.id !== edge.to.id);\n }\n\n /**\n * Outer edges are stored CCW order.\n *\n * @memberof Node\n * @param {Edge} edge - Edge to add as an outerEdge.\n */\n addOuterEdge(edge: Edge) {\n this.outerEdges.push(edge);\n this.outerEdgesSorted = false;\n }\n\n /**\n * Sorts outer edges in CCW way.\n *\n * @memberof Node\n * @private\n */\n sortOuterEdges() {\n if (!this.outerEdgesSorted) {\n //this.outerEdges.sort((a, b) => a.compareTo(b));\n // Using this comparator in order to be deterministic\n this.outerEdges.sort((a, b) => {\n const aNode = a.to,\n bNode = b.to;\n\n if (\n aNode.coordinates[0] - this.coordinates[0] >= 0 &&\n bNode.coordinates[0] - this.coordinates[0] < 0\n )\n return 1;\n if (\n aNode.coordinates[0] - this.coordinates[0] < 0 &&\n bNode.coordinates[0] - this.coordinates[0] >= 0\n )\n return -1;\n\n if (\n aNode.coordinates[0] - this.coordinates[0] === 0 &&\n bNode.coordinates[0] - this.coordinates[0] === 0\n ) {\n if (\n aNode.coordinates[1] - this.coordinates[1] >= 0 ||\n bNode.coordinates[1] - this.coordinates[1] >= 0\n )\n return aNode.coordinates[1] - bNode.coordinates[1];\n return bNode.coordinates[1] - aNode.coordinates[1];\n }\n\n const det = orientationIndex(\n this.coordinates,\n aNode.coordinates,\n bNode.coordinates\n );\n if (det < 0) return 1;\n if (det > 0) return -1;\n\n const d1 =\n Math.pow(aNode.coordinates[0] - this.coordinates[0], 2) +\n Math.pow(aNode.coordinates[1] - this.coordinates[1], 2),\n d2 =\n Math.pow(bNode.coordinates[0] - this.coordinates[0], 2) +\n Math.pow(bNode.coordinates[1] - this.coordinates[1], 2);\n\n return d1 - d2;\n });\n this.outerEdgesSorted = true;\n }\n }\n\n /**\n * Retrieves outer edges.\n *\n * They are sorted if they aren't in the CCW order.\n *\n * @memberof Node\n * @returns {Edge[]} - List of outer edges sorted in a CCW order.\n */\n getOuterEdges() {\n this.sortOuterEdges();\n return this.outerEdges;\n }\n\n getOuterEdge(i: number) {\n this.sortOuterEdges();\n return this.outerEdges[i];\n }\n\n addInnerEdge(edge: Edge) {\n this.innerEdges.push(edge);\n }\n}\n\nexport { Node };\nexport default Node;\n","import { lineString } from \"@turf/helpers\";\nimport { orientationIndex } from \"./util.js\";\nimport { Node } from \"./Node.js\";\nimport { EdgeRing } from \"./EdgeRing.js\";\n\n/**\n * This class is inspired by GEOS's geos::operation::polygonize::PolygonizeDirectedEdge\n */\nclass Edge {\n public label?: number;\n public symetric?: Edge;\n public from: Node;\n public to: Node;\n public next?: Edge;\n public ring?: EdgeRing;\n\n /**\n * Creates or get the symetric Edge.\n *\n * @returns {Edge} - Symetric Edge.\n */\n getSymetric() {\n if (!this.symetric) {\n this.symetric = new Edge(this.to, this.from);\n this.symetric.symetric = this;\n }\n\n return this.symetric;\n }\n\n /**\n * @param {Node} from - start node of the Edge\n * @param {Node} to - end node of the edge\n */\n constructor(from: Node, to: Node) {\n this.from = from; //< start\n this.to = to; //< End\n\n this.next = undefined; //< The edge to be computed after\n this.label = undefined; //< Used in order to detect Cut Edges (Bridges)\n this.symetric = undefined; //< The symetric edge of this\n this.ring = undefined; //< EdgeRing in which the Edge is\n\n this.from.addOuterEdge(this);\n this.to.addInnerEdge(this);\n }\n\n /**\n * Removes edge from from and to nodes.\n */\n deleteEdge() {\n this.from.removeOuterEdge(this);\n this.to.removeInnerEdge(this);\n }\n\n /**\n * Compares Edge equallity.\n *\n * An edge is equal to another, if the from and to nodes are the same.\n *\n * @param {Edge} edge - Another Edge\n * @returns {boolean} - True if Edges are equal, False otherwise\n */\n isEqual(edge: Edge) {\n return this.from.id === edge.from.id && this.to.id === edge.to.id;\n }\n\n toString() {\n return `Edge { ${this.from.id} -> ${this.to.id} }`;\n }\n\n /**\n * Returns a LineString representation of the Edge\n *\n * @returns {Feature<LineString>} - LineString representation of the Edge\n */\n toLineString() {\n return lineString([this.from.coordinates, this.to.coordinates]);\n }\n\n /**\n * Comparator of two edges.\n *\n * Implementation of geos::planargraph::DirectedEdge::compareTo.\n *\n * @param {Edge} edge - Another edge to compare with this one\n * @returns {number} -1 if this Edge has a greater angle with the positive x-axis than b,\n * 0 if the Edges are colinear,\n * 1 otherwise\n */\n compareTo(edge: Edge) {\n return orientationIndex(\n edge.from.coordinates,\n edge.to.coordinates,\n this.to.coordinates\n );\n }\n}\n\nexport { Edge };\nexport default Edge;\n","import { Polygon, Feature, Point, Position } from \"geojson\";\nimport {\n orientationIndex,\n envelopeIsEqual,\n envelopeContains,\n coordinatesEqual,\n} from \"./util.js\";\nimport { multiPoint, polygon, point } from \"@turf/helpers\";\nimport { envelope } from \"@turf/envelope\";\nimport { booleanPointInPolygon } from \"@turf/boolean-point-in-polygon\";\nimport { Edge } from \"./Edge.js\";\n\n/**\n * Ring of edges which form a polygon.\n *\n * The ring may be either an outer shell or a hole.\n *\n * This class is inspired in GEOS's geos::operation::polygonize::EdgeRing\n */\nclass EdgeRing {\n private edges: Edge[];\n private polygon?: Feature<\n Polygon,\n {\n [name: string]: any;\n }\n >;\n private envelope?: Feature<\n Polygon,\n {\n [name: string]: any;\n }\n >;\n\n constructor() {\n this.edges = [];\n this.polygon = undefined; //< Caches Polygon representation\n this.envelope = undefined; //< Caches Envelope representation\n }\n\n /**\n * Add an edge to the ring, inserting it in the last position.\n *\n * @memberof EdgeRing\n * @param {Edge} edge - Edge to be inserted\n */\n push(edge: Edge) {\n this.edges.push(edge);\n this.polygon = this.envelope = undefined;\n }\n\n /**\n * Get Edge.\n *\n * @memberof EdgeRing\n * @param {number} i - Index\n * @returns {Edge} - Edge in the i position\n */\n get(i: number) {\n return this.edges[i];\n }\n\n /**\n * Getter of length property.\n *\n * @memberof EdgeRing\n * @returns {number} - Length of the edge ring.\n */\n get length() {\n return this.edges.length;\n }\n\n /**\n * Similar to Array.prototype.forEach for the list of Edges in the EdgeRing.\n *\n * @memberof EdgeRing\n * @param {Function} f - The same function to be passed to Array.prototype.forEach\n */\n forEach(f: (edge: Edge, index: number, array: Edge[]) => void) {\n this.edges.forEach(f);\n }\n\n /**\n * Similar to Array.prototype.map for the list of Edges in the EdgeRing.\n *\n * @memberof EdgeRing\n * @param {Function} f - The same function to be passed to Array.prototype.map\n * @returns {Array} - The mapped values in the function\n */\n map<T>(f: (edge: Edge, index: number, array: Edge[]) => T): T[] {\n return this.edges.map(f);\n }\n\n /**\n * Similar to Array.prototype.some for the list of Edges in the EdgeRing.\n *\n * @memberof EdgeRing\n * @param {Function} f - The same function to be passed to Array.prototype.some\n * @returns {boolean} - True if an Edge check the condition\n */\n some(f: (edge: Edge, index: number, array: Edge[]) => boolean) {\n return this.edges.some(f);\n }\n\n /**\n * Check if the ring is valid in geomtry terms.\n *\n * A ring must have either 0 or 4 or more points. The first and the last must be\n * equal (in 2D)\n * geos::geom::LinearRing::validateConstruction\n *\n * @memberof EdgeRing\n * @returns {boolean} - Validity of the EdgeRing\n */\n isValid() {\n // TODO: stub\n return true;\n }\n\n /**\n * Tests whether this ring is a hole.\n *\n * A ring is a hole if it is oriented counter-clockwise.\n * Similar implementation of geos::algorithm::CGAlgorithms::isCCW\n *\n * @memberof EdgeRing\n * @returns {boolean} - true: if it is a hole\n */\n isHole() {\n // XXX: Assuming Ring is valid\n // Find highest point\n const hiIndex = this.edges.reduce((high, edge, i) => {\n if (edge.from.coordinates[1] > this.edges[high].from.coordinates[1])\n high = i;\n return high;\n }, 0),\n iPrev = (hiIndex === 0 ? this.length : hiIndex) - 1,\n iNext = (hiIndex + 1) % this.length,\n disc = orientationIndex(\n this.edges[iPrev].from.coordinates,\n this.edges[hiIndex].from.coordinates,\n this.edges[iNext].from.coordinates\n );\n\n if (disc === 0)\n return (\n this.edges[iPrev].from.coordinates[0] >\n this.edges[iNext].from.coordinates[0]\n );\n return disc > 0;\n }\n\n /**\n * Creates a MultiPoint representing the EdgeRing (discarts edges directions).\n *\n * @memberof EdgeRing\n * @returns {Feature<MultiPoint>} - Multipoint representation of the EdgeRing\n */\n toMultiPoint() {\n return multiPoint(this.edges.map((edge) => edge.from.coordinates));\n }\n\n /**\n * Creates a Polygon representing the EdgeRing.\n *\n * @memberof EdgeRing\n * @returns {Feature<Polygon>} - Polygon representation of the Edge Ring\n */\n toPolygon() {\n if (this.polygon) return this.polygon;\n const coordinates = this.edges.map((edge) => edge.from.coordinates);\n coordinates.push(this.edges[0].from.coordinates);\n return (this.polygon = polygon([coordinates]));\n }\n\n /**\n * Calculates the envelope of the EdgeRing.\n *\n * @memberof EdgeRing\n * @returns {Feature<Polygon>} - envelope\n */\n getEnvelope() {\n if (this.envelope) return this.envelope;\n return (this.envelope = envelope(this.toPolygon()) as Feature<\n Polygon,\n { [name: string]: any }\n >);\n }\n\n /**\n * `geos::operation::polygonize::EdgeRing::findEdgeRingContaining`\n *\n * @param {EdgeRing} testEdgeRing - EdgeRing to look in the list\n * @param {EdgeRing[]} shellList - List of EdgeRing in which to search\n *\n * @returns {EdgeRing} - EdgeRing which contains the testEdgeRing\n */\n static findEdgeRingContaining(\n testEdgeRing: EdgeRing,\n shellList: EdgeRing[]\n ): EdgeRing | undefined {\n const testEnvelope = testEdgeRing.getEnvelope();\n\n let minEnvelope: Feature<Polygon>, minShell: EdgeRing | undefined;\n shellList.forEach((shell) => {\n const tryEnvelope = shell.getEnvelope();\n\n if (minShell) minEnvelope = minShell.getEnvelope();\n\n // the hole envelope cannot equal the shell envelope\n if (envelopeIsEqual(tryEnvelope, testEnvelope)) return;\n\n if (envelopeContains(tryEnvelope, testEnvelope)) {\n const testEdgeRingCoordinates = testEdgeRing.map(\n (edge) => edge.from.coordinates\n );\n\n let testPoint: Position | undefined;\n for (const pt of testEdgeRingCoordinates) {\n if (\n !shell.some((edge) => coordinatesEqual(pt, edge.from.coordinates))\n ) {\n testPoint = pt;\n }\n }\n\n if (testPoint && shell.inside(point(testPoint))) {\n if (!minShell || envelopeContains(minEnvelope, tryEnvelope))\n minShell = shell;\n }\n }\n });\n\n return minShell;\n }\n\n /**\n * Checks if the point is inside the edgeRing\n *\n * @param {Feature<Point>} pt - Point to check if it is inside the edgeRing\n * @returns {boolean} - True if it is inside, False otherwise\n */\n inside(pt: Feature<Point>) {\n return booleanPointInPolygon(pt, this.toPolygon());\n }\n}\n\nexport { EdgeRing };\nexport default EdgeRing;\n","import { Node } from \"./Node.js\";\nimport { Edge } from \"./Edge.js\";\nimport { EdgeRing } from \"./EdgeRing.js\";\nimport { flattenEach, coordReduce } from \"@turf/meta\";\nimport { featureOf } from \"@turf/invariant\";\nimport {\n FeatureCollection,\n LineString,\n MultiLineString,\n Feature,\n} from \"geojson\";\nimport { AllGeoJSON } from \"@turf/helpers\";\n\n/**\n * Validates the geoJson.\n *\n * @param {GeoJSON} geoJson - input geoJson.\n * @throws {Error} if geoJson is invalid.\n */\nfunction validateGeoJson(geoJson: AllGeoJSON) {\n if (!geoJson) throw new Error(\"No geojson passed\");\n\n if (\n geoJson.type !== \"FeatureCollection\" &&\n geoJson.type !== \"GeometryCollection\" &&\n geoJson.type !== \"MultiLineString\" &&\n geoJson.type !== \"LineString\" &&\n geoJson.type !== \"Feature\"\n )\n throw new Error(\n `Invalid input type '${geoJson.type}'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature`\n );\n}\n\n/**\n * Represents a planar graph of edges and nodes that can be used to compute a polygonization.\n *\n * Although, this class is inspired by GEOS's `geos::operation::polygonize::PolygonizeGraph`,\n * it isn't a rewrite. As regards algorithm, this class implements the same logic, but it\n * isn't a javascript transcription of the C++ source.\n *\n * This graph is directed (both directions are created)\n */\nclass Graph {\n private nodes: { [id: string]: Node };\n private edges: Edge[];\n\n /**\n * Creates a graph from a GeoJSON.\n *\n * @param {FeatureCollection<LineString>} geoJson - it must comply with the restrictions detailed in the index\n * @returns {Graph} - The newly created graph\n * @throws {Error} if geoJson is invalid.\n */\n static fromGeoJson(\n geoJson:\n | FeatureCollection<LineString | MultiLineString>\n | LineString\n | MultiLineString\n | Feature<LineString | MultiLineString>\n ) {\n validateGeoJson(geoJson);\n\n const graph = new Graph();\n flattenEach(geoJson, (feature) => {\n featureOf(feature, \"LineString\", \"Graph::fromGeoJson\");\n // When a LineString if formed by many segments, split them\n coordReduce<number[]>(feature, (prev, cur) => {\n if (prev) {\n const start = graph.getNode(prev),\n end = graph.getNode(cur);\n\n graph.addEdge(start, end);\n }\n return cur;\n });\n });\n\n return graph;\n }\n\n /**\n * Creates or get a Node.\n *\n * @param {number[]} coordinates - Coordinates of the node\n * @returns {Node} - The created or stored node\n */\n getNode(coordinates: number[]) {\n const id = Node.buildId(coordinates);\n let node = this.nodes[id];\n if (!node) node = this.nodes[id] = new Node(coordinates);\n\n return node;\n }\n\n /**\n * Adds an Edge and its symetricall.\n *\n * Edges are added symetrically, i.e.: we also add its symetric\n *\n * @param {Node} from - Node which starts the Edge\n * @param {Node} to - Node which ends the Edge\n */\n addEdge(from: Node, to: Node) {\n const edge = new Edge(from, to),\n symetricEdge = edge.getSymetric();\n\n this.edges.push(edge);\n this.edges.push(symetricEdge);\n }\n\n constructor() {\n this.edges = []; //< {Edge[]} dirEdges\n\n // The key is the `id` of the Node (ie: coordinates.join(','))\n this.nodes = {};\n }\n\n /**\n * Removes Dangle Nodes (nodes with grade 1).\n */\n deleteDangles() {\n Object.keys(this.nodes)\n .map((id) => this.nodes[id])\n .forEach((node) => this._removeIfDangle(node));\n }\n\n /**\n * Check if node is dangle, if so, remove it.\n *\n * It calls itself recursively, removing a dangling node might cause another dangling node\n *\n * @param {Node} node - Node to check if it's a dangle\n */\n _removeIfDangle(node: Node) {\n // As edges are directed and symetrical, we count only innerEdges\n if (node.innerEdges.length <= 1) {\n const outerNodes = node.getOuterEdges().map((e) => e.to);\n this.removeNode(node);\n outerNodes.forEach((n) => this._removeIfDangle(n));\n }\n }\n\n /**\n * Delete cut-edges (bridge edges).\n *\n * The graph will be traversed, all the edges will be labeled according the ring\n * in which they are. (The label is a number incremented by 1). Edges with the same\n * label are cut-edges.\n */\n deleteCutEdges() {\n this._computeNextCWEdges();\n this._findLabeledEdgeRings();\n\n // Cut-edges (bridges) are edges where both edges have the same label\n this.edges.forEach((edge) => {\n if (edge.label === edge.symetric!.label) {\n this.removeEdge(edge.symetric!);\n this.removeEdge(edge);\n }\n });\n }\n\n /**\n * Set the `next` property of each Edge.\n *\n * The graph will be transversed in a CW form, so, we set the next of the symetrical edge as the previous one.\n * OuterEdges are sorted CCW.\n *\n * @param {Node} [node] - If no node is passed, the function calls itself for every node in the Graph\n */\n _computeNextCWEdges(node?: Node) {\n if (typeof node === \"undefined\") {\n Object.keys(this.nodes).forEach((id) =>\n this._computeNextCWEdges(this.nodes[id])\n );\n } else {\n node.getOuterEdges().forEach((edge, i) => {\n node.getOuterEdge(\n (i === 0 ? node.getOuterEdges().length : i) - 1\n ).symetric!.next = edge;\n });\n }\n }\n\n /**\n * Computes the next edge pointers going CCW around the given node, for the given edgering label.\n *\n * This algorithm has the effect of converting maximal edgerings into minimal edgerings\n *\n * XXX: method literally transcribed from `geos::operation::polygonize::PolygonizeGraph::computeNextCCWEdges`,\n * could be written in a more javascript way.\n *\n * @param {Node} node - Node\n * @param {number} label - Ring's label\n */\n _computeNextCCWEdges(node: Node, label: number) {\n const edges = node.getOuterEdges();\n let firstOutDE, prevInDE;\n\n for (let i = edges.length - 1; i >= 0; --i) {\n let de = edges[i],\n sym = de.symetric,\n outDE,\n inDE;\n\n if (de.label === label) outDE = de;\n\n if (sym!.label === label) inDE = sym;\n\n if (!outDE || !inDE)\n // This edge is not in edgering\n continue;\n\n if (inDE) prevInDE = inDE;\n\n if (outDE) {\n if (prevInDE) {\n prevInDE.next = outDE;\n prevInDE = undefined;\n }\n\n if (!firstOutDE) firstOutDE = outDE;\n }\n }\n\n if (prevInDE) prevInDE.next = firstOutDE;\n }\n\n /**\n * Finds rings and labels edges according to which rings are.\n *\n * The label is a number which is increased for each ring.\n *\n * @returns {Edge[]} edges that start rings\n */\n _findLabeledEdgeRings() {\n const edgeRingStarts: Edge[] = [];\n let label = 0;\n this.edges.forEach((edge) => {\n if (edge.label! >= 0) return;\n\n edgeRingStarts.push(edge);\n\n let e = edge;\n do {\n e.label = label;\n e = e.next!;\n } while (!edge.isEqual(e));\n\n label++;\n });\n\n return edgeRingStarts;\n }\n\n /**\n * Computes the EdgeRings formed by the edges in this graph.\n *\n * @returns {EdgeRing[]} - A list of all the EdgeRings in the graph.\n */\n getEdgeRings() {\n this._computeNextCWEdges();\n\n // Clear labels\n this.edges.forEach((edge) => {\n edge.label = undefined;\n });\n\n this._findLabeledEdgeRings().forEach((edge) => {\n // convertMaximalToMinimalEdgeRings\n this._findIntersectionNodes(edge).forEach((node) => {\n this._computeNextCCWEdges(node, edge.label!);\n });\n });\n\n const edgeRingList: EdgeRing[] = [];\n\n // find all edgerings\n this.edges.forEach((edge) => {\n if (edge.ring) return;\n edgeRingList.push(this._findEdgeRing(edge));\n });\n\n return edgeRingList;\n }\n\n /**\n * Find all nodes in a Maxima EdgeRing which are self-intersection nodes.\n *\n * @param {Node} startEdge - Start Edge of the Ring\n * @returns {Node[]} - intersection nodes\n */\n _findIntersectionNodes(startEdge: Edge) {\n const intersectionNodes = [];\n let edge = startEdge;\n do {\n // getDegree\n let degree = 0;\n edge.from.getOuterEdges().forEach((e) => {\n if (e.label === startEdge.label) ++degree;\n });\n\n if (degree > 1) intersectionNodes.push(edge.from);\n\n edge = edge.next!;\n } while (!startEdge.isEqual(edge));\n\n return intersectionNodes;\n }\n\n /**\n * Get the edge-ring which starts from the provided Edge.\n *\n * @param {Edge} startEdge - starting edge of the edge ring\n * @returns {EdgeRing} - EdgeRing which start Edge is the provided one.\n */\n _findEdgeRing(startEdge: Edge) {\n let edge = startEdge;\n const edgeRing = new EdgeRing();\n\n do {\n edgeRing.push(edge);\n edge.ring = edgeRing;\n edge = edge.next!;\n } while (!startEdge.isEqual(edge));\n\n return edgeRing;\n }\n\n /**\n * Removes a node from the Graph.\n *\n * It also removes edges asociated to that node\n * @param {Node} node - Node to be removed\n */\n removeNode(node: Node) {\n node.getOuterEdges().forEach((edge) => this.removeEdge(edge));\n node.innerEdges.forEach((edge) => this.removeEdge(edge));\n delete this.nodes[node.id];\n }\n\n /**\n * Remove edge from the graph and deletes the edge.\n *\n * @param {Edge} edge - Edge to be removed\n */\n removeEdge(edge: Edge) {\n this.edges = this.edges.filter((e) => !e.isEqual(edge));\n edge.deleteEdge();\n }\n}\n\nexport { Graph };\nexport default Graph;\n"],"mappings":";AAOA,SAAS,yBAAyB;;;ACNlC,SAAS,6BAA6B;AACtC,SAAS,aAAa;AAGtB,SAAS,SAAS,GAAW;AAC3B,UAAS,IAAI,MAA6B,IAAI,MAA4B,CAAC;AAC7E;AAgBO,SAAS,iBAAiB,IAAc,IAAc,GAAa;AACxE,QAAM,M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AAAA;AAAA;AAAA,EAOA,WAAW,MAAY;AACrB,SAAK,QAAQ,KAAK,MAAM,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,IAAI,CAAC;AACtD,SAAK,WAAW;AAAA,EAClB;AACF;;;ALlUA,SAAS,WACP,SAC4B;AAC5B,QAAM,QAAQ,MAAM,YAAY,OAAO;AAGvC,QAAM,cAAc;AAGpB,QAAM,eAAe;AAGrB,QAAM,QAAoB,CAAC,GACzB,SAAqB,CAAC;AAExB,QACG,aAAa,EACb,OAAO,CAAC,aAAa,SAAS,QAAQ,CAAC,EACvC,QAAQ,CAAC,aAAa;AACrB,QAAI,SAAS,OAAO,EAAG,OAAM,KAAK,QAAQ;AAAA,QACrC,QAAO,KAAK,QAAQ;AAAA,EAC3B,CAAC;AAGH,QAAM,QAAQ,CAAC,SAAS;AACtB,QAAI,SAAS,uBAAuB,MAAM,MAAM,EAAG,QAAO,KAAK,IAAI;AAAA,EACrE,CAAC;AAGD,SAAO,kBAAkB,OAAO,IAAI,CAAC,UAAU,MAAM,UAAU,CAAC,CAAC;AACnE;AAGA,IAAO,gBAAQ;","names":["point","booleanPointInPolygon"]}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@turf/polygonize",
3
- "version": "7.2.0",
4
- "description": "turf polygonize module",
3
+ "version": "7.3.0",
4
+ "description": "Polygonizes a set of lines that represents edges in a planar graph.",
5
5
  "author": "Turf Authors",
6
6
  "contributors": [
7
7
  "Nicolas Cisco <@nickcis>",
@@ -57,24 +57,24 @@
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/benchmark": "^2.1.5",
60
- "@types/tape": "^4.13.4",
60
+ "@types/tape": "^5.8.1",
61
61
  "benchmark": "^2.1.4",
62
62
  "load-json-file": "^7.0.1",
63
63
  "npm-run-all": "^4.1.5",
64
64
  "tape": "^5.9.0",
65
- "tsup": "^8.3.5",
66
- "tsx": "^4.19.2",
67
- "typescript": "^5.5.4",
68
- "write-json-file": "^5.0.0"
65
+ "tsup": "^8.4.0",
66
+ "tsx": "^4.19.4",
67
+ "typescript": "^5.8.3",
68
+ "write-json-file": "^6.0.0"
69
69
  },
70
70
  "dependencies": {
71
- "@turf/boolean-point-in-polygon": "^7.2.0",
72
- "@turf/envelope": "^7.2.0",
73
- "@turf/helpers": "^7.2.0",
74
- "@turf/invariant": "^7.2.0",
75
- "@turf/meta": "^7.2.0",
71
+ "@turf/boolean-point-in-polygon": "7.3.0",
72
+ "@turf/envelope": "7.3.0",
73
+ "@turf/helpers": "7.3.0",
74
+ "@turf/invariant": "7.3.0",
75
+ "@turf/meta": "7.3.0",
76
76
  "@types/geojson": "^7946.0.10",
77
77
  "tslib": "^2.8.1"
78
78
  },
79
- "gitHead": "7b0f0374c4668cd569f8904c71e2ae7d941be867"
79
+ "gitHead": "9f58a103e8f9a587ab640307ed03ba5233913ddd"
80
80
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@turf/projection",
3
- "version": "7.2.0",
4
- "description": "turf projection module",
3
+ "version": "7.3.0",
4
+ "description": "Provides tools for conversion between geographic coordinates and projected coordinates.",
5
5
  "author": "Turf Authors",
6
6
  "contributors": [
7
7
  "Stefano Borghi <@stebogit>"
@@ -64,25 +64,25 @@
64
64
  "test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
65
65
  },
66
66
  "devDependencies": {
67
- "@turf/truncate": "^7.2.0",
67
+ "@turf/truncate": "7.3.0",
68
68
  "@types/benchmark": "^2.1.5",
69
- "@types/tape": "^4.13.4",
69
+ "@types/tape": "^5.8.1",
70
70
  "benchmark": "^2.1.4",
71
71
  "load-json-file": "^7.0.1",
72
72
  "npm-run-all": "^4.1.5",
73
73
  "proj4": "^2.9.2",
74
74
  "tape": "^5.9.0",
75
- "tsup": "^8.3.5",
76
- "tsx": "^4.19.2",
77
- "typescript": "^5.5.4",
78
- "write-json-file": "^5.0.0"
75
+ "tsup": "^8.4.0",
76
+ "tsx": "^4.19.4",
77
+ "typescript": "^5.8.3",
78
+ "write-json-file": "^6.0.0"
79
79
  },
80
80
  "dependencies": {
81
- "@turf/clone": "^7.2.0",
82
- "@turf/helpers": "^7.2.0",
83
- "@turf/meta": "^7.2.0",
81
+ "@turf/clone": "7.3.0",
82
+ "@turf/helpers": "7.3.0",
83
+ "@turf/meta": "7.3.0",
84
84
  "@types/geojson": "^7946.0.10",
85
85
  "tslib": "^2.8.1"
86
86
  },
87
- "gitHead": "7b0f0374c4668cd569f8904c71e2ae7d941be867"
87
+ "gitHead": "9f58a103e8f9a587ab640307ed03ba5233913ddd"
88
88
  }
@@ -106,9 +106,9 @@ function factorial(num) {
106
106
  }
107
107
  return inner(num);
108
108
  }
109
- var turf_quadrat_analysis_default = quadratAnalysis;
109
+ var index_default = quadratAnalysis;
110
110
 
111
111
 
112
112
 
113
- exports.default = turf_quadrat_analysis_default; exports.quadratAnalysis = quadratAnalysis;
113
+ exports.default = index_default; exports.quadratAnalysis = quadratAnalysis;
114
114
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-quadrat-analysis/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACCA,kCAAqB;AACrB,kCAAiC;AACjC,iDAA4B;AAC5B,4CAAyB;AACzB,+CAA2B;AAkD3B,SAAS,eAAA,CACP,eAAA,EACA,OAAA,EAIuB;AACvB,EAAA,QAAA,EAAU,QAAA,GAAW,CAAC,CAAA;AACtB,EAAA,MAAM,UAAA,EAAY,OAAA,CAAQ,UAAA,GAAa,wBAAA,eAAwB,CAAA;AAC/D,EAAA,MAAM,gBAAA,EAAkB,OAAA,CAAQ,gBAAA,GAAmB,EAAA;AACnD,EAAA,MAAM,OAAA,EAAS,eAAA,CAAgB,QAAA;AAG/B,EAAA,MAAM,YAAA,EAAc,MAAA,CAAO,MAAA;AAC3B,EAAA,MAAM,WAAA,EAAa,wBAAA,sCAAK,SAAqB,CAAC,CAAA;AAC9C,EAAA,MA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Aa;AAC9B,EAAA,MAAM,EAAA,EAAc,CAAC,CAAA;AACrB,EAAA,SAAS,KAAA,CAAM,CAAA,EAAmB;AAChC,IAAA,GAAA,CAAI,EAAA,IAAM,EAAA,GAAK,EAAA,IAAM,CAAA,EAAG;AACtB,MAAA,OAAO,CAAA;AAAA,IACT;AACA,IAAA,GAAA,CAAI,CAAA,CAAE,CAAC,EAAA,EAAI,CAAA,EAAG;AACZ,MAAA,OAAO,CAAA,CAAE,CAAC,CAAA;AAAA,IACZ;AACA,IAAA,OAAQ,CAAA,CAAE,CAAC,EAAA,EAAI,KAAA,CAAM,EAAA,EAAI,CAAC,EAAA,EAAI,CAAA;AAAA,EAChC;AACA,EAAA,OAAO,KAAA,CAAM,GAAG,CAAA;AAClB;AAGA,IAAO,8BAAA,EAAQ,eAAA;ADtHf;AACE;AACA;AACF,2FAAC","file":"/home/runner/work/turf/turf/packages/turf-quadrat-analysis/dist/cjs/index.cjs","sourcesContent":[null,"import { BBox, FeatureCollection, Point } from \"geojson\";\nimport { area } from \"@turf/area\";\nimport { bbox as turfBBox } from \"@turf/bbox\";\nimport { bboxPolygon } from \"@turf/bbox-polygon\";\nimport { getCoord } from \"@turf/invariant\";\nimport { squareGrid } from \"@turf/square-grid\";\n\ninterface QuadratAnalysisResult {\n criticalValue: number;\n maxAbsoluteDifference: number;\n isRandom: boolean;\n observedDistribution: number[];\n}\n\n/**\n * Quadrat analysis lays a set of equal-size areas(quadrat) over the study area and counts\n * the number of features in each quadrat and creates a frequency table.\n * The table lists the number of quadrats containing no features,\n * the number containing one feature, two features, and so on,\n * all the way up to the quadrat containing the most features.\n * The method then creates the frequency table for the random distribution, usually based on a Poisson distribution.\n * The method uses the distribution to calculate the probability for 0 feature occuring,\n * 1 feature occuring, 2 features, and so on,\n * and lists these probabilities in the frequency table.\n * By comparing the two frequency tables, you can see whether the features create a pattern.\n * If the table for the observed distribution has more quadrats containing many features than the\n * table for the random distribution dose, then the features create a clustered pattern.\n *\n * It is hard to judge the frequency tables are similar or different just by looking at them.\n * So, we can use serval statistical tests to find out how much the frequency tables differ.\n * We use Kolmogorov-Smirnov test.This method calculates cumulative probabilities for both distributions,\n * and then compares the cumulative probabilities at each class level and selects the largest absolute difference D.\n * Then, the test compares D to the critical value for a confidence level you specify.\n * If D is greater than the critical value, the difference between the observed distribution and\n * the random distribution is significant. The greater the value the bigger the difference.\n *\n * Traditionally, squares are used for the shape of the quadrats, in a regular grid(square-grid).\n * Some researchers suggest that the quadrat size equal twice the size of mean area per feature,\n * which is simply the area of the study area divided by the number of features.\n *\n *\n * @function\n * @param {FeatureCollection<Point>} pointFeatureSet point set to study\n * @param {Object} [options={}] optional parameters\n * @param {[number, number, number, number]} [options.studyBbox] bbox representing the study area\n * @param {20 | 15 | 10 | 5 | 2 | 1} [options.confidenceLevel=20] a confidence level.\n * The unit is percentage . 5 means 95%, value must be in {@link K_TABLE}\n * @returns {QuadratAnalysisResult} result\n * @example\n *\n * var bbox = [-65, 40, -63, 42];\n * var dataset = turf.randomPoint(100, { bbox: bbox });\n * var result = turf.quadratAnalysis(dataset);\n *\n */\nfunction quadratAnalysis(\n pointFeatureSet: FeatureCollection<Point>,\n options: {\n studyBbox?: [number, number, number, number];\n confidenceLevel?: 20 | 15 | 10 | 5 | 2 | 1;\n }\n): QuadratAnalysisResult {\n options = options || {};\n const studyBbox = options.studyBbox || turfBBox(pointFeatureSet);\n const confidenceLevel = options.confidenceLevel || 20;\n const points = pointFeatureSet.features;\n\n // create square-grid\n const numOfPoints = points.length;\n const sizeOfArea = area(bboxPolygon(studyBbox));\n const lengthOfSide = Math.sqrt((sizeOfArea / numOfPoints) * 2);\n const grid = squareGrid(studyBbox, lengthOfSide, {\n units: \"meters\",\n });\n const quadrats = grid.features;\n\n // count the number of features in each quadrat\n const quadratIdDict: { [key: string]: { box: BBox; cnt: number } } = {};\n for (let i = 0; i < quadrats.length; i++) {\n quadratIdDict[i] = {\n box: turfBBox(quadrats[i]),\n cnt: 0,\n };\n }\n\n let sumOfPoint = 0;\n for (const pt of points) {\n for (const key of Object.keys(quadratIdDict)) {\n const box = quadratIdDict[key].box;\n if (inBBox(getCoord(pt), box)) {\n quadratIdDict[key].cnt += 1;\n sumOfPoint += 1;\n break;\n }\n }\n }\n\n // the most amount of features in quadrat\n let maxCnt = 0;\n for (const key of Object.keys(quadratIdDict)) {\n const cnt = quadratIdDict[key].cnt;\n if (cnt > maxCnt) {\n maxCnt = cnt;\n }\n }\n\n const expectedDistribution = [];\n const numOfQuadrat = Object.keys(quadratIdDict).length;\n const lambda = sumOfPoint / numOfQuadrat;\n\n // get the cumulative probability of the random distribution\n let cumulativeProbility = 0.0;\n for (let x = 0; x < maxCnt + 1; x++) {\n cumulativeProbility +=\n (Math.exp(-lambda) * Math.pow(lambda, x)) / factorial(x);\n expectedDistribution.push(cumulativeProbility);\n }\n\n // get the cumulative probability of the observed distribution\n const observedDistribution = [];\n let cumulativeObservedQuads = 0;\n for (let x = 0; x < maxCnt + 1; x++) {\n for (const key of Object.keys(quadratIdDict)) {\n if (quadratIdDict[key].cnt === x) {\n cumulativeObservedQuads += 1;\n }\n }\n const p = cumulativeObservedQuads / numOfQuadrat;\n observedDistribution.push(p);\n }\n\n // get the largest absolute difference between two distributions\n let maxDifference = 0;\n for (let x = 0; x < maxCnt + 1; x++) {\n const difference = Math.abs(\n expectedDistribution[x] - observedDistribution[x]\n );\n if (difference > maxDifference) {\n maxDifference = difference;\n }\n }\n\n const k = K_TABLE[confidenceLevel];\n\n // statistical test\n const criticalValue = k / Math.sqrt(numOfQuadrat);\n const result: QuadratAnalysisResult = {\n criticalValue,\n isRandom: true,\n maxAbsoluteDifference: maxDifference,\n observedDistribution,\n };\n\n if (maxDifference > criticalValue) {\n result.isRandom = false;\n }\n\n return result;\n}\n\n/**\n * the confidence level\n *\n * @constant\n * @type {Object}\n * @property {number} 20 1.07275\n * @property {number} 15 1.13795\n * @property {number} 10 1.22385\n * @property {number} 5 1.3581\n * @property {number} 2 1.51743\n * @property {number} 1 1.62762\n */\nconst K_TABLE = {\n 20: 1.07275,\n 15: 1.13795,\n 10: 1.22385,\n 5: 1.3581,\n 2: 1.51743,\n 1: 1.62762,\n};\n\n/**\n * the return type of the quadratAnalysis\n *\n * @typedef {object} QuadratAnalysisResult\n * @property {number} criticalValue\n * @property {number} maxAbsoluteDifference\n * @property {boolean} isRandom\n * @property {Array<number>} observedDistribution the cumulative distribution of observed features,\n * the index represents the number of features in the quadrat.\n */\n\n/**\n * inBBox from @turf/boolean-point-in-polygon\n *\n * @private\n * @param {Array<number>} pt point [x,y]\n * @param {BBox} bbox BBox [west, south, east, north]\n * @returns {boolean} true/false if point is inside BBox\n */\nfunction inBBox(pt: number[], bbox: BBox) {\n return (\n bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1]\n );\n}\n\n/**\n * https://stackoverflow.com/questions/3959211/fast-factorial-function-in-javascript\n * @private\n * @param {number} num Number\n * @returns {number} the factorial of num\n */\nfunction factorial(num: number) {\n const f: number[] = [];\n function inner(n: number): number {\n if (n === 0 || n === 1) {\n return 1;\n }\n if (f[n] > 0) {\n return f[n];\n }\n return (f[n] = inner(n - 1) * n);\n }\n return inner(num);\n}\n\nexport { QuadratAnalysisResult, quadratAnalysis };\nexport default quadratAnalysis;\n"]}
1
+ {"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-quadrat-analysis/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACCA,kCAAqB;AACrB,kCAAiC;AACjC,iDAA4B;AAC5B,4CAAyB;AACzB,+CAA2B;AAkD3B,SAAS,eAAA,CACP,eAAA,EACA,OAAA,EAIuB;AACvB,EAAA,QAAA,EAAU,QAAA,GAAW,CAAC,CAAA;AACtB,EAAA,MAAM,UAAA,EAAY,OAAA,CAAQ,UAAA,GAAa,wBAAA,eAAwB,CAAA;AAC/D,EAAA,MAAM,gBAAA,EAAkB,OAAA,CAAQ,gBAAA,GAAmB,EAAA;AACnD,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,CAAC,EAAA,GAAK,IAAA,CAAK,CAAC,EAAA,GAAK,EAAA,CAAG,CAAC,EAAA,GAAK,IAAA,CAAK,CAAC,EAAA,GAAK,EAAA,CAAG,CAAC,CAAA;AAE/E;AAQA,SAAS,SAAA,CAAU,GAAA,EAAa;AAC9B,EAAA,MAAM,EAAA,EAAc,CAAC,CAAA;AACrB,EAAA,SAAS,KAAA,CAAM,CAAA,EAAmB;AAChC,IAAA,GAAA,CAAI,EAAA,IAAM,EAAA,GAAK,EAAA,IAAM,CAAA,EAAG;AACtB,MAAA,OAAO,CAAA;AAAA,IACT;AACA,IAAA,GAAA,CAAI,CAAA,CAAE,CAAC,EAAA,EAAI,CAAA,EAAG;AACZ,MAAA,OAAO,CAAA,CAAE,CAAC,CAAA;AAAA,IACZ;AACA,IAAA,OAAQ,CAAA,CAAE,CAAC,EAAA,EAAI,KAAA,CAAM,EAAA,EAAI,CAAC,EAAA,EAAI,CAAA;AAAA,EAChC;AACA,EAAA,OAAO,KAAA,CAAM,GAAG,CAAA;AAClB;AAGA,IAAO,cAAA,EAAQ,eAAA;ADtHf;AACE;AACA;AACF,2EAAC","file":"/home/runner/work/turf/turf/packages/turf-quadrat-analysis/dist/cjs/index.cjs","sourcesContent":[null,"import { BBox, FeatureCollection, Point } from \"geojson\";\nimport { area } from \"@turf/area\";\nimport { bbox as turfBBox } from \"@turf/bbox\";\nimport { bboxPolygon } from \"@turf/bbox-polygon\";\nimport { getCoord } from \"@turf/invariant\";\nimport { squareGrid } from \"@turf/square-grid\";\n\ninterface QuadratAnalysisResult {\n criticalValue: number;\n maxAbsoluteDifference: number;\n isRandom: boolean;\n observedDistribution: number[];\n}\n\n/**\n * Quadrat analysis lays a set of equal-size areas(quadrat) over the study area and counts\n * the number of features in each quadrat and creates a frequency table.\n * The table lists the number of quadrats containing no features,\n * the number containing one feature, two features, and so on,\n * all the way up to the quadrat containing the most features.\n * The method then creates the frequency table for the random distribution, usually based on a Poisson distribution.\n * The method uses the distribution to calculate the probability for 0 feature occuring,\n * 1 feature occuring, 2 features, and so on,\n * and lists these probabilities in the frequency table.\n * By comparing the two frequency tables, you can see whether the features create a pattern.\n * If the table for the observed distribution has more quadrats containing many features than the\n * table for the random distribution dose, then the features create a clustered pattern.\n *\n * It is hard to judge the frequency tables are similar or different just by looking at them.\n * So, we can use serval statistical tests to find out how much the frequency tables differ.\n * We use Kolmogorov-Smirnov test.This method calculates cumulative probabilities for both distributions,\n * and then compares the cumulative probabilities at each class level and selects the largest absolute difference D.\n * Then, the test compares D to the critical value for a confidence level you specify.\n * If D is greater than the critical value, the difference between the observed distribution and\n * the random distribution is significant. The greater the value the bigger the difference.\n *\n * Traditionally, squares are used for the shape of the quadrats, in a regular grid(square-grid).\n * Some researchers suggest that the quadrat size equal twice the size of mean area per feature,\n * which is simply the area of the study area divided by the number of features.\n *\n *\n * @function\n * @param {FeatureCollection<Point>} pointFeatureSet point set to study\n * @param {Object} [options={}] optional parameters\n * @param {[number, number, number, number]} [options.studyBbox] bbox representing the study area\n * @param {20 | 15 | 10 | 5 | 2 | 1} [options.confidenceLevel=20] a confidence level.\n * The unit is percentage . 5 means 95%, value must be in {@link K_TABLE}\n * @returns {QuadratAnalysisResult} result\n * @example\n *\n * var bbox = [-65, 40, -63, 42];\n * var dataset = turf.randomPoint(100, { bbox: bbox });\n * var result = turf.quadratAnalysis(dataset);\n *\n */\nfunction quadratAnalysis(\n pointFeatureSet: FeatureCollection<Point>,\n options: {\n studyBbox?: [number, number, number, number];\n confidenceLevel?: 20 | 15 | 10 | 5 | 2 | 1;\n }\n): QuadratAnalysisResult {\n options = options || {};\n const studyBbox = options.studyBbox || turfBBox(pointFeatureSet);\n const confidenceLevel = options.confidenceLevel || 20;\n const points = pointFeatureSet.features;\n\n // create square-grid\n const numOfPoints = points.length;\n const sizeOfArea = area(bboxPolygon(studyBbox));\n const lengthOfSide = Math.sqrt((sizeOfArea / numOfPoints) * 2);\n const grid = squareGrid(studyBbox, lengthOfSide, {\n units: \"meters\",\n });\n const quadrats = grid.features;\n\n // count the number of features in each quadrat\n const quadratIdDict: { [key: string]: { box: BBox; cnt: number } } = {};\n for (let i = 0; i < quadrats.length; i++) {\n quadratIdDict[i] = {\n box: turfBBox(quadrats[i]),\n cnt: 0,\n };\n }\n\n let sumOfPoint = 0;\n for (const pt of points) {\n for (const key of Object.keys(quadratIdDict)) {\n const box = quadratIdDict[key].box;\n if (inBBox(getCoord(pt), box)) {\n quadratIdDict[key].cnt += 1;\n sumOfPoint += 1;\n break;\n }\n }\n }\n\n // the most amount of features in quadrat\n let maxCnt = 0;\n for (const key of Object.keys(quadratIdDict)) {\n const cnt = quadratIdDict[key].cnt;\n if (cnt > maxCnt) {\n maxCnt = cnt;\n }\n }\n\n const expectedDistribution = [];\n const numOfQuadrat = Object.keys(quadratIdDict).length;\n const lambda = sumOfPoint / numOfQuadrat;\n\n // get the cumulative probability of the random distribution\n let cumulativeProbility = 0.0;\n for (let x = 0; x < maxCnt + 1; x++) {\n cumulativeProbility +=\n (Math.exp(-lambda) * Math.pow(lambda, x)) / factorial(x);\n expectedDistribution.push(cumulativeProbility);\n }\n\n // get the cumulative probability of the observed distribution\n const observedDistribution = [];\n let cumulativeObservedQuads = 0;\n for (let x = 0; x < maxCnt + 1; x++) {\n for (const key of Object.keys(quadratIdDict)) {\n if (quadratIdDict[key].cnt === x) {\n cumulativeObservedQuads += 1;\n }\n }\n const p = cumulativeObservedQuads / numOfQuadrat;\n observedDistribution.push(p);\n }\n\n // get the largest absolute difference between two distributions\n let maxDifference = 0;\n for (let x = 0; x < maxCnt + 1; x++) {\n const difference = Math.abs(\n expectedDistribution[x] - observedDistribution[x]\n );\n if (difference > maxDifference) {\n maxDifference = difference;\n }\n }\n\n const k = K_TABLE[confidenceLevel];\n\n // statistical test\n const criticalValue = k / Math.sqrt(numOfQuadrat);\n const result: QuadratAnalysisResult = {\n criticalValue,\n isRandom: true,\n maxAbsoluteDifference: maxDifference,\n observedDistribution,\n };\n\n if (maxDifference > criticalValue) {\n result.isRandom = false;\n }\n\n return result;\n}\n\n/**\n * the confidence level\n *\n * @constant\n * @type {Object}\n * @property {number} 20 1.07275\n * @property {number} 15 1.13795\n * @property {number} 10 1.22385\n * @property {number} 5 1.3581\n * @property {number} 2 1.51743\n * @property {number} 1 1.62762\n */\nconst K_TABLE = {\n 20: 1.07275,\n 15: 1.13795,\n 10: 1.22385,\n 5: 1.3581,\n 2: 1.51743,\n 1: 1.62762,\n};\n\n/**\n * the return type of the quadratAnalysis\n *\n * @typedef {object} QuadratAnalysisResult\n * @property {number} criticalValue\n * @property {number} maxAbsoluteDifference\n * @property {boolean} isRandom\n * @property {Array<number>} observedDistribution the cumulative distribution of observed features,\n * the index represents the number of features in the quadrat.\n */\n\n/**\n * inBBox from @turf/boolean-point-in-polygon\n *\n * @private\n * @param {Array<number>} pt point [x,y]\n * @param {BBox} bbox BBox [west, south, east, north]\n * @returns {boolean} true/false if point is inside BBox\n */\nfunction inBBox(pt: number[], bbox: BBox) {\n return (\n bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1]\n );\n}\n\n/**\n * https://stackoverflow.com/questions/3959211/fast-factorial-function-in-javascript\n * @private\n * @param {number} num Number\n * @returns {number} the factorial of num\n */\nfunction factorial(num: number) {\n const f: number[] = [];\n function inner(n: number): number {\n if (n === 0 || n === 1) {\n return 1;\n }\n if (f[n] > 0) {\n return f[n];\n }\n return (f[n] = inner(n - 1) * n);\n }\n return inner(num);\n}\n\nexport { QuadratAnalysisResult, quadratAnalysis };\nexport default quadratAnalysis;\n"]}
@@ -106,9 +106,9 @@ function factorial(num) {
106
106
  }
107
107
  return inner(num);
108
108
  }
109
- var turf_quadrat_analysis_default = quadratAnalysis;
109
+ var index_default = quadratAnalysis;
110
110
  export {
111
- turf_quadrat_analysis_default as default,
111
+ index_default as default,
112
112
  quadratAnalysis
113
113
  };
114
114
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts"],"sourcesContent":["import { BBox, FeatureCollection, Point } from \"geojson\";\nimport { area } from \"@turf/area\";\nimport { bbox as turfBBox } from \"@turf/bbox\";\nimport { bboxPolygon } from \"@turf/bbox-polygon\";\nimport { getCoord } from \"@turf/invariant\";\nimport { squareGrid } from \"@turf/square-grid\";\n\ninterface QuadratAnalysisResult {\n criticalValue: number;\n maxAbsoluteDifference: number;\n isRandom: boolean;\n observedDistribution: number[];\n}\n\n/**\n * Quadrat analysis lays a set of equal-size areas(quadrat) over the study area and counts\n * the number of features in each quadrat and creates a frequency table.\n * The table lists the number of quadrats containing no features,\n * the number containing one feature, two features, and so on,\n * all the way up to the quadrat containing the most features.\n * The method then creates the frequency table for the random distribution, usually based on a Poisson distribution.\n * The method uses the distribution to calculate the probability for 0 feature occuring,\n * 1 feature occuring, 2 features, and so on,\n * and lists these probabilities in the frequency table.\n * By comparing the two frequency tables, you can see whether the features create a pattern.\n * If the table for the observed distribution has more quadrats containing many features than the\n * table for the random distribution dose, then the features create a clustered pattern.\n *\n * It is hard to judge the frequency tables are similar or different just by looking at them.\n * So, we can use serval statistical tests to find out how much the frequency tables differ.\n * We use Kolmogorov-Smirnov test.This method calculates cumulative probabilities for both distributions,\n * and then compares the cumulative probabilities at each class level and selects the largest absolute difference D.\n * Then, the test compares D to the critical value for a confidence level you specify.\n * If D is greater than the critical value, the difference between the observed distribution and\n * the random distribution is significant. The greater the value the bigger the difference.\n *\n * Traditionally, squares are used for the shape of the quadrats, in a regular grid(square-grid).\n * Some researchers suggest that the quadrat size equal twice the size of mean area per feature,\n * which is simply the area of the study area divided by the number of features.\n *\n *\n * @function\n * @param {FeatureCollection<Point>} pointFeatureSet point set to study\n * @param {Object} [options={}] optional parameters\n * @param {[number, number, number, number]} [options.studyBbox] bbox representing the study area\n * @param {20 | 15 | 10 | 5 | 2 | 1} [options.confidenceLevel=20] a confidence level.\n * The unit is percentage . 5 means 95%, value must be in {@link K_TABLE}\n * @returns {QuadratAnalysisResult} result\n * @example\n *\n * var bbox = [-65, 40, -63, 42];\n * var dataset = turf.randomPoint(100, { bbox: bbox });\n * var result = turf.quadratAnalysis(dataset);\n *\n */\nfunction quadratAnalysis(\n pointFeatureSet: FeatureCollection<Point>,\n options: {\n studyBbox?: [number, number, number, number];\n confidenceLevel?: 20 | 15 | 10 | 5 | 2 | 1;\n }\n): QuadratAnalysisResult {\n options = options || {};\n const studyBbox = options.studyBbox || turfBBox(pointFeatureSet);\n const confidenceLevel = options.confidenceLevel || 20;\n const points = pointFeatureSet.features;\n\n // create square-grid\n const numOfPoints = points.length;\n const sizeOfArea = area(bboxPolygon(studyBbox));\n const lengthOfSide = Math.sqrt((sizeOfArea / numOfPoints) * 2);\n const grid = squareGrid(studyBbox, lengthOfSide, {\n units: \"meters\",\n });\n const quadrats = grid.features;\n\n // count the number of features in each quadrat\n const quadratIdDict: { [key: string]: { box: BBox; cnt: number } } = {};\n for (let i = 0; i < quadrats.length; i++) {\n quadratIdDict[i] = {\n box: turfBBox(quadrats[i]),\n cnt: 0,\n };\n }\n\n let sumOfPoint = 0;\n for (const pt of points) {\n for (const key of Object.keys(quadratIdDict)) {\n const box = quadratIdDict[key].box;\n if (inBBox(getCoord(pt), box)) {\n quadratIdDict[key].cnt += 1;\n sumOfPoint += 1;\n break;\n }\n }\n }\n\n // the most amount of features in quadrat\n let maxCnt = 0;\n for (const key of Object.keys(quadratIdDict)) {\n const cnt = quadratIdDict[key].cnt;\n if (cnt > maxCnt) {\n maxCnt = cnt;\n }\n }\n\n const expectedDistribution = [];\n const numOfQuadrat = Object.keys(quadratIdDict).length;\n const lambda = sumOfPoint / numOfQuadrat;\n\n // get the cumulative probability of the random distribution\n let cumulativeProbility = 0.0;\n for (let x = 0; x < maxCnt + 1; x++) {\n cumulativeProbility +=\n (Math.exp(-lambda) * Math.pow(lambda, x)) / factorial(x);\n expectedDistribution.push(cumulativeProbility);\n }\n\n // get the cumulative probability of the observed distribution\n const observedDistribution = [];\n let cumulativeObservedQuads = 0;\n for (let x = 0; x < maxCnt + 1; x++) {\n for (const key of Object.keys(quadratIdDict)) {\n if (quadratIdDict[key].cnt === x) {\n cumulativeObservedQuads += 1;\n }\n }\n const p = cumulativeObservedQuads / numOfQuadrat;\n observedDistribution.push(p);\n }\n\n // get the largest absolute difference between two distributions\n let maxDifference = 0;\n for (let x = 0; x < maxCnt + 1; x++) {\n const difference = Math.abs(\n expectedDistribution[x] - observedDistribution[x]\n );\n if (difference > maxDifference) {\n maxDifference = difference;\n }\n }\n\n const k = K_TABLE[confidenceLevel];\n\n // statistical test\n const criticalValue = k / Math.sqrt(numOfQuadrat);\n const result: QuadratAnalysisResult = {\n criticalValue,\n isRandom: true,\n maxAbsoluteDifference: maxDifference,\n observedDistribution,\n };\n\n if (maxDifference > criticalValue) {\n result.isRandom = false;\n }\n\n return result;\n}\n\n/**\n * the confidence level\n *\n * @constant\n * @type {Object}\n * @property {number} 20 1.07275\n * @property {number} 15 1.13795\n * @property {number} 10 1.22385\n * @property {number} 5 1.3581\n * @property {number} 2 1.51743\n * @property {number} 1 1.62762\n */\nconst K_TABLE = {\n 20: 1.07275,\n 15: 1.13795,\n 10: 1.22385,\n 5: 1.3581,\n 2: 1.51743,\n 1: 1.62762,\n};\n\n/**\n * the return type of the quadratAnalysis\n *\n * @typedef {object} QuadratAnalysisResult\n * @property {number} criticalValue\n * @property {number} maxAbsoluteDifference\n * @property {boolean} isRandom\n * @property {Array<number>} observedDistribution the cumulative distribution of observed features,\n * the index represents the number of features in the quadrat.\n */\n\n/**\n * inBBox from @turf/boolean-point-in-polygon\n *\n * @private\n * @param {Array<number>} pt point [x,y]\n * @param {BBox} bbox BBox [west, south, east, north]\n * @returns {boolean} true/false if point is inside BBox\n */\nfunction inBBox(pt: number[], bbox: BBox) {\n return (\n bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1]\n );\n}\n\n/**\n * https://stackoverflow.com/questions/3959211/fast-factorial-function-in-javascript\n * @private\n * @param {number} num Number\n * @returns {number} the factorial of num\n */\nfunction factorial(num: number) {\n const f: number[] = [];\n function inner(n: number): number {\n if (n === 0 || n === 1) {\n return 1;\n }\n if (f[n] > 0) {\n return f[n];\n }\n return (f[n] = inner(n - 1) * n);\n }\n return inner(num);\n}\n\nexport { QuadratAnalysisResult, quadratAnalysis };\nexport default quadratAnalysis;\n"],"mappings":";AACA,SAAS,YAAY;AACrB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAkD3B,SAAS,gBACP,iBACA,SAIuB;AACvB,YAAU,WAAW,CAAC;AACtB,QAAM,YAAY,QAAQ,aAAa,SAAS,eAAe;AAC/D,QAAM,kBAAkB,QAAQ,mBAAmB;AACnD,QAAM,SAAS,gBAAgB;AAG/B,QAAM,cAAc,OAAO;AAC3B,QAAM,aAAa,KAAK,YAAY,SAAS,CAAC;AAC9C,QAAM,eAAe,KAAK,KAAM,aAAa,cAAe,CAAC;AAC7D,QAAM,OAAO,WAAW,WAAW,cAAc;AAAA,IAC/C,OAAO;AAAA,EACT,CAAC;AACD,QAAM,WAAW,KAAK;AAGtB,QAAM,gBAA+D,CAAC;AACtE,WAAS,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;AACxC,kBAAc,CAAC,IAAI;AAAA,MACjB,KAAK,SAAS,SAAS,CAAC,CAAC;AAAA,MACzB,KAAK;AAAA,IACP;AAAA,EACF;AAEA,MAAI,aAAa;AACjB,aAAW,MAAM,QAAQ;AACvB,eAAW,OAAO,OAAO,KAAK,aAAa,GAAG;AAC5C,YAAM,MAAM,cAAc,GAAG,EAAE;AAC/B,UAAI,OAAO,SAAS,EAAE,GAAG,GAAG,GAAG;AAC7B,sBAAc,GAAG,EAAE,OAAO;AAC1B,sBAAc;AACd;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAGA,MAAI,SAAS;AACb,aAAW,OAAO,OAAO,KAAK,aAAa,GAAG;AAC5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AAAA,EACH,GAAG;AACL;AAqBA,SAAS,OAAO,IAAc,MAAY;AACxC,SACE,KAAK,CAAC,KAAK,GAAG,CAAC,KAAK,KAAK,CAAC,KAAK,GAAG,CAAC,KAAK,KAAK,CAAC,KAAK,GAAG,CAAC,KAAK,KAAK,CAAC,KAAK,GAAG,CAAC;AAE/E;AAQA,SAAS,UAAU,KAAa;AAC9B,QAAM,IAAc,CAAC;AACrB,WAAS,MAAM,GAAmB;AAChC,QAAI,MAAM,KAAK,MAAM,GAAG;AACtB,aAAO;AAAA,IACT;AACA,QAAI,EAAE,CAAC,IAAI,GAAG;AACZ,aAAO,EAAE,CAAC;AAAA,IACZ;AACA,WAAQ,EAAE,CAAC,IAAI,MAAM,IAAI,CAAC,IAAI;AAAA,EAChC;AACA,SAAO,MAAM,GAAG;AAClB;AAGA,IAAO,gCAAQ;","names":[]}
1
+ {"version":3,"sources":["../../index.ts"],"sourcesContent":["import { BBox, FeatureCollection, Point } from \"geojson\";\nimport { area } from \"@turf/area\";\nimport { bbox as turfBBox } from \"@turf/bbox\";\nimport { bboxPolygon } from \"@turf/bbox-polygon\";\nimport { getCoord } from \"@turf/invariant\";\nimport { squareGrid } from \"@turf/square-grid\";\n\ninterface QuadratAnalysisResult {\n criticalValue: number;\n maxAbsoluteDifference: number;\n isRandom: boolean;\n observedDistribution: number[];\n}\n\n/**\n * Quadrat analysis lays a set of equal-size areas(quadrat) over the study area and counts\n * the number of features in each quadrat and creates a frequency table.\n * The table lists the number of quadrats containing no features,\n * the number containing one feature, two features, and so on,\n * all the way up to the quadrat containing the most features.\n * The method then creates the frequency table for the random distribution, usually based on a Poisson distribution.\n * The method uses the distribution to calculate the probability for 0 feature occuring,\n * 1 feature occuring, 2 features, and so on,\n * and lists these probabilities in the frequency table.\n * By comparing the two frequency tables, you can see whether the features create a pattern.\n * If the table for the observed distribution has more quadrats containing many features than the\n * table for the random distribution dose, then the features create a clustered pattern.\n *\n * It is hard to judge the frequency tables are similar or different just by looking at them.\n * So, we can use serval statistical tests to find out how much the frequency tables differ.\n * We use Kolmogorov-Smirnov test.This method calculates cumulative probabilities for both distributions,\n * and then compares the cumulative probabilities at each class level and selects the largest absolute difference D.\n * Then, the test compares D to the critical value for a confidence level you specify.\n * If D is greater than the critical value, the difference between the observed distribution and\n * the random distribution is significant. The greater the value the bigger the difference.\n *\n * Traditionally, squares are used for the shape of the quadrats, in a regular grid(square-grid).\n * Some researchers suggest that the quadrat size equal twice the size of mean area per feature,\n * which is simply the area of the study area divided by the number of features.\n *\n *\n * @function\n * @param {FeatureCollection<Point>} pointFeatureSet point set to study\n * @param {Object} [options={}] optional parameters\n * @param {[number, number, number, number]} [options.studyBbox] bbox representing the study area\n * @param {20 | 15 | 10 | 5 | 2 | 1} [options.confidenceLevel=20] a confidence level.\n * The unit is percentage . 5 means 95%, value must be in {@link K_TABLE}\n * @returns {QuadratAnalysisResult} result\n * @example\n *\n * var bbox = [-65, 40, -63, 42];\n * var dataset = turf.randomPoint(100, { bbox: bbox });\n * var result = turf.quadratAnalysis(dataset);\n *\n */\nfunction quadratAnalysis(\n pointFeatureSet: FeatureCollection<Point>,\n options: {\n studyBbox?: [number, number, number, number];\n confidenceLevel?: 20 | 15 | 10 | 5 | 2 | 1;\n }\n): QuadratAnalysisResult {\n options = options || {};\n const studyBbox = options.studyBbox || turfBBox(pointFeatureSet);\n const confidenceLevel = options.confidenceLevel || 20;\n const points = pointFeatureSet.features;\n\n // create square-grid\n const numOfPoints = points.length;\n const sizeOfArea = area(bboxPolygon(studyBbox));\n const lengthOfSide = Math.sqrt((sizeOfArea / numOfPoints) * 2);\n const grid = squareGrid(studyBbox, lengthOfSide, {\n units: \"meters\",\n });\n const quadrats = grid.features;\n\n // count the number of features in each quadrat\n const quadratIdDict: { [key: string]: { box: BBox; cnt: number } } = {};\n for (let i = 0; i < quadrats.length; i++) {\n quadratIdDict[i] = {\n box: turfBBox(quadrats[i]),\n cnt: 0,\n };\n }\n\n let sumOfPoint = 0;\n for (const pt of points) {\n for (const key of Object.keys(quadratIdDict)) {\n const box = quadratIdDict[key].box;\n if (inBBox(getCoord(pt), box)) {\n quadratIdDict[key].cnt += 1;\n sumOfPoint += 1;\n break;\n }\n }\n }\n\n // the most amount of features in quadrat\n let maxCnt = 0;\n for (const key of Object.keys(quadratIdDict)) {\n const cnt = quadratIdDict[key].cnt;\n if (cnt > maxCnt) {\n maxCnt = cnt;\n }\n }\n\n const expectedDistribution = [];\n const numOfQuadrat = Object.keys(quadratIdDict).length;\n const lambda = sumOfPoint / numOfQuadrat;\n\n // get the cumulative probability of the random distribution\n let cumulativeProbility = 0.0;\n for (let x = 0; x < maxCnt + 1; x++) {\n cumulativeProbility +=\n (Math.exp(-lambda) * Math.pow(lambda, x)) / factorial(x);\n expectedDistribution.push(cumulativeProbility);\n }\n\n // get the cumulative probability of the observed distribution\n const observedDistribution = [];\n let cumulativeObservedQuads = 0;\n for (let x = 0; x < maxCnt + 1; x++) {\n for (const key of Object.keys(quadratIdDict)) {\n if (quadratIdDict[key].cnt === x) {\n cumulativeObservedQuads += 1;\n }\n }\n const p = cumulativeObservedQuads / numOfQuadrat;\n observedDistribution.push(p);\n }\n\n // get the largest absolute difference between two distributions\n let maxDifference = 0;\n for (let x = 0; x < maxCnt + 1; x++) {\n const difference = Math.abs(\n expectedDistribution[x] - observedDistribution[x]\n );\n if (difference > maxDifference) {\n maxDifference = difference;\n }\n }\n\n const k = K_TABLE[confidenceLevel];\n\n // statistical test\n const criticalValue = k / Math.sqrt(numOfQuadrat);\n const result: QuadratAnalysisResult = {\n criticalValue,\n isRandom: true,\n maxAbsoluteDifference: maxDifference,\n observedDistribution,\n };\n\n if (maxDifference > criticalValue) {\n result.isRandom = false;\n }\n\n return result;\n}\n\n/**\n * the confidence level\n *\n * @constant\n * @type {Object}\n * @property {number} 20 1.07275\n * @property {number} 15 1.13795\n * @property {number} 10 1.22385\n * @property {number} 5 1.3581\n * @property {number} 2 1.51743\n * @property {number} 1 1.62762\n */\nconst K_TABLE = {\n 20: 1.07275,\n 15: 1.13795,\n 10: 1.22385,\n 5: 1.3581,\n 2: 1.51743,\n 1: 1.62762,\n};\n\n/**\n * the return type of the quadratAnalysis\n *\n * @typedef {object} QuadratAnalysisResult\n * @property {number} criticalValue\n * @property {number} maxAbsoluteDifference\n * @property {boolean} isRandom\n * @property {Array<number>} observedDistribution the cumulative distribution of observed features,\n * the index represents the number of features in the quadrat.\n */\n\n/**\n * inBBox from @turf/boolean-point-in-polygon\n *\n * @private\n * @param {Array<number>} pt point [x,y]\n * @param {BBox} bbox BBox [west, south, east, north]\n * @returns {boolean} true/false if point is inside BBox\n */\nfunction inBBox(pt: number[], bbox: BBox) {\n return (\n bbox[0] <= pt[0] && bbox[1] <= pt[1] && bbox[2] >= pt[0] && bbox[3] >= pt[1]\n );\n}\n\n/**\n * https://stackoverflow.com/questions/3959211/fast-factorial-function-in-javascript\n * @private\n * @param {number} num Number\n * @returns {number} the factorial of num\n */\nfunction factorial(num: number) {\n const f: number[] = [];\n function inner(n: number): number {\n if (n === 0 || n === 1) {\n return 1;\n }\n if (f[n] > 0) {\n return f[n];\n }\n return (f[n] = inner(n - 1) * n);\n }\n return inner(num);\n}\n\nexport { QuadratAnalysisResult, quadratAnalysis };\nexport default quadratAnalysis;\n"],"mappings":";AACA,SAAS,YAAY;AACrB,SAAS,QAAQ,gBAAgB;AACjC,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAkD3B,SAAS,gBACP,iBACA,SAIuB;AACvB,YAAU,WAAW,CAAC;AACtB,QAAM,YAAY,QAAQ,aAAa,SAAS,eAAe;AAC/D,QAAM,kBAAkB,QAAQ,mBAAmB;AACnD,QAAM,SAAS,gBAAgB;AAG/B,QAAM,cAAc,OAAO;AAC3B,QAAM,aAAa,KAAK,YAAY,SAAS,CAAC;AAC9C,QAAM,eAAe,KAAK,KAAM,aAAa,cAAe,CAAC;AAC7D,QAAM,OAAO,WAAW,WAAW,cAAc;AAAA,IAC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MAAI,gBAAgB;AACpB,WAAS,IAAI,GAAG,IAAI,SAAS,GAAG,KAAK;AACnC,UAAM,aAAa,KAAK;AAAA,MACtB,qBAAqB,CAAC,IAAI,qBAAqB,CAAC;AAAA,IAClD;AACA,QAAI,aAAa,eAAe;AAC9B,sBAAgB;AAAA,IAClB;AAAA,EACF;AAEA,QAAM,IAAI,QAAQ,eAAe;AAGjC,QAAM,gBAAgB,IAAI,KAAK,KAAK,YAAY;AAChD,QAAM,SAAgC;AAAA,IACpC;AAAA,IACA,UAAU;AAAA,IACV,uBAAuB;AAAA,IACvB;AAAA,EACF;AAEA,MAAI,gBAAgB,eAAe;AACjC,WAAO,WAAW;AAAA,EACpB;AAEA,SAAO;AACT;AAcA,IAAM,UAAU;AAAA,EACd,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAqBA,SAAS,OAAO,IAAc,MAAY;AACxC,SACE,KAAK,CAAC,KAAK,GAAG,CAAC,KAAK,KAAK,CAAC,KAAK,GAAG,CAAC,KAAK,KAAK,CAAC,KAAK,GAAG,CAAC,KAAK,KAAK,CAAC,KAAK,GAAG,CAAC;AAE/E;AAQA,SAAS,UAAU,KAAa;AAC9B,QAAM,IAAc,CAAC;AACrB,WAAS,MAAM,GAAmB;AAChC,QAAI,MAAM,KAAK,MAAM,GAAG;AACtB,aAAO;AAAA,IACT;AACA,QAAI,EAAE,CAAC,IAAI,GAAG;AACZ,aAAO,EAAE,CAAC;AAAA,IACZ;AACA,WAAQ,EAAE,CAAC,IAAI,MAAM,IAAI,CAAC,IAAI;AAAA,EAChC;AACA,SAAO,MAAM,GAAG;AAClB;AAGA,IAAO,gBAAQ;","names":[]}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@turf/quadrat-analysis",
3
- "version": "7.2.0",
4
- "description": "turf quadrat-analysis module",
3
+ "version": "7.3.0",
4
+ "description": "Quadrat analysis lays a set of equal-size areas(quadrat) over the study area and counts the number of features in each quadrat and creates a frequency table.",
5
5
  "author": "Turf Authors",
6
6
  "contributors": [
7
7
  "Haoming Zhuang <@zhuang-hao-ming>"
@@ -52,30 +52,30 @@
52
52
  "test:tape": "tsx test.ts"
53
53
  },
54
54
  "devDependencies": {
55
- "@turf/nearest-neighbor-analysis": "^7.2.0",
55
+ "@turf/nearest-neighbor-analysis": "7.3.0",
56
56
  "@types/benchmark": "^2.1.5",
57
- "@types/tape": "^4.13.4",
57
+ "@types/tape": "^5.8.1",
58
58
  "benchmark": "^2.1.4",
59
59
  "load-json-file": "^7.0.1",
60
60
  "npm-run-all": "^4.1.5",
61
61
  "tape": "^5.9.0",
62
- "tsup": "^8.3.5",
63
- "tsx": "^4.19.2",
64
- "typescript": "^5.5.4",
65
- "write-json-file": "^5.0.0"
62
+ "tsup": "^8.4.0",
63
+ "tsx": "^4.19.4",
64
+ "typescript": "^5.8.3",
65
+ "write-json-file": "^6.0.0"
66
66
  },
67
67
  "dependencies": {
68
- "@turf/area": "^7.2.0",
69
- "@turf/bbox": "^7.2.0",
70
- "@turf/bbox-polygon": "^7.2.0",
71
- "@turf/centroid": "^7.2.0",
72
- "@turf/helpers": "^7.2.0",
73
- "@turf/invariant": "^7.2.0",
74
- "@turf/point-grid": "^7.2.0",
75
- "@turf/random": "^7.2.0",
76
- "@turf/square-grid": "^7.2.0",
68
+ "@turf/area": "7.3.0",
69
+ "@turf/bbox": "7.3.0",
70
+ "@turf/bbox-polygon": "7.3.0",
71
+ "@turf/centroid": "7.3.0",
72
+ "@turf/helpers": "7.3.0",
73
+ "@turf/invariant": "7.3.0",
74
+ "@turf/point-grid": "7.3.0",
75
+ "@turf/random": "7.3.0",
76
+ "@turf/square-grid": "7.3.0",
77
77
  "@types/geojson": "^7946.0.10",
78
78
  "tslib": "^2.8.1"
79
79
  },
80
- "gitHead": "7b0f0374c4668cd569f8904c71e2ae7d941be867"
80
+ "gitHead": "9f58a103e8f9a587ab640307ed03ba5233913ddd"
81
81
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@turf/random",
3
- "version": "7.2.0",
4
- "description": "turf random module",
3
+ "version": "7.3.0",
4
+ "description": "Generates random points, lines, or polygons for testing.",
5
5
  "author": "Turf Authors",
6
6
  "license": "MIT",
7
7
  "bugs": {
@@ -50,19 +50,19 @@
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/benchmark": "^2.1.5",
53
- "@types/tape": "^4.13.4",
53
+ "@types/tape": "^5.8.1",
54
54
  "benchmark": "^2.1.4",
55
- "glob": "^10.3.10",
55
+ "glob": "^11.0.2",
56
56
  "npm-run-all": "^4.1.5",
57
57
  "tape": "^5.9.0",
58
- "tsup": "^8.3.5",
59
- "tsx": "^4.19.2",
60
- "typescript": "^5.5.4"
58
+ "tsup": "^8.4.0",
59
+ "tsx": "^4.19.4",
60
+ "typescript": "^5.8.3"
61
61
  },
62
62
  "dependencies": {
63
- "@turf/helpers": "^7.2.0",
63
+ "@turf/helpers": "7.3.0",
64
64
  "@types/geojson": "^7946.0.10",
65
65
  "tslib": "^2.8.1"
66
66
  },
67
- "gitHead": "7b0f0374c4668cd569f8904c71e2ae7d941be867"
67
+ "gitHead": "9f58a103e8f9a587ab640307ed03ba5233913ddd"
68
68
  }
@@ -48,9 +48,9 @@ function rectangleGrid(bbox, cellWidth, cellHeight, options = {}) {
48
48
  }
49
49
  return _helpers.featureCollection.call(void 0, results);
50
50
  }
51
- var turf_rectangle_grid_default = rectangleGrid;
51
+ var index_default = rectangleGrid;
52
52
 
53
53
 
54
54
 
55
- exports.default = turf_rectangle_grid_default; exports.rectangleGrid = rectangleGrid;
55
+ exports.default = index_default; exports.rectangleGrid = rectangleGrid;
56
56
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-rectangle-grid/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACAA,6DAA+C;AAS/C;AACE;AACA;AAC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IAAA,IAAA,CAAA,IAAS,IAAA,EAAM,CAAA,EAAG,IAAA,EAAM,IAAA,EAAM,GAAA,EAAA,EAAO;AACnC,MAAA,MAAM,SAAA,EAAW,8BAAA;AAAA,QACf;AAAA,UACE;AAAA,YACE,CAAC,QAAA,EAAU,QAAQ,CAAA;AAAA,YACnB,CAAC,QAAA,EAAU,SAAA,EAAW,aAAa,CAAA;AAAA,YACnC,CAAC,SAAA,EAAW,YAAA,EAAc,SAAA,EAAW,aAAa,CAAA;AAAA,YAClD,CAAC,SAAA,EAAW,YAAA,EAAc,QAAQ,CAAA;AAAA,YAClC,CAAC,QAAA,EAAU,QAAQ;AAAA,UACrB;AAAA,QACF,CAAA;AAAA,QACA,OAAA,CAAQ;AAAA,MACV,CAAA;AACA,MAAA,GAAA,CAAI,OAAA,CAAQ,IAAA,EAAM;AAChB,QAAA,GAAA,CAAI,kDAAA,OAAU,CAAQ,IAAA,EAAM,QAAQ,CAAA,EAAG;AACrC,UAAA,OAAA,CAAQ,IAAA,CAAK,QAAQ,CAAA;AAAA,QACvB;AAAA,MACF,EAAA,KAAO;AACL,QAAA,OAAA,CAAQ,IAAA,CAAK,QAAQ,CAAA;AAAA,MACvB;AAEA,MAAA,SAAA,GAAY,aAAA;AAAA,IACd;AACA,IAAA,SAAA,GAAY,YAAA;AAAA,EACd;AACA,EAAA,OAAO,wCAAA,OAAyB,CAAA;AAClC;AAGA,IAAO,4BAAA,EAAQ,aAAA;ADtDf;AACE;AACA;AACF,qFAAC","file":"/home/runner/work/turf/turf/packages/turf-rectangle-grid/dist/cjs/index.cjs","sourcesContent":[null,"import { booleanIntersects as intersect } from \"@turf/boolean-intersects\";\nimport {\n BBox,\n Feature,\n FeatureCollection,\n MultiPolygon,\n Polygon,\n GeoJsonProperties,\n} from \"geojson\";\nimport {\n convertLength,\n featureCollection,\n polygon,\n Units,\n} from \"@turf/helpers\";\n/**\n * Creates a grid of rectangular polygons with width and height consistent in degrees\n *\n * @function\n * @param {BBox} bbox extent of grid in [minX, minY, maxX, maxY] order. If the grid does not fill the bbox perfectly, it is centered.\n * @param {number} cellWidth width of each cell, in units\n * @param {number} cellHeight height of each cell, in units\n * @param {Object} [options={}] Optional parameters\n * @param {Units} [options.units='kilometers'] the units of the cell width and height value.\n * Supports all valid Turf {@link https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md Units}.\n * If you are looking for rectangles with equal width and height in linear units (e.g. kilometers) this is not the module for you.\n * The cellWidth and cellHeight is converted from units provided to degrees internally, so the width and height of resulting polygons will be consistent only in degrees.\n * @param {Feature<Polygon|MultiPolygon>} [options.mask] if passed a Polygon or MultiPolygon,\n * the grid Points will be created only inside it\n * @param {Object} [options.properties={}] passed to each point of the grid\n * @returns {FeatureCollection<Polygon>} a grid of polygons\n * @example\n * var bbox = [-95, 30 ,-85, 40];\n * var cellWidth = 50;\n * var cellHeight = 20;\n * var options = {units: 'miles'};\n *\n * var rectangleGrid = turf.rectangleGrid(bbox, cellWidth, cellHeight, options);\n *\n * //addToMap\n * var addToMap = [rectangleGrid]\n */\nfunction rectangleGrid<P extends GeoJsonProperties = GeoJsonProperties>(\n bbox: BBox,\n cellWidth: number,\n cellHeight: number,\n options: {\n units?: Units;\n properties?: P;\n mask?: Feature<Polygon | MultiPolygon> | Polygon | MultiPolygon;\n } = {}\n): FeatureCollection<Polygon, P> {\n // Containers\n const results = [];\n const west = bbox[0];\n const south = bbox[1];\n const east = bbox[2];\n const north = bbox[3];\n\n const bboxWidth = east - west;\n const cellWidthDeg = convertLength(cellWidth, options.units, \"degrees\");\n\n const bboxHeight = north - south;\n const cellHeightDeg = convertLength(cellHeight, options.units, \"degrees\");\n\n const columns = Math.floor(Math.abs(bboxWidth) / cellWidthDeg);\n const rows = Math.floor(Math.abs(bboxHeight) / cellHeightDeg);\n\n // if the grid does not fill the bbox perfectly, center it.\n const deltaX = (bboxWidth - columns * cellWidthDeg) / 2;\n const deltaY = (bboxHeight - rows * cellHeightDeg) / 2;\n\n // iterate over columns & rows\n let currentX = west + deltaX;\n for (let column = 0; column < columns; column++) {\n let currentY = south + deltaY;\n for (let row = 0; row < rows; row++) {\n const cellPoly = polygon(\n [\n [\n [currentX, currentY],\n [currentX, currentY + cellHeightDeg],\n [currentX + cellWidthDeg, currentY + cellHeightDeg],\n [currentX + cellWidthDeg, currentY],\n [currentX, currentY],\n ],\n ],\n options.properties\n );\n if (options.mask) {\n if (intersect(options.mask, cellPoly)) {\n results.push(cellPoly);\n }\n } else {\n results.push(cellPoly);\n }\n\n currentY += cellHeightDeg;\n }\n currentX += cellWidthDeg;\n }\n return featureCollection(results);\n}\n\nexport { rectangleGrid };\nexport default rectangleGrid;\n"]}
1
+ {"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-rectangle-grid/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACAA,6DAA+C;AAS/C;AACE;AACA;AACA;AAAA,wCAEK;AA4BP,SAAS,aAAA,CACP,IAAA,EACA,SAAA,EACA,UAAA,EACA,QAAA,EAII,CAAC,CAAA,EAC0B;AAE/B,EAAA,MAAM,QAAA,EAAU,CAAC,CAAA;AACjB,EAAA,MAAM,KAAA,EAAO,IAAA,CAAK,CAAC,CAAA;AACnB,EAAA,MAAM,MAAA,EAAQ,IAAA,CAAK,CAAC,CAAA;AACpB,EAAA,MAAM,KAAA,EAAO,IAAA,CAAK,CAAC,CAAA;AACnB,EAAA,MAAM,MAAA,EAAQ,IAAA,CAAK,CAAC,CAAA;AAEpB,EAAA,MAAM,UAAA,EAAY,KAAA,EAAO,IAAA;AACzB,EAAA,MAAM,aAAA,EAAe,oCAAA,SAAc,EAAW,OAAA,CAAQ,KAAA,EAAO,SAAS,CAAA;AAEtE,EAAA,MAAM,WAAA,EAAa,MAAA,EAAQ,KAAA;AAC3B,EAAA,MAAM,cAAA,EAAgB,oCAAA,UAAc,EAAY,OAAA,CAAQ,KAAA,EAAO,SAAS,CAAA;AAExE,EAAA,MAAM,QAAA,EAAU,IAAA,CA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AAO;AACL,QAAA,OAAA,CAAQ,IAAA,CAAK,QAAQ,CAAA;AAAA,MACvB;AAEA,MAAA,SAAA,GAAY,aAAA;AAAA,IACd;AACA,IAAA,SAAA,GAAY,YAAA;AAAA,EACd;AACA,EAAA,OAAO,wCAAA,OAAyB,CAAA;AAClC;AAGA,IAAO,cAAA,EAAQ,aAAA;ADtDf;AACE;AACA;AACF,uEAAC","file":"/home/runner/work/turf/turf/packages/turf-rectangle-grid/dist/cjs/index.cjs","sourcesContent":[null,"import { booleanIntersects as intersect } from \"@turf/boolean-intersects\";\nimport {\n BBox,\n Feature,\n FeatureCollection,\n MultiPolygon,\n Polygon,\n GeoJsonProperties,\n} from \"geojson\";\nimport {\n convertLength,\n featureCollection,\n polygon,\n Units,\n} from \"@turf/helpers\";\n/**\n * Creates a grid of rectangular polygons with width and height consistent in degrees\n *\n * @function\n * @param {BBox} bbox extent of grid in [minX, minY, maxX, maxY] order. If the grid does not fill the bbox perfectly, it is centered.\n * @param {number} cellWidth width of each cell, in units\n * @param {number} cellHeight height of each cell, in units\n * @param {Object} [options={}] Optional parameters\n * @param {Units} [options.units='kilometers'] the units of the cell width and height value.\n * Supports all valid Turf {@link https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md Units}.\n * If you are looking for rectangles with equal width and height in linear units (e.g. kilometers) this is not the module for you.\n * The cellWidth and cellHeight is converted from units provided to degrees internally, so the width and height of resulting polygons will be consistent only in degrees.\n * @param {Feature<Polygon|MultiPolygon>} [options.mask] if passed a Polygon or MultiPolygon,\n * the grid Points will be created only inside it\n * @param {Object} [options.properties={}] passed to each point of the grid\n * @returns {FeatureCollection<Polygon>} a grid of polygons\n * @example\n * var bbox = [-95, 30 ,-85, 40];\n * var cellWidth = 50;\n * var cellHeight = 20;\n * var options = {units: 'miles'};\n *\n * var rectangleGrid = turf.rectangleGrid(bbox, cellWidth, cellHeight, options);\n *\n * //addToMap\n * var addToMap = [rectangleGrid]\n */\nfunction rectangleGrid<P extends GeoJsonProperties = GeoJsonProperties>(\n bbox: BBox,\n cellWidth: number,\n cellHeight: number,\n options: {\n units?: Units;\n properties?: P;\n mask?: Feature<Polygon | MultiPolygon> | Polygon | MultiPolygon;\n } = {}\n): FeatureCollection<Polygon, P> {\n // Containers\n const results = [];\n const west = bbox[0];\n const south = bbox[1];\n const east = bbox[2];\n const north = bbox[3];\n\n const bboxWidth = east - west;\n const cellWidthDeg = convertLength(cellWidth, options.units, \"degrees\");\n\n const bboxHeight = north - south;\n const cellHeightDeg = convertLength(cellHeight, options.units, \"degrees\");\n\n const columns = Math.floor(Math.abs(bboxWidth) / cellWidthDeg);\n const rows = Math.floor(Math.abs(bboxHeight) / cellHeightDeg);\n\n // if the grid does not fill the bbox perfectly, center it.\n const deltaX = (bboxWidth - columns * cellWidthDeg) / 2;\n const deltaY = (bboxHeight - rows * cellHeightDeg) / 2;\n\n // iterate over columns & rows\n let currentX = west + deltaX;\n for (let column = 0; column < columns; column++) {\n let currentY = south + deltaY;\n for (let row = 0; row < rows; row++) {\n const cellPoly = polygon(\n [\n [\n [currentX, currentY],\n [currentX, currentY + cellHeightDeg],\n [currentX + cellWidthDeg, currentY + cellHeightDeg],\n [currentX + cellWidthDeg, currentY],\n [currentX, currentY],\n ],\n ],\n options.properties\n );\n if (options.mask) {\n if (intersect(options.mask, cellPoly)) {\n results.push(cellPoly);\n }\n } else {\n results.push(cellPoly);\n }\n\n currentY += cellHeightDeg;\n }\n currentX += cellWidthDeg;\n }\n return featureCollection(results);\n}\n\nexport { rectangleGrid };\nexport default rectangleGrid;\n"]}
@@ -48,9 +48,9 @@ function rectangleGrid(bbox, cellWidth, cellHeight, options = {}) {
48
48
  }
49
49
  return featureCollection(results);
50
50
  }
51
- var turf_rectangle_grid_default = rectangleGrid;
51
+ var index_default = rectangleGrid;
52
52
  export {
53
- turf_rectangle_grid_default as default,
53
+ index_default as default,
54
54
  rectangleGrid
55
55
  };
56
56
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts"],"sourcesContent":["import { booleanIntersects as intersect } from \"@turf/boolean-intersects\";\nimport {\n BBox,\n Feature,\n FeatureCollection,\n MultiPolygon,\n Polygon,\n GeoJsonProperties,\n} from \"geojson\";\nimport {\n convertLength,\n featureCollection,\n polygon,\n Units,\n} from \"@turf/helpers\";\n/**\n * Creates a grid of rectangular polygons with width and height consistent in degrees\n *\n * @function\n * @param {BBox} bbox extent of grid in [minX, minY, maxX, maxY] order. If the grid does not fill the bbox perfectly, it is centered.\n * @param {number} cellWidth width of each cell, in units\n * @param {number} cellHeight height of each cell, in units\n * @param {Object} [options={}] Optional parameters\n * @param {Units} [options.units='kilometers'] the units of the cell width and height value.\n * Supports all valid Turf {@link https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md Units}.\n * If you are looking for rectangles with equal width and height in linear units (e.g. kilometers) this is not the module for you.\n * The cellWidth and cellHeight is converted from units provided to degrees internally, so the width and height of resulting polygons will be consistent only in degrees.\n * @param {Feature<Polygon|MultiPolygon>} [options.mask] if passed a Polygon or MultiPolygon,\n * the grid Points will be created only inside it\n * @param {Object} [options.properties={}] passed to each point of the grid\n * @returns {FeatureCollection<Polygon>} a grid of polygons\n * @example\n * var bbox = [-95, 30 ,-85, 40];\n * var cellWidth = 50;\n * var cellHeight = 20;\n * var options = {units: 'miles'};\n *\n * var rectangleGrid = turf.rectangleGrid(bbox, cellWidth, cellHeight, options);\n *\n * //addToMap\n * var addToMap = [rectangleGrid]\n */\nfunction rectangleGrid<P extends GeoJsonProperties = GeoJsonProperties>(\n bbox: BBox,\n cellWidth: number,\n cellHeight: number,\n options: {\n units?: Units;\n properties?: P;\n mask?: Feature<Polygon | MultiPolygon> | Polygon | MultiPolygon;\n } = {}\n): FeatureCollection<Polygon, P> {\n // Containers\n const results = [];\n const west = bbox[0];\n const south = bbox[1];\n const east = bbox[2];\n const north = bbox[3];\n\n const bboxWidth = east - west;\n const cellWidthDeg = convertLength(cellWidth, options.units, \"degrees\");\n\n const bboxHeight = north - south;\n const cellHeightDeg = convertLength(cellHeight, options.units, \"degrees\");\n\n const columns = Math.floor(Math.abs(bboxWidth) / cellWidthDeg);\n const rows = Math.floor(Math.abs(bboxHeight) / cellHeightDeg);\n\n // if the grid does not fill the bbox perfectly, center it.\n const deltaX = (bboxWidth - columns * cellWidthDeg) / 2;\n const deltaY = (bboxHeight - rows * cellHeightDeg) / 2;\n\n // iterate over columns & rows\n let currentX = west + deltaX;\n for (let column = 0; column < columns; column++) {\n let currentY = south + deltaY;\n for (let row = 0; row < rows; row++) {\n const cellPoly = polygon(\n [\n [\n [currentX, currentY],\n [currentX, currentY + cellHeightDeg],\n [currentX + cellWidthDeg, currentY + cellHeightDeg],\n [currentX + cellWidthDeg, currentY],\n [currentX, currentY],\n ],\n ],\n options.properties\n );\n if (options.mask) {\n if (intersect(options.mask, cellPoly)) {\n results.push(cellPoly);\n }\n } else {\n results.push(cellPoly);\n }\n\n currentY += cellHeightDeg;\n }\n currentX += cellWidthDeg;\n }\n return featureCollection(results);\n}\n\nexport { rectangleGrid };\nexport default rectangleGrid;\n"],"mappings":";AAAA,SAAS,qBAAqB,iBAAiB;AAS/C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AA4BP,SAAS,cACP,MACA,WACA,YACA,UAII,CAAC,GAC0B;AAE/B,QAAM,UAAU,CAAC;AACjB,QAAM,OAAO,KAAK,CAAC;AACnB,QAAM,QAAQ,KAAK,CAAC;AACpB,QAAM,OAAO,KAAK,CAAC;AACnB,QAAM,QAAQ,KAAK,CAAC;AAEpB,QAAM,YAAY,OAAO;AACzB,QAAM,eAAe,cAAc,WAAW,QAAQ,OAAO,SAAS;AAEtE,QAAM,aAAa,QAAQ;AAC3B,QAAM,gBAAgB,cAAc,YAAY,QAAQ,OAAO,SAAS;AAExE,QAAM,UAAU,KAAK,MAAM,KAAK,IAAI,SAAS,IAAI,YAAY;AAC7D,QAAM,OAAO,KAAK,MAAM,KAAK,IAAI,UAAU,IAAI,aAAa;AAG5D,QAAM,UAAU,YAAY,UAAU,gBAAgB;AACtD,QAAM,UAAU,aAAa,OAAO,iBAAiB;AAGrD,MAAI,WAAW,OAAO;AACtB,WAAS,SAAS,GAAG,SAAS,SAAS,UAAU;AAC/C,QAAI,WAAW,QAAQ;AACvB,aAAS,MAAM,GAAG,MAAM,MAAM,OAAO;AACnC,YAAM,WAAW;AAAA,QACf;AAAA,UACE;AAAA,YACE,CAAC,UAAU,QAAQ;AAAA,YACnB,CAAC,UAAU,WAAW,aAAa;AAAA,YACnC,CAAC,WAAW,cAAc,WAAW,aAAa;AAAA,YAClD,CAAC,WAAW,cAAc,QAAQ;AAAA,YAClC,CAAC,UAAU,QAAQ;AAAA,UACrB;AAAA,QACF;AAAA,QACA,QAAQ;AAAA,MACV;AACA,UAAI,QAAQ,MAAM;AAChB,YAAI,UAAU,QAAQ,MAAM,QAAQ,GAAG;AACrC,kBAAQ,KAAK,QAAQ;AAAA,QACvB;AAAA,MACF,OAAO;AACL,gBAAQ,KAAK,QAAQ;AAAA,MACvB;AAEA,kBAAY;AAAA,IACd;AACA,gBAAY;AAAA,EACd;AACA,SAAO,kBAAkB,OAAO;AAClC;AAGA,IAAO,8BAAQ;","names":[]}
1
+ {"version":3,"sources":["../../index.ts"],"sourcesContent":["import { booleanIntersects as intersect } from \"@turf/boolean-intersects\";\nimport {\n BBox,\n Feature,\n FeatureCollection,\n MultiPolygon,\n Polygon,\n GeoJsonProperties,\n} from \"geojson\";\nimport {\n convertLength,\n featureCollection,\n polygon,\n Units,\n} from \"@turf/helpers\";\n/**\n * Creates a grid of rectangular polygons with width and height consistent in degrees\n *\n * @function\n * @param {BBox} bbox extent of grid in [minX, minY, maxX, maxY] order. If the grid does not fill the bbox perfectly, it is centered.\n * @param {number} cellWidth width of each cell, in units\n * @param {number} cellHeight height of each cell, in units\n * @param {Object} [options={}] Optional parameters\n * @param {Units} [options.units='kilometers'] the units of the cell width and height value.\n * Supports all valid Turf {@link https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md Units}.\n * If you are looking for rectangles with equal width and height in linear units (e.g. kilometers) this is not the module for you.\n * The cellWidth and cellHeight is converted from units provided to degrees internally, so the width and height of resulting polygons will be consistent only in degrees.\n * @param {Feature<Polygon|MultiPolygon>} [options.mask] if passed a Polygon or MultiPolygon,\n * the grid Points will be created only inside it\n * @param {Object} [options.properties={}] passed to each point of the grid\n * @returns {FeatureCollection<Polygon>} a grid of polygons\n * @example\n * var bbox = [-95, 30 ,-85, 40];\n * var cellWidth = 50;\n * var cellHeight = 20;\n * var options = {units: 'miles'};\n *\n * var rectangleGrid = turf.rectangleGrid(bbox, cellWidth, cellHeight, options);\n *\n * //addToMap\n * var addToMap = [rectangleGrid]\n */\nfunction rectangleGrid<P extends GeoJsonProperties = GeoJsonProperties>(\n bbox: BBox,\n cellWidth: number,\n cellHeight: number,\n options: {\n units?: Units;\n properties?: P;\n mask?: Feature<Polygon | MultiPolygon> | Polygon | MultiPolygon;\n } = {}\n): FeatureCollection<Polygon, P> {\n // Containers\n const results = [];\n const west = bbox[0];\n const south = bbox[1];\n const east = bbox[2];\n const north = bbox[3];\n\n const bboxWidth = east - west;\n const cellWidthDeg = convertLength(cellWidth, options.units, \"degrees\");\n\n const bboxHeight = north - south;\n const cellHeightDeg = convertLength(cellHeight, options.units, \"degrees\");\n\n const columns = Math.floor(Math.abs(bboxWidth) / cellWidthDeg);\n const rows = Math.floor(Math.abs(bboxHeight) / cellHeightDeg);\n\n // if the grid does not fill the bbox perfectly, center it.\n const deltaX = (bboxWidth - columns * cellWidthDeg) / 2;\n const deltaY = (bboxHeight - rows * cellHeightDeg) / 2;\n\n // iterate over columns & rows\n let currentX = west + deltaX;\n for (let column = 0; column < columns; column++) {\n let currentY = south + deltaY;\n for (let row = 0; row < rows; row++) {\n const cellPoly = polygon(\n [\n [\n [currentX, currentY],\n [currentX, currentY + cellHeightDeg],\n [currentX + cellWidthDeg, currentY + cellHeightDeg],\n [currentX + cellWidthDeg, currentY],\n [currentX, currentY],\n ],\n ],\n options.properties\n );\n if (options.mask) {\n if (intersect(options.mask, cellPoly)) {\n results.push(cellPoly);\n }\n } else {\n results.push(cellPoly);\n }\n\n currentY += cellHeightDeg;\n }\n currentX += cellWidthDeg;\n }\n return featureCollection(results);\n}\n\nexport { rectangleGrid };\nexport default rectangleGrid;\n"],"mappings":";AAAA,SAAS,qBAAqB,iBAAiB;AAS/C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AA4BP,SAAS,cACP,MACA,WACA,YACA,UAII,CAAC,GAC0B;AAE/B,QAAM,UAAU,CAAC;AACjB,QAAM,OAAO,KAAK,CAAC;AACnB,QAAM,QAAQ,KAAK,CAAC;AACpB,QAAM,OAAO,KAAK,CAAC;AACnB,QAAM,QAAQ,KAAK,CAAC;AAEpB,QAAM,YAAY,OAAO;AACzB,QAAM,eAAe,cAAc,WAAW,QAAQ,OAAO,SAAS;AAEtE,QAAM,aAAa,QAAQ;AAC3B,QAAM,gBAAgB,cAAc,YAAY,QAAQ,OAAO,SAAS;AAExE,QAAM,UAAU,KAAK,MAAM,KAAK,IAAI,SAAS,IAAI,YAAY;AAC7D,QAAM,OAAO,KAAK,MAAM,KAAK,IAAI,UAAU,IAAI,aAAa;AAG5D,QAAM,UAAU,YAAY,UAAU,gBAAgB;AACtD,QAAM,UAAU,aAAa,OAAO,iBAAiB;AAGrD,MAAI,WAAW,OAAO;AACtB,WAAS,SAAS,GAAG,SAAS,SAAS,UAAU;AAC/C,QAAI,WAAW,QAAQ;AACvB,aAAS,MAAM,GAAG,MAAM,MAAM,OAAO;AACnC,YAAM,WAAW;AAAA,QACf;AAAA,UACE;AAAA,YACE,CAAC,UAAU,QAAQ;AAAA,YACnB,CAAC,UAAU,WAAW,aAAa;AAAA,YACnC,CAAC,WAAW,cAAc,WAAW,aAAa;AAAA,YAClD,CAAC,WAAW,cAAc,QAAQ;AAAA,YAClC,CAAC,UAAU,QAAQ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