@npm9912/v-map 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (438) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +185 -0
  3. package/dist/cjs/_commonjsHelpers-B83fTs8d.js +36 -0
  4. package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
  5. package/dist/cjs/cesium-provider-BiFFyAl9.js +2598 -0
  6. package/dist/cjs/deck-provider-Ctq3Q8a1.js +47824 -0
  7. package/dist/cjs/geotiff-CEwvF9cG.js +47 -0
  8. package/dist/cjs/geotiff-source-RaNzzWkC.js +1522 -0
  9. package/dist/cjs/index-B1oGO1g-.js +10658 -0
  10. package/dist/cjs/index-B8LHqjyg.js +1765 -0
  11. package/dist/cjs/index-BIL4VsgP.js +310 -0
  12. package/dist/cjs/index-Blku2QY8.js +167 -0
  13. package/dist/cjs/index-CJvvX4yx.js +21 -0
  14. package/dist/cjs/index-CbVT-Con.js +699 -0
  15. package/dist/cjs/index-ISOEpMC3.js +20478 -0
  16. package/dist/cjs/index-JSwBbvGA.js +1621 -0
  17. package/dist/cjs/index.browser-DQhD8Jwl.js +6873 -0
  18. package/dist/cjs/index.cjs.js +2 -0
  19. package/dist/cjs/layer-extension-B_olS0rc.js +65 -0
  20. package/dist/cjs/leaflet-provider-DOqfs7g5.js +1815 -0
  21. package/dist/cjs/loader.cjs.js +13 -0
  22. package/dist/cjs/main-dist-7TykwFci.js +2655 -0
  23. package/dist/cjs/messages-D7h4m8Tx.js +186 -0
  24. package/dist/cjs/openlayers-provider-Dfeg6L4n.js +1604 -0
  25. package/dist/cjs/polygon-layer-B9PrN7vr.js +1300 -0
  26. package/dist/cjs/scenegraph-layer-DwNoxQdi.js +2530 -0
  27. package/dist/cjs/styleconfig-CVRqArk-.js +23 -0
  28. package/dist/cjs/v-map-builder.cjs.entry.js +3786 -0
  29. package/dist/cjs/v-map-layer-geojson_12.cjs.entry.js +40894 -0
  30. package/dist/cjs/v-map-layer-helper-iAzxAg9I.js +285 -0
  31. package/dist/cjs/v-map-layer-terrain-geotiff.cjs.entry.js +258 -0
  32. package/dist/cjs/v-map-layercontrol.cjs.entry.js +247 -0
  33. package/dist/cjs/v-map.cjs.js +25 -0
  34. package/dist/cjs/v-map.v-map-layer-osm.v-map-layergroup-BsXp3BoL.js +582 -0
  35. package/dist/cjs/v-map_3.cjs.entry.js +12 -0
  36. package/dist/collection/collection-manifest.json +30 -0
  37. package/dist/collection/components/v-map/v-map.css +3 -0
  38. package/dist/collection/components/v-map/v-map.js +467 -0
  39. package/dist/collection/components/v-map/v-map.test.js +33 -0
  40. package/dist/collection/components/v-map-builder/v-map-builder.css +1 -0
  41. package/dist/collection/components/v-map-builder/v-map-builder.js +913 -0
  42. package/dist/collection/components/v-map-builder/v-map-builder.test.js +56 -0
  43. package/dist/collection/components/v-map-layer-geojson/v-map-layer-geojson.js +862 -0
  44. package/dist/collection/components/v-map-layer-geojson/v-map-layer-geojson.test.js +42 -0
  45. package/dist/collection/components/v-map-layer-geotiff/v-map-layer-geotiff.css +4 -0
  46. package/dist/collection/components/v-map-layer-geotiff/v-map-layer-geotiff.js +500 -0
  47. package/dist/collection/components/v-map-layer-geotiff/v-map-layer-geotiff.test.js +38 -0
  48. package/dist/collection/components/v-map-layer-google/v-map-layer-google.css +1 -0
  49. package/dist/collection/components/v-map-layer-google/v-map-layer-google.js +442 -0
  50. package/dist/collection/components/v-map-layer-osm/error-api.test.js +108 -0
  51. package/dist/collection/components/v-map-layer-osm/v-map-layer-osm.css +4 -0
  52. package/dist/collection/components/v-map-layer-osm/v-map-layer-osm.js +311 -0
  53. package/dist/collection/components/v-map-layer-osm/v-map-layer-osm.test.js +36 -0
  54. package/dist/collection/components/v-map-layer-scatterplot/v-map-layer-scatterplot.css +1 -0
  55. package/dist/collection/components/v-map-layer-scatterplot/v-map-layer-scatterplot.js +305 -0
  56. package/dist/collection/components/v-map-layer-terrain/v-map-layer-terrain.css +3 -0
  57. package/dist/collection/components/v-map-layer-terrain/v-map-layer-terrain.js +548 -0
  58. package/dist/collection/components/v-map-layer-terrain/v-map-layer-terrain.test.js +36 -0
  59. package/dist/collection/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.css +3 -0
  60. package/dist/collection/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.js +735 -0
  61. package/dist/collection/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.test.js +42 -0
  62. package/dist/collection/components/v-map-layer-tile3d/v-map-layer-tile3d.css +3 -0
  63. package/dist/collection/components/v-map-layer-tile3d/v-map-layer-tile3d.js +449 -0
  64. package/dist/collection/components/v-map-layer-tile3d/v-map-layer-tile3d.test.js +50 -0
  65. package/dist/collection/components/v-map-layer-wcs/v-map-layer-wcs.css +1 -0
  66. package/dist/collection/components/v-map-layer-wcs/v-map-layer-wcs.js +448 -0
  67. package/dist/collection/components/v-map-layer-wcs/v-map-layer-wcs.test.js +39 -0
  68. package/dist/collection/components/v-map-layer-wfs/v-map-layer-wfs.css +1 -0
  69. package/dist/collection/components/v-map-layer-wfs/v-map-layer-wfs.js +489 -0
  70. package/dist/collection/components/v-map-layer-wfs/v-map-layer-wfs.test.js +43 -0
  71. package/dist/collection/components/v-map-layer-wkt/v-map-layer-wkt.css +1 -0
  72. package/dist/collection/components/v-map-layer-wkt/v-map-layer-wkt.js +811 -0
  73. package/dist/collection/components/v-map-layer-wkt/v-map-layer-wkt.test.js +34 -0
  74. package/dist/collection/components/v-map-layer-wms/v-map-layer-wms.css +1 -0
  75. package/dist/collection/components/v-map-layer-wms/v-map-layer-wms.js +453 -0
  76. package/dist/collection/components/v-map-layer-wms/v-map-layer-wms.test.js +36 -0
  77. package/dist/collection/components/v-map-layer-xyz/v-map-layer-xyz.css +1 -0
  78. package/dist/collection/components/v-map-layer-xyz/v-map-layer-xyz.js +331 -0
  79. package/dist/collection/components/v-map-layer-xyz/v-map-layer-xyz.test.js +28 -0
  80. package/dist/collection/components/v-map-layercontrol/v-map-layercontrol.css +74 -0
  81. package/dist/collection/components/v-map-layercontrol/v-map-layercontrol.js +277 -0
  82. package/dist/collection/components/v-map-layercontrol/v-map-layercontrol.test.js +134 -0
  83. package/dist/collection/components/v-map-layergroup/v-map-layergroup.css +4 -0
  84. package/dist/collection/components/v-map-layergroup/v-map-layergroup.js +212 -0
  85. package/dist/collection/components/v-map-layergroup/v-map-layergroup.test.js +39 -0
  86. package/dist/collection/components/v-map-style/v-map-style.css +38 -0
  87. package/dist/collection/components/v-map-style/v-map-style.js +492 -0
  88. package/dist/collection/components/v-map-style/v-map-style.unit.js +62 -0
  89. package/dist/collection/index.js +1 -0
  90. package/dist/collection/layer/v-map-layer-helper.js +281 -0
  91. package/dist/collection/layer/v-map-layer-helper.unit.js +234 -0
  92. package/dist/collection/lib/cesium-loader.js +58 -0
  93. package/dist/collection/lib/ensure-importmap.js +12 -0
  94. package/dist/collection/lib/ensure-importmap.unit.js +57 -0
  95. package/dist/collection/lib/versions.gen.js +6 -0
  96. package/dist/collection/lib/vstyle.js +8 -0
  97. package/dist/collection/map-provider/cesium/CesiumGeoTIFFTerrainProvider.js +285 -0
  98. package/dist/collection/map-provider/cesium/CesiumLayerGroups.js +159 -0
  99. package/dist/collection/map-provider/cesium/GeoTIFFImageryProvider.js +192 -0
  100. package/dist/collection/map-provider/cesium/GeoTIFFImageryProvider.test.js +57 -0
  101. package/dist/collection/map-provider/cesium/cesium-provider.js +1408 -0
  102. package/dist/collection/map-provider/cesium/i-layer.js +1 -0
  103. package/dist/collection/map-provider/cesium/layer-manager.js +467 -0
  104. package/dist/collection/map-provider/deck/DeckGLGeoTIFFLayer.js +483 -0
  105. package/dist/collection/map-provider/deck/DeckGLGeoTIFFTerrainLayer.js +410 -0
  106. package/dist/collection/map-provider/deck/LayerGroupWithModel.js +169 -0
  107. package/dist/collection/map-provider/deck/LayerGroups.js +192 -0
  108. package/dist/collection/map-provider/deck/LayerModel.js +1 -0
  109. package/dist/collection/map-provider/deck/RenderableGroup.js +1 -0
  110. package/dist/collection/map-provider/deck/deck-provider.js +1563 -0
  111. package/dist/collection/map-provider/geotiff/geotiff-source.js +172 -0
  112. package/dist/collection/map-provider/geotiff/utils/AABB2D.js +24 -0
  113. package/dist/collection/map-provider/geotiff/utils/BVHNode2D.js +166 -0
  114. package/dist/collection/map-provider/geotiff/utils/GeoTIFFTileProcessor.js +484 -0
  115. package/dist/collection/map-provider/geotiff/utils/Triangle.js +1 -0
  116. package/dist/collection/map-provider/geotiff/utils/Triangulation.js +321 -0
  117. package/dist/collection/map-provider/geotiff/utils/colormap-utils.js +190 -0
  118. package/dist/collection/map-provider/geotiff/utils/normalization-utils.js +122 -0
  119. package/dist/collection/map-provider/geotiff/utils/sampling-utils.js +108 -0
  120. package/dist/collection/map-provider/leaflet/GeoTIFFGridLayer.js +147 -0
  121. package/dist/collection/map-provider/leaflet/WCSGridLayer.js +124 -0
  122. package/dist/collection/map-provider/leaflet/google-map-tiles-layer.js +352 -0
  123. package/dist/collection/map-provider/leaflet/leaflet-helpers.js +94 -0
  124. package/dist/collection/map-provider/leaflet/leaflet-provider.js +1095 -0
  125. package/dist/collection/map-provider/ol/CustomGeoTiff.js +145 -0
  126. package/dist/collection/map-provider/ol/openlayers-helper.js +26 -0
  127. package/dist/collection/map-provider/ol/openlayers-provider.js +1427 -0
  128. package/dist/collection/map-provider/provider-factory.js +44 -0
  129. package/dist/collection/map-provider/provider-factory.unit.js +66 -0
  130. package/dist/collection/testing/browser-test-utils.js +49 -0
  131. package/dist/collection/testing/e2e-testing.js +122 -0
  132. package/dist/collection/testing/e2e-utils.js +70 -0
  133. package/dist/collection/testing/geotiff-test-server.js +100 -0
  134. package/dist/collection/testing/mocks/geostyler-lyrx-parser.js +12 -0
  135. package/dist/collection/testing/mocks/geostyler-mapbox-parser.js +12 -0
  136. package/dist/collection/testing/mocks/geostyler-qgis-parser.js +12 -0
  137. package/dist/collection/testing/mocks/geostyler-sld-parser.js +13 -0
  138. package/dist/collection/testing/mocks/geostyler-style.js +5 -0
  139. package/dist/collection/testing/setupTests.browser.js +1 -0
  140. package/dist/collection/testing/setupTests.stencil.js +20 -0
  141. package/dist/collection/testing/setupTests.vitest.js +59 -0
  142. package/dist/collection/testing/stencil-testing-wrapper.js +43 -0
  143. package/dist/collection/testing/styleMock.js +1 -0
  144. package/dist/collection/types/color.js +1 -0
  145. package/dist/collection/types/cssmode.js +1 -0
  146. package/dist/collection/types/flavour.js +1 -0
  147. package/dist/collection/types/layerconfig.js +1 -0
  148. package/dist/collection/types/lonlat.js +1 -0
  149. package/dist/collection/types/mapinitoptions.js +1 -0
  150. package/dist/collection/types/mapprovider.js +1 -0
  151. package/dist/collection/types/provideroptions.js +1 -0
  152. package/dist/collection/types/styleconfig.js +19 -0
  153. package/dist/collection/types/styling.js +13 -0
  154. package/dist/collection/types/styling.unit.js +37 -0
  155. package/dist/collection/types/vmaplayer.js +1 -0
  156. package/dist/collection/utils/async-mutex.js +28 -0
  157. package/dist/collection/utils/diff.js +142 -0
  158. package/dist/collection/utils/diff.unit.js +59 -0
  159. package/dist/collection/utils/dom-env.js +43 -0
  160. package/dist/collection/utils/dom-env.unit.js +92 -0
  161. package/dist/collection/utils/events.js +8 -0
  162. package/dist/collection/utils/logger.js +183 -0
  163. package/dist/collection/utils/logger.unit.js +98 -0
  164. package/dist/collection/utils/messages.js +12 -0
  165. package/dist/collection/utils/spatial-utils.js +27 -0
  166. package/dist/collection/utils/spatial-utils.unit.js +24 -0
  167. package/dist/components/_commonjsHelpers.js +1 -0
  168. package/dist/components/cesium-provider.js +1 -0
  169. package/dist/components/deck-provider.js +1 -0
  170. package/dist/components/events.js +1 -0
  171. package/dist/components/geotiff-source.js +1 -0
  172. package/dist/components/geotiff.js +4 -0
  173. package/dist/components/index.browser.js +15 -0
  174. package/dist/components/index.d.ts +35 -0
  175. package/dist/components/index.js +1 -0
  176. package/dist/components/index2.js +1 -0
  177. package/dist/components/index3.js +1 -0
  178. package/dist/components/index4.js +1 -0
  179. package/dist/components/index5.js +1 -0
  180. package/dist/components/index6.js +1 -0
  181. package/dist/components/index7.js +1 -0
  182. package/dist/components/index8.js +7 -0
  183. package/dist/components/layer-extension.js +1 -0
  184. package/dist/components/leaflet-provider.js +1 -0
  185. package/dist/components/main-dist.js +1 -0
  186. package/dist/components/messages.js +1 -0
  187. package/dist/components/openlayers-provider.js +1 -0
  188. package/dist/components/polygon-layer.js +1 -0
  189. package/dist/components/scenegraph-layer.js +1 -0
  190. package/dist/components/styleconfig.js +1 -0
  191. package/dist/components/styling.js +1 -0
  192. package/dist/components/v-map-builder.d.ts +11 -0
  193. package/dist/components/v-map-builder.js +2 -0
  194. package/dist/components/v-map-layer-geojson.d.ts +11 -0
  195. package/dist/components/v-map-layer-geojson.js +1 -0
  196. package/dist/components/v-map-layer-geojson2.js +1 -0
  197. package/dist/components/v-map-layer-geotiff.d.ts +11 -0
  198. package/dist/components/v-map-layer-geotiff.js +1 -0
  199. package/dist/components/v-map-layer-geotiff2.js +1 -0
  200. package/dist/components/v-map-layer-google.d.ts +11 -0
  201. package/dist/components/v-map-layer-google.js +1 -0
  202. package/dist/components/v-map-layer-google2.js +1 -0
  203. package/dist/components/v-map-layer-helper.js +1 -0
  204. package/dist/components/v-map-layer-osm.d.ts +11 -0
  205. package/dist/components/v-map-layer-osm.js +1 -0
  206. package/dist/components/v-map-layer-osm2.js +1 -0
  207. package/dist/components/v-map-layer-scatterplot.d.ts +11 -0
  208. package/dist/components/v-map-layer-scatterplot.js +1 -0
  209. package/dist/components/v-map-layer-scatterplot2.js +1 -0
  210. package/dist/components/v-map-layer-terrain-geotiff.d.ts +11 -0
  211. package/dist/components/v-map-layer-terrain-geotiff.js +1 -0
  212. package/dist/components/v-map-layer-terrain.d.ts +11 -0
  213. package/dist/components/v-map-layer-terrain.js +1 -0
  214. package/dist/components/v-map-layer-terrain2.js +1 -0
  215. package/dist/components/v-map-layer-tile3d.d.ts +11 -0
  216. package/dist/components/v-map-layer-tile3d.js +1 -0
  217. package/dist/components/v-map-layer-tile3d2.js +1 -0
  218. package/dist/components/v-map-layer-wcs.d.ts +11 -0
  219. package/dist/components/v-map-layer-wcs.js +1 -0
  220. package/dist/components/v-map-layer-wcs2.js +1 -0
  221. package/dist/components/v-map-layer-wfs.d.ts +11 -0
  222. package/dist/components/v-map-layer-wfs.js +1 -0
  223. package/dist/components/v-map-layer-wfs2.js +1 -0
  224. package/dist/components/v-map-layer-wkt.d.ts +11 -0
  225. package/dist/components/v-map-layer-wkt.js +1 -0
  226. package/dist/components/v-map-layer-wkt2.js +1 -0
  227. package/dist/components/v-map-layer-wms.d.ts +11 -0
  228. package/dist/components/v-map-layer-wms.js +1 -0
  229. package/dist/components/v-map-layer-wms2.js +1 -0
  230. package/dist/components/v-map-layer-xyz.d.ts +11 -0
  231. package/dist/components/v-map-layer-xyz.js +1 -0
  232. package/dist/components/v-map-layer-xyz2.js +1 -0
  233. package/dist/components/v-map-layercontrol.d.ts +11 -0
  234. package/dist/components/v-map-layercontrol.js +1 -0
  235. package/dist/components/v-map-layergroup.d.ts +11 -0
  236. package/dist/components/v-map-layergroup.js +1 -0
  237. package/dist/components/v-map-layergroup2.js +1 -0
  238. package/dist/components/v-map-style.d.ts +11 -0
  239. package/dist/components/v-map-style.js +1 -0
  240. package/dist/components/v-map-style2.js +10 -0
  241. package/dist/components/v-map.d.ts +11 -0
  242. package/dist/components/v-map.js +1 -0
  243. package/dist/components/v-map2.js +1 -0
  244. package/dist/esm/_commonjsHelpers-E-ZsRS8r.js +32 -0
  245. package/dist/esm/app-globals-DQuL1Twl.js +3 -0
  246. package/dist/esm/cesium-provider-BJfAup3w.js +2596 -0
  247. package/dist/esm/deck-provider-C7U9VDEq.js +47709 -0
  248. package/dist/esm/geotiff-BEWxTIfH.js +45 -0
  249. package/dist/esm/geotiff-source-esnDnC-u.js +1516 -0
  250. package/dist/esm/index-B1zwA4IC.js +685 -0
  251. package/dist/esm/index-BBpiaTpT.js +165 -0
  252. package/dist/esm/index-BIEmlzCf.js +1697 -0
  253. package/dist/esm/index-BUHa4Jj0.js +307 -0
  254. package/dist/esm/index-DbSdn93t.js +20461 -0
  255. package/dist/esm/index-RpJarvr_.js +10656 -0
  256. package/dist/esm/index-jN06TXUp.js +14 -0
  257. package/dist/esm/index-jzneDarq.js +1613 -0
  258. package/dist/esm/index.browser-DhQAXuA7.js +6860 -0
  259. package/dist/esm/index.js +1 -0
  260. package/dist/esm/layer-extension-CZXK5goK.js +63 -0
  261. package/dist/esm/leaflet-provider-Q41TB6ku.js +1794 -0
  262. package/dist/esm/loader.js +11 -0
  263. package/dist/esm/main-dist-CwnA7_Xn.js +2652 -0
  264. package/dist/esm/messages-CMKJzsgL.js +180 -0
  265. package/dist/esm/openlayers-provider-CMsDsQTQ.js +1602 -0
  266. package/dist/esm/polygon-layer-ByhxGhWC.js +1295 -0
  267. package/dist/esm/scenegraph-layer-09K_B6DT.js +2526 -0
  268. package/dist/esm/styleconfig-B-bAcABs.js +21 -0
  269. package/dist/esm/v-map-builder.entry.js +3784 -0
  270. package/dist/esm/v-map-layer-geojson_12.entry.js +40881 -0
  271. package/dist/esm/v-map-layer-helper-Dys44Cgo.js +283 -0
  272. package/dist/esm/v-map-layer-terrain-geotiff.entry.js +256 -0
  273. package/dist/esm/v-map-layercontrol.entry.js +245 -0
  274. package/dist/esm/v-map.js +21 -0
  275. package/dist/esm/v-map.v-map-layer-osm.v-map-layergroup-B4pFHuSf.js +572 -0
  276. package/dist/esm/v-map_3.entry.js +4 -0
  277. package/dist/index.cjs.js +1 -0
  278. package/dist/index.js +1 -0
  279. package/dist/types/cesium-augment.d.ts +5 -0
  280. package/dist/types/components/v-map/v-map.d.ts +70 -0
  281. package/dist/types/components/v-map/v-map.test.d.ts +1 -0
  282. package/dist/types/components/v-map-builder/v-map-builder.d.ts +48 -0
  283. package/dist/types/components/v-map-builder/v-map-builder.test.d.ts +1 -0
  284. package/dist/types/components/v-map-layer-geojson/v-map-layer-geojson.d.ts +129 -0
  285. package/dist/types/components/v-map-layer-geojson/v-map-layer-geojson.test.d.ts +1 -0
  286. package/dist/types/components/v-map-layer-geotiff/v-map-layer-geotiff.d.ts +74 -0
  287. package/dist/types/components/v-map-layer-geotiff/v-map-layer-geotiff.test.d.ts +1 -0
  288. package/dist/types/components/v-map-layer-google/v-map-layer-google.d.ts +78 -0
  289. package/dist/types/components/v-map-layer-osm/error-api.test.d.ts +1 -0
  290. package/dist/types/components/v-map-layer-osm/v-map-layer-osm.d.ts +50 -0
  291. package/dist/types/components/v-map-layer-osm/v-map-layer-osm.test.d.ts +1 -0
  292. package/dist/types/components/v-map-layer-scatterplot/v-map-layer-scatterplot.d.ts +54 -0
  293. package/dist/types/components/v-map-layer-terrain/v-map-layer-terrain.d.ts +74 -0
  294. package/dist/types/components/v-map-layer-terrain/v-map-layer-terrain.test.d.ts +1 -0
  295. package/dist/types/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.d.ts +117 -0
  296. package/dist/types/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.test.d.ts +1 -0
  297. package/dist/types/components/v-map-layer-tile3d/v-map-layer-tile3d.d.ts +69 -0
  298. package/dist/types/components/v-map-layer-tile3d/v-map-layer-tile3d.test.d.ts +1 -0
  299. package/dist/types/components/v-map-layer-wcs/v-map-layer-wcs.d.ts +47 -0
  300. package/dist/types/components/v-map-layer-wcs/v-map-layer-wcs.test.d.ts +1 -0
  301. package/dist/types/components/v-map-layer-wfs/v-map-layer-wfs.d.ts +59 -0
  302. package/dist/types/components/v-map-layer-wfs/v-map-layer-wfs.test.d.ts +1 -0
  303. package/dist/types/components/v-map-layer-wkt/v-map-layer-wkt.d.ts +132 -0
  304. package/dist/types/components/v-map-layer-wkt/v-map-layer-wkt.test.d.ts +1 -0
  305. package/dist/types/components/v-map-layer-wms/v-map-layer-wms.d.ts +76 -0
  306. package/dist/types/components/v-map-layer-wms/v-map-layer-wms.test.d.ts +1 -0
  307. package/dist/types/components/v-map-layer-xyz/v-map-layer-xyz.d.ts +59 -0
  308. package/dist/types/components/v-map-layer-xyz/v-map-layer-xyz.test.d.ts +1 -0
  309. package/dist/types/components/v-map-layercontrol/v-map-layercontrol.d.ts +44 -0
  310. package/dist/types/components/v-map-layercontrol/v-map-layercontrol.test.d.ts +1 -0
  311. package/dist/types/components/v-map-layergroup/v-map-layergroup.d.ts +31 -0
  312. package/dist/types/components/v-map-layergroup/v-map-layergroup.test.d.ts +1 -0
  313. package/dist/types/components/v-map-style/v-map-style.d.ts +75 -0
  314. package/dist/types/components/v-map-style/v-map-style.unit.d.ts +1 -0
  315. package/dist/types/components.d.ts +2391 -0
  316. package/dist/types/globals.d.ts +16 -0
  317. package/dist/types/index.d.ts +10 -0
  318. package/dist/types/layer/v-map-layer-helper.d.ts +45 -0
  319. package/dist/types/layer/v-map-layer-helper.unit.d.ts +1 -0
  320. package/dist/types/leaflet-augment.d.ts +15 -0
  321. package/dist/types/lib/cesium-loader.d.ts +3 -0
  322. package/dist/types/lib/ensure-importmap.d.ts +3 -0
  323. package/dist/types/lib/ensure-importmap.unit.d.ts +1 -0
  324. package/dist/types/lib/versions.gen.d.ts +5 -0
  325. package/dist/types/lib/vstyle.d.ts +44 -0
  326. package/dist/types/map-provider/cesium/CesiumGeoTIFFTerrainProvider.d.ts +92 -0
  327. package/dist/types/map-provider/cesium/CesiumLayerGroups.d.ts +64 -0
  328. package/dist/types/map-provider/cesium/GeoTIFFImageryProvider.d.ts +75 -0
  329. package/dist/types/map-provider/cesium/GeoTIFFImageryProvider.test.d.ts +1 -0
  330. package/dist/types/map-provider/cesium/cesium-provider.d.ts +87 -0
  331. package/dist/types/map-provider/cesium/i-layer.d.ts +11 -0
  332. package/dist/types/map-provider/cesium/layer-manager.d.ts +31 -0
  333. package/dist/types/map-provider/deck/DeckGLGeoTIFFLayer.d.ts +91 -0
  334. package/dist/types/map-provider/deck/DeckGLGeoTIFFTerrainLayer.d.ts +82 -0
  335. package/dist/types/map-provider/deck/LayerGroupWithModel.d.ts +55 -0
  336. package/dist/types/map-provider/deck/LayerGroups.d.ts +63 -0
  337. package/dist/types/map-provider/deck/LayerModel.d.ts +8 -0
  338. package/dist/types/map-provider/deck/RenderableGroup.d.ts +20 -0
  339. package/dist/types/map-provider/deck/deck-provider.d.ts +92 -0
  340. package/dist/types/map-provider/geotiff/geotiff-source.d.ts +30 -0
  341. package/dist/types/map-provider/geotiff/utils/AABB2D.d.ts +28 -0
  342. package/dist/types/map-provider/geotiff/utils/BVHNode2D.d.ts +36 -0
  343. package/dist/types/map-provider/geotiff/utils/GeoTIFFTileProcessor.d.ts +116 -0
  344. package/dist/types/map-provider/geotiff/utils/Triangle.d.ts +5 -0
  345. package/dist/types/map-provider/geotiff/utils/Triangulation.d.ts +94 -0
  346. package/dist/types/map-provider/geotiff/utils/colormap-utils.d.ts +47 -0
  347. package/dist/types/map-provider/geotiff/utils/normalization-utils.d.ts +39 -0
  348. package/dist/types/map-provider/geotiff/utils/sampling-utils.d.ts +13 -0
  349. package/dist/types/map-provider/leaflet/GeoTIFFGridLayer.d.ts +34 -0
  350. package/dist/types/map-provider/leaflet/WCSGridLayer.d.ts +38 -0
  351. package/dist/types/map-provider/leaflet/google-map-tiles-layer.d.ts +73 -0
  352. package/dist/types/map-provider/leaflet/leaflet-helpers.d.ts +6 -0
  353. package/dist/types/map-provider/leaflet/leaflet-provider.d.ts +73 -0
  354. package/dist/types/map-provider/ol/CustomGeoTiff.d.ts +14 -0
  355. package/dist/types/map-provider/ol/openlayers-helper.d.ts +2 -0
  356. package/dist/types/map-provider/ol/openlayers-provider.d.ts +80 -0
  357. package/dist/types/map-provider/provider-factory.d.ts +12 -0
  358. package/dist/types/map-provider/provider-factory.unit.d.ts +1 -0
  359. package/dist/types/namespaces.d.ts +3 -0
  360. package/dist/types/ol-augment.d.ts +3 -0
  361. package/dist/types/ol-override.d.ts +7 -0
  362. package/dist/types/ol.d.ts +10 -0
  363. package/dist/types/stencil-public-runtime.d.ts +1860 -0
  364. package/dist/types/testing/browser-test-utils.d.ts +6 -0
  365. package/dist/types/testing/e2e-testing.d.ts +5 -0
  366. package/dist/types/testing/e2e-utils.d.ts +4 -0
  367. package/dist/types/testing/geotiff-test-server.d.ts +5 -0
  368. package/dist/types/testing/mocks/geostyler-lyrx-parser.d.ts +11 -0
  369. package/dist/types/testing/mocks/geostyler-mapbox-parser.d.ts +11 -0
  370. package/dist/types/testing/mocks/geostyler-qgis-parser.d.ts +11 -0
  371. package/dist/types/testing/mocks/geostyler-sld-parser.d.ts +11 -0
  372. package/dist/types/testing/mocks/geostyler-style.d.ts +5 -0
  373. package/dist/types/testing/setupTests.browser.d.ts +1 -0
  374. package/dist/types/testing/setupTests.stencil.d.ts +1 -0
  375. package/dist/types/testing/setupTests.vitest.d.ts +1 -0
  376. package/dist/types/testing/stencil-testing-wrapper.d.ts +3 -0
  377. package/dist/types/types/color.d.ts +1 -0
  378. package/dist/types/types/cssmode.d.ts +1 -0
  379. package/dist/types/types/flavour.d.ts +1 -0
  380. package/dist/types/types/layerconfig.d.ts +207 -0
  381. package/dist/types/types/lonlat.d.ts +1 -0
  382. package/dist/types/types/mapinitoptions.d.ts +4 -0
  383. package/dist/types/types/mapprovider.d.ts +46 -0
  384. package/dist/types/types/provideroptions.d.ts +8 -0
  385. package/dist/types/types/styleconfig.d.ts +27 -0
  386. package/dist/types/types/styling.d.ts +24 -0
  387. package/dist/types/types/styling.unit.d.ts +1 -0
  388. package/dist/types/types/vmaplayer.d.ts +10 -0
  389. package/dist/types/utils/async-mutex.d.ts +7 -0
  390. package/dist/types/utils/diff.d.ts +64 -0
  391. package/dist/types/utils/diff.unit.d.ts +1 -0
  392. package/dist/types/utils/dom-env.d.ts +5 -0
  393. package/dist/types/utils/dom-env.unit.d.ts +1 -0
  394. package/dist/types/utils/events.d.ts +29 -0
  395. package/dist/types/utils/logger.d.ts +47 -0
  396. package/dist/types/utils/logger.unit.d.ts +1 -0
  397. package/dist/types/utils/messages.d.ts +12 -0
  398. package/dist/types/utils/spatial-utils.d.ts +6 -0
  399. package/dist/types/utils/spatial-utils.unit.d.ts +1 -0
  400. package/dist/types/versions.d.ts +7 -0
  401. package/dist/v-map/index.esm.js +0 -0
  402. package/dist/v-map/p--vVleK-M.js +1 -0
  403. package/dist/v-map/p-09d10db0.entry.js +1 -0
  404. package/dist/v-map/p-5eba6058.entry.js +10 -0
  405. package/dist/v-map/p-6b102336.entry.js +1 -0
  406. package/dist/v-map/p-B-bAcABs.js +1 -0
  407. package/dist/v-map/p-BBpiaTpT.js +1 -0
  408. package/dist/v-map/p-BdijL4Av.js +1 -0
  409. package/dist/v-map/p-Be3r33VF.js +4 -0
  410. package/dist/v-map/p-BeFu0ap4.js +1 -0
  411. package/dist/v-map/p-BxFJezdK.js +1 -0
  412. package/dist/v-map/p-CMKJzsgL.js +1 -0
  413. package/dist/v-map/p-CXfA_q8m.js +1 -0
  414. package/dist/v-map/p-CZqY0yW4.js +1 -0
  415. package/dist/v-map/p-CafTHT9i.js +1 -0
  416. package/dist/v-map/p-DCTHyf58.js +1 -0
  417. package/dist/v-map/p-DQuL1Twl.js +1 -0
  418. package/dist/v-map/p-DR9McdNX.js +1 -0
  419. package/dist/v-map/p-Dckgonw8.js +1 -0
  420. package/dist/v-map/p-DhQAXuA7.js +15 -0
  421. package/dist/v-map/p-DmICdG34.js +7 -0
  422. package/dist/v-map/p-DrOQ9V4h.js +1 -0
  423. package/dist/v-map/p-DvHXtWUg.js +1 -0
  424. package/dist/v-map/p-E-ZsRS8r.js +1 -0
  425. package/dist/v-map/p-MyTSFnEk.js +1 -0
  426. package/dist/v-map/p-RpJarvr_.js +1 -0
  427. package/dist/v-map/p-WaMDUuAz.js +1 -0
  428. package/dist/v-map/p-aa410e64.entry.js +2 -0
  429. package/dist/v-map/p-c21c93fe.entry.js +1 -0
  430. package/dist/v-map/p-jzneDarq.js +2 -0
  431. package/dist/v-map/p-uiIP-taz.js +1 -0
  432. package/dist/v-map/v-map.esm.js +1 -0
  433. package/loader/cdn.js +1 -0
  434. package/loader/index.cjs.js +1 -0
  435. package/loader/index.d.ts +24 -0
  436. package/loader/index.es2017.js +1 -0
  437. package/loader/index.js +2 -0
  438. package/package.json +193 -0
@@ -0,0 +1,484 @@
1
+ import { Triangulation, calculateBounds } from "./Triangulation";
2
+ import { log, warn } from "../../../utils/logger";
3
+ import { sampleNearest, sampleBilinear, } from "./sampling-utils";
4
+ /**
5
+ * Processes GeoTIFF tiles with triangulation-based reprojection
6
+ *
7
+ * This class encapsulates the tile rendering logic using triangulation
8
+ * for efficient reprojection from arbitrary source projections to Web Mercator.
9
+ */
10
+ export class GeoTIFFTileProcessor {
11
+ // Configuration
12
+ config;
13
+ worldSize = 40075016.686; // Earth circumference in meters (Web Mercator)
14
+ // Global triangulation for the entire image (created once)
15
+ globalTriangulation;
16
+ constructor(config) {
17
+ this.config = config;
18
+ if (config.worldSize) {
19
+ this.worldSize = config.worldSize;
20
+ }
21
+ }
22
+ /**
23
+ * Create global triangulation for the entire GeoTIFF image
24
+ * This is called once to avoid recreating triangulation for every tile
25
+ */
26
+ createGlobalTriangulation() {
27
+ const startTime = performance.now();
28
+ const [srcWest, srcSouth, srcEast, srcNorth] = this.config.sourceBounds;
29
+ // Transform source corners to target projection (Mercator)
30
+ const transformFnToProj = (coord) => {
31
+ return this.config.transformSourceMapToViewFn(coord);
32
+ };
33
+ const { source: bounds } = calculateBounds(null, null, [srcWest, srcSouth, srcEast, srcNorth], transformFnToProj);
34
+ const mercatorBounds = [
35
+ bounds.minX,
36
+ bounds.minY,
37
+ bounds.maxX,
38
+ bounds.maxY,
39
+ ];
40
+ log('Creating global triangulation for bounds:', {
41
+ source: this.config.sourceBounds,
42
+ mercator: mercatorBounds,
43
+ });
44
+ // Inverse transformation: from target (Mercator) back to source
45
+ const inverseTransformFn = (coord) => {
46
+ return this.config.transformViewToSourceMapFn(coord);
47
+ };
48
+ // Use adaptive error threshold based on pixel resolution
49
+ const errorThreshold = this.config.resolution / 2.0;
50
+ const step = Math.min(10, Math.max(this.config.imageWidth, this.config.imageHeight) / 256);
51
+ this.globalTriangulation = new Triangulation(inverseTransformFn, mercatorBounds, errorThreshold, this.config.sourceRef, this.config.resolution, step);
52
+ // Force indexing
53
+ this.globalTriangulation.findSourceTriangleForTargetPoint([0, 0]);
54
+ const triangles = this.globalTriangulation.getTriangles();
55
+ log(`Global triangulation created: ${triangles.length} triangles in ${(performance.now() - startTime).toFixed(2)}ms`);
56
+ }
57
+ /**
58
+ * Get the global triangulation (may be undefined if not created yet)
59
+ */
60
+ getGlobalTriangulation() {
61
+ return this.globalTriangulation;
62
+ }
63
+ /**
64
+ * Normalize terrain samples so mesh generation does not create spikes
65
+ * for nodata or otherwise invalid height values.
66
+ */
67
+ sanitizeElevationValue(value) {
68
+ if (!Number.isFinite(value)) {
69
+ return 0;
70
+ }
71
+ if (this.config.noDataValue !== undefined &&
72
+ value === this.config.noDataValue) {
73
+ return 0;
74
+ }
75
+ return value;
76
+ }
77
+ /**
78
+ * Calculate tile size in meters for a given zoom level
79
+ */
80
+ getTileSizeInMeter(z) {
81
+ return this.worldSize / Math.pow(2, z);
82
+ }
83
+ /**
84
+ * Convert tile coordinates to View projection bounds
85
+ * For Web Mercator (deck.gl/Leaflet/Cesium): returns bounds in meters
86
+ * Note: This assumes Web Mercator tiling scheme. Override for other projections.
87
+ */
88
+ getTileBounds(x, y, z) {
89
+ const tileSize = this.getTileSizeInMeter(z);
90
+ const west = -this.worldSize / 2 + x * tileSize;
91
+ const north = this.worldSize / 2 - y * tileSize;
92
+ const east = west + tileSize;
93
+ const south = north - tileSize;
94
+ return [west, south, east, north];
95
+ }
96
+ /**
97
+ * Select best overview image based on zoom level
98
+ */
99
+ selectOverviewImage(z, tileSize) {
100
+ const baseResolution = this.config.baseImage.getResolution()[0];
101
+ if (!this.config.overviewImages ||
102
+ this.config.overviewImages.length === 0) {
103
+ return {
104
+ bestImage: this.config.baseImage,
105
+ bestResolution: baseResolution,
106
+ imageLevel: 0,
107
+ };
108
+ }
109
+ const tileSizeInMeter = this.getTileSizeInMeter(z);
110
+ const tileResolution = tileSizeInMeter / tileSize;
111
+ // Check base image and all overviews
112
+ const allImages = [this.config.baseImage, ...this.config.overviewImages];
113
+ const maxResImage = allImages[this.config.overviewImages.length];
114
+ const maxResolution = baseResolution * Math.pow(2, this.config.overviewImages.length);
115
+ let imageLevel = this.config.overviewImages.length;
116
+ let bestResolution = maxResolution;
117
+ let bestImage = maxResImage;
118
+ let levelCounter = 0;
119
+ let resolution = baseResolution;
120
+ for (const img of allImages) {
121
+ const ratio = tileResolution / (resolution * 2.0);
122
+ if (ratio <= 1.0) {
123
+ bestImage = img;
124
+ bestResolution = resolution;
125
+ imageLevel = levelCounter;
126
+ break;
127
+ }
128
+ levelCounter++;
129
+ resolution = resolution * 2;
130
+ }
131
+ return { bestImage, bestResolution, imageLevel };
132
+ }
133
+ /**
134
+ * Calculate source bounds for a tile after transformation
135
+ * @param viewBounds - Tile bounds in View projection
136
+ */
137
+ calculateTileSourceBounds(viewBounds) {
138
+ const [viewWest, viewSouth, viewEast, viewNorth] = viewBounds;
139
+ const { source: bounds } = calculateBounds(this.config.sourceRef, this.config.resolution, [viewWest, viewSouth, viewEast, viewNorth], this.config.transformViewToSourceMapFn);
140
+ // Transform tile corners from View to Source projection
141
+ const sw = this.config.transformViewToSourceMapFn([viewWest, viewSouth]);
142
+ const ne = this.config.transformViewToSourceMapFn([viewEast, viewNorth]);
143
+ const nw = this.config.transformViewToSourceMapFn([viewWest, viewNorth]);
144
+ const se = this.config.transformViewToSourceMapFn([viewEast, viewSouth]);
145
+ // Calculate bounding box from transformed corners
146
+ const tileSrcWest = Math.min(bounds.minX, sw[0], ne[0], nw[0], se[0]);
147
+ const tileSrcEast = Math.max(bounds.maxX, sw[0], ne[0], nw[0], se[0]);
148
+ const tileSrcSouth = Math.min(bounds.minY, sw[1], ne[1], nw[1], se[1]);
149
+ const tileSrcNorth = Math.max(bounds.maxY, sw[1], ne[1], nw[1], se[1]);
150
+ return { tileSrcWest, tileSrcEast, tileSrcSouth, tileSrcNorth };
151
+ }
152
+ /**
153
+ * Calculate pixel window for reading from GeoTIFF
154
+ */
155
+ calculateReadWindow(tileSrcBounds, ovWidth, ovHeight) {
156
+ const [srcWest, srcSouth, srcEast, srcNorth] = this.config.sourceBounds;
157
+ const srcWidth = srcEast - srcWest;
158
+ const srcHeight = srcNorth - srcSouth;
159
+ const { tileSrcWest, tileSrcEast, tileSrcSouth, tileSrcNorth } = tileSrcBounds;
160
+ // Calculate pixel window for this tile area
161
+ const pixelXMin = Math.floor(((tileSrcWest - srcWest) / srcWidth) * ovWidth);
162
+ const pixelXMax = Math.ceil(((tileSrcEast - srcWest) / srcWidth) * ovWidth);
163
+ const pixelYMin = Math.floor(((srcNorth - tileSrcNorth) / srcHeight) * ovHeight);
164
+ const pixelYMax = Math.ceil(((srcNorth - tileSrcSouth) / srcHeight) * ovHeight);
165
+ // Bounds check with 2-pixel padding
166
+ const readXMin = Math.min(ovWidth, Math.max(0, pixelXMin - 2));
167
+ const readXMax = Math.max(0, Math.min(ovWidth, pixelXMax + 2));
168
+ const readYMin = Math.min(ovHeight, Math.max(0, pixelYMin - 2));
169
+ const readYMax = Math.max(0, Math.min(ovHeight, pixelYMax + 2));
170
+ const readWidth = readXMax - readXMin;
171
+ const readHeight = readYMax - readYMin;
172
+ if (readWidth <= 0 || readHeight <= 0) {
173
+ warn('Invalid read window for tile', {
174
+ readXMin,
175
+ readXMax,
176
+ readYMin,
177
+ readYMax,
178
+ ovWidth,
179
+ ovHeight,
180
+ });
181
+ return null;
182
+ }
183
+ return {
184
+ readXMin,
185
+ readXMax,
186
+ readYMin,
187
+ readYMax,
188
+ readWidth,
189
+ readHeight,
190
+ };
191
+ }
192
+ /**
193
+ * Load and convert raster data from GeoTIFF image
194
+ */
195
+ async loadAndConvertRasterData(image, readWindow) {
196
+ const { readXMin, readYMin, readXMax, readYMax } = readWindow;
197
+ let rasters = null;
198
+ let lasterr = null;
199
+ for (let i = 0; i <= 2; i++) {
200
+ try {
201
+ // Read only the needed area from GeoTIFF (COG-optimized!)
202
+ rasters = await image.readRasters({
203
+ window: [readXMin, readYMin, readXMax, readYMax],
204
+ });
205
+ }
206
+ catch (err) {
207
+ // warn('Error - readRasters - read window: ', readWindow);
208
+ lasterr = err;
209
+ }
210
+ if (rasters != null) {
211
+ lasterr = null;
212
+ break;
213
+ }
214
+ }
215
+ if (lasterr != null) {
216
+ log(lasterr);
217
+ warn('Error - readRasters - read window: ', readWindow);
218
+ throw lasterr;
219
+ }
220
+ // Convert to TypedArray array and detect type
221
+ const rasterBands = [];
222
+ let arrayType = '';
223
+ for (let i = 0; i < rasters.length; i++) {
224
+ const raster = rasters[i];
225
+ if (typeof raster === 'number') {
226
+ warn('Unexpected number in rasters array');
227
+ continue;
228
+ }
229
+ rasterBands.push(raster);
230
+ if (i === 0) {
231
+ arrayType = raster.constructor.name;
232
+ }
233
+ }
234
+ return { rasterBands, arrayType };
235
+ }
236
+ /**
237
+ * Render tile pixels using triangulation-based reprojection
238
+ */
239
+ renderTilePixels(params) {
240
+ const { sampleSize, mercatorBounds, triangulation, rasterBands, arrayType, readWindow, ovWidth, ovHeight, resampleMethod, colorStops, } = params;
241
+ const [mercWest, mercSouth, mercEast, mercNorth] = mercatorBounds;
242
+ const [srcWest, srcSouth, srcEast, srcNorth] = this.config.sourceBounds;
243
+ const srcWidth = srcEast - srcWest;
244
+ const srcHeight = srcNorth - srcSouth;
245
+ const outputData = new Uint8ClampedArray(sampleSize * sampleSize * 4); // RGBA
246
+ let tri = null;
247
+ for (let py = 0; py < sampleSize; py++) {
248
+ for (let px = 0; px < sampleSize; px++) {
249
+ const idx = (py * sampleSize + px) * 4; // RGBA index
250
+ // Pixel position in Mercator
251
+ const mercX = mercWest + (px / sampleSize) * (mercEast - mercWest);
252
+ const mercY = mercNorth - (py / sampleSize) * (mercNorth - mercSouth);
253
+ // Find triangle containing this pixel
254
+ const targetPoint = [mercX, mercY];
255
+ tri = triangulation.findSourceTriangleForTargetPoint(targetPoint, tri);
256
+ if (tri) {
257
+ // Transform using affine transformation
258
+ const [srcX, srcY] = triangulation.applyAffineTransform(mercX, mercY, tri.transform);
259
+ // Check if point is within source bounds
260
+ if (srcX < srcWest ||
261
+ srcX > srcEast ||
262
+ srcY < srcSouth ||
263
+ srcY > srcNorth) {
264
+ // Outside bounds - transparent
265
+ outputData[idx] = 0;
266
+ outputData[idx + 1] = 0;
267
+ outputData[idx + 2] = 0;
268
+ outputData[idx + 3] = 0;
269
+ }
270
+ else {
271
+ // Convert source coordinates to pixel coordinates (in overview image)
272
+ const imgX = ((srcX - srcWest) / srcWidth) * ovWidth;
273
+ const imgY = ((srcNorth - srcY) / srcHeight) * ovHeight;
274
+ // Sample pixel from source raster
275
+ const rgba = resampleMethod === 'near'
276
+ ? sampleNearest(imgX, imgY, rasterBands, arrayType, readWindow.readWidth, readWindow.readHeight, readWindow.readXMin, readWindow.readYMin, colorStops)
277
+ : sampleBilinear(imgX, imgY, rasterBands, arrayType, readWindow.readWidth, readWindow.readHeight, readWindow.readXMin, readWindow.readYMin, colorStops);
278
+ if (rgba) {
279
+ outputData[idx] = rgba[0];
280
+ outputData[idx + 1] = rgba[1];
281
+ outputData[idx + 2] = rgba[2];
282
+ outputData[idx + 3] = rgba[3];
283
+ }
284
+ else {
285
+ // No data
286
+ outputData[idx] = 0;
287
+ outputData[idx + 1] = 0;
288
+ outputData[idx + 2] = 0;
289
+ outputData[idx + 3] = 0;
290
+ }
291
+ }
292
+ }
293
+ else {
294
+ // Pixel not in any triangle (should not happen)
295
+ outputData[idx] = 0;
296
+ outputData[idx + 1] = 0;
297
+ outputData[idx + 2] = 0;
298
+ outputData[idx + 3] = 0;
299
+ }
300
+ }
301
+ }
302
+ return outputData;
303
+ }
304
+ /**
305
+ * Check if tile intersects with GeoTIFF source bounds
306
+ * @param viewBounds - Tile bounds in View projection (e.g., Web Mercator for deck.gl/Leaflet/Cesium)
307
+ */
308
+ tileIntersectsSource(viewBounds) {
309
+ const [viewWest, viewSouth, viewEast, viewNorth] = viewBounds;
310
+ const [srcWest, srcSouth, srcEast, srcNorth] = this.config.sourceBounds;
311
+ // Transform tile corners from View to Source projection
312
+ const sw = this.config.transformViewToSourceMapFn([viewWest, viewSouth]);
313
+ const ne = this.config.transformViewToSourceMapFn([viewEast, viewNorth]);
314
+ const nw = this.config.transformViewToSourceMapFn([viewWest, viewNorth]);
315
+ const se = this.config.transformViewToSourceMapFn([viewEast, viewSouth]);
316
+ // Calculate bounding box of transformed tile in source projection
317
+ const tileMinX = Math.min(sw[0], ne[0], nw[0], se[0]);
318
+ const tileMaxX = Math.max(sw[0], ne[0], nw[0], se[0]);
319
+ const tileMinY = Math.min(sw[1], ne[1], nw[1], se[1]);
320
+ const tileMaxY = Math.max(sw[1], ne[1], nw[1], se[1]);
321
+ // Check for intersection
322
+ const intersects = tileMaxX >= srcWest &&
323
+ tileMinX <= srcEast &&
324
+ tileMaxY >= srcSouth &&
325
+ tileMinY <= srcNorth;
326
+ return intersects;
327
+ }
328
+ /**
329
+ * Generate tile data with triangulation-based reprojection
330
+ *
331
+ * This is the main method that orchestrates the entire tile rendering process.
332
+ */
333
+ async getTileData(params) {
334
+ const { x, y, z, tileSize, resolution, resampleMethod, colorStops } = params;
335
+ // 1. Calculate View projection bounds for the tile
336
+ const viewBounds = this.getTileBounds(x, y, z);
337
+ log(`v-map - geotiff - getTileData(${x},${y},${z}): viewBounds=[${viewBounds.map(v => v.toFixed(0)).join(',')}], sourceBounds=[${this.config.sourceBounds.map(v => v.toFixed(0)).join(',')}], toProjection=${this.config.toProjection}`);
338
+ // 2. Early exit: Check if tile intersects with source bounds
339
+ if (!this.tileIntersectsSource(viewBounds)) {
340
+ // Tile is completely outside source bounds - return transparent tile
341
+ log(`v-map - geotiff - getTileData(${x},${y},${z}): no intersection, returning transparent`);
342
+ const sampleSize = Math.ceil(tileSize * resolution);
343
+ return new Uint8ClampedArray(sampleSize * sampleSize * 4);
344
+ }
345
+ // 3. Calculate sampling resolution
346
+ const sampleSize = Math.ceil(tileSize * resolution);
347
+ // 4. Get or create triangulation
348
+ let triangulation;
349
+ if (!this.globalTriangulation) {
350
+ warn('Global triangulation not available, creating fallback for tile');
351
+ triangulation = new Triangulation(this.config.transformViewToSourceMapFn, viewBounds, 0.5);
352
+ }
353
+ else {
354
+ triangulation = this.globalTriangulation;
355
+ }
356
+ // 5. Calculate source bounds for this tile
357
+ const tileSrcBounds = this.calculateTileSourceBounds(viewBounds);
358
+ // 6. Select best overview image based on zoom
359
+ const { bestImage, bestResolution, imageLevel } = this.selectOverviewImage(z, tileSize);
360
+ const ovWidth = bestImage.getWidth();
361
+ const ovHeight = bestImage.getHeight();
362
+ // 7. Calculate pixel window for reading
363
+ const readWindow = this.calculateReadWindow(tileSrcBounds, ovWidth, ovHeight);
364
+ if (!readWindow) {
365
+ return new Uint8ClampedArray(sampleSize * sampleSize * 4);
366
+ }
367
+ // 8. Load and convert raster data
368
+ const { rasterBands, arrayType } = await this.loadAndConvertRasterData(bestImage, readWindow);
369
+ const bandCount = rasterBands.length;
370
+ log(`Read window: [${readWindow.readXMin}, ${readWindow.readYMin}, ${readWindow.readXMax}, ${readWindow.readYMax}] (${readWindow.readWidth}x${readWindow.readHeight} pixels), ${bandCount} bands, type: ${arrayType}, imageLevel: ${imageLevel}, resolution: ${bestResolution}`);
371
+ // 9. Render tile pixels
372
+ const outputData = this.renderTilePixels({
373
+ sampleSize,
374
+ mercatorBounds: viewBounds, // Pass View bounds (kept name for backward compat)
375
+ triangulation,
376
+ rasterBands,
377
+ arrayType,
378
+ readWindow,
379
+ ovWidth,
380
+ ovHeight,
381
+ resampleMethod,
382
+ colorStops,
383
+ });
384
+ return outputData;
385
+ }
386
+ /**
387
+ * Get raw elevation values for a tile as Float32Array.
388
+ *
389
+ * Returns a (tileSize+1) × (tileSize+1) float array suitable for Martini
390
+ * terrain mesh generation. Border pixels are backfilled for Martini compatibility.
391
+ * Band 0 of the GeoTIFF is used as the elevation source.
392
+ */
393
+ async getElevationData(params) {
394
+ const { x, y, z, tileSize } = params;
395
+ const gridSize = tileSize + 1; // Martini requires (2^n + 1)^2 grid
396
+ const viewBounds = this.getTileBounds(x, y, z);
397
+ if (!this.tileIntersectsSource(viewBounds)) {
398
+ return new Float32Array(gridSize * gridSize);
399
+ }
400
+ let triangulation;
401
+ if (!this.globalTriangulation) {
402
+ warn('Global triangulation not available, creating fallback for elevation tile');
403
+ triangulation = new Triangulation(this.config.transformViewToSourceMapFn, viewBounds, 0.5);
404
+ }
405
+ else {
406
+ triangulation = this.globalTriangulation;
407
+ }
408
+ const tileSrcBounds = this.calculateTileSourceBounds(viewBounds);
409
+ const { bestImage } = this.selectOverviewImage(z, tileSize);
410
+ const ovWidth = bestImage.getWidth();
411
+ const ovHeight = bestImage.getHeight();
412
+ const readWindow = this.calculateReadWindow(tileSrcBounds, ovWidth, ovHeight);
413
+ if (!readWindow) {
414
+ return new Float32Array(gridSize * gridSize);
415
+ }
416
+ const { rasterBands } = await this.loadAndConvertRasterData(bestImage, readWindow);
417
+ const [mercWest, mercSouth, mercEast, mercNorth] = viewBounds;
418
+ const [srcWest, srcSouth, srcEast, srcNorth] = this.config.sourceBounds;
419
+ const srcWidth = srcEast - srcWest;
420
+ const srcHeight = srcNorth - srcSouth;
421
+ const output = new Float32Array(gridSize * gridSize);
422
+ let tri = null;
423
+ for (let py = 0; py < tileSize; py++) {
424
+ for (let px = 0; px < tileSize; px++) {
425
+ const mercX = mercWest + (px / tileSize) * (mercEast - mercWest);
426
+ const mercY = mercNorth - (py / tileSize) * (mercNorth - mercSouth);
427
+ const targetPoint = [mercX, mercY];
428
+ tri = triangulation.findSourceTriangleForTargetPoint(targetPoint, tri);
429
+ if (tri) {
430
+ const [srcX, srcY] = triangulation.applyAffineTransform(mercX, mercY, tri.transform);
431
+ if (srcX >= srcWest && srcX <= srcEast && srcY >= srcSouth && srcY <= srcNorth) {
432
+ const imgX = ((srcX - srcWest) / srcWidth) * ovWidth;
433
+ const imgY = ((srcNorth - srcY) / srcHeight) * ovHeight;
434
+ const sampleX = Math.round(imgX) - readWindow.readXMin;
435
+ const sampleY = Math.round(imgY) - readWindow.readYMin;
436
+ if (sampleX >= 0 && sampleX < readWindow.readWidth &&
437
+ sampleY >= 0 && sampleY < readWindow.readHeight) {
438
+ const sampleValue = Number(rasterBands[0][sampleY * readWindow.readWidth + sampleX]);
439
+ output[py * gridSize + px] =
440
+ this.sanitizeElevationValue(sampleValue);
441
+ }
442
+ }
443
+ }
444
+ }
445
+ }
446
+ // Backfill right border column (Martini requirement)
447
+ for (let row = 0; row < tileSize; row++) {
448
+ output[row * gridSize + tileSize] = output[row * gridSize + tileSize - 1];
449
+ }
450
+ // Backfill bottom border row (Martini requirement)
451
+ for (let col = 0; col <= tileSize; col++) {
452
+ output[tileSize * gridSize + col] = output[(tileSize - 1) * gridSize + col];
453
+ }
454
+ return output;
455
+ }
456
+ }
457
+ export async function getTileProcessorConfig(tiffSource, viewProjection) {
458
+ const { default: proj4 } = await import('proj4');
459
+ // Transform from View projection to Source projection
460
+ const transformViewToSourceMapFn = (coord) => {
461
+ const result = proj4(viewProjection, tiffSource.fromProjection, coord);
462
+ return [Number(result[0]), Number(result[1])];
463
+ };
464
+ // Inverse: Transform from Source projection to View projection
465
+ const transformSourceMapToViewFn = (coord) => {
466
+ const result = proj4(tiffSource.fromProjection, viewProjection, coord);
467
+ return [Number(result[0]), Number(result[1])];
468
+ };
469
+ const config = {
470
+ transformViewToSourceMapFn,
471
+ transformSourceMapToViewFn,
472
+ sourceBounds: tiffSource.sourceBounds,
473
+ sourceRef: tiffSource.sourceRef,
474
+ resolution: tiffSource.resolution,
475
+ imageWidth: tiffSource.width,
476
+ imageHeight: tiffSource.height,
477
+ fromProjection: tiffSource.fromProjection,
478
+ toProjection: viewProjection,
479
+ baseImage: tiffSource.baseImage,
480
+ overviewImages: tiffSource.overviewImages ?? [],
481
+ noDataValue: tiffSource.noDataValue,
482
+ };
483
+ return config;
484
+ }