@loaders.gl/tiles 5.0.0-alpha.11 → 5.0.0-alpha.13

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 (698) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +18 -72
  3. package/dist/dist.dev.js +5874 -23815
  4. package/dist/dist.min.js +3 -3
  5. package/dist/image-set.d.ts +1 -1
  6. package/dist/image-set.d.ts.map +1 -1
  7. package/dist/index.cjs +2803 -10209
  8. package/dist/index.cjs.map +3 -3
  9. package/dist/index.d.ts +4 -43
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +3 -26
  12. package/dist/index.js.map +1 -1
  13. package/dist/mlt/bundled.d.ts +3 -0
  14. package/dist/mlt/bundled.d.ts.map +1 -0
  15. package/dist/mlt/bundled.js +5 -0
  16. package/dist/mlt/bundled.js.map +1 -0
  17. package/dist/mlt/index.cjs +3701 -0
  18. package/dist/mlt/index.cjs.map +6 -0
  19. package/dist/mlt/index.d.ts +10 -0
  20. package/dist/mlt/index.d.ts.map +1 -0
  21. package/dist/mlt/index.js +12 -0
  22. package/dist/mlt/index.js.map +1 -0
  23. package/dist/mlt/lib/encode-mlt-geometry.d.ts +6 -0
  24. package/dist/mlt/lib/encode-mlt-geometry.d.ts.map +1 -0
  25. package/dist/mlt/lib/encode-mlt-geometry.js +150 -0
  26. package/dist/mlt/lib/encode-mlt-geometry.js.map +1 -0
  27. package/dist/mlt/lib/encode-mlt-streams.d.ts +13 -0
  28. package/dist/mlt/lib/encode-mlt-streams.d.ts.map +1 -0
  29. package/dist/mlt/lib/encode-mlt-streams.js +57 -0
  30. package/dist/mlt/lib/encode-mlt-streams.js.map +1 -0
  31. package/dist/mlt/lib/encode-mlt.d.ts +6 -0
  32. package/dist/mlt/lib/encode-mlt.d.ts.map +1 -0
  33. package/dist/mlt/lib/encode-mlt.js +174 -0
  34. package/dist/mlt/lib/encode-mlt.js.map +1 -0
  35. package/dist/mlt/lib/parse-mlt.d.ts +11 -0
  36. package/dist/mlt/lib/parse-mlt.d.ts.map +1 -0
  37. package/dist/mlt/lib/parse-mlt.js +675 -0
  38. package/dist/mlt/lib/parse-mlt.js.map +1 -0
  39. package/dist/mlt/mlt-format.d.ts +14 -0
  40. package/dist/mlt/mlt-format.d.ts.map +1 -0
  41. package/dist/mlt/mlt-format.js +17 -0
  42. package/dist/mlt/mlt-format.js.map +1 -0
  43. package/dist/mlt/mlt-loader-with-parser.d.ts +91 -0
  44. package/dist/mlt/mlt-loader-with-parser.d.ts.map +1 -0
  45. package/dist/mlt/mlt-loader-with-parser.js +29 -0
  46. package/dist/mlt/mlt-loader-with-parser.js.map +1 -0
  47. package/dist/mlt/mlt-loader.d.ts +115 -0
  48. package/dist/mlt/mlt-loader.d.ts.map +1 -0
  49. package/dist/mlt/mlt-loader.js +38 -0
  50. package/dist/mlt/mlt-loader.js.map +1 -0
  51. package/dist/mlt/mlt-source-loader.d.ts +82 -0
  52. package/dist/mlt/mlt-source-loader.d.ts.map +1 -0
  53. package/dist/mlt/mlt-source-loader.js +179 -0
  54. package/dist/mlt/mlt-source-loader.js.map +1 -0
  55. package/dist/mlt/mlt-writer.d.ts +45 -0
  56. package/dist/mlt/mlt-writer.d.ts.map +1 -0
  57. package/dist/mlt/mlt-writer.js +21 -0
  58. package/dist/mlt/mlt-writer.js.map +1 -0
  59. package/dist/mlt/unbundled.d.ts +3 -0
  60. package/dist/mlt/unbundled.d.ts.map +1 -0
  61. package/dist/mlt/unbundled.js +5 -0
  62. package/dist/mlt/unbundled.js.map +1 -0
  63. package/dist/mvt/arrow-table-tile-source-loader-types.d.ts +36 -0
  64. package/dist/mvt/arrow-table-tile-source-loader-types.d.ts.map +1 -0
  65. package/dist/mvt/arrow-table-tile-source-loader-types.js +36 -0
  66. package/dist/mvt/arrow-table-tile-source-loader-types.js.map +1 -0
  67. package/dist/mvt/arrow-table-tile-source-loader.cjs +6343 -0
  68. package/dist/mvt/arrow-table-tile-source-loader.cjs.map +6 -0
  69. package/dist/mvt/arrow-table-tile-source-loader.d.ts +69 -0
  70. package/dist/mvt/arrow-table-tile-source-loader.d.ts.map +1 -0
  71. package/dist/mvt/arrow-table-tile-source-loader.js +216 -0
  72. package/dist/mvt/arrow-table-tile-source-loader.js.map +1 -0
  73. package/dist/mvt/arrow-table-tile-source-types.d.ts +21 -0
  74. package/dist/mvt/arrow-table-tile-source-types.d.ts.map +1 -0
  75. package/dist/mvt/arrow-table-tile-source-types.js +6 -0
  76. package/dist/mvt/arrow-table-tile-source-types.js.map +1 -0
  77. package/dist/mvt/bundled.d.ts +6 -0
  78. package/dist/mvt/bundled.d.ts.map +1 -0
  79. package/dist/mvt/bundled.js +7 -0
  80. package/dist/mvt/bundled.js.map +1 -0
  81. package/dist/mvt/dist.dev.js +46689 -0
  82. package/dist/mvt/dist.min.js +94 -0
  83. package/dist/mvt/index.cjs +10095 -0
  84. package/dist/mvt/index.cjs.map +6 -0
  85. package/dist/mvt/index.d.ts +28 -0
  86. package/dist/mvt/index.d.ts.map +1 -0
  87. package/dist/mvt/index.js +27 -0
  88. package/dist/mvt/index.js.map +1 -0
  89. package/dist/mvt/lib/encode-mvt-arrow.d.ts +6 -0
  90. package/dist/mvt/lib/encode-mvt-arrow.d.ts.map +1 -0
  91. package/dist/mvt/lib/encode-mvt-arrow.js +225 -0
  92. package/dist/mvt/lib/encode-mvt-arrow.js.map +1 -0
  93. package/dist/mvt/lib/encode-mvt.d.ts +30 -0
  94. package/dist/mvt/lib/encode-mvt.d.ts.map +1 -0
  95. package/dist/mvt/lib/encode-mvt.js +20 -0
  96. package/dist/mvt/lib/encode-mvt.js.map +1 -0
  97. package/dist/mvt/lib/get-schemas-from-tilejson.d.ts +4 -0
  98. package/dist/mvt/lib/get-schemas-from-tilejson.d.ts.map +1 -0
  99. package/dist/mvt/lib/get-schemas-from-tilejson.js +56 -0
  100. package/dist/mvt/lib/get-schemas-from-tilejson.js.map +1 -0
  101. package/dist/mvt/lib/is-longitude-latitude-crs.d.ts +3 -0
  102. package/dist/mvt/lib/is-longitude-latitude-crs.d.ts.map +1 -0
  103. package/dist/mvt/lib/is-longitude-latitude-crs.js +13 -0
  104. package/dist/mvt/lib/is-longitude-latitude-crs.js.map +1 -0
  105. package/dist/mvt/lib/mapbox-vt-pbf/geojson-wrapper.d.ts +25 -0
  106. package/dist/mvt/lib/mapbox-vt-pbf/geojson-wrapper.d.ts.map +1 -0
  107. package/dist/mvt/lib/mapbox-vt-pbf/geojson-wrapper.js +73 -0
  108. package/dist/mvt/lib/mapbox-vt-pbf/geojson-wrapper.js.map +1 -0
  109. package/dist/mvt/lib/mapbox-vt-pbf/to-vector-tile.d.ts +52 -0
  110. package/dist/mvt/lib/mapbox-vt-pbf/to-vector-tile.d.ts.map +1 -0
  111. package/dist/mvt/lib/mapbox-vt-pbf/to-vector-tile.js +165 -0
  112. package/dist/mvt/lib/mapbox-vt-pbf/to-vector-tile.js.map +1 -0
  113. package/dist/mvt/lib/mvt-pbf/mvt-constants.d.ts +116 -0
  114. package/dist/mvt/lib/mvt-pbf/mvt-constants.d.ts.map +1 -0
  115. package/dist/mvt/lib/mvt-pbf/mvt-constants.js +127 -0
  116. package/dist/mvt/lib/mvt-pbf/mvt-constants.js.map +1 -0
  117. package/dist/mvt/lib/mvt-pbf/mvt-types.d.ts +17 -0
  118. package/dist/mvt/lib/mvt-pbf/mvt-types.d.ts.map +1 -0
  119. package/dist/mvt/lib/mvt-pbf/mvt-types.js +5 -0
  120. package/dist/mvt/lib/mvt-pbf/mvt-types.js.map +1 -0
  121. package/dist/mvt/lib/mvt-pbf/parse-geometry-from-pbf.d.ts +77 -0
  122. package/dist/mvt/lib/mvt-pbf/parse-geometry-from-pbf.d.ts.map +1 -0
  123. package/dist/mvt/lib/mvt-pbf/parse-geometry-from-pbf.js +235 -0
  124. package/dist/mvt/lib/mvt-pbf/parse-geometry-from-pbf.js.map +1 -0
  125. package/dist/mvt/lib/mvt-pbf/parse-mvt-from-pbf.d.ts +25 -0
  126. package/dist/mvt/lib/mvt-pbf/parse-mvt-from-pbf.d.ts.map +1 -0
  127. package/dist/mvt/lib/mvt-pbf/parse-mvt-from-pbf.js +263 -0
  128. package/dist/mvt/lib/mvt-pbf/parse-mvt-from-pbf.js.map +1 -0
  129. package/dist/mvt/lib/mvt-pbf/write-mvt-to-pbf.d.ts +4 -0
  130. package/dist/mvt/lib/mvt-pbf/write-mvt-to-pbf.d.ts.map +1 -0
  131. package/dist/mvt/lib/mvt-pbf/write-mvt-to-pbf.js +134 -0
  132. package/dist/mvt/lib/mvt-pbf/write-mvt-to-pbf.js.map +1 -0
  133. package/dist/mvt/lib/mvt-worker-transport.d.ts +15 -0
  134. package/dist/mvt/lib/mvt-worker-transport.d.ts.map +1 -0
  135. package/dist/mvt/lib/mvt-worker-transport.js +54 -0
  136. package/dist/mvt/lib/mvt-worker-transport.js.map +1 -0
  137. package/dist/mvt/lib/parse-mvt-geojson.d.ts +6 -0
  138. package/dist/mvt/lib/parse-mvt-geojson.d.ts.map +1 -0
  139. package/dist/mvt/lib/parse-mvt-geojson.js +48 -0
  140. package/dist/mvt/lib/parse-mvt-geojson.js.map +1 -0
  141. package/dist/mvt/lib/parse-mvt.d.ts +14 -0
  142. package/dist/mvt/lib/parse-mvt.d.ts.map +1 -0
  143. package/dist/mvt/lib/parse-mvt.js +105 -0
  144. package/dist/mvt/lib/parse-mvt.js.map +1 -0
  145. package/dist/mvt/lib/parse-tilejson.d.ts +74 -0
  146. package/dist/mvt/lib/parse-tilejson.d.ts.map +1 -0
  147. package/dist/mvt/lib/parse-tilejson.js +267 -0
  148. package/dist/mvt/lib/parse-tilejson.js.map +1 -0
  149. package/dist/mvt/lib/resolve-table-tile-parameters.d.ts +4 -0
  150. package/dist/mvt/lib/resolve-table-tile-parameters.d.ts.map +1 -0
  151. package/dist/mvt/lib/resolve-table-tile-parameters.js +16 -0
  152. package/dist/mvt/lib/resolve-table-tile-parameters.js.map +1 -0
  153. package/dist/mvt/lib/types.d.ts +88 -0
  154. package/dist/mvt/lib/types.d.ts.map +1 -0
  155. package/dist/mvt/lib/types.js.map +1 -0
  156. package/dist/mvt/lib/utils/geometry-utils.d.ts +83 -0
  157. package/dist/mvt/lib/utils/geometry-utils.d.ts.map +1 -0
  158. package/dist/mvt/lib/utils/geometry-utils.js +211 -0
  159. package/dist/mvt/lib/utils/geometry-utils.js.map +1 -0
  160. package/dist/mvt/lib/vector-tile/vector-tile-feature.d.ts +72 -0
  161. package/dist/mvt/lib/vector-tile/vector-tile-feature.d.ts.map +1 -0
  162. package/dist/mvt/lib/vector-tile/vector-tile-feature.js +350 -0
  163. package/dist/mvt/lib/vector-tile/vector-tile-feature.js.map +1 -0
  164. package/dist/mvt/lib/vector-tile/vector-tile-layer.d.ts +29 -0
  165. package/dist/mvt/lib/vector-tile/vector-tile-layer.d.ts.map +1 -0
  166. package/dist/mvt/lib/vector-tile/vector-tile-layer.js +108 -0
  167. package/dist/mvt/lib/vector-tile/vector-tile-layer.js.map +1 -0
  168. package/dist/mvt/lib/vector-tile/vector-tile.d.ts +9 -0
  169. package/dist/mvt/lib/vector-tile/vector-tile.d.ts.map +1 -0
  170. package/dist/mvt/lib/vector-tile/vector-tile.js +28 -0
  171. package/dist/mvt/lib/vector-tile/vector-tile.js.map +1 -0
  172. package/dist/mvt/lib/vector-tiler/arrow-tile.d.ts +6 -0
  173. package/dist/mvt/lib/vector-tiler/arrow-tile.d.ts.map +1 -0
  174. package/dist/mvt/lib/vector-tiler/arrow-tile.js +84 -0
  175. package/dist/mvt/lib/vector-tiler/arrow-tile.js.map +1 -0
  176. package/dist/mvt/lib/vector-tiler/features/clip-features.d.ts +16 -0
  177. package/dist/mvt/lib/vector-tiler/features/clip-features.d.ts.map +1 -0
  178. package/dist/mvt/lib/vector-tiler/features/clip-features.js +211 -0
  179. package/dist/mvt/lib/vector-tiler/features/clip-features.js.map +1 -0
  180. package/dist/mvt/lib/vector-tiler/features/convert-feature.d.ts +18 -0
  181. package/dist/mvt/lib/vector-tiler/features/convert-feature.d.ts.map +1 -0
  182. package/dist/mvt/lib/vector-tiler/features/convert-feature.js +161 -0
  183. package/dist/mvt/lib/vector-tiler/features/convert-feature.js.map +1 -0
  184. package/dist/mvt/lib/vector-tiler/features/proto-feature.d.ts +30 -0
  185. package/dist/mvt/lib/vector-tiler/features/proto-feature.d.ts.map +1 -0
  186. package/dist/mvt/lib/vector-tiler/features/proto-feature.js +53 -0
  187. package/dist/mvt/lib/vector-tiler/features/proto-feature.js.map +1 -0
  188. package/dist/mvt/lib/vector-tiler/features/simplify-path.d.ts +10 -0
  189. package/dist/mvt/lib/vector-tiler/features/simplify-path.d.ts.map +1 -0
  190. package/dist/mvt/lib/vector-tiler/features/simplify-path.js +67 -0
  191. package/dist/mvt/lib/vector-tiler/features/simplify-path.js.map +1 -0
  192. package/dist/mvt/lib/vector-tiler/features/wrap-features.d.ts +17 -0
  193. package/dist/mvt/lib/vector-tiler/features/wrap-features.d.ts.map +1 -0
  194. package/dist/mvt/lib/vector-tiler/features/wrap-features.js +95 -0
  195. package/dist/mvt/lib/vector-tiler/features/wrap-features.js.map +1 -0
  196. package/dist/mvt/lib/vector-tiler/proto-tile.d.ts +40 -0
  197. package/dist/mvt/lib/vector-tiler/proto-tile.d.ts.map +1 -0
  198. package/dist/mvt/lib/vector-tiler/proto-tile.js +139 -0
  199. package/dist/mvt/lib/vector-tiler/proto-tile.js.map +1 -0
  200. package/dist/mvt/lib/vector-tiler/tile-to-geojson.d.ts +12 -0
  201. package/dist/mvt/lib/vector-tiler/tile-to-geojson.d.ts.map +1 -0
  202. package/dist/mvt/lib/vector-tiler/tile-to-geojson.js +81 -0
  203. package/dist/mvt/lib/vector-tiler/tile-to-geojson.js.map +1 -0
  204. package/dist/mvt/lib/vector-tiler/transform-tile.d.ts +7 -0
  205. package/dist/mvt/lib/vector-tiler/transform-tile.d.ts.map +1 -0
  206. package/dist/mvt/lib/vector-tiler/transform-tile.js +42 -0
  207. package/dist/mvt/lib/vector-tiler/transform-tile.js.map +1 -0
  208. package/dist/mvt/map-style-format.d.ts +13 -0
  209. package/dist/mvt/map-style-format.d.ts.map +1 -0
  210. package/dist/mvt/map-style-format.js +16 -0
  211. package/dist/mvt/map-style-format.js.map +1 -0
  212. package/dist/mvt/map-style-loader-with-parser.d.ts +26 -0
  213. package/dist/mvt/map-style-loader-with-parser.d.ts.map +1 -0
  214. package/dist/mvt/map-style-loader-with-parser.js +38 -0
  215. package/dist/mvt/map-style-loader-with-parser.js.map +1 -0
  216. package/dist/mvt/map-style-loader.d.ts +44 -0
  217. package/dist/mvt/map-style-loader.d.ts.map +1 -0
  218. package/dist/mvt/map-style-loader.js +25 -0
  219. package/dist/mvt/map-style-loader.js.map +1 -0
  220. package/dist/mvt/map-style-schema.d.ts +58 -0
  221. package/dist/mvt/map-style-schema.d.ts.map +1 -0
  222. package/dist/mvt/map-style-schema.js +47 -0
  223. package/dist/mvt/map-style-schema.js.map +1 -0
  224. package/dist/mvt/map-style.d.ts +110 -0
  225. package/dist/mvt/map-style.d.ts.map +1 -0
  226. package/dist/mvt/map-style.js +90 -0
  227. package/dist/mvt/map-style.js.map +1 -0
  228. package/dist/mvt/mvt-format.d.ts +14 -0
  229. package/dist/mvt/mvt-format.d.ts.map +1 -0
  230. package/dist/mvt/mvt-format.js +23 -0
  231. package/dist/mvt/mvt-format.js.map +1 -0
  232. package/dist/mvt/mvt-geojson-loader-types.d.ts +82 -0
  233. package/dist/mvt/mvt-geojson-loader-types.d.ts.map +1 -0
  234. package/dist/mvt/mvt-geojson-loader-types.js +34 -0
  235. package/dist/mvt/mvt-geojson-loader-types.js.map +1 -0
  236. package/dist/mvt/mvt-geojson-loader.cjs +1366 -0
  237. package/dist/mvt/mvt-geojson-loader.cjs.map +6 -0
  238. package/dist/mvt/mvt-geojson-loader.d.ts +32 -0
  239. package/dist/mvt/mvt-geojson-loader.d.ts.map +1 -0
  240. package/dist/mvt/mvt-geojson-loader.js +13 -0
  241. package/dist/mvt/mvt-geojson-loader.js.map +1 -0
  242. package/dist/mvt/mvt-loader-with-parser.d.ts +105 -0
  243. package/dist/mvt/mvt-loader-with-parser.d.ts.map +1 -0
  244. package/dist/mvt/mvt-loader-with-parser.js +21 -0
  245. package/dist/mvt/mvt-loader-with-parser.js.map +1 -0
  246. package/dist/mvt/mvt-loader.d.ts +129 -0
  247. package/dist/mvt/mvt-loader.d.ts.map +1 -0
  248. package/dist/mvt/mvt-loader.js +40 -0
  249. package/dist/mvt/mvt-loader.js.map +1 -0
  250. package/dist/mvt/mvt-source-loader.d.ts +102 -0
  251. package/dist/mvt/mvt-source-loader.d.ts.map +1 -0
  252. package/dist/mvt/mvt-source-loader.js +275 -0
  253. package/dist/mvt/mvt-source-loader.js.map +1 -0
  254. package/dist/mvt/mvt-writer.d.ts +28 -0
  255. package/dist/mvt/mvt-writer.d.ts.map +1 -0
  256. package/dist/mvt/mvt-writer.js +32 -0
  257. package/dist/mvt/mvt-writer.js.map +1 -0
  258. package/dist/mvt/table-tile-source-loader.d.ts +169 -0
  259. package/dist/mvt/table-tile-source-loader.d.ts.map +1 -0
  260. package/dist/mvt/table-tile-source-loader.js +478 -0
  261. package/dist/mvt/table-tile-source-loader.js.map +1 -0
  262. package/dist/mvt/tilejson-format.d.ts +13 -0
  263. package/dist/mvt/tilejson-format.d.ts.map +1 -0
  264. package/dist/mvt/tilejson-format.js +16 -0
  265. package/dist/mvt/tilejson-format.js.map +1 -0
  266. package/dist/mvt/tilejson-loader-with-parser.d.ts +13 -0
  267. package/dist/mvt/tilejson-loader-with-parser.d.ts.map +1 -0
  268. package/dist/mvt/tilejson-loader-with-parser.js +25 -0
  269. package/dist/mvt/tilejson-loader-with-parser.js.map +1 -0
  270. package/dist/mvt/tilejson-loader.d.ts +56 -0
  271. package/dist/mvt/tilejson-loader.d.ts.map +1 -0
  272. package/dist/mvt/tilejson-loader.js +28 -0
  273. package/dist/mvt/tilejson-loader.js.map +1 -0
  274. package/dist/mvt/tilejson-zod-schema.cjs +79 -0
  275. package/dist/mvt/tilejson-zod-schema.cjs.map +6 -0
  276. package/dist/mvt/tilejson-zod-schema.d.ts +218 -0
  277. package/dist/mvt/tilejson-zod-schema.d.ts.map +1 -0
  278. package/dist/mvt/tilejson-zod-schema.js +68 -0
  279. package/dist/mvt/tilejson-zod-schema.js.map +1 -0
  280. package/dist/mvt/tilejson.schema.json +197 -0
  281. package/dist/mvt/unbundled.d.ts +8 -0
  282. package/dist/mvt/unbundled.d.ts.map +1 -0
  283. package/dist/mvt/unbundled.js +8 -0
  284. package/dist/mvt/unbundled.js.map +1 -0
  285. package/dist/mvt/workers/mvt-worker-node.d.ts +2 -0
  286. package/dist/mvt/workers/mvt-worker-node.d.ts.map +1 -0
  287. package/dist/mvt/workers/mvt-worker-node.js +8 -0
  288. package/dist/mvt/workers/mvt-worker-node.js.map +1 -0
  289. package/dist/mvt/workers/mvt-worker.d.ts +2 -0
  290. package/dist/mvt/workers/mvt-worker.d.ts.map +1 -0
  291. package/dist/mvt/workers/mvt-worker.js +7 -0
  292. package/dist/mvt/workers/mvt-worker.js.map +1 -0
  293. package/dist/mvt-worker-node.js +72460 -0
  294. package/dist/mvt-worker-node.js.map +7 -0
  295. package/dist/mvt-worker.js +21239 -0
  296. package/dist/pmtiles/bundled.d.ts +3 -0
  297. package/dist/pmtiles/bundled.d.ts.map +1 -0
  298. package/dist/pmtiles/bundled.js +5 -0
  299. package/dist/pmtiles/bundled.js.map +1 -0
  300. package/dist/pmtiles/dist.dev.js +50530 -0
  301. package/dist/pmtiles/dist.min.js +94 -0
  302. package/dist/pmtiles/geoarrow.cjs +6718 -0
  303. package/dist/pmtiles/geoarrow.cjs.map +6 -0
  304. package/dist/pmtiles/geoarrow.d.ts +30 -0
  305. package/dist/pmtiles/geoarrow.d.ts.map +1 -0
  306. package/dist/pmtiles/geoarrow.js +143 -0
  307. package/dist/pmtiles/geoarrow.js.map +1 -0
  308. package/dist/pmtiles/index.cjs +8011 -0
  309. package/dist/pmtiles/index.cjs.map +6 -0
  310. package/dist/pmtiles/index.d.ts +14 -0
  311. package/dist/pmtiles/index.d.ts.map +1 -0
  312. package/dist/pmtiles/index.js +10 -0
  313. package/dist/pmtiles/index.js.map +1 -0
  314. package/dist/pmtiles/lib/blob-source.d.ts +14 -0
  315. package/dist/pmtiles/lib/blob-source.d.ts.map +1 -0
  316. package/dist/pmtiles/lib/blob-source.js +32 -0
  317. package/dist/pmtiles/lib/blob-source.js.map +1 -0
  318. package/dist/pmtiles/lib/encode-pmtiles.d.ts +8 -0
  319. package/dist/pmtiles/lib/encode-pmtiles.d.ts.map +1 -0
  320. package/dist/pmtiles/lib/encode-pmtiles.js +268 -0
  321. package/dist/pmtiles/lib/encode-pmtiles.js.map +1 -0
  322. package/dist/pmtiles/lib/parse-pmtiles.d.ts +52 -0
  323. package/dist/pmtiles/lib/parse-pmtiles.d.ts.map +1 -0
  324. package/dist/pmtiles/lib/parse-pmtiles.js +95 -0
  325. package/dist/pmtiles/lib/parse-pmtiles.js.map +1 -0
  326. package/dist/pmtiles/lib/range-request-source.d.ts +24 -0
  327. package/dist/pmtiles/lib/range-request-source.d.ts.map +1 -0
  328. package/dist/pmtiles/lib/range-request-source.js +45 -0
  329. package/dist/pmtiles/lib/range-request-source.js.map +1 -0
  330. package/dist/pmtiles/lib/version.d.ts +2 -0
  331. package/dist/pmtiles/lib/version.d.ts.map +1 -0
  332. package/dist/pmtiles/lib/version.js +8 -0
  333. package/dist/pmtiles/lib/version.js.map +1 -0
  334. package/dist/pmtiles/pmtiles-format.d.ts +14 -0
  335. package/dist/pmtiles/pmtiles-format.d.ts.map +1 -0
  336. package/dist/pmtiles/pmtiles-format.js +17 -0
  337. package/dist/pmtiles/pmtiles-format.js.map +1 -0
  338. package/dist/pmtiles/pmtiles-loader-with-parser.d.ts +30 -0
  339. package/dist/pmtiles/pmtiles-loader-with-parser.d.ts.map +1 -0
  340. package/dist/pmtiles/pmtiles-loader-with-parser.js +41 -0
  341. package/dist/pmtiles/pmtiles-loader-with-parser.js.map +1 -0
  342. package/dist/pmtiles/pmtiles-loader.d.ts +41 -0
  343. package/dist/pmtiles/pmtiles-loader.d.ts.map +1 -0
  344. package/dist/pmtiles/pmtiles-loader.js +20 -0
  345. package/dist/pmtiles/pmtiles-loader.js.map +1 -0
  346. package/dist/pmtiles/pmtiles-source-loader.d.ts +85 -0
  347. package/dist/pmtiles/pmtiles-source-loader.d.ts.map +1 -0
  348. package/dist/pmtiles/pmtiles-source-loader.js +239 -0
  349. package/dist/pmtiles/pmtiles-source-loader.js.map +1 -0
  350. package/dist/pmtiles/pmtiles-writer-types.d.ts +39 -0
  351. package/dist/pmtiles/pmtiles-writer-types.d.ts.map +1 -0
  352. package/dist/pmtiles/pmtiles-writer-types.js +5 -0
  353. package/dist/pmtiles/pmtiles-writer-types.js.map +1 -0
  354. package/dist/pmtiles/pmtiles-writer.d.ts +22 -0
  355. package/dist/pmtiles/pmtiles-writer.d.ts.map +1 -0
  356. package/dist/pmtiles/pmtiles-writer.js +15 -0
  357. package/dist/pmtiles/pmtiles-writer.js.map +1 -0
  358. package/dist/pmtiles/raster.cjs +1183 -0
  359. package/dist/pmtiles/raster.cjs.map +6 -0
  360. package/dist/pmtiles/raster.d.ts +30 -0
  361. package/dist/pmtiles/raster.d.ts.map +1 -0
  362. package/dist/pmtiles/raster.js +212 -0
  363. package/dist/pmtiles/raster.js.map +1 -0
  364. package/dist/pmtiles/source-info.d.ts +25 -0
  365. package/dist/pmtiles/source-info.d.ts.map +1 -0
  366. package/dist/{types.js → pmtiles/source-info.js} +1 -1
  367. package/dist/pmtiles/source-info.js.map +1 -0
  368. package/dist/pmtiles/unbundled.d.ts +3 -0
  369. package/dist/pmtiles/unbundled.d.ts.map +1 -0
  370. package/dist/pmtiles/unbundled.js +5 -0
  371. package/dist/pmtiles/unbundled.js.map +1 -0
  372. package/dist/raster-set.d.ts +1 -1
  373. package/dist/raster-set.d.ts.map +1 -1
  374. package/dist/raster-set.js +1 -1
  375. package/dist/raster-set.js.map +1 -1
  376. package/dist/tile-matrix.cjs +81 -0
  377. package/dist/tile-matrix.cjs.map +6 -0
  378. package/dist/tile-matrix.d.ts +52 -0
  379. package/dist/tile-matrix.d.ts.map +1 -0
  380. package/dist/tile-matrix.js +75 -0
  381. package/dist/tile-matrix.js.map +1 -0
  382. package/dist/tileset-2d/tile-2d-header.d.ts +2 -2
  383. package/dist/tileset-2d/tile-2d-header.d.ts.map +1 -1
  384. package/dist/tileset-2d/tile-2d-header.js +11 -11
  385. package/dist/tileset-2d/tile-2d-header.js.map +1 -1
  386. package/dist/tileset-2d/tileset-2d.d.ts +19 -10
  387. package/dist/tileset-2d/tileset-2d.d.ts.map +1 -1
  388. package/dist/tileset-2d/tileset-2d.js +69 -15
  389. package/dist/tileset-2d/tileset-2d.js.map +1 -1
  390. package/dist/tileset-2d.d.ts +2 -1
  391. package/dist/tileset-2d.d.ts.map +1 -1
  392. package/dist/tileset-2d.js +1 -1
  393. package/dist/tileset-2d.js.map +1 -1
  394. package/package.json +104 -16
  395. package/src/image-set.ts +1 -1
  396. package/src/index.ts +9 -123
  397. package/src/mlt/bundled.ts +9 -0
  398. package/src/mlt/index.ts +18 -0
  399. package/src/mlt/lib/encode-mlt-geometry.ts +162 -0
  400. package/src/mlt/lib/encode-mlt-streams.ts +66 -0
  401. package/src/mlt/lib/encode-mlt.ts +215 -0
  402. package/src/mlt/lib/parse-mlt.ts +906 -0
  403. package/src/mlt/libs/mlt-decoder.cjs +4552 -0
  404. package/src/mlt/mlt-format.ts +19 -0
  405. package/src/mlt/mlt-loader-with-parser.ts +57 -0
  406. package/src/mlt/mlt-loader.ts +64 -0
  407. package/src/mlt/mlt-source-loader.ts +266 -0
  408. package/src/mlt/mlt-writer.ts +47 -0
  409. package/src/mlt/unbundled.ts +6 -0
  410. package/src/mvt/arrow-table-tile-source-loader-types.ts +55 -0
  411. package/src/mvt/arrow-table-tile-source-loader.ts +307 -0
  412. package/src/mvt/arrow-table-tile-source-types.ts +32 -0
  413. package/src/mvt/bundled.ts +14 -0
  414. package/src/mvt/index.ts +67 -0
  415. package/src/mvt/lib/encode-mvt-arrow.ts +273 -0
  416. package/src/mvt/lib/encode-mvt.ts +46 -0
  417. package/src/mvt/lib/get-schemas-from-tilejson.ts +64 -0
  418. package/src/mvt/lib/is-longitude-latitude-crs.ts +15 -0
  419. package/src/mvt/lib/mapbox-vt-pbf/geojson-to-vt.ts.disabled +76 -0
  420. package/src/mvt/lib/mapbox-vt-pbf/geojson-wrapper.ts +89 -0
  421. package/src/mvt/lib/mapbox-vt-pbf/to-vector-tile.ts +230 -0
  422. package/src/mvt/lib/mvt-pbf/mvt-constants.ts +135 -0
  423. package/src/mvt/lib/mvt-pbf/mvt-types.ts +22 -0
  424. package/src/mvt/lib/mvt-pbf/parse-geometry-from-pbf.ts +285 -0
  425. package/src/mvt/lib/mvt-pbf/parse-mvt-from-pbf.ts +310 -0
  426. package/src/mvt/lib/mvt-pbf/write-mvt-to-pbf.ts +162 -0
  427. package/src/mvt/lib/mvt-worker-transport.ts +74 -0
  428. package/src/mvt/lib/parse-mvt-geojson.ts +65 -0
  429. package/src/mvt/lib/parse-mvt.ts +145 -0
  430. package/src/mvt/lib/parse-tilejson.ts +397 -0
  431. package/src/mvt/lib/resolve-table-tile-parameters.ts +23 -0
  432. package/src/mvt/lib/types.ts +90 -0
  433. package/src/mvt/lib/utils/geometry-utils.ts +238 -0
  434. package/src/mvt/lib/vector-tile/LICENSE.txt +31 -0
  435. package/src/mvt/lib/vector-tile/vector-tile-feature.ts +430 -0
  436. package/src/mvt/lib/vector-tile/vector-tile-layer.ts +130 -0
  437. package/src/mvt/lib/vector-tile/vector-tile.ts +32 -0
  438. package/src/mvt/lib/vector-tiler/LICENSE +19 -0
  439. package/src/mvt/lib/vector-tiler/arrow-tile.ts +93 -0
  440. package/src/mvt/lib/vector-tiler/features/clip-features.ts +250 -0
  441. package/src/mvt/lib/vector-tiler/features/convert-feature.ts +213 -0
  442. package/src/mvt/lib/vector-tiler/features/proto-feature.ts +104 -0
  443. package/src/mvt/lib/vector-tiler/features/simplify-path.ts +84 -0
  444. package/src/mvt/lib/vector-tiler/features/wrap-features.ts +125 -0
  445. package/src/mvt/lib/vector-tiler/proto-tile.ts +217 -0
  446. package/src/mvt/lib/vector-tiler/tile-to-geojson.ts +104 -0
  447. package/src/mvt/lib/vector-tiler/transform-tile.ts +57 -0
  448. package/src/mvt/map-style-format.ts +18 -0
  449. package/src/mvt/map-style-loader-with-parser.ts +62 -0
  450. package/src/mvt/map-style-loader.ts +31 -0
  451. package/src/mvt/map-style-schema.ts +53 -0
  452. package/src/mvt/map-style.ts +218 -0
  453. package/src/mvt/mvt-format.ts +25 -0
  454. package/src/mvt/mvt-geojson-loader-types.ts +60 -0
  455. package/src/mvt/mvt-geojson-loader.ts +20 -0
  456. package/src/mvt/mvt-loader-with-parser.ts +53 -0
  457. package/src/mvt/mvt-loader.ts +73 -0
  458. package/src/mvt/mvt-source-loader.ts +410 -0
  459. package/src/mvt/mvt-writer.ts +35 -0
  460. package/src/mvt/table-tile-source-loader.ts +672 -0
  461. package/src/mvt/tilejson-format.ts +18 -0
  462. package/src/mvt/tilejson-loader-with-parser.ts +38 -0
  463. package/src/mvt/tilejson-loader.ts +42 -0
  464. package/src/mvt/tilejson-zod-schema.ts +199 -0
  465. package/src/mvt/unbundled.ts +13 -0
  466. package/src/mvt/workers/mvt-worker-node.ts +9 -0
  467. package/src/mvt/workers/mvt-worker.ts +8 -0
  468. package/src/pmtiles/bundled.ts +6 -0
  469. package/src/pmtiles/geoarrow.ts +188 -0
  470. package/src/pmtiles/index.ts +27 -0
  471. package/src/pmtiles/lib/blob-source.ts +41 -0
  472. package/src/pmtiles/lib/encode-pmtiles.ts +322 -0
  473. package/src/pmtiles/lib/parse-pmtiles.ts +180 -0
  474. package/src/pmtiles/lib/range-request-source.ts +60 -0
  475. package/src/pmtiles/lib/version.ts +8 -0
  476. package/src/pmtiles/pmtiles-format.ts +19 -0
  477. package/src/pmtiles/pmtiles-loader-with-parser.ts +60 -0
  478. package/src/pmtiles/pmtiles-loader.ts +30 -0
  479. package/src/pmtiles/pmtiles-source-loader.ts +346 -0
  480. package/src/pmtiles/pmtiles-writer-types.ts +45 -0
  481. package/src/pmtiles/pmtiles-writer.ts +26 -0
  482. package/src/pmtiles/raster.ts +289 -0
  483. package/src/pmtiles/source-info.ts +25 -0
  484. package/src/pmtiles/unbundled.ts +6 -0
  485. package/src/raster-set.ts +2 -2
  486. package/src/tile-matrix.ts +138 -0
  487. package/src/tileset-2d/tile-2d-header.ts +14 -13
  488. package/src/tileset-2d/tileset-2d.ts +81 -19
  489. package/src/tileset-2d.ts +25 -1
  490. package/dist/constants.d.ts +0 -38
  491. package/dist/constants.d.ts.map +0 -1
  492. package/dist/constants.js +0 -39
  493. package/dist/constants.js.map +0 -1
  494. package/dist/point-cloud/point-cloud-tile.d.ts +0 -47
  495. package/dist/point-cloud/point-cloud-tile.d.ts.map +0 -1
  496. package/dist/point-cloud/point-cloud-tile.js +0 -70
  497. package/dist/point-cloud/point-cloud-tile.js.map +0 -1
  498. package/dist/point-cloud/point-cloud-tileset.d.ts +0 -135
  499. package/dist/point-cloud/point-cloud-tileset.d.ts.map +0 -1
  500. package/dist/point-cloud/point-cloud-tileset.js +0 -549
  501. package/dist/point-cloud/point-cloud-tileset.js.map +0 -1
  502. package/dist/point-cloud/types.d.ts +0 -81
  503. package/dist/point-cloud/types.d.ts.map +0 -1
  504. package/dist/point-cloud/types.js.map +0 -1
  505. package/dist/spatial/format-spatial-reference.d.ts +0 -68
  506. package/dist/spatial/format-spatial-reference.d.ts.map +0 -1
  507. package/dist/spatial/format-spatial-reference.js +0 -291
  508. package/dist/spatial/format-spatial-reference.js.map +0 -1
  509. package/dist/spatial/get-spatial-coordinate-frame.d.ts +0 -20
  510. package/dist/spatial/get-spatial-coordinate-frame.d.ts.map +0 -1
  511. package/dist/spatial/get-spatial-coordinate-frame.js +0 -139
  512. package/dist/spatial/get-spatial-coordinate-frame.js.map +0 -1
  513. package/dist/spatial/i3s-elevation.d.ts +0 -20
  514. package/dist/spatial/i3s-elevation.d.ts.map +0 -1
  515. package/dist/spatial/i3s-elevation.js +0 -90
  516. package/dist/spatial/i3s-elevation.js.map +0 -1
  517. package/dist/spatial/i3s-spatial-transformer.d.ts +0 -205
  518. package/dist/spatial/i3s-spatial-transformer.d.ts.map +0 -1
  519. package/dist/spatial/i3s-spatial-transformer.js +0 -731
  520. package/dist/spatial/i3s-spatial-transformer.js.map +0 -1
  521. package/dist/spatial/normalize-crs-identifier.d.ts +0 -15
  522. package/dist/spatial/normalize-crs-identifier.d.ts.map +0 -1
  523. package/dist/spatial/normalize-crs-identifier.js +0 -22
  524. package/dist/spatial/normalize-crs-identifier.js.map +0 -1
  525. package/dist/spatial/spatial-coordinate-transformer.d.ts +0 -52
  526. package/dist/spatial/spatial-coordinate-transformer.d.ts.map +0 -1
  527. package/dist/spatial/spatial-coordinate-transformer.js +0 -295
  528. package/dist/spatial/spatial-coordinate-transformer.js.map +0 -1
  529. package/dist/spatial/spatial-resource-registry.d.ts +0 -47
  530. package/dist/spatial/spatial-resource-registry.d.ts.map +0 -1
  531. package/dist/spatial/spatial-resource-registry.js +0 -76
  532. package/dist/spatial/spatial-resource-registry.js.map +0 -1
  533. package/dist/spatial/spatial-types.d.ts +0 -190
  534. package/dist/spatial/spatial-types.d.ts.map +0 -1
  535. package/dist/spatial/spatial-types.js +0 -192
  536. package/dist/spatial/spatial-types.js.map +0 -1
  537. package/dist/spatial/tiles-3d-spatial-transformer.d.ts +0 -32
  538. package/dist/spatial/tiles-3d-spatial-transformer.d.ts.map +0 -1
  539. package/dist/spatial/tiles-3d-spatial-transformer.js +0 -163
  540. package/dist/spatial/tiles-3d-spatial-transformer.js.map +0 -1
  541. package/dist/tileset-3d/common/indexed-archive-tileset-source.d.ts +0 -60
  542. package/dist/tileset-3d/common/indexed-archive-tileset-source.d.ts.map +0 -1
  543. package/dist/tileset-3d/common/indexed-archive-tileset-source.js +0 -130
  544. package/dist/tileset-3d/common/indexed-archive-tileset-source.js.map +0 -1
  545. package/dist/tileset-3d/common/tile-3d-contracts.d.ts +0 -63
  546. package/dist/tileset-3d/common/tile-3d-contracts.d.ts.map +0 -1
  547. package/dist/tileset-3d/common/tile-3d-contracts.js +0 -51
  548. package/dist/tileset-3d/common/tile-3d-contracts.js.map +0 -1
  549. package/dist/tileset-3d/common/tile-3d.d.ts +0 -410
  550. package/dist/tileset-3d/common/tile-3d.d.ts.map +0 -1
  551. package/dist/tileset-3d/common/tile-3d.js +0 -1056
  552. package/dist/tileset-3d/common/tile-3d.js.map +0 -1
  553. package/dist/tileset-3d/common/tileset-3d.d.ts +0 -367
  554. package/dist/tileset-3d/common/tileset-3d.d.ts.map +0 -1
  555. package/dist/tileset-3d/common/tileset-3d.js +0 -879
  556. package/dist/tileset-3d/common/tileset-3d.js.map +0 -1
  557. package/dist/tileset-3d/common/tileset-cache.d.ts +0 -29
  558. package/dist/tileset-3d/common/tileset-cache.d.ts.map +0 -1
  559. package/dist/tileset-3d/common/tileset-cache.js +0 -82
  560. package/dist/tileset-3d/common/tileset-cache.js.map +0 -1
  561. package/dist/tileset-3d/common/tileset-content-traversal.d.ts +0 -37
  562. package/dist/tileset-3d/common/tileset-content-traversal.d.ts.map +0 -1
  563. package/dist/tileset-3d/common/tileset-content-traversal.js +0 -80
  564. package/dist/tileset-3d/common/tileset-content-traversal.js.map +0 -1
  565. package/dist/tileset-3d/common/tileset-observability.d.ts +0 -60
  566. package/dist/tileset-3d/common/tileset-observability.d.ts.map +0 -1
  567. package/dist/tileset-3d/common/tileset-observability.js +0 -39
  568. package/dist/tileset-3d/common/tileset-observability.js.map +0 -1
  569. package/dist/tileset-3d/common/tileset-source.d.ts +0 -228
  570. package/dist/tileset-3d/common/tileset-source.d.ts.map +0 -1
  571. package/dist/tileset-3d/common/tileset-source.js +0 -17
  572. package/dist/tileset-3d/common/tileset-source.js.map +0 -1
  573. package/dist/tileset-3d/common/tileset-traverser.d.ts +0 -88
  574. package/dist/tileset-3d/common/tileset-traverser.d.ts.map +0 -1
  575. package/dist/tileset-3d/common/tileset-traverser.js +0 -341
  576. package/dist/tileset-3d/common/tileset-traverser.js.map +0 -1
  577. package/dist/tileset-3d/format-3d-tiles/implicit-tiling.d.ts +0 -182
  578. package/dist/tileset-3d/format-3d-tiles/implicit-tiling.d.ts.map +0 -1
  579. package/dist/tileset-3d/format-3d-tiles/implicit-tiling.js +0 -681
  580. package/dist/tileset-3d/format-3d-tiles/implicit-tiling.js.map +0 -1
  581. package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.d.ts +0 -221
  582. package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.d.ts.map +0 -1
  583. package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.js +0 -770
  584. package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.js.map +0 -1
  585. package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.d.ts +0 -111
  586. package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.d.ts.map +0 -1
  587. package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.js +0 -339
  588. package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.js.map +0 -1
  589. package/dist/tileset-3d/format-i3s/i3s-pending-tiles-register.d.ts +0 -27
  590. package/dist/tileset-3d/format-i3s/i3s-pending-tiles-register.d.ts.map +0 -1
  591. package/dist/tileset-3d/format-i3s/i3s-pending-tiles-register.js +0 -45
  592. package/dist/tileset-3d/format-i3s/i3s-pending-tiles-register.js.map +0 -1
  593. package/dist/tileset-3d/format-i3s/i3s-source.d.ts +0 -116
  594. package/dist/tileset-3d/format-i3s/i3s-source.d.ts.map +0 -1
  595. package/dist/tileset-3d/format-i3s/i3s-source.js +0 -450
  596. package/dist/tileset-3d/format-i3s/i3s-source.js.map +0 -1
  597. package/dist/tileset-3d/format-i3s/i3s-tile-manager.d.ts +0 -34
  598. package/dist/tileset-3d/format-i3s/i3s-tile-manager.d.ts.map +0 -1
  599. package/dist/tileset-3d/format-i3s/i3s-tile-manager.js +0 -81
  600. package/dist/tileset-3d/format-i3s/i3s-tile-manager.js.map +0 -1
  601. package/dist/tileset-3d/format-i3s/i3s-tileset-traverser.d.ts +0 -25
  602. package/dist/tileset-3d/format-i3s/i3s-tileset-traverser.d.ts.map +0 -1
  603. package/dist/tileset-3d/format-i3s/i3s-tileset-traverser.js +0 -84
  604. package/dist/tileset-3d/format-i3s/i3s-tileset-traverser.js.map +0 -1
  605. package/dist/tileset-3d/helpers/3d-tiles-options.d.ts +0 -5
  606. package/dist/tileset-3d/helpers/3d-tiles-options.d.ts.map +0 -1
  607. package/dist/tileset-3d/helpers/3d-tiles-options.js +0 -9
  608. package/dist/tileset-3d/helpers/3d-tiles-options.js.map +0 -1
  609. package/dist/tileset-3d/helpers/bounding-volume.d.ts +0 -23
  610. package/dist/tileset-3d/helpers/bounding-volume.d.ts.map +0 -1
  611. package/dist/tileset-3d/helpers/bounding-volume.js +0 -236
  612. package/dist/tileset-3d/helpers/bounding-volume.js.map +0 -1
  613. package/dist/tileset-3d/helpers/frame-state.d.ts +0 -93
  614. package/dist/tileset-3d/helpers/frame-state.d.ts.map +0 -1
  615. package/dist/tileset-3d/helpers/frame-state.js +0 -211
  616. package/dist/tileset-3d/helpers/frame-state.js.map +0 -1
  617. package/dist/tileset-3d/helpers/i3s-lod.d.ts +0 -20
  618. package/dist/tileset-3d/helpers/i3s-lod.d.ts.map +0 -1
  619. package/dist/tileset-3d/helpers/i3s-lod.js +0 -95
  620. package/dist/tileset-3d/helpers/i3s-lod.js.map +0 -1
  621. package/dist/tileset-3d/helpers/s2-bounding-volume.d.ts +0 -17
  622. package/dist/tileset-3d/helpers/s2-bounding-volume.d.ts.map +0 -1
  623. package/dist/tileset-3d/helpers/s2-bounding-volume.js +0 -20
  624. package/dist/tileset-3d/helpers/s2-bounding-volume.js.map +0 -1
  625. package/dist/tileset-3d/helpers/tiles-3d-lod.d.ts +0 -72
  626. package/dist/tileset-3d/helpers/tiles-3d-lod.d.ts.map +0 -1
  627. package/dist/tileset-3d/helpers/tiles-3d-lod.js +0 -257
  628. package/dist/tileset-3d/helpers/tiles-3d-lod.js.map +0 -1
  629. package/dist/tileset-3d/helpers/tiles-3d-request-priority.d.ts +0 -134
  630. package/dist/tileset-3d/helpers/tiles-3d-request-priority.d.ts.map +0 -1
  631. package/dist/tileset-3d/helpers/tiles-3d-request-priority.js +0 -179
  632. package/dist/tileset-3d/helpers/tiles-3d-request-priority.js.map +0 -1
  633. package/dist/tileset-3d/helpers/transform-utils.d.ts +0 -3
  634. package/dist/tileset-3d/helpers/transform-utils.d.ts.map +0 -1
  635. package/dist/tileset-3d/helpers/transform-utils.js +0 -86
  636. package/dist/tileset-3d/helpers/transform-utils.js.map +0 -1
  637. package/dist/tileset-3d/helpers/zoom.d.ts +0 -46
  638. package/dist/tileset-3d/helpers/zoom.d.ts.map +0 -1
  639. package/dist/tileset-3d/helpers/zoom.js +0 -86
  640. package/dist/tileset-3d/helpers/zoom.js.map +0 -1
  641. package/dist/types.d.ts +0 -48
  642. package/dist/types.d.ts.map +0 -1
  643. package/dist/types.js.map +0 -1
  644. package/dist/utils/doubly-linked-list-node.d.ts +0 -11
  645. package/dist/utils/doubly-linked-list-node.d.ts.map +0 -1
  646. package/dist/utils/doubly-linked-list-node.js +0 -20
  647. package/dist/utils/doubly-linked-list-node.js.map +0 -1
  648. package/dist/utils/doubly-linked-list.d.ts +0 -30
  649. package/dist/utils/doubly-linked-list.d.ts.map +0 -1
  650. package/dist/utils/doubly-linked-list.js +0 -93
  651. package/dist/utils/doubly-linked-list.js.map +0 -1
  652. package/dist/utils/managed-array.d.ts +0 -85
  653. package/dist/utils/managed-array.d.ts.map +0 -1
  654. package/dist/utils/managed-array.js +0 -152
  655. package/dist/utils/managed-array.js.map +0 -1
  656. package/src/constants.ts +0 -59
  657. package/src/point-cloud/point-cloud-tile.ts +0 -80
  658. package/src/point-cloud/point-cloud-tileset.ts +0 -767
  659. package/src/point-cloud/types.ts +0 -99
  660. package/src/spatial/format-spatial-reference.ts +0 -385
  661. package/src/spatial/get-spatial-coordinate-frame.ts +0 -169
  662. package/src/spatial/i3s-elevation.ts +0 -96
  663. package/src/spatial/i3s-spatial-transformer.ts +0 -1021
  664. package/src/spatial/normalize-crs-identifier.ts +0 -26
  665. package/src/spatial/spatial-coordinate-transformer.ts +0 -377
  666. package/src/spatial/spatial-resource-registry.ts +0 -90
  667. package/src/spatial/spatial-types.ts +0 -422
  668. package/src/spatial/tiles-3d-spatial-transformer.ts +0 -194
  669. package/src/tileset-3d/common/indexed-archive-tileset-source.ts +0 -205
  670. package/src/tileset-3d/common/tile-3d-contracts.ts +0 -115
  671. package/src/tileset-3d/common/tile-3d.ts +0 -1310
  672. package/src/tileset-3d/common/tileset-3d.ts +0 -1208
  673. package/src/tileset-3d/common/tileset-cache.ts +0 -111
  674. package/src/tileset-3d/common/tileset-content-traversal.ts +0 -114
  675. package/src/tileset-3d/common/tileset-observability.ts +0 -100
  676. package/src/tileset-3d/common/tileset-source.ts +0 -284
  677. package/src/tileset-3d/common/tileset-traverser.ts +0 -416
  678. package/src/tileset-3d/format-3d-tiles/implicit-tiling.ts +0 -1059
  679. package/src/tileset-3d/format-3d-tiles/tiles-3d-source.ts +0 -1025
  680. package/src/tileset-3d/format-3d-tiles/tileset-3d-traverser.ts +0 -391
  681. package/src/tileset-3d/format-i3s/i3s-pending-tiles-register.ts +0 -48
  682. package/src/tileset-3d/format-i3s/i3s-source.ts +0 -557
  683. package/src/tileset-3d/format-i3s/i3s-tile-manager.ts +0 -105
  684. package/src/tileset-3d/format-i3s/i3s-tileset-traverser.ts +0 -102
  685. package/src/tileset-3d/helpers/3d-tiles-options.ts +0 -11
  686. package/src/tileset-3d/helpers/bounding-volume.ts +0 -281
  687. package/src/tileset-3d/helpers/frame-state.ts +0 -322
  688. package/src/tileset-3d/helpers/i3s-lod.ts +0 -109
  689. package/src/tileset-3d/helpers/s2-bounding-volume.ts +0 -35
  690. package/src/tileset-3d/helpers/tiles-3d-lod.ts +0 -370
  691. package/src/tileset-3d/helpers/tiles-3d-request-priority.ts +0 -301
  692. package/src/tileset-3d/helpers/transform-utils.ts +0 -109
  693. package/src/tileset-3d/helpers/zoom.ts +0 -120
  694. package/src/types.ts +0 -54
  695. package/src/utils/doubly-linked-list-node.ts +0 -22
  696. package/src/utils/doubly-linked-list.ts +0 -105
  697. package/src/utils/managed-array.ts +0 -174
  698. /package/dist/{point-cloud → mvt/lib}/types.js +0 -0
@@ -0,0 +1,1366 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __esm = (fn, res, err) => function __init() {
9
+ if (err) throw err[0];
10
+ try {
11
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
12
+ } catch (e) {
13
+ throw err = [e], e;
14
+ }
15
+ };
16
+ var __export = (target, all) => {
17
+ for (var name in all)
18
+ __defProp(target, name, { get: all[name], enumerable: true });
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
27
+ };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ // If the importer is in node compatibility mode or this is not an ESM
30
+ // file that has been converted to a CommonJS file using a Babel-
31
+ // compatible transform (i.e. "__esModule" has not been set), then set
32
+ // "default" to the CommonJS "module.exports" for node compatibility.
33
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
+ mod
35
+ ));
36
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
+
38
+ // src/mvt/lib/utils/geometry-utils.ts
39
+ function signedArea2(ring) {
40
+ let sum = 0;
41
+ for (let i = 0, j = ring.length - 1, p1, p2; i < ring.length; j = i++) {
42
+ p1 = ring[i];
43
+ p2 = ring[j];
44
+ sum += (p2[0] - p1[0]) * (p1[1] + p2[1]);
45
+ }
46
+ return sum;
47
+ }
48
+ function convertToLocalCoordinates2(coordinates, extent) {
49
+ if (Array.isArray(coordinates[0])) {
50
+ for (const subcoords of coordinates) {
51
+ convertToLocalCoordinates2(subcoords, extent);
52
+ }
53
+ return;
54
+ }
55
+ const p = coordinates;
56
+ p[0] /= extent;
57
+ p[1] /= extent;
58
+ }
59
+ function convertToLocalCoordinatesFlat2(data, extent) {
60
+ for (let i = 0; i < data.length; ++i) {
61
+ data[i] /= extent;
62
+ }
63
+ }
64
+ function projectToLngLat2(line, tileIndex, extent) {
65
+ if (typeof line[0] === "number") {
66
+ projectToLngLat2([line], tileIndex, extent);
67
+ return;
68
+ }
69
+ if (typeof line[0][0] !== "number") {
70
+ for (const point of line) {
71
+ projectToLngLat2(point, tileIndex, extent);
72
+ }
73
+ return;
74
+ }
75
+ const size = extent * Math.pow(2, tileIndex.z);
76
+ const x0 = extent * tileIndex.x;
77
+ const y0 = extent * tileIndex.y;
78
+ for (let j = 0; j < line.length; j++) {
79
+ const p = line[j];
80
+ p[0] = (p[0] + x0) * 360 / size - 180;
81
+ const y2 = 180 - (p[1] + y0) * 360 / size;
82
+ p[1] = 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90;
83
+ }
84
+ }
85
+ function projectToLngLatFlat2(data, tileIndex, extent) {
86
+ const { x, y, z } = tileIndex;
87
+ const size = extent * Math.pow(2, z);
88
+ const x0 = extent * x;
89
+ const y0 = extent * y;
90
+ for (let j = 0, jl = data.length; j < jl; j += 2) {
91
+ data[j] = (data[j] + x0) * 360 / size - 180;
92
+ const y2 = 180 - (data[j + 1] + y0) * 360 / size;
93
+ data[j + 1] = 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90;
94
+ }
95
+ }
96
+ function classifyRings2(rings) {
97
+ const len = rings.length;
98
+ if (len <= 1) return [rings];
99
+ const polygons = [];
100
+ let polygon;
101
+ let ccw;
102
+ for (let i = 0; i < len; i++) {
103
+ const area = signedArea2(rings[i]);
104
+ if (area === 0) continue;
105
+ if (ccw === void 0) ccw = area < 0;
106
+ if (ccw === area < 0) {
107
+ if (polygon) polygons.push(polygon);
108
+ polygon = [rings[i]];
109
+ } else if (polygon) polygon.push(rings[i]);
110
+ }
111
+ if (polygon) polygons.push(polygon);
112
+ return polygons;
113
+ }
114
+ function classifyRingsFlat2(geom) {
115
+ const len = geom.indices.length;
116
+ const type = "Polygon";
117
+ if (len <= 1) {
118
+ return {
119
+ type,
120
+ data: geom.data,
121
+ areas: [[(0, import_polygon2.getPolygonSignedArea)(geom.data)]],
122
+ indices: [geom.indices]
123
+ };
124
+ }
125
+ const areas = [];
126
+ const polygons = [];
127
+ let ringAreas = [];
128
+ let polygon = [];
129
+ let ccw;
130
+ let offset = 0;
131
+ for (let endIndex, i = 0, startIndex; i < len; i++) {
132
+ startIndex = geom.indices[i] - offset;
133
+ endIndex = geom.indices[i + 1] - offset || geom.data.length;
134
+ const shape = geom.data.slice(startIndex, endIndex);
135
+ const area = (0, import_polygon2.getPolygonSignedArea)(shape);
136
+ if (area === 0) {
137
+ const before = geom.data.slice(0, startIndex);
138
+ const after = geom.data.slice(endIndex);
139
+ geom.data = before.concat(after);
140
+ offset += endIndex - startIndex;
141
+ continue;
142
+ }
143
+ if (ccw === void 0) ccw = area < 0;
144
+ if (ccw === area < 0) {
145
+ if (polygon.length) {
146
+ areas.push(ringAreas);
147
+ polygons.push(polygon);
148
+ }
149
+ polygon = [startIndex];
150
+ ringAreas = [area];
151
+ } else {
152
+ ringAreas.push(area);
153
+ polygon.push(startIndex);
154
+ }
155
+ }
156
+ if (ringAreas) areas.push(ringAreas);
157
+ if (polygon.length) polygons.push(polygon);
158
+ return { type, areas, indices: polygons, data: geom.data };
159
+ }
160
+ var import_polygon2;
161
+ var init_geometry_utils = __esm({
162
+ "src/mvt/lib/utils/geometry-utils.ts"() {
163
+ "use strict";
164
+ import_polygon2 = require("@math.gl/geometry/polygon");
165
+ }
166
+ });
167
+
168
+ // src/mvt/lib/vector-tile/vector-tile-feature.ts
169
+ function _toGeoJSONFeature2(vtFeature, coords, transform) {
170
+ let type = VectorTileFeature2.types[vtFeature.type];
171
+ let i;
172
+ let j;
173
+ let coordinates;
174
+ switch (vtFeature.type) {
175
+ case 1:
176
+ const points = [];
177
+ for (i = 0; i < coords.length; i++) {
178
+ points[i] = coords[i][0];
179
+ }
180
+ coordinates = points;
181
+ transform(coordinates, vtFeature.extent);
182
+ break;
183
+ case 2:
184
+ coordinates = coords;
185
+ for (i = 0; i < coordinates.length; i++) {
186
+ transform(coordinates[i], vtFeature.extent);
187
+ }
188
+ break;
189
+ case 3:
190
+ coordinates = classifyRings2(coords);
191
+ for (i = 0; i < coordinates.length; i++) {
192
+ for (j = 0; j < coordinates[i].length; j++) {
193
+ transform(coordinates[i][j], vtFeature.extent);
194
+ }
195
+ }
196
+ break;
197
+ default:
198
+ throw new Error("illegal vector tile type");
199
+ }
200
+ if (coordinates.length === 1) {
201
+ coordinates = coordinates[0];
202
+ } else {
203
+ type = `Multi${type}`;
204
+ }
205
+ const result = {
206
+ type: "Feature",
207
+ geometry: {
208
+ type,
209
+ coordinates
210
+ },
211
+ properties: vtFeature.properties
212
+ };
213
+ if (vtFeature.id !== null) {
214
+ result.id = vtFeature.id;
215
+ }
216
+ return result;
217
+ }
218
+ function readFeature2(tag, feature, pbf) {
219
+ if (feature && pbf) {
220
+ if (tag === 1) feature.id = pbf.readVarint();
221
+ else if (tag === 2) readTag2(pbf, feature);
222
+ else if (tag === 3) feature.type = pbf.readVarint();
223
+ else if (tag === 4) feature._geometry = pbf.pos;
224
+ }
225
+ }
226
+ function readTag2(pbf, feature) {
227
+ const end = pbf.readVarint() + pbf.pos;
228
+ while (pbf.pos < end) {
229
+ const key = feature._keys[pbf.readVarint()];
230
+ const value = feature._values[pbf.readVarint()];
231
+ if (key === "__proto__") {
232
+ Object.defineProperty(feature.properties, key, {
233
+ value,
234
+ enumerable: true,
235
+ configurable: true,
236
+ writable: true
237
+ });
238
+ } else {
239
+ feature.properties[key] = value;
240
+ }
241
+ }
242
+ }
243
+ var VectorTileFeature2;
244
+ var init_vector_tile_feature = __esm({
245
+ "src/mvt/lib/vector-tile/vector-tile-feature.ts"() {
246
+ "use strict";
247
+ init_geometry_utils();
248
+ VectorTileFeature2 = class {
249
+ properties;
250
+ extent;
251
+ type;
252
+ id;
253
+ _pbf;
254
+ _geometry;
255
+ _keys;
256
+ _values;
257
+ _geometryInfo;
258
+ static types = ["Unknown", "Point", "LineString", "Polygon"];
259
+ // eslint-disable-next-line max-params
260
+ constructor(pbf, end, extent, keys, values, geometryInfo) {
261
+ this.properties = {};
262
+ this.extent = extent;
263
+ this.type = 0;
264
+ this.id = null;
265
+ this._pbf = pbf;
266
+ this._geometry = -1;
267
+ this._keys = keys;
268
+ this._values = values;
269
+ this._geometryInfo = geometryInfo;
270
+ pbf.readFields(readFeature2, this, end);
271
+ }
272
+ toGeoJSONFeature(coordinates, tileIndex) {
273
+ const coords = this.loadGeometry();
274
+ switch (coordinates) {
275
+ case "wgs84":
276
+ return _toGeoJSONFeature2(
277
+ this,
278
+ coords,
279
+ (line) => projectToLngLat2(line, tileIndex, this.extent)
280
+ );
281
+ default:
282
+ return _toGeoJSONFeature2(this, coords, convertToLocalCoordinates2);
283
+ }
284
+ }
285
+ /**
286
+ *
287
+ * @param options
288
+ * @returns
289
+ */
290
+ toBinaryFeature(coordinates, tileIndex) {
291
+ const geom = this.loadFlatGeometry();
292
+ switch (coordinates) {
293
+ case "wgs84":
294
+ return this._toBinaryCoordinates(
295
+ geom,
296
+ (coords) => projectToLngLatFlat2(coords, tileIndex, this.extent)
297
+ );
298
+ default:
299
+ return this._toBinaryCoordinates(geom, convertToLocalCoordinatesFlat2);
300
+ }
301
+ }
302
+ /** Read a bounding box from the feature */
303
+ // eslint-disable-next-line max-statements
304
+ bbox() {
305
+ const pbf = this._pbf;
306
+ pbf.pos = this._geometry;
307
+ const end = pbf.readVarint() + pbf.pos;
308
+ let cmd = 1;
309
+ let length = 0;
310
+ let x = 0;
311
+ let y = 0;
312
+ let x1 = Infinity;
313
+ let x2 = -Infinity;
314
+ let y1 = Infinity;
315
+ let y2 = -Infinity;
316
+ while (pbf.pos < end) {
317
+ if (length <= 0) {
318
+ const cmdLen = pbf.readVarint();
319
+ cmd = cmdLen & 7;
320
+ length = cmdLen >> 3;
321
+ }
322
+ length--;
323
+ if (cmd === 1 || cmd === 2) {
324
+ x += pbf.readSVarint();
325
+ y += pbf.readSVarint();
326
+ if (x < x1) x1 = x;
327
+ if (x > x2) x2 = x;
328
+ if (y < y1) y1 = y;
329
+ if (y > y2) y2 = y;
330
+ } else if (cmd !== 7) {
331
+ throw new Error(`unknown command ${cmd}`);
332
+ }
333
+ }
334
+ return [x1, y1, x2, y2];
335
+ }
336
+ // BINARY HELPERS
337
+ /**
338
+ *
339
+ * @param transform
340
+ * @returns result
341
+ */
342
+ _toBinaryCoordinates(geom, transform) {
343
+ let geometry;
344
+ transform(geom.data, this.extent);
345
+ const coordLength = 2;
346
+ switch (this.type) {
347
+ case 1:
348
+ this._geometryInfo.pointFeaturesCount++;
349
+ this._geometryInfo.pointPositionsCount += geom.indices.length;
350
+ geometry = { type: "Point", ...geom };
351
+ break;
352
+ case 2:
353
+ this._geometryInfo.lineFeaturesCount++;
354
+ this._geometryInfo.linePathsCount += geom.indices.length;
355
+ this._geometryInfo.linePositionsCount += geom.data.length / coordLength;
356
+ geometry = { type: "LineString", ...geom };
357
+ break;
358
+ case 3:
359
+ geometry = classifyRingsFlat2(geom);
360
+ this._geometryInfo.polygonFeaturesCount++;
361
+ this._geometryInfo.polygonObjectsCount += geometry.indices.length;
362
+ for (const indices of geometry.indices) {
363
+ this._geometryInfo.polygonRingsCount += indices.length;
364
+ }
365
+ this._geometryInfo.polygonPositionsCount += geometry.data.length / coordLength;
366
+ break;
367
+ default:
368
+ throw new Error(`Invalid geometry type: ${this.type}`);
369
+ }
370
+ const result = { type: "Feature", geometry, properties: this.properties };
371
+ if (this.id !== null) {
372
+ result.id = this.id;
373
+ }
374
+ return result;
375
+ }
376
+ // GEOJSON HELPER
377
+ // eslint-disable-next-line complexity, max-statements
378
+ loadGeometry() {
379
+ const pbf = this._pbf;
380
+ pbf.pos = this._geometry;
381
+ const end = pbf.readVarint() + pbf.pos;
382
+ let cmd = 1;
383
+ let length = 0;
384
+ let x = 0;
385
+ let y = 0;
386
+ const lines = [];
387
+ let line;
388
+ while (pbf.pos < end) {
389
+ if (length <= 0) {
390
+ const cmdLen = pbf.readVarint();
391
+ cmd = cmdLen & 7;
392
+ length = cmdLen >> 3;
393
+ }
394
+ length--;
395
+ switch (cmd) {
396
+ case 1:
397
+ case 2:
398
+ x += pbf.readSVarint();
399
+ y += pbf.readSVarint();
400
+ if (cmd === 1) {
401
+ if (line) lines.push(line);
402
+ line = [];
403
+ }
404
+ if (line) line.push([x, y]);
405
+ break;
406
+ case 7:
407
+ if (line) {
408
+ line.push(line[0].slice());
409
+ }
410
+ break;
411
+ default:
412
+ throw new Error(`unknown command ${cmd}`);
413
+ }
414
+ }
415
+ if (line) lines.push(line);
416
+ return lines;
417
+ }
418
+ /**
419
+ * Expands the protobuf data to an intermediate Flat GeoJSON
420
+ * data format, which maps closely to the binary data buffers.
421
+ * It is similar to GeoJSON, but rather than storing the coordinates
422
+ * in multidimensional arrays, we have a 1D `data` with all the
423
+ * coordinates, and then index into this using the `indices`
424
+ * parameter, e.g.
425
+ *
426
+ * geometry: {
427
+ * type: 'Point', data: [1,2], indices: [0]
428
+ * }
429
+ * geometry: {
430
+ * type: 'LineString', data: [1,2,3,4,...], indices: [0]
431
+ * }
432
+ * geometry: {
433
+ * type: 'Polygon', data: [1,2,3,4,...], indices: [[0, 2]]
434
+ * }
435
+ * Thus the indices member lets us look up the relevant range
436
+ * from the data array.
437
+ * The Multi* versions of the above types share the same data
438
+ * structure, just with multiple elements in the indices array
439
+ */
440
+ // eslint-disable-next-line complexity, max-statements
441
+ loadFlatGeometry() {
442
+ const pbf = this._pbf;
443
+ pbf.pos = this._geometry;
444
+ const endPos = pbf.readVarint() + pbf.pos;
445
+ let cmd = 1;
446
+ let cmdLen;
447
+ let length = 0;
448
+ let x = 0;
449
+ let y = 0;
450
+ let i = 0;
451
+ const indices = [];
452
+ const data = [];
453
+ while (pbf.pos < endPos) {
454
+ if (length <= 0) {
455
+ cmdLen = pbf.readVarint();
456
+ cmd = cmdLen & 7;
457
+ length = cmdLen >> 3;
458
+ }
459
+ length--;
460
+ if (cmd === 1 || cmd === 2) {
461
+ x += pbf.readSVarint();
462
+ y += pbf.readSVarint();
463
+ if (cmd === 1) {
464
+ indices.push(i);
465
+ }
466
+ data.push(x, y);
467
+ i += 2;
468
+ } else if (cmd === 7) {
469
+ if (i > 0) {
470
+ const start = indices[indices.length - 1];
471
+ data.push(data[start], data[start + 1]);
472
+ i += 2;
473
+ }
474
+ } else {
475
+ throw new Error(`unknown command ${cmd}`);
476
+ }
477
+ }
478
+ return { data, indices };
479
+ }
480
+ };
481
+ }
482
+ });
483
+
484
+ // src/mvt/lib/vector-tile/vector-tile-layer.ts
485
+ function readLayer2(tag, layer, pbf) {
486
+ if (layer && pbf) {
487
+ if (tag === 15) layer.version = pbf.readVarint();
488
+ else if (tag === 1) layer.name = pbf.readString();
489
+ else if (tag === 5) layer.extent = pbf.readVarint();
490
+ else if (tag === 2) layer._features.push(pbf.pos);
491
+ else if (tag === 3) layer._keys.push(pbf.readString());
492
+ else if (tag === 4) layer._values.push(readValueMessage2(pbf));
493
+ }
494
+ }
495
+ function readValueMessage2(pbf) {
496
+ let value = null;
497
+ const end = pbf.readVarint() + pbf.pos;
498
+ while (pbf.pos < end) {
499
+ const tag = pbf.readVarint() >> 3;
500
+ value = tag === 1 ? pbf.readString() : tag === 2 ? pbf.readFloat() : tag === 3 ? pbf.readDouble() : tag === 4 ? pbf.readVarint64() : tag === 5 ? pbf.readVarint() : tag === 6 ? pbf.readSVarint() : tag === 7 ? pbf.readBoolean() : null;
501
+ }
502
+ return value;
503
+ }
504
+ var VectorTileLayer2;
505
+ var init_vector_tile_layer = __esm({
506
+ "src/mvt/lib/vector-tile/vector-tile-layer.ts"() {
507
+ "use strict";
508
+ init_vector_tile_feature();
509
+ VectorTileLayer2 = class {
510
+ version;
511
+ name;
512
+ extent;
513
+ length;
514
+ _pbf;
515
+ _keys;
516
+ _values;
517
+ _features;
518
+ constructor(pbf, end) {
519
+ this.version = 1;
520
+ this.name = "";
521
+ this.extent = 4096;
522
+ this.length = 0;
523
+ this._pbf = pbf;
524
+ this._keys = [];
525
+ this._values = [];
526
+ this._features = [];
527
+ pbf.readFields(readLayer2, this, end);
528
+ this.length = this._features.length;
529
+ }
530
+ /**
531
+ * return feature `i` from this layer as a `VectorTileFeature`
532
+ * @param index
533
+ * @returns feature
534
+ */
535
+ getGeoJSONFeature(i) {
536
+ if (i < 0 || i >= this._features.length) {
537
+ throw new Error("feature index out of bounds");
538
+ }
539
+ this._pbf.pos = this._features[i];
540
+ const end = this._pbf.readVarint() + this._pbf.pos;
541
+ return new VectorTileFeature2(this._pbf, end, this.extent, this._keys, this._values);
542
+ }
543
+ /**
544
+ * return binary feature `i` from this layer as a `VectorTileFeature`
545
+ *
546
+ * @param index
547
+ * @param geometryInfo
548
+ * @returns binary feature
549
+ */
550
+ getBinaryFeature(i, geometryInfo) {
551
+ if (i < 0 || i >= this._features.length) {
552
+ throw new Error("feature index out of bounds");
553
+ }
554
+ this._pbf.pos = this._features[i];
555
+ const end = this._pbf.readVarint() + this._pbf.pos;
556
+ return new VectorTileFeature2(
557
+ this._pbf,
558
+ end,
559
+ this.extent,
560
+ this._keys,
561
+ this._values,
562
+ geometryInfo
563
+ );
564
+ }
565
+ };
566
+ }
567
+ });
568
+
569
+ // src/mvt/lib/vector-tile/vector-tile.ts
570
+ function readTile2(tag, layers, pbf) {
571
+ if (tag === 3) {
572
+ if (pbf) {
573
+ const layer = new VectorTileLayer2(pbf, pbf.readVarint() + pbf.pos);
574
+ if (layer.length && layers) {
575
+ layers[layer.name] = layer;
576
+ }
577
+ }
578
+ }
579
+ }
580
+ var VectorTile2;
581
+ var init_vector_tile = __esm({
582
+ "src/mvt/lib/vector-tile/vector-tile.ts"() {
583
+ "use strict";
584
+ init_vector_tile_layer();
585
+ VectorTile2 = class {
586
+ layers;
587
+ constructor(pbf, end) {
588
+ this.layers = pbf.readFields(readTile2, /* @__PURE__ */ Object.create(null), end);
589
+ }
590
+ };
591
+ }
592
+ });
593
+
594
+ // src/mvt/lib/parse-mvt-geojson.ts
595
+ function parseMVTGeoJSON2(arrayBuffer, options = {}) {
596
+ const mvtOptions = options.mvt || {};
597
+ if (mvtOptions.coordinates === "wgs84" && !mvtOptions.tileIndex) {
598
+ throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");
599
+ }
600
+ const features = [];
601
+ if (arrayBuffer.byteLength > 0) {
602
+ features.push(...parseToGeoJSONFeatures2(arrayBuffer, mvtOptions));
603
+ }
604
+ return { shape: "geojson-table", type: "FeatureCollection", features };
605
+ }
606
+ function parseToGeoJSONFeatures2(arrayBuffer, mvtOptions) {
607
+ if (arrayBuffer.byteLength <= 0) {
608
+ return [];
609
+ }
610
+ const tile = new VectorTile2(new import_pbf2.default(arrayBuffer));
611
+ const selectedLayers = Array.isArray(mvtOptions.layers) ? mvtOptions.layers : Object.keys(tile.layers);
612
+ const features = [];
613
+ for (const layerName of selectedLayers) {
614
+ const vectorTileLayer = tile.layers[layerName];
615
+ if (!vectorTileLayer) {
616
+ continue;
617
+ }
618
+ for (let index = 0; index < vectorTileLayer.length; index++) {
619
+ const vectorTileFeature = vectorTileLayer.getGeoJSONFeature(index);
620
+ const feature = vectorTileFeature.toGeoJSONFeature(
621
+ mvtOptions.coordinates || "local",
622
+ mvtOptions.tileIndex
623
+ );
624
+ if (mvtOptions.layerProperty) {
625
+ feature.properties ||= {};
626
+ feature.properties[mvtOptions.layerProperty] = layerName;
627
+ }
628
+ if (mvtOptions.sourceLayer) {
629
+ feature.sourceLayer = layerName;
630
+ }
631
+ features.push(feature);
632
+ }
633
+ }
634
+ return features;
635
+ }
636
+ var import_pbf2;
637
+ var init_parse_mvt_geojson = __esm({
638
+ "src/mvt/lib/parse-mvt-geojson.ts"() {
639
+ "use strict";
640
+ import_pbf2 = __toESM(require("pbf"), 1);
641
+ init_vector_tile();
642
+ }
643
+ });
644
+
645
+ // src/mvt/mvt-format.ts
646
+ var MVTFormat2;
647
+ var init_mvt_format = __esm({
648
+ "src/mvt/mvt-format.ts"() {
649
+ "use strict";
650
+ MVTFormat2 = {
651
+ name: "Mapbox Vector Tile",
652
+ id: "mvt",
653
+ module: "tiles",
654
+ encoding: "protobuf",
655
+ format: "mvt",
656
+ // Note: ArcGIS uses '.pbf' extension and 'application/octet-stream'
657
+ extensions: ["mvt", "pbf"],
658
+ mimeTypes: [
659
+ // https://www.iana.org/assignments/media-types/application/vnd.mapbox-vector-tile
660
+ "application/vnd.mapbox-vector-tile",
661
+ "application/x-protobuf"
662
+ // 'application/octet-stream'
663
+ ],
664
+ category: "geometry"
665
+ };
666
+ }
667
+ });
668
+
669
+ // src/mvt/mvt-geojson-loader-types.ts
670
+ async function preload() {
671
+ const { MVTGeoJSONLoaderWithParser: MVTGeoJSONLoaderWithParser3 } = await Promise.resolve().then(() => (init_mvt_geojson_loader(), mvt_geojson_loader_exports));
672
+ return MVTGeoJSONLoaderWithParser3;
673
+ }
674
+ var VERSION, MVTGeoJSONLoader;
675
+ var init_mvt_geojson_loader_types = __esm({
676
+ "src/mvt/mvt-geojson-loader-types.ts"() {
677
+ "use strict";
678
+ init_mvt_format();
679
+ VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
680
+ MVTGeoJSONLoader = {
681
+ ...MVTFormat2,
682
+ name: "Mapbox Vector Tile (GeoJSON)",
683
+ dataType: null,
684
+ batchType: null,
685
+ version: VERSION,
686
+ worker: false,
687
+ options: {
688
+ mvt: {
689
+ shape: "geojson-table",
690
+ coordinates: "local",
691
+ layerProperty: "layerName",
692
+ sourceLayer: false,
693
+ layers: void 0,
694
+ tileIndex: void 0
695
+ }
696
+ },
697
+ preload,
698
+ binary: true
699
+ };
700
+ }
701
+ });
702
+
703
+ // src/mvt/mvt-geojson-loader.ts
704
+ var mvt_geojson_loader_exports = {};
705
+ __export(mvt_geojson_loader_exports, {
706
+ MVTGeoJSONLoaderWithParser: () => MVTGeoJSONLoaderWithParser
707
+ });
708
+ var _MVTGeoJSONLoaderPreload, MVTGeoJSONLoaderMetadataWithoutPreload, MVTGeoJSONLoaderWithParser;
709
+ var init_mvt_geojson_loader = __esm({
710
+ "src/mvt/mvt-geojson-loader.ts"() {
711
+ "use strict";
712
+ init_parse_mvt_geojson();
713
+ init_mvt_geojson_loader_types();
714
+ ({ preload: _MVTGeoJSONLoaderPreload, ...MVTGeoJSONLoaderMetadataWithoutPreload } = MVTGeoJSONLoader);
715
+ MVTGeoJSONLoaderWithParser = {
716
+ ...MVTGeoJSONLoaderMetadataWithoutPreload,
717
+ parse: async (arrayBuffer, options) => parseMVTGeoJSON2(arrayBuffer, options),
718
+ parseSync: parseMVTGeoJSON2
719
+ };
720
+ }
721
+ });
722
+
723
+ // dist/mvt/mvt-geojson-loader.js
724
+ var mvt_geojson_loader_exports2 = {};
725
+ __export(mvt_geojson_loader_exports2, {
726
+ MVTGeoJSONLoaderWithParser: () => MVTGeoJSONLoaderWithParser2
727
+ });
728
+ module.exports = __toCommonJS(mvt_geojson_loader_exports2);
729
+
730
+ // dist/mvt/lib/parse-mvt-geojson.js
731
+ var import_pbf = __toESM(require("pbf"), 1);
732
+
733
+ // dist/mvt/lib/utils/geometry-utils.js
734
+ var import_polygon = require("@math.gl/geometry/polygon");
735
+ function signedArea(ring) {
736
+ let sum = 0;
737
+ for (let i = 0, j = ring.length - 1, p1, p2; i < ring.length; j = i++) {
738
+ p1 = ring[i];
739
+ p2 = ring[j];
740
+ sum += (p2[0] - p1[0]) * (p1[1] + p2[1]);
741
+ }
742
+ return sum;
743
+ }
744
+ function convertToLocalCoordinates(coordinates, extent) {
745
+ if (Array.isArray(coordinates[0])) {
746
+ for (const subcoords of coordinates) {
747
+ convertToLocalCoordinates(subcoords, extent);
748
+ }
749
+ return;
750
+ }
751
+ const p = coordinates;
752
+ p[0] /= extent;
753
+ p[1] /= extent;
754
+ }
755
+ function convertToLocalCoordinatesFlat(data, extent) {
756
+ for (let i = 0; i < data.length; ++i) {
757
+ data[i] /= extent;
758
+ }
759
+ }
760
+ function projectToLngLat(line, tileIndex, extent) {
761
+ if (typeof line[0] === "number") {
762
+ projectToLngLat([line], tileIndex, extent);
763
+ return;
764
+ }
765
+ if (typeof line[0][0] !== "number") {
766
+ for (const point of line) {
767
+ projectToLngLat(point, tileIndex, extent);
768
+ }
769
+ return;
770
+ }
771
+ const size = extent * Math.pow(2, tileIndex.z);
772
+ const x0 = extent * tileIndex.x;
773
+ const y0 = extent * tileIndex.y;
774
+ for (let j = 0; j < line.length; j++) {
775
+ const p = line[j];
776
+ p[0] = (p[0] + x0) * 360 / size - 180;
777
+ const y2 = 180 - (p[1] + y0) * 360 / size;
778
+ p[1] = 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90;
779
+ }
780
+ }
781
+ function projectToLngLatFlat(data, tileIndex, extent) {
782
+ const { x, y, z } = tileIndex;
783
+ const size = extent * Math.pow(2, z);
784
+ const x0 = extent * x;
785
+ const y0 = extent * y;
786
+ for (let j = 0, jl = data.length; j < jl; j += 2) {
787
+ data[j] = (data[j] + x0) * 360 / size - 180;
788
+ const y2 = 180 - (data[j + 1] + y0) * 360 / size;
789
+ data[j + 1] = 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90;
790
+ }
791
+ }
792
+ function classifyRings(rings) {
793
+ const len = rings.length;
794
+ if (len <= 1)
795
+ return [rings];
796
+ const polygons = [];
797
+ let polygon;
798
+ let ccw;
799
+ for (let i = 0; i < len; i++) {
800
+ const area = signedArea(rings[i]);
801
+ if (area === 0)
802
+ continue;
803
+ if (ccw === void 0)
804
+ ccw = area < 0;
805
+ if (ccw === area < 0) {
806
+ if (polygon)
807
+ polygons.push(polygon);
808
+ polygon = [rings[i]];
809
+ } else if (polygon)
810
+ polygon.push(rings[i]);
811
+ }
812
+ if (polygon)
813
+ polygons.push(polygon);
814
+ return polygons;
815
+ }
816
+ function classifyRingsFlat(geom) {
817
+ const len = geom.indices.length;
818
+ const type = "Polygon";
819
+ if (len <= 1) {
820
+ return {
821
+ type,
822
+ data: geom.data,
823
+ areas: [[(0, import_polygon.getPolygonSignedArea)(geom.data)]],
824
+ indices: [geom.indices]
825
+ };
826
+ }
827
+ const areas = [];
828
+ const polygons = [];
829
+ let ringAreas = [];
830
+ let polygon = [];
831
+ let ccw;
832
+ let offset = 0;
833
+ for (let endIndex, i = 0, startIndex; i < len; i++) {
834
+ startIndex = geom.indices[i] - offset;
835
+ endIndex = geom.indices[i + 1] - offset || geom.data.length;
836
+ const shape = geom.data.slice(startIndex, endIndex);
837
+ const area = (0, import_polygon.getPolygonSignedArea)(shape);
838
+ if (area === 0) {
839
+ const before = geom.data.slice(0, startIndex);
840
+ const after = geom.data.slice(endIndex);
841
+ geom.data = before.concat(after);
842
+ offset += endIndex - startIndex;
843
+ continue;
844
+ }
845
+ if (ccw === void 0)
846
+ ccw = area < 0;
847
+ if (ccw === area < 0) {
848
+ if (polygon.length) {
849
+ areas.push(ringAreas);
850
+ polygons.push(polygon);
851
+ }
852
+ polygon = [startIndex];
853
+ ringAreas = [area];
854
+ } else {
855
+ ringAreas.push(area);
856
+ polygon.push(startIndex);
857
+ }
858
+ }
859
+ if (ringAreas)
860
+ areas.push(ringAreas);
861
+ if (polygon.length)
862
+ polygons.push(polygon);
863
+ return { type, areas, indices: polygons, data: geom.data };
864
+ }
865
+
866
+ // dist/mvt/lib/vector-tile/vector-tile-feature.js
867
+ var VectorTileFeature = class {
868
+ properties;
869
+ extent;
870
+ type;
871
+ id;
872
+ _pbf;
873
+ _geometry;
874
+ _keys;
875
+ _values;
876
+ _geometryInfo;
877
+ static types = ["Unknown", "Point", "LineString", "Polygon"];
878
+ // eslint-disable-next-line max-params
879
+ constructor(pbf, end, extent, keys, values, geometryInfo) {
880
+ this.properties = {};
881
+ this.extent = extent;
882
+ this.type = 0;
883
+ this.id = null;
884
+ this._pbf = pbf;
885
+ this._geometry = -1;
886
+ this._keys = keys;
887
+ this._values = values;
888
+ this._geometryInfo = geometryInfo;
889
+ pbf.readFields(readFeature, this, end);
890
+ }
891
+ toGeoJSONFeature(coordinates, tileIndex) {
892
+ const coords = this.loadGeometry();
893
+ switch (coordinates) {
894
+ case "wgs84":
895
+ return _toGeoJSONFeature(this, coords, (line) => projectToLngLat(line, tileIndex, this.extent));
896
+ default:
897
+ return _toGeoJSONFeature(this, coords, convertToLocalCoordinates);
898
+ }
899
+ }
900
+ /**
901
+ *
902
+ * @param options
903
+ * @returns
904
+ */
905
+ toBinaryFeature(coordinates, tileIndex) {
906
+ const geom = this.loadFlatGeometry();
907
+ switch (coordinates) {
908
+ case "wgs84":
909
+ return this._toBinaryCoordinates(geom, (coords) => projectToLngLatFlat(coords, tileIndex, this.extent));
910
+ default:
911
+ return this._toBinaryCoordinates(geom, convertToLocalCoordinatesFlat);
912
+ }
913
+ }
914
+ /** Read a bounding box from the feature */
915
+ // eslint-disable-next-line max-statements
916
+ bbox() {
917
+ const pbf = this._pbf;
918
+ pbf.pos = this._geometry;
919
+ const end = pbf.readVarint() + pbf.pos;
920
+ let cmd = 1;
921
+ let length = 0;
922
+ let x = 0;
923
+ let y = 0;
924
+ let x1 = Infinity;
925
+ let x2 = -Infinity;
926
+ let y1 = Infinity;
927
+ let y2 = -Infinity;
928
+ while (pbf.pos < end) {
929
+ if (length <= 0) {
930
+ const cmdLen = pbf.readVarint();
931
+ cmd = cmdLen & 7;
932
+ length = cmdLen >> 3;
933
+ }
934
+ length--;
935
+ if (cmd === 1 || cmd === 2) {
936
+ x += pbf.readSVarint();
937
+ y += pbf.readSVarint();
938
+ if (x < x1)
939
+ x1 = x;
940
+ if (x > x2)
941
+ x2 = x;
942
+ if (y < y1)
943
+ y1 = y;
944
+ if (y > y2)
945
+ y2 = y;
946
+ } else if (cmd !== 7) {
947
+ throw new Error(`unknown command ${cmd}`);
948
+ }
949
+ }
950
+ return [x1, y1, x2, y2];
951
+ }
952
+ // BINARY HELPERS
953
+ /**
954
+ *
955
+ * @param transform
956
+ * @returns result
957
+ */
958
+ _toBinaryCoordinates(geom, transform) {
959
+ let geometry;
960
+ transform(geom.data, this.extent);
961
+ const coordLength = 2;
962
+ switch (this.type) {
963
+ case 1:
964
+ this._geometryInfo.pointFeaturesCount++;
965
+ this._geometryInfo.pointPositionsCount += geom.indices.length;
966
+ geometry = { type: "Point", ...geom };
967
+ break;
968
+ case 2:
969
+ this._geometryInfo.lineFeaturesCount++;
970
+ this._geometryInfo.linePathsCount += geom.indices.length;
971
+ this._geometryInfo.linePositionsCount += geom.data.length / coordLength;
972
+ geometry = { type: "LineString", ...geom };
973
+ break;
974
+ case 3:
975
+ geometry = classifyRingsFlat(geom);
976
+ this._geometryInfo.polygonFeaturesCount++;
977
+ this._geometryInfo.polygonObjectsCount += geometry.indices.length;
978
+ for (const indices of geometry.indices) {
979
+ this._geometryInfo.polygonRingsCount += indices.length;
980
+ }
981
+ this._geometryInfo.polygonPositionsCount += geometry.data.length / coordLength;
982
+ break;
983
+ default:
984
+ throw new Error(`Invalid geometry type: ${this.type}`);
985
+ }
986
+ const result = { type: "Feature", geometry, properties: this.properties };
987
+ if (this.id !== null) {
988
+ result.id = this.id;
989
+ }
990
+ return result;
991
+ }
992
+ // GEOJSON HELPER
993
+ // eslint-disable-next-line complexity, max-statements
994
+ loadGeometry() {
995
+ const pbf = this._pbf;
996
+ pbf.pos = this._geometry;
997
+ const end = pbf.readVarint() + pbf.pos;
998
+ let cmd = 1;
999
+ let length = 0;
1000
+ let x = 0;
1001
+ let y = 0;
1002
+ const lines = [];
1003
+ let line;
1004
+ while (pbf.pos < end) {
1005
+ if (length <= 0) {
1006
+ const cmdLen = pbf.readVarint();
1007
+ cmd = cmdLen & 7;
1008
+ length = cmdLen >> 3;
1009
+ }
1010
+ length--;
1011
+ switch (cmd) {
1012
+ case 1:
1013
+ case 2:
1014
+ x += pbf.readSVarint();
1015
+ y += pbf.readSVarint();
1016
+ if (cmd === 1) {
1017
+ if (line)
1018
+ lines.push(line);
1019
+ line = [];
1020
+ }
1021
+ if (line)
1022
+ line.push([x, y]);
1023
+ break;
1024
+ case 7:
1025
+ if (line) {
1026
+ line.push(line[0].slice());
1027
+ }
1028
+ break;
1029
+ default:
1030
+ throw new Error(`unknown command ${cmd}`);
1031
+ }
1032
+ }
1033
+ if (line)
1034
+ lines.push(line);
1035
+ return lines;
1036
+ }
1037
+ /**
1038
+ * Expands the protobuf data to an intermediate Flat GeoJSON
1039
+ * data format, which maps closely to the binary data buffers.
1040
+ * It is similar to GeoJSON, but rather than storing the coordinates
1041
+ * in multidimensional arrays, we have a 1D `data` with all the
1042
+ * coordinates, and then index into this using the `indices`
1043
+ * parameter, e.g.
1044
+ *
1045
+ * geometry: {
1046
+ * type: 'Point', data: [1,2], indices: [0]
1047
+ * }
1048
+ * geometry: {
1049
+ * type: 'LineString', data: [1,2,3,4,...], indices: [0]
1050
+ * }
1051
+ * geometry: {
1052
+ * type: 'Polygon', data: [1,2,3,4,...], indices: [[0, 2]]
1053
+ * }
1054
+ * Thus the indices member lets us look up the relevant range
1055
+ * from the data array.
1056
+ * The Multi* versions of the above types share the same data
1057
+ * structure, just with multiple elements in the indices array
1058
+ */
1059
+ // eslint-disable-next-line complexity, max-statements
1060
+ loadFlatGeometry() {
1061
+ const pbf = this._pbf;
1062
+ pbf.pos = this._geometry;
1063
+ const endPos = pbf.readVarint() + pbf.pos;
1064
+ let cmd = 1;
1065
+ let cmdLen;
1066
+ let length = 0;
1067
+ let x = 0;
1068
+ let y = 0;
1069
+ let i = 0;
1070
+ const indices = [];
1071
+ const data = [];
1072
+ while (pbf.pos < endPos) {
1073
+ if (length <= 0) {
1074
+ cmdLen = pbf.readVarint();
1075
+ cmd = cmdLen & 7;
1076
+ length = cmdLen >> 3;
1077
+ }
1078
+ length--;
1079
+ if (cmd === 1 || cmd === 2) {
1080
+ x += pbf.readSVarint();
1081
+ y += pbf.readSVarint();
1082
+ if (cmd === 1) {
1083
+ indices.push(i);
1084
+ }
1085
+ data.push(x, y);
1086
+ i += 2;
1087
+ } else if (cmd === 7) {
1088
+ if (i > 0) {
1089
+ const start = indices[indices.length - 1];
1090
+ data.push(data[start], data[start + 1]);
1091
+ i += 2;
1092
+ }
1093
+ } else {
1094
+ throw new Error(`unknown command ${cmd}`);
1095
+ }
1096
+ }
1097
+ return { data, indices };
1098
+ }
1099
+ };
1100
+ function _toGeoJSONFeature(vtFeature, coords, transform) {
1101
+ let type = VectorTileFeature.types[vtFeature.type];
1102
+ let i;
1103
+ let j;
1104
+ let coordinates;
1105
+ switch (vtFeature.type) {
1106
+ case 1:
1107
+ const points = [];
1108
+ for (i = 0; i < coords.length; i++) {
1109
+ points[i] = coords[i][0];
1110
+ }
1111
+ coordinates = points;
1112
+ transform(coordinates, vtFeature.extent);
1113
+ break;
1114
+ case 2:
1115
+ coordinates = coords;
1116
+ for (i = 0; i < coordinates.length; i++) {
1117
+ transform(coordinates[i], vtFeature.extent);
1118
+ }
1119
+ break;
1120
+ case 3:
1121
+ coordinates = classifyRings(coords);
1122
+ for (i = 0; i < coordinates.length; i++) {
1123
+ for (j = 0; j < coordinates[i].length; j++) {
1124
+ transform(coordinates[i][j], vtFeature.extent);
1125
+ }
1126
+ }
1127
+ break;
1128
+ default:
1129
+ throw new Error("illegal vector tile type");
1130
+ }
1131
+ if (coordinates.length === 1) {
1132
+ coordinates = coordinates[0];
1133
+ } else {
1134
+ type = `Multi${type}`;
1135
+ }
1136
+ const result = {
1137
+ type: "Feature",
1138
+ geometry: {
1139
+ type,
1140
+ coordinates
1141
+ },
1142
+ properties: vtFeature.properties
1143
+ };
1144
+ if (vtFeature.id !== null) {
1145
+ result.id = vtFeature.id;
1146
+ }
1147
+ return result;
1148
+ }
1149
+ function readFeature(tag, feature, pbf) {
1150
+ if (feature && pbf) {
1151
+ if (tag === 1)
1152
+ feature.id = pbf.readVarint();
1153
+ else if (tag === 2)
1154
+ readTag(pbf, feature);
1155
+ else if (tag === 3)
1156
+ feature.type = pbf.readVarint();
1157
+ else if (tag === 4)
1158
+ feature._geometry = pbf.pos;
1159
+ }
1160
+ }
1161
+ function readTag(pbf, feature) {
1162
+ const end = pbf.readVarint() + pbf.pos;
1163
+ while (pbf.pos < end) {
1164
+ const key = feature._keys[pbf.readVarint()];
1165
+ const value = feature._values[pbf.readVarint()];
1166
+ if (key === "__proto__") {
1167
+ Object.defineProperty(feature.properties, key, {
1168
+ value,
1169
+ enumerable: true,
1170
+ configurable: true,
1171
+ writable: true
1172
+ });
1173
+ } else {
1174
+ feature.properties[key] = value;
1175
+ }
1176
+ }
1177
+ }
1178
+
1179
+ // dist/mvt/lib/vector-tile/vector-tile-layer.js
1180
+ var VectorTileLayer = class {
1181
+ version;
1182
+ name;
1183
+ extent;
1184
+ length;
1185
+ _pbf;
1186
+ _keys;
1187
+ _values;
1188
+ _features;
1189
+ constructor(pbf, end) {
1190
+ this.version = 1;
1191
+ this.name = "";
1192
+ this.extent = 4096;
1193
+ this.length = 0;
1194
+ this._pbf = pbf;
1195
+ this._keys = [];
1196
+ this._values = [];
1197
+ this._features = [];
1198
+ pbf.readFields(readLayer, this, end);
1199
+ this.length = this._features.length;
1200
+ }
1201
+ /**
1202
+ * return feature `i` from this layer as a `VectorTileFeature`
1203
+ * @param index
1204
+ * @returns feature
1205
+ */
1206
+ getGeoJSONFeature(i) {
1207
+ if (i < 0 || i >= this._features.length) {
1208
+ throw new Error("feature index out of bounds");
1209
+ }
1210
+ this._pbf.pos = this._features[i];
1211
+ const end = this._pbf.readVarint() + this._pbf.pos;
1212
+ return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);
1213
+ }
1214
+ /**
1215
+ * return binary feature `i` from this layer as a `VectorTileFeature`
1216
+ *
1217
+ * @param index
1218
+ * @param geometryInfo
1219
+ * @returns binary feature
1220
+ */
1221
+ getBinaryFeature(i, geometryInfo) {
1222
+ if (i < 0 || i >= this._features.length) {
1223
+ throw new Error("feature index out of bounds");
1224
+ }
1225
+ this._pbf.pos = this._features[i];
1226
+ const end = this._pbf.readVarint() + this._pbf.pos;
1227
+ return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values, geometryInfo);
1228
+ }
1229
+ };
1230
+ function readLayer(tag, layer, pbf) {
1231
+ if (layer && pbf) {
1232
+ if (tag === 15)
1233
+ layer.version = pbf.readVarint();
1234
+ else if (tag === 1)
1235
+ layer.name = pbf.readString();
1236
+ else if (tag === 5)
1237
+ layer.extent = pbf.readVarint();
1238
+ else if (tag === 2)
1239
+ layer._features.push(pbf.pos);
1240
+ else if (tag === 3)
1241
+ layer._keys.push(pbf.readString());
1242
+ else if (tag === 4)
1243
+ layer._values.push(readValueMessage(pbf));
1244
+ }
1245
+ }
1246
+ function readValueMessage(pbf) {
1247
+ let value = null;
1248
+ const end = pbf.readVarint() + pbf.pos;
1249
+ while (pbf.pos < end) {
1250
+ const tag = pbf.readVarint() >> 3;
1251
+ value = tag === 1 ? pbf.readString() : tag === 2 ? pbf.readFloat() : tag === 3 ? pbf.readDouble() : tag === 4 ? pbf.readVarint64() : tag === 5 ? pbf.readVarint() : tag === 6 ? pbf.readSVarint() : tag === 7 ? pbf.readBoolean() : null;
1252
+ }
1253
+ return value;
1254
+ }
1255
+
1256
+ // dist/mvt/lib/vector-tile/vector-tile.js
1257
+ var VectorTile = class {
1258
+ layers;
1259
+ constructor(pbf, end) {
1260
+ this.layers = pbf.readFields(readTile, /* @__PURE__ */ Object.create(null), end);
1261
+ }
1262
+ };
1263
+ function readTile(tag, layers, pbf) {
1264
+ if (tag === 3) {
1265
+ if (pbf) {
1266
+ const layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
1267
+ if (layer.length && layers) {
1268
+ layers[layer.name] = layer;
1269
+ }
1270
+ }
1271
+ }
1272
+ }
1273
+
1274
+ // dist/mvt/lib/parse-mvt-geojson.js
1275
+ function parseMVTGeoJSON(arrayBuffer, options = {}) {
1276
+ const mvtOptions = options.mvt || {};
1277
+ if (mvtOptions.coordinates === "wgs84" && !mvtOptions.tileIndex) {
1278
+ throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");
1279
+ }
1280
+ const features = [];
1281
+ if (arrayBuffer.byteLength > 0) {
1282
+ features.push(...parseToGeoJSONFeatures(arrayBuffer, mvtOptions));
1283
+ }
1284
+ return { shape: "geojson-table", type: "FeatureCollection", features };
1285
+ }
1286
+ function parseToGeoJSONFeatures(arrayBuffer, mvtOptions) {
1287
+ if (arrayBuffer.byteLength <= 0) {
1288
+ return [];
1289
+ }
1290
+ const tile = new VectorTile(new import_pbf.default(arrayBuffer));
1291
+ const selectedLayers = Array.isArray(mvtOptions.layers) ? mvtOptions.layers : Object.keys(tile.layers);
1292
+ const features = [];
1293
+ for (const layerName of selectedLayers) {
1294
+ const vectorTileLayer = tile.layers[layerName];
1295
+ if (!vectorTileLayer) {
1296
+ continue;
1297
+ }
1298
+ for (let index = 0; index < vectorTileLayer.length; index++) {
1299
+ const vectorTileFeature = vectorTileLayer.getGeoJSONFeature(index);
1300
+ const feature = vectorTileFeature.toGeoJSONFeature(mvtOptions.coordinates || "local", mvtOptions.tileIndex);
1301
+ if (mvtOptions.layerProperty) {
1302
+ feature.properties ||= {};
1303
+ feature.properties[mvtOptions.layerProperty] = layerName;
1304
+ }
1305
+ if (mvtOptions.sourceLayer) {
1306
+ feature.sourceLayer = layerName;
1307
+ }
1308
+ features.push(feature);
1309
+ }
1310
+ }
1311
+ return features;
1312
+ }
1313
+
1314
+ // dist/mvt/mvt-format.js
1315
+ var MVTFormat = {
1316
+ name: "Mapbox Vector Tile",
1317
+ id: "mvt",
1318
+ module: "tiles",
1319
+ encoding: "protobuf",
1320
+ format: "mvt",
1321
+ // Note: ArcGIS uses '.pbf' extension and 'application/octet-stream'
1322
+ extensions: ["mvt", "pbf"],
1323
+ mimeTypes: [
1324
+ // https://www.iana.org/assignments/media-types/application/vnd.mapbox-vector-tile
1325
+ "application/vnd.mapbox-vector-tile",
1326
+ "application/x-protobuf"
1327
+ // 'application/octet-stream'
1328
+ ],
1329
+ category: "geometry"
1330
+ };
1331
+
1332
+ // dist/mvt/mvt-geojson-loader-types.js
1333
+ var VERSION2 = true ? "5.0.0-alpha.13" : "latest";
1334
+ async function preload2() {
1335
+ const { MVTGeoJSONLoaderWithParser: MVTGeoJSONLoaderWithParser3 } = await Promise.resolve().then(() => (init_mvt_geojson_loader(), mvt_geojson_loader_exports));
1336
+ return MVTGeoJSONLoaderWithParser3;
1337
+ }
1338
+ var MVTGeoJSONLoader2 = {
1339
+ ...MVTFormat,
1340
+ name: "Mapbox Vector Tile (GeoJSON)",
1341
+ dataType: null,
1342
+ batchType: null,
1343
+ version: VERSION2,
1344
+ worker: false,
1345
+ options: {
1346
+ mvt: {
1347
+ shape: "geojson-table",
1348
+ coordinates: "local",
1349
+ layerProperty: "layerName",
1350
+ sourceLayer: false,
1351
+ layers: void 0,
1352
+ tileIndex: void 0
1353
+ }
1354
+ },
1355
+ preload: preload2,
1356
+ binary: true
1357
+ };
1358
+
1359
+ // dist/mvt/mvt-geojson-loader.js
1360
+ var { preload: _MVTGeoJSONLoaderPreload2, ...MVTGeoJSONLoaderMetadataWithoutPreload2 } = MVTGeoJSONLoader2;
1361
+ var MVTGeoJSONLoaderWithParser2 = {
1362
+ ...MVTGeoJSONLoaderMetadataWithoutPreload2,
1363
+ parse: async (arrayBuffer, options) => parseMVTGeoJSON(arrayBuffer, options),
1364
+ parseSync: parseMVTGeoJSON
1365
+ };
1366
+ //# sourceMappingURL=mvt-geojson-loader.cjs.map