@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,1604 @@
1
+ 'use strict';
2
+
3
+ var Map = require('ol/Map');
4
+ var View = require('ol/View');
5
+ var VectorLayer = require('ol/layer/Vector');
6
+ var LayerGroup = require('ol/layer/Group');
7
+ var TileLayer = require('ol/layer/Tile');
8
+ var ImageLayer = require('ol/layer/Image');
9
+ var VectorSource = require('ol/source/Vector');
10
+ var TileWMS = require('ol/source/TileWMS');
11
+ var OSM = require('ol/source/OSM');
12
+ var XYZ = require('ol/source/XYZ');
13
+ var Google = require('ol/source/Google');
14
+ var TileArcGISRest = require('ol/source/TileArcGISRest');
15
+ var OlImageWrapper = require('ol/Image');
16
+ var ImageSource = require('ol/source/Image');
17
+ var GeoJSON = require('ol/format/GeoJSON');
18
+ var GML2 = require('ol/format/GML2');
19
+ var GML3 = require('ol/format/GML3');
20
+ var GML32 = require('ol/format/GML32');
21
+ var WKT = require('ol/format/WKT');
22
+ var Control = require('ol/control/Control');
23
+ var OlStyle = require('ol/style/Style');
24
+ var OlFill = require('ol/style/Fill');
25
+ var OlStroke = require('ol/style/Stroke');
26
+ var OlCircle = require('ol/style/Circle');
27
+ var OlIcon = require('ol/style/Icon');
28
+ var OlText = require('ol/style/Text');
29
+ var loadingstrategy = require('ol/loadingstrategy');
30
+ var proj = require('ol/proj');
31
+ var styleconfig = require('./styleconfig-CVRqArk-.js');
32
+ var messages = require('./messages-D7h4m8Tx.js');
33
+ var vMap_vMapLayerOsm_vMapLayergroup_entry = require('./v-map.v-map-layer-osm.v-map-layergroup-BsXp3BoL.js');
34
+ var index = require('./index-B1oGO1g-.js');
35
+ var GeoTIFF = require('ol/source/GeoTIFF');
36
+ var mainDist = require('./main-dist-7TykwFci.js');
37
+ var proj4 = require('ol/proj/proj4');
38
+ var WebGLTileLayer = require('ol/layer/WebGLTile');
39
+ require('./index-JSwBbvGA.js');
40
+ require('./v-map-layer-helper-iAzxAg9I.js');
41
+ require('./_commonjsHelpers-B83fTs8d.js');
42
+
43
+ /** CSS in ShadowRoot injizieren – ohne '?inline', kompatibel zu Stencil/Rollup */
44
+ async function injectOlCss(shadowRoot) {
45
+ if (!shadowRoot)
46
+ return;
47
+ const id = 'ol-css-sheet';
48
+ // Doppeltes Einfügen vermeiden
49
+ if (shadowRoot.querySelector(`style[data-id="${id}"]`))
50
+ return;
51
+ const url = `https://cdn.jsdelivr.net/npm/ol@${vMap_vMapLayerOsm_vMapLayergroup_entry.OL_VERSION}/ol.css`;
52
+ const css = await (await fetch(url)).text();
53
+ if ('adoptedStyleSheets' in Document.prototype) {
54
+ const sheet = new CSSStyleSheet();
55
+ await sheet.replace(css);
56
+ shadowRoot.adoptedStyleSheets = [
57
+ ...(shadowRoot.adoptedStyleSheets ?? []),
58
+ sheet,
59
+ ];
60
+ }
61
+ else {
62
+ const style = document.createElement('style');
63
+ style.setAttribute('data-id', id);
64
+ style.textContent = css;
65
+ shadowRoot.appendChild(style);
66
+ }
67
+ }
68
+
69
+ // let projectionHelpersPromise: Promise<ProjectionHelpers> | null = null;
70
+ // async function loadProjectionHelpers(): Promise<ProjectionHelpers> {
71
+ // if (!projectionHelpersPromise) {
72
+ // projectionHelpersPromise = Promise.all([
73
+ // import('ol/proj'),
74
+ // import('ol/proj/proj4'),
75
+ // ]).then(([projModule, proj4Module]) => ({
76
+ // getProjection: getProjection,
77
+ // register: register,
78
+ // }));
79
+ // }
80
+ // return projectionHelpersPromise;
81
+ // }
82
+ async function createCustomGeoTiff(options) {
83
+ /**
84
+ * Gibt die GeoKeys eines GeoTIFF-Bildes zurück.
85
+ * @param image Das GeoTIFF-Bild.
86
+ * @returns Die GeoKeys oder `null`, falls keine vorhanden sind.
87
+ */
88
+ function getGeoKeys(image) {
89
+ if (typeof image.getGeoKeys === 'function') {
90
+ return image.getGeoKeys() || null;
91
+ }
92
+ return image.geoKeys || null;
93
+ }
94
+ return class CustomGeoTiff extends GeoTIFF {
95
+ geoKeys_ = null;
96
+ constructor() {
97
+ super(options);
98
+ }
99
+ /**
100
+ * Gibt die GeoKeys der ersten Quelle zurück.
101
+ * @returns Ein Promise, das die GeoKeys oder `null` zurückgibt.
102
+ */
103
+ async getGeoKeys() {
104
+ if (this.geoKeys_ !== null) {
105
+ return this.geoKeys_;
106
+ }
107
+ await this.getView();
108
+ //const sources = this.sources_;
109
+ // @ts-expect-error Zugriff auf private Eigenschaft `sourceImagery_`
110
+ const sources = this.sourceImagery_;
111
+ if (sources && sources.length > 0) {
112
+ this.determineGeoKeys(sources);
113
+ }
114
+ return this.geoKeys_;
115
+ }
116
+ /**
117
+ * Bestimmt die GeoKeys aus den Quellen.
118
+ * @param sources Die Quellen des GeoTIFFs.
119
+ */
120
+ determineGeoKeys(sources) {
121
+ if (!sources || sources.length === 0) {
122
+ return;
123
+ }
124
+ const firstSource = sources[0];
125
+ for (let i = firstSource.length - 1; i >= 0; --i) {
126
+ const image = firstSource[i];
127
+ const geoKeys = getGeoKeys(image);
128
+ if (geoKeys) {
129
+ this.geoKeys_ = geoKeys;
130
+ break;
131
+ }
132
+ }
133
+ }
134
+ /**
135
+ * Gibt die Proj4-Projektionsparameter basierend auf den GeoKeys zurück.
136
+ * @returns Ein Promise, das die Proj4-Projektionsparameter oder `null` zurückgibt.
137
+ */
138
+ async getProjectionParameters() {
139
+ const geoKeys = await this.getGeoKeys();
140
+ if (!geoKeys) {
141
+ return null;
142
+ }
143
+ return mainDist.geokeysToProj4.toProj4(geoKeys);
144
+ }
145
+ /**
146
+ * Gibt die Proj4-Projektion als String basierend auf den GeoKeys zurück.
147
+ * @returns Ein Promise, das die Proj4-Projektion als String oder `null` zurückgibt.
148
+ */
149
+ async getProj4String() {
150
+ const params = await this.getProjectionParameters();
151
+ if (!params) {
152
+ return null;
153
+ }
154
+ // Proj4-String aus den Parametern erstellen
155
+ return params.proj4 || null;
156
+ }
157
+ // /**
158
+ // * Registriert die Proj4-Projektion in OpenLayers, falls sie noch nicht existiert.
159
+ // * @param proj4String Die Proj4-Projektion als String.
160
+ // * @param code Der Code für die Projektion (z. B. 'CUSTOM:1234').
161
+ // * @returns Die OpenLayers-Projektion oder `null`, falls die Registrierung fehlschlägt.
162
+ // */
163
+ // public async registerProjectionIfNeeded(
164
+ // proj4String: string,
165
+ // code: string,
166
+ // ): Promise<import('ol/proj').Projection | null> {
167
+ // try {
168
+ // const existingProjection = getProjection(code);
169
+ // if (existingProjection) {
170
+ // return existingProjection;
171
+ // }
172
+ // proj4.defs(code, proj4String);
173
+ // register(proj4);
174
+ // return getProjection(code);
175
+ // } catch (err) {
176
+ // error('Fehler bei der Registrierung der Projektion:', err);
177
+ // return null;
178
+ // }
179
+ // }
180
+ /**
181
+ * Registriert die Proj4-Projektion in OpenLayers, falls sie noch nicht existiert.
182
+ * @returns Die OpenLayers-Projektion oder `null`, falls die Registrierung fehlschlägt.
183
+ */
184
+ async registerProjectionIfNeeded() {
185
+ try {
186
+ //const { getProjection, register } = await loadProjectionHelpers();
187
+ const proj4String = await this.getProj4String();
188
+ const code = this.getProjection()?.getCode();
189
+ const existingProjection = proj.get(code);
190
+ if (existingProjection) {
191
+ return existingProjection;
192
+ }
193
+ if (proj4String === null) {
194
+ messages.warn(`Can not get proj string for code: ${code}`);
195
+ return null;
196
+ }
197
+ index.default.defs(code, proj4String);
198
+ proj4.register(index.default);
199
+ return proj.get(code);
200
+ }
201
+ catch (err) {
202
+ messages.error('Fehler bei der Registrierung der Projektion:', err);
203
+ return null;
204
+ }
205
+ }
206
+ };
207
+ }
208
+
209
+ class OpenLayersProvider {
210
+ map;
211
+ layers = [];
212
+ baseLayers = [];
213
+ googleLogoAdded = false;
214
+ projection = 'EPSG:3857';
215
+ layerErrorCallbacks = new globalThis.Map();
216
+ layerErrorCleanups = new globalThis.Map();
217
+ async init(options) {
218
+ await injectOlCss(options.shadowRoot);
219
+ Object.assign(options.target.style, {
220
+ width: '100%',
221
+ height: '100%',
222
+ position: 'relative',
223
+ background: '#fff',
224
+ });
225
+ this.map = new Map({
226
+ target: options.target,
227
+ // layers: [new TileLayer({ source: new OSM() })],
228
+ layers: [],
229
+ view: new View({
230
+ projection: this.projection,
231
+ center: proj.fromLonLat(options?.mapInitOptions?.center ?? [0, 0]),
232
+ zoom: options?.mapInitOptions?.zoom ?? 2,
233
+ }),
234
+ });
235
+ new ResizeObserver(() => this.map?.updateSize()).observe(options.target);
236
+ }
237
+ async destroy() {
238
+ this.map?.setTarget(undefined);
239
+ this.map = undefined;
240
+ }
241
+ async updateLayer(layerId, update) {
242
+ const layer = await this._getLayerById(layerId);
243
+ switch (update.type) {
244
+ case 'geojson':
245
+ await this.updateGeoJSONLayer(layer, update.data);
246
+ break;
247
+ case 'osm':
248
+ await this.updateOSMLayer(layer, update.data);
249
+ break;
250
+ case 'wms':
251
+ await this.updateWMSLayer(layer, update.data);
252
+ break;
253
+ case 'wfs':
254
+ await this.updateWFSLayer(layer, update.data);
255
+ break;
256
+ case 'wcs':
257
+ await this.updateWCSLayer(layer, update.data);
258
+ break;
259
+ case 'arcgis':
260
+ await this.updateArcGISLayer(layer, update.data);
261
+ break;
262
+ case 'wkt':
263
+ await this.updateWKTLayer(layer, update.data);
264
+ break;
265
+ case 'geotiff':
266
+ await this.updateGeoTIFFLayer(layer, update.data);
267
+ break;
268
+ }
269
+ }
270
+ async ensureGroup(groupId, visible, _opts) {
271
+ await this._ensureGroup(groupId, visible);
272
+ }
273
+ async _ensureGroup(groupId, visible) {
274
+ if (!this.map) {
275
+ return null;
276
+ }
277
+ let group = this.layers.find(l => l.get?.('groupId') === groupId);
278
+ if (!group) {
279
+ group = new LayerGroup({
280
+ layers: [],
281
+ properties: {
282
+ groupId: groupId,
283
+ visible: typeof visible !== undefined ? visible : true,
284
+ },
285
+ });
286
+ this.map.addLayer(group);
287
+ this.layers.push(group);
288
+ }
289
+ return group;
290
+ }
291
+ async setBaseLayer(groupId, layerElementId) {
292
+ if (layerElementId === null) {
293
+ messages.log('ol - setBaseLayer - layerElementId is null.');
294
+ return;
295
+ }
296
+ const group = this.layers.find(l => l.get?.('groupId') === groupId);
297
+ const layer = this.baseLayers.find(l => l.get('layerElementId') === layerElementId);
298
+ if (layer === undefined) {
299
+ messages.log('ol - setBaseLayer - layer not found. layerElementId: ' +
300
+ layerElementId);
301
+ return;
302
+ }
303
+ group.getLayers().clear();
304
+ group.getLayers().push(layer);
305
+ //group.set('layerId', layerId, false);
306
+ }
307
+ async addBaseLayer(layerConfig, basemapid, layerElementId) {
308
+ if (layerElementId === undefined || layerElementId === null) {
309
+ messages.log('ol - addBaseLayer - layerElementId not set.');
310
+ return null;
311
+ }
312
+ if (basemapid === undefined || basemapid === null) {
313
+ messages.log('ol - addBaseLayer - basemapid not set.');
314
+ }
315
+ const group = await this._ensureGroup(layerConfig.groupId, layerConfig.groupVisible);
316
+ if (group == null) {
317
+ return null;
318
+ }
319
+ group.set('basemap', true, false);
320
+ const layer = await this.createLayer(layerConfig);
321
+ if (layer == null) {
322
+ return null;
323
+ }
324
+ layer.set('group', group);
325
+ this.baseLayers.push(layer);
326
+ let layerId = null;
327
+ if (layer) {
328
+ layerId = crypto.randomUUID();
329
+ layer.set('id', layerId, false);
330
+ layer.set('layerElementId', layerElementId, false);
331
+ const common = layerConfig;
332
+ if (common.opacity !== undefined) {
333
+ layer.setOpacity(common.opacity);
334
+ }
335
+ if (common.zIndex !== undefined) {
336
+ layer.setZIndex(common.zIndex);
337
+ }
338
+ if (common.visible) {
339
+ layer.setVisible(true);
340
+ }
341
+ else if (common.visible === false) {
342
+ layer.setVisible(false);
343
+ }
344
+ if (basemapid === layerElementId) {
345
+ group.getLayers().clear();
346
+ group.getLayers().push(layer);
347
+ //group.set('layerId', layerId, false);
348
+ }
349
+ }
350
+ return layerId;
351
+ }
352
+ async addLayerToGroup(layerConfig) {
353
+ const group = await this._ensureGroup(layerConfig.groupId, layerConfig.groupVisible);
354
+ if (group == null) {
355
+ return null;
356
+ }
357
+ const layer = await this.createLayer(layerConfig);
358
+ if (layer === null) {
359
+ return null;
360
+ }
361
+ layer.set('group', group);
362
+ group.getLayers().push(layer);
363
+ const layerId = crypto.randomUUID();
364
+ layer.set('id', layerId, false);
365
+ const common = layerConfig;
366
+ if (common.opacity !== undefined) {
367
+ layer.setOpacity(common.opacity);
368
+ }
369
+ if (common.zIndex !== undefined) {
370
+ layer.setZIndex(common.zIndex);
371
+ }
372
+ if (common.visible) {
373
+ layer.setVisible(true);
374
+ }
375
+ else if (common.visible === false) {
376
+ layer.setVisible(false);
377
+ }
378
+ return layerId;
379
+ }
380
+ async createLayer(layerConfig) {
381
+ switch (layerConfig.type) {
382
+ case 'geojson':
383
+ return this.createGeoJSONLayer(layerConfig);
384
+ case 'xyz':
385
+ return this.createXYZLayer(layerConfig);
386
+ case 'google':
387
+ return this.createGoogleLayer(layerConfig);
388
+ case 'osm':
389
+ return this.createOSMLayer(layerConfig);
390
+ case 'wms':
391
+ return this.createWMSLayer(layerConfig);
392
+ case 'wfs':
393
+ return this.createWFSLayer(layerConfig);
394
+ case 'wcs':
395
+ return this.createWCSLayer(layerConfig);
396
+ case 'arcgis':
397
+ return this.createArcGISLayer(layerConfig);
398
+ case 'wkt':
399
+ return this.createWKTLayer(layerConfig);
400
+ case 'geotiff':
401
+ return this.createGeoTIFFLayer(layerConfig);
402
+ default:
403
+ throw new Error(`Unsupported layer type: ${layerConfig.type}`);
404
+ }
405
+ }
406
+ async updateWMSLayer(layer, data) {
407
+ layer.setSource(new TileWMS({
408
+ url: data.url,
409
+ params: {
410
+ LAYERS: data.layers,
411
+ TILED: true,
412
+ ...(data.extraParams ?? {}),
413
+ },
414
+ }));
415
+ }
416
+ async updateOSMLayer(layer, data) {
417
+ let url = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';
418
+ if (data.url) {
419
+ url = data.url + '/{z}/{x}/{y}.png';
420
+ }
421
+ layer.setSource(new OSM({
422
+ url: url,
423
+ }));
424
+ }
425
+ async updateGeoJSONLayer(layer, data) {
426
+ let vectorSource = null;
427
+ const geojsonOptions = {
428
+ featureProjection: this.projection,
429
+ };
430
+ if (data.geojson) {
431
+ const geojsonObject = JSON.parse(data.geojson);
432
+ vectorSource = new VectorSource({
433
+ features: new GeoJSON(geojsonOptions).readFeatures(geojsonObject),
434
+ });
435
+ }
436
+ else {
437
+ vectorSource = new VectorSource({
438
+ url: data.url,
439
+ format: new GeoJSON(geojsonOptions),
440
+ });
441
+ }
442
+ layer.setSource(vectorSource);
443
+ let layerStyle;
444
+ if (data.geostylerStyle) {
445
+ layerStyle = await this.createGeostylerStyleFunction(data.geostylerStyle);
446
+ }
447
+ else if (data.style) {
448
+ layerStyle = await this.createEnhancedStyleFunction(data.style);
449
+ }
450
+ if (layerStyle) {
451
+ layer.setStyle(layerStyle);
452
+ }
453
+ }
454
+ async updateWFSLayer(layer, data) {
455
+ const merged = this.mergeLayerConfig(layer, 'wfsConfig', data);
456
+ const vectorSource = await this.createWFSSpource(merged);
457
+ layer.setSource(vectorSource);
458
+ // Apply style if provided
459
+ let layerStyle;
460
+ if (merged.geostylerStyle) {
461
+ layerStyle = await this.createGeostylerStyleFunction(merged.geostylerStyle);
462
+ }
463
+ else if (merged.style) {
464
+ layerStyle = await this.createEnhancedStyleFunction(merged.style);
465
+ }
466
+ if (layerStyle) {
467
+ layer.setStyle(layerStyle);
468
+ }
469
+ }
470
+ async updateWCSLayer(layer, data) {
471
+ const merged = this.mergeLayerConfig(layer, 'wcsConfig', data);
472
+ const source = await this.createWcsSource(merged);
473
+ layer.setSource(source);
474
+ }
475
+ async updateArcGISLayer(layer, data) {
476
+ const tileLayer = layer;
477
+ const currentSource = tileLayer.getSource();
478
+ const params = {
479
+ ...(currentSource?.getParams?.() ?? {}),
480
+ ...(data?.params ?? {}),
481
+ };
482
+ if (data?.token) {
483
+ params.token = data.token;
484
+ }
485
+ const sourceOptions = {
486
+ url: data?.url ??
487
+ currentSource?.getUrls?.()?.[0],
488
+ params,
489
+ ...(data?.options ?? {}),
490
+ };
491
+ const arcgisSource = new TileArcGISRest(sourceOptions);
492
+ tileLayer.setSource(arcgisSource);
493
+ }
494
+ async createEnhancedStyleFunction(style) {
495
+ // Helper method to apply opacity to colors
496
+ function applyOpacity(color, opacity) {
497
+ if (color.startsWith('rgba')) {
498
+ // Extract rgb values and apply new opacity
499
+ const rgbMatch = color.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
500
+ if (rgbMatch) {
501
+ const [, r, g, b] = rgbMatch;
502
+ return `rgba(${r}, ${g}, ${b}, ${opacity})`;
503
+ }
504
+ }
505
+ else if (color.startsWith('rgb')) {
506
+ const rgbMatch = color.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
507
+ if (rgbMatch) {
508
+ const [, r, g, b] = rgbMatch;
509
+ return `rgba(${r}, ${g}, ${b}, ${opacity})`;
510
+ }
511
+ }
512
+ else if (color.startsWith('#')) {
513
+ // Convert hex to rgba
514
+ const hex = color.slice(1);
515
+ const r = parseInt(hex.slice(0, 2), 16);
516
+ const g = parseInt(hex.slice(2, 4), 16);
517
+ const b = parseInt(hex.slice(4, 6), 16);
518
+ return `rgba(${r}, ${g}, ${b}, ${opacity})`;
519
+ }
520
+ return color; // Return original if can't parse
521
+ }
522
+ return (feature) => {
523
+ const styles = [];
524
+ const geometry = feature.getGeometry();
525
+ const geometryType = geometry.getType();
526
+ // Create fill style
527
+ const fillColor = style.fillColor ?? 'rgba(0,100,255,0.3)';
528
+ const fillOpacity = style.fillOpacity ?? 0.3;
529
+ const fill = new OlFill({
530
+ color: applyOpacity(fillColor, fillOpacity),
531
+ });
532
+ // Create stroke style
533
+ const strokeColor = style.strokeColor ?? 'rgba(0,100,255,1)';
534
+ const strokeOpacity = style.strokeOpacity ?? 1;
535
+ const strokeWidth = style.strokeWidth ?? 2;
536
+ const stroke = new OlStroke({
537
+ color: applyOpacity(strokeColor, strokeOpacity),
538
+ width: strokeWidth,
539
+ lineDash: style.strokeDashArray,
540
+ });
541
+ // Point styling
542
+ if (geometryType === 'Point') {
543
+ if (style.iconUrl) {
544
+ // Icon style for points
545
+ styles.push(new OlStyle({
546
+ image: new OlIcon({
547
+ src: style.iconUrl,
548
+ size: style.iconSize || [32, 32],
549
+ anchor: style.iconAnchor || [0.5, 1],
550
+ }),
551
+ }));
552
+ }
553
+ else {
554
+ // Circle style for points
555
+ const pointColor = style.pointColor ?? 'rgba(0,100,255,1)';
556
+ const pointOpacity = style.pointOpacity ?? 1;
557
+ const pointRadius = style.pointRadius ?? 6;
558
+ styles.push(new OlStyle({
559
+ image: new OlCircle({
560
+ radius: pointRadius,
561
+ fill: new OlFill({
562
+ color: applyOpacity(pointColor, pointOpacity),
563
+ }),
564
+ stroke: stroke,
565
+ }),
566
+ }));
567
+ }
568
+ }
569
+ else {
570
+ // Polygon and line styling
571
+ styles.push(new OlStyle({
572
+ fill: geometryType.includes('Polygon') ? fill : undefined,
573
+ stroke: stroke,
574
+ }));
575
+ }
576
+ // Text labeling
577
+ if (style.textProperty && feature.get(style.textProperty)) {
578
+ const textColor = style.textColor ?? '#000000';
579
+ const textSize = style.textSize ?? 12;
580
+ const textHaloColor = style.textHaloColor;
581
+ const textHaloWidth = style.textHaloWidth ?? 2;
582
+ const textOffset = style.textOffset || [0, 0];
583
+ styles.push(new OlStyle({
584
+ text: new OlText({
585
+ text: String(feature.get(style.textProperty)),
586
+ font: `${textSize}px Arial`,
587
+ fill: new OlFill({ color: textColor }),
588
+ stroke: textHaloColor
589
+ ? new OlStroke({
590
+ color: textHaloColor,
591
+ width: textHaloWidth,
592
+ })
593
+ : undefined,
594
+ offsetX: textOffset[0],
595
+ offsetY: textOffset[1],
596
+ }),
597
+ }));
598
+ }
599
+ return styles;
600
+ };
601
+ }
602
+ async createGeoJSONLayer(config) {
603
+ let vectorSource = null;
604
+ const geojsonOptions = {
605
+ featureProjection: this.projection,
606
+ };
607
+ if (config.geojson) {
608
+ const geojsonObject = JSON.parse(config.geojson);
609
+ vectorSource = new VectorSource({
610
+ features: new GeoJSON(geojsonOptions).readFeatures(geojsonObject),
611
+ });
612
+ }
613
+ else {
614
+ vectorSource = new VectorSource({
615
+ url: config.url,
616
+ format: new GeoJSON(geojsonOptions),
617
+ });
618
+ }
619
+ // // Create enhanced style function
620
+ // const styleFunction = (feature: any) => {
621
+ // const styles = [];
622
+ // const geometry = feature.getGeometry();
623
+ // const geometryType = geometry.getType();
624
+ // // Base style configuration
625
+ // const style = config.style || {};
626
+ // // Create fill style
627
+ // const fillColor = style.fillColor ?? 'rgba(0,100,255,0.3)';
628
+ // const fillOpacity = style.fillOpacity ?? 0.3;
629
+ // const fill = new Fill({
630
+ // color: this.applyOpacity(fillColor, fillOpacity),
631
+ // });
632
+ // // Create stroke style
633
+ // const strokeColor = style.strokeColor ?? 'rgba(0,100,255,1)';
634
+ // const strokeOpacity = style.strokeOpacity ?? 1;
635
+ // const strokeWidth = style.strokeWidth ?? 2;
636
+ // const stroke = new Stroke({
637
+ // color: this.applyOpacity(strokeColor, strokeOpacity),
638
+ // width: strokeWidth,
639
+ // lineDash: style.strokeDashArray,
640
+ // });
641
+ // // Point styling
642
+ // if (geometryType === 'Point') {
643
+ // if (style.iconUrl) {
644
+ // // Icon style for points
645
+ // styles.push(
646
+ // new Style({
647
+ // image: new Icon({
648
+ // src: style.iconUrl,
649
+ // size: style.iconSize || [32, 32],
650
+ // anchor: style.iconAnchor || [0.5, 1],
651
+ // }),
652
+ // }),
653
+ // );
654
+ // } else {
655
+ // // Circle style for points
656
+ // const pointColor = style.pointColor ?? 'rgba(0,100,255,1)';
657
+ // const pointOpacity = style.pointOpacity ?? 1;
658
+ // const pointRadius = style.pointRadius ?? 6;
659
+ // styles.push(
660
+ // new Style({
661
+ // image: new Circle({
662
+ // radius: pointRadius,
663
+ // fill: new Fill({
664
+ // color: this.applyOpacity(pointColor, pointOpacity),
665
+ // }),
666
+ // stroke: stroke,
667
+ // }),
668
+ // }),
669
+ // );
670
+ // }
671
+ // } else {
672
+ // // Polygon and line styling
673
+ // styles.push(
674
+ // new Style({
675
+ // fill: geometryType.includes('Polygon') ? fill : undefined,
676
+ // stroke: stroke,
677
+ // }),
678
+ // );
679
+ // }
680
+ // // Text labeling
681
+ // if (style.textProperty && feature.get(style.textProperty)) {
682
+ // const textColor = style.textColor ?? '#000000';
683
+ // const textSize = style.textSize ?? 12;
684
+ // const textHaloColor = style.textHaloColor;
685
+ // const textHaloWidth = style.textHaloWidth ?? 2;
686
+ // const textOffset = style.textOffset || [0, 0];
687
+ // styles.push(
688
+ // new Style({
689
+ // text: new Text({
690
+ // text: String(feature.get(style.textProperty)),
691
+ // font: `${textSize}px Arial`,
692
+ // fill: new Fill({ color: textColor }),
693
+ // stroke: textHaloColor
694
+ // ? new Stroke({
695
+ // color: textHaloColor,
696
+ // width: textHaloWidth,
697
+ // })
698
+ // : undefined,
699
+ // offsetX: textOffset[0],
700
+ // offsetY: textOffset[1],
701
+ // }),
702
+ // }),
703
+ // );
704
+ // }
705
+ // return styles;
706
+ // };
707
+ // Use geostyler style if available, otherwise use default style function
708
+ let layerStyle;
709
+ if (config.geostylerStyle) {
710
+ layerStyle = await this.createGeostylerStyleFunction(config.geostylerStyle);
711
+ }
712
+ else {
713
+ const style = config.style
714
+ ? { ...styleconfig.DEFAULT_STYLE, ...config.style }
715
+ : styleconfig.DEFAULT_STYLE;
716
+ layerStyle = await this.createEnhancedStyleFunction(style);
717
+ }
718
+ const layer = new VectorLayer({
719
+ source: vectorSource,
720
+ style: layerStyle,
721
+ });
722
+ return layer;
723
+ }
724
+ async createWFSSpource(config) {
725
+ const outputFormat = (config.outputFormat ?? 'application/json').toLowerCase();
726
+ let format = new GeoJSON();
727
+ switch (outputFormat) {
728
+ case 'gml2':
729
+ format = new GML2();
730
+ break;
731
+ case 'gml3':
732
+ format = new GML3();
733
+ break;
734
+ case 'gml32':
735
+ format = new GML32();
736
+ break;
737
+ }
738
+ const urlFunction = this.getWFSGetFeatureUrl(config);
739
+ const vectorSource = new VectorSource({
740
+ format: format,
741
+ url: urlFunction,
742
+ strategy: loadingstrategy.bbox,
743
+ });
744
+ return vectorSource;
745
+ }
746
+ async createWFSLayer(config) {
747
+ const vectorSource = await this.createWFSSpource(config);
748
+ // Use geostyler style if available, otherwise use default style function
749
+ let layerStyle;
750
+ if (config.geostylerStyle) {
751
+ layerStyle = await this.createGeostylerStyleFunction(config.geostylerStyle);
752
+ }
753
+ else {
754
+ const style = config.style
755
+ ? { ...styleconfig.DEFAULT_STYLE, ...config.style }
756
+ : styleconfig.DEFAULT_STYLE;
757
+ layerStyle = await this.createEnhancedStyleFunction(style);
758
+ }
759
+ const layer = new VectorLayer({
760
+ source: vectorSource,
761
+ style: layerStyle,
762
+ });
763
+ layer.set('wfsConfig', config, false);
764
+ return layer;
765
+ }
766
+ // private async createWFSLayer2(
767
+ // config: Extract<LayerConfig, { type: 'wfs' }>,
768
+ // ): Promise<Layer> {
769
+ // const [{ default: VectorLayer }] = await Promise.all([
770
+ // import('ol/layer/Vector'),
771
+ // ]);
772
+ // const geojson = await this.fetchWFSFromUrl(config);
773
+ // const vectorSource = await this.createVectorSourceFromGeoJSON(geojson);
774
+ // // Use geostyler style if available, otherwise use default style function
775
+ // let layerStyle;
776
+ // if (config.geostylerStyle) {
777
+ // layerStyle = await this.createGeostylerStyleFunction(
778
+ // config.geostylerStyle,
779
+ // );
780
+ // } else {
781
+ // const style = config.style
782
+ // ? { ...DEFAULT_STYLE, ...config.style }
783
+ // : DEFAULT_STYLE;
784
+ // layerStyle = await this.createEnhancedStyleFunction(style);
785
+ // }
786
+ // const layer = new VectorLayer({
787
+ // source: vectorSource,
788
+ // style: layerStyle,
789
+ // visible: config.visible ?? true,
790
+ // });
791
+ // layer.set('wfsConfig', config, false);
792
+ // return layer as unknown as Layer;
793
+ // }
794
+ /**
795
+ * Convert a GeoStyler style to an OpenLayers style function.
796
+ *
797
+ * TODO: Replace this hand-rolled conversion (~200 lines) with
798
+ * geostyler-openlayers-parser's writeStyle(). The official parser
799
+ * covers more symbolizer types, handles filters, and stays in sync
800
+ * with the GeoStyler spec. See:
801
+ * https://github.com/geostyler/geostyler-openlayers-parser
802
+ */
803
+ async createGeostylerStyleFunction(geostylerStyle) {
804
+ // Helper to extract static value from GeoStyler property (could be function or value)
805
+ const getValue = (prop, defaultValue = undefined) => {
806
+ if (prop === undefined || prop === null)
807
+ return defaultValue;
808
+ // If it's a GeoStyler function object, we can't evaluate it here - return default
809
+ if (typeof prop === 'object' && prop.name)
810
+ return defaultValue;
811
+ return prop;
812
+ };
813
+ return (feature) => {
814
+ const styles = [];
815
+ const geometry = feature.getGeometry();
816
+ const geometryType = geometry.getType();
817
+ // Process each rule in the geostyler style
818
+ if (geostylerStyle.rules) {
819
+ for (const rule of geostylerStyle.rules) {
820
+ // TODO: Add filter evaluation for rule.filter
821
+ if (rule.symbolizers) {
822
+ for (const symbolizer of rule.symbolizers) {
823
+ switch (symbolizer.kind) {
824
+ case 'Fill':
825
+ if (geometryType.includes('Polygon')) {
826
+ const fillColor = getValue(symbolizer.color, 'rgba(0,100,255,0.3)');
827
+ const outlineColor = getValue(symbolizer.outlineColor);
828
+ const outlineWidth = getValue(symbolizer.outlineWidth, 1);
829
+ styles.push(new OlStyle({
830
+ fill: new OlFill({
831
+ color: fillColor,
832
+ }),
833
+ stroke: outlineColor
834
+ ? new OlStroke({
835
+ color: outlineColor,
836
+ width: outlineWidth,
837
+ })
838
+ : undefined,
839
+ }));
840
+ }
841
+ break;
842
+ case 'Line':
843
+ {
844
+ const lineColor = getValue(symbolizer.color, 'rgba(0,100,255,1)');
845
+ const lineWidth = getValue(symbolizer.width, 1);
846
+ const dashArray = symbolizer.dasharray
847
+ ? Array.isArray(symbolizer.dasharray)
848
+ ? symbolizer.dasharray.map(v => getValue(v, 0))
849
+ : undefined
850
+ : undefined;
851
+ styles.push(new OlStyle({
852
+ stroke: new OlStroke({
853
+ color: lineColor,
854
+ width: lineWidth,
855
+ lineDash: dashArray,
856
+ }),
857
+ }));
858
+ }
859
+ break;
860
+ case 'Mark':
861
+ if (geometryType === 'Point') {
862
+ const markColor = getValue(symbolizer.color, 'rgba(0,100,255,1)');
863
+ const markRadius = getValue(symbolizer.radius, 6);
864
+ const strokeColor = getValue(symbolizer.strokeColor);
865
+ const strokeWidth = getValue(symbolizer.strokeWidth, 1);
866
+ styles.push(new OlStyle({
867
+ image: new OlCircle({
868
+ radius: markRadius,
869
+ fill: new OlFill({
870
+ color: markColor,
871
+ }),
872
+ stroke: strokeColor
873
+ ? new OlStroke({
874
+ color: strokeColor,
875
+ width: strokeWidth,
876
+ })
877
+ : undefined,
878
+ }),
879
+ }));
880
+ }
881
+ break;
882
+ case 'Icon':
883
+ if (geometryType === 'Point') {
884
+ const iconSrc = getValue(symbolizer.image);
885
+ const iconSize = getValue(symbolizer.size, 32);
886
+ const iconOpacity = getValue(symbolizer.opacity, 1);
887
+ if (iconSrc && typeof iconSrc === 'string') {
888
+ styles.push(new OlStyle({
889
+ image: new OlIcon({
890
+ src: iconSrc,
891
+ size: [iconSize, iconSize],
892
+ opacity: iconOpacity,
893
+ }),
894
+ }));
895
+ }
896
+ }
897
+ break;
898
+ case 'Text':
899
+ {
900
+ const textSym = symbolizer;
901
+ const labelProp = getValue(textSym.label);
902
+ if (labelProp && feature.get(labelProp)) {
903
+ const textColor = getValue(textSym.color, '#000000');
904
+ const textSize = getValue(textSym.size, 12);
905
+ const textFont = getValue(textSym.font?.[0], 'Arial');
906
+ const haloColor = getValue(textSym.haloColor);
907
+ const haloWidth = getValue(textSym.haloWidth, 1);
908
+ const offset = textSym.offset;
909
+ const offsetX = offset && Array.isArray(offset)
910
+ ? getValue(offset[0], 0)
911
+ : 0;
912
+ const offsetY = offset && Array.isArray(offset)
913
+ ? getValue(offset[1], 0)
914
+ : 0;
915
+ styles.push(new OlStyle({
916
+ text: new OlText({
917
+ text: String(feature.get(labelProp)),
918
+ font: `${textSize}px ${textFont}`,
919
+ fill: new OlFill({
920
+ color: textColor,
921
+ }),
922
+ stroke: haloColor
923
+ ? new OlStroke({
924
+ color: haloColor,
925
+ width: haloWidth,
926
+ })
927
+ : undefined,
928
+ offsetX: offsetX,
929
+ offsetY: offsetY,
930
+ }),
931
+ }));
932
+ }
933
+ }
934
+ break;
935
+ }
936
+ }
937
+ }
938
+ }
939
+ }
940
+ return styles.length > 0 ? styles : undefined;
941
+ };
942
+ }
943
+ async createXYZLayer(config) {
944
+ return new TileLayer({
945
+ source: new XYZ({
946
+ url: config.url,
947
+ attributions: config.attributions,
948
+ maxZoom: config.maxZoom ?? 19,
949
+ ...(config.options ?? {}),
950
+ }),
951
+ });
952
+ }
953
+ async createGoogleLayer(config) {
954
+ if (!config.apiKey) {
955
+ throw new Error("Google-Layer benötigt 'apiKey' (Google Maps Platform).");
956
+ }
957
+ // Optionen auf ol/source/Google abbilden
958
+ const source = new Google({
959
+ key: config.apiKey,
960
+ mapType: config.mapType ?? 'roadmap', // roadmap | satellite | terrain | hybrid
961
+ // optional:
962
+ scale: config.scale ?? 'scaleFactor2x', // 'scaleFactor1x' | 'scaleFactor2x' | 'scaleFactor4x'
963
+ highDpi: config.highDpi ?? true,
964
+ language: config.language,
965
+ region: config.region,
966
+ imageFormat: config.imageFormat,
967
+ styles: config.styles,
968
+ layerTypes: config.layerTypes,
969
+ });
970
+ source.on('change', () => {
971
+ if (source.getState() === 'error') {
972
+ // Fehler transparent machen (z.B. ungültiger Key / Billing)
973
+ const err = source.getError();
974
+ messages.error('Google source error', err);
975
+ this.map.getTargetElement()?.dispatchEvent(new CustomEvent('google-source-error', {
976
+ detail: { message: err ?? 'Google source error' },
977
+ bubbles: true,
978
+ composed: true,
979
+ }));
980
+ }
981
+ });
982
+ const layer = new TileLayer({ source });
983
+ // Google Logo/Branding: als Control ergänzen (unten links)
984
+ if (!this.googleLogoAdded) {
985
+ class GoogleLogoControl extends Control {
986
+ constructor() {
987
+ const el = document.createElement('img');
988
+ el.style.pointerEvents = 'none';
989
+ el.style.position = 'absolute';
990
+ el.style.bottom = '5px';
991
+ el.style.left = '5px';
992
+ el.style.height = '18px';
993
+ el.alt = 'Google';
994
+ el.src =
995
+ 'https://developers.google.com/static/maps/documentation/images/google_on_white.png';
996
+ super({ element: el });
997
+ }
998
+ }
999
+ this.map.addControl(new GoogleLogoControl());
1000
+ this.googleLogoAdded = true;
1001
+ }
1002
+ return layer;
1003
+ }
1004
+ async createOSMLayer(config) {
1005
+ let url = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';
1006
+ if (config.url) {
1007
+ url = config.url + '/{z}/{x}/{y}.png';
1008
+ }
1009
+ const layer = new TileLayer({
1010
+ source: new OSM({
1011
+ url: url,
1012
+ }),
1013
+ });
1014
+ return layer;
1015
+ }
1016
+ async createWMSLayer(config) {
1017
+ return new TileLayer({
1018
+ source: new TileWMS({
1019
+ url: config.url,
1020
+ params: {
1021
+ LAYERS: config.layers,
1022
+ TILED: true,
1023
+ ...(config.extraParams ?? {}),
1024
+ },
1025
+ }),
1026
+ });
1027
+ }
1028
+ // ── Runtime error listeners ──────────────────────────────────────
1029
+ onLayerError(layerId, callback) {
1030
+ this.layerErrorCallbacks.set(layerId, callback);
1031
+ this._getLayerById(layerId).then(layer => {
1032
+ if (!layer)
1033
+ return;
1034
+ this.attachSourceErrorListeners(layerId, layer);
1035
+ });
1036
+ }
1037
+ offLayerError(layerId) {
1038
+ this.layerErrorCleanups.get(layerId)?.();
1039
+ this.layerErrorCleanups.delete(layerId);
1040
+ this.layerErrorCallbacks.delete(layerId);
1041
+ }
1042
+ attachSourceErrorListeners(layerId, layer) {
1043
+ // Clean up previous listeners for this layer (e.g. after source replacement)
1044
+ this.layerErrorCleanups.get(layerId)?.();
1045
+ const cb = this.layerErrorCallbacks.get(layerId);
1046
+ if (!cb)
1047
+ return;
1048
+ const source = layer.getSource?.();
1049
+ if (!source)
1050
+ return;
1051
+ const cleanups = [];
1052
+ // Tile sources (OSM, XYZ, WMS, ArcGIS, Google)
1053
+ if ('getTile' in source || source instanceof TileWMS || source instanceof OSM || source instanceof XYZ || source instanceof Google || source instanceof TileArcGISRest) {
1054
+ const handler = () => { cb({ type: 'network', message: 'Tile load error' }); };
1055
+ source.on('tileloaderror', handler);
1056
+ cleanups.push(() => source.un('tileloaderror', handler));
1057
+ }
1058
+ // Vector sources (GeoJSON URL, WFS)
1059
+ if (source instanceof VectorSource) {
1060
+ const handler = () => { cb({ type: 'network', message: 'Feature load error' }); };
1061
+ source.on('featuresloaderror', handler);
1062
+ cleanups.push(() => source.un('featuresloaderror', handler));
1063
+ }
1064
+ // Image sources (WCS)
1065
+ if (source instanceof ImageSource) {
1066
+ const handler = () => { cb({ type: 'network', message: 'Image load error' }); };
1067
+ source.on('imageloaderror', handler);
1068
+ cleanups.push(() => source.un('imageloaderror', handler));
1069
+ }
1070
+ // Re-attach on source replacement (e.g. updateWMSLayer)
1071
+ const sourceChangeHandler = () => {
1072
+ this.attachSourceErrorListeners(layerId, layer);
1073
+ };
1074
+ layer.on('change:source', sourceChangeHandler);
1075
+ cleanups.push(() => layer.un('change:source', sourceChangeHandler));
1076
+ this.layerErrorCleanups.set(layerId, () => cleanups.forEach(fn => fn()));
1077
+ }
1078
+ async setView(center, zoom) {
1079
+ if (!this.map)
1080
+ return;
1081
+ this.map
1082
+ .getView()
1083
+ .animate({ center: proj.fromLonLat(center), zoom, duration: 0 });
1084
+ }
1085
+ async _forEachLayer(layerOrGroup, callback) {
1086
+ // Wenn das aktuelle Objekt eine LayerGroup ist, rufen wir die Funktion für jedes Kind erneut auf
1087
+ if (layerOrGroup instanceof LayerGroup) {
1088
+ const layers = layerOrGroup.getLayers().getArray(); // Array der Unter‑Layer
1089
+ for (const child of layers) {
1090
+ if (await this._forEachLayer(child, callback)) {
1091
+ return true;
1092
+ }
1093
+ }
1094
+ }
1095
+ else {
1096
+ // Es handelt sich um einen normalen Layer → Callback ausführen
1097
+ if (callback(layerOrGroup)) {
1098
+ return true;
1099
+ }
1100
+ }
1101
+ return false;
1102
+ }
1103
+ async _getLayerById(layerId) {
1104
+ if (!this.map) {
1105
+ return null;
1106
+ }
1107
+ let layerFound = null;
1108
+ await this._forEachLayer(this.map.getLayerGroup(), layer => {
1109
+ if (layer.get('id') === layerId) {
1110
+ layerFound = layer;
1111
+ return true;
1112
+ }
1113
+ });
1114
+ if (layerFound)
1115
+ return layerFound;
1116
+ layerFound = this.baseLayers.find(l => l.get('id') === layerId);
1117
+ if (layerFound === undefined)
1118
+ return null;
1119
+ return layerFound;
1120
+ }
1121
+ async _getLayerGroupById(groupId) {
1122
+ if (!this.map) {
1123
+ return null;
1124
+ }
1125
+ const group = this.layers.find(l => l.get?.('groupId') === groupId);
1126
+ if (group !== undefined)
1127
+ return group;
1128
+ return null;
1129
+ }
1130
+ async removeLayer(layerId) {
1131
+ if (!layerId) {
1132
+ return;
1133
+ }
1134
+ this.offLayerError(layerId);
1135
+ const layer = await this._getLayerById(layerId);
1136
+ if (layer) {
1137
+ const group = layer.get('group');
1138
+ if (group)
1139
+ group.getLayers().remove(layer);
1140
+ }
1141
+ }
1142
+ async setOpacity(layerId, opacity) {
1143
+ if (!layerId) {
1144
+ return;
1145
+ }
1146
+ const layer = await this._getLayerById(layerId);
1147
+ if (layer) {
1148
+ layer.setOpacity(opacity);
1149
+ }
1150
+ }
1151
+ async setZIndex(layerId, zIndex) {
1152
+ if (!layerId) {
1153
+ return;
1154
+ }
1155
+ const layer = await this._getLayerById(layerId);
1156
+ if (layer) {
1157
+ layer.setZIndex(zIndex);
1158
+ }
1159
+ }
1160
+ async setVisible(layerId, visible) {
1161
+ const layer = await this._getLayerById(layerId);
1162
+ if (layer) {
1163
+ layer.setVisible(visible);
1164
+ }
1165
+ }
1166
+ async setGroupVisible(groupId, visible) {
1167
+ const layer = await this._getLayerGroupById(groupId);
1168
+ if (layer) {
1169
+ layer.setVisible(visible);
1170
+ }
1171
+ }
1172
+ async updateWKTLayer(layer, data) {
1173
+ const wktFormat = new WKT();
1174
+ let vectorSource = null;
1175
+ // Get the view's projection to ensure correct coordinate transformation
1176
+ const viewProjection = this.map?.getView()?.getProjection();
1177
+ if (data.wkt) {
1178
+ // Parse WKT string directly
1179
+ const feature = wktFormat.readFeature(data.wkt, {
1180
+ dataProjection: 'EPSG:4326',
1181
+ featureProjection: viewProjection,
1182
+ });
1183
+ vectorSource = new VectorSource({
1184
+ features: [feature],
1185
+ });
1186
+ }
1187
+ else if (data.url) {
1188
+ // Fetch WKT from URL
1189
+ const response = await fetch(data.url);
1190
+ if (!response.ok)
1191
+ throw new Error(`Failed to fetch WKT: ${response.status}`);
1192
+ const wktText = await response.text();
1193
+ const feature = wktFormat.readFeature(wktText, {
1194
+ dataProjection: 'EPSG:4326',
1195
+ featureProjection: viewProjection,
1196
+ });
1197
+ vectorSource = new VectorSource({
1198
+ features: [feature],
1199
+ });
1200
+ }
1201
+ if (vectorSource) {
1202
+ layer.setSource(vectorSource);
1203
+ }
1204
+ let layerStyle;
1205
+ if (data.geostylerStyle) {
1206
+ layerStyle = await this.createGeostylerStyleFunction(data.geostylerStyle);
1207
+ }
1208
+ else if (data.style) {
1209
+ layerStyle = await this.createEnhancedStyleFunction(data.style);
1210
+ }
1211
+ if (layerStyle) {
1212
+ layer.setStyle(layerStyle);
1213
+ }
1214
+ }
1215
+ async createWKTLayer(config) {
1216
+ const wktFormat = new WKT();
1217
+ let vectorSource = null;
1218
+ // Get the view's projection to ensure correct coordinate transformation
1219
+ const viewProjection = this.map?.getView()?.getProjection();
1220
+ if (config.wkt) {
1221
+ // Parse WKT string directly
1222
+ try {
1223
+ const feature = wktFormat.readFeature(config.wkt, {
1224
+ dataProjection: 'EPSG:4326',
1225
+ featureProjection: viewProjection,
1226
+ });
1227
+ vectorSource = new VectorSource({
1228
+ features: [feature],
1229
+ });
1230
+ }
1231
+ catch (e) {
1232
+ messages.error('Failed to parse WKT:', e);
1233
+ vectorSource = new VectorSource({ features: [] });
1234
+ }
1235
+ }
1236
+ else if (config.url) {
1237
+ // Fetch WKT from URL
1238
+ try {
1239
+ const response = await fetch(config.url);
1240
+ if (!response.ok)
1241
+ throw new Error(`Failed to fetch WKT: ${response.status}`);
1242
+ const wktText = await response.text();
1243
+ const feature = wktFormat.readFeature(wktText, {
1244
+ dataProjection: 'EPSG:4326',
1245
+ featureProjection: viewProjection,
1246
+ });
1247
+ vectorSource = new VectorSource({
1248
+ features: [feature],
1249
+ });
1250
+ }
1251
+ catch (e) {
1252
+ messages.error('Failed to load WKT from URL:', e);
1253
+ vectorSource = new VectorSource({ features: [] });
1254
+ }
1255
+ }
1256
+ else {
1257
+ vectorSource = new VectorSource({ features: [] });
1258
+ }
1259
+ // Use geostyler style if available, otherwise use default style function
1260
+ let layerStyle;
1261
+ if (config.geostylerStyle) {
1262
+ layerStyle = await this.createGeostylerStyleFunction(config.geostylerStyle);
1263
+ }
1264
+ else {
1265
+ const style = config.style
1266
+ ? { ...styleconfig.DEFAULT_STYLE, ...config.style }
1267
+ : styleconfig.DEFAULT_STYLE;
1268
+ layerStyle = await this.createEnhancedStyleFunction(style);
1269
+ }
1270
+ const layer = new VectorLayer({
1271
+ source: vectorSource,
1272
+ style: layerStyle,
1273
+ opacity: config.opacity ?? 1,
1274
+ visible: config.visible ?? true,
1275
+ zIndex: config.zIndex ?? 1000,
1276
+ });
1277
+ return layer;
1278
+ }
1279
+ async createGeoTIFFLayer(config) {
1280
+ if (!config.url) {
1281
+ throw new Error('GeoTIFF layer requires a URL');
1282
+ }
1283
+ const srcInfo = {
1284
+ url: config.url,
1285
+ };
1286
+ if (config.nodata !== null && !isNaN(config.nodata)) {
1287
+ srcInfo.nodata = config.nodata;
1288
+ }
1289
+ const CustomGeoTiff = await createCustomGeoTiff({
1290
+ sources: [srcInfo],
1291
+ wrapX: false, // Prevent rendering tiles beyond extent
1292
+ });
1293
+ const source = new CustomGeoTiff();
1294
+ await source.registerProjectionIfNeeded();
1295
+ const layer = new WebGLTileLayer({
1296
+ source,
1297
+ opacity: config.opacity ?? 1,
1298
+ visible: config.visible ?? true,
1299
+ zIndex: config.zIndex ?? 100,
1300
+ });
1301
+ return layer;
1302
+ }
1303
+ // private async createGeoTIFFLayer(
1304
+ // config: Extract<LayerConfig, { type: 'geotiff' }>,
1305
+ // ): Promise<Layer> {
1306
+ // if (!config.url) {
1307
+ // throw new Error('GeoTIFF layer requires a URL');
1308
+ // }
1309
+ // createCustomGeoTiff;
1310
+ // const source = new GeoTIFF({
1311
+ // sources: [
1312
+ // {
1313
+ // url: config.url,
1314
+ // },
1315
+ // ],
1316
+ // });
1317
+ // const layer = new TileLayer({
1318
+ // source,
1319
+ // opacity: config.opacity ?? 1,
1320
+ // visible: config.visible ?? true,
1321
+ // zIndex: config.zIndex ?? 1000,
1322
+ // });
1323
+ // return layer;
1324
+ // }
1325
+ async createWCSLayer(config) {
1326
+ const source = await this.createWcsSource(config);
1327
+ const layer = new ImageLayer({
1328
+ source,
1329
+ visible: config.visible ?? true,
1330
+ opacity: config.opacity ?? 1,
1331
+ });
1332
+ layer.set('wcsConfig', config, false);
1333
+ return layer;
1334
+ }
1335
+ getWFSGetFeatureUrl(config) {
1336
+ return (extent) => {
1337
+ const wfsVersion = config.version ?? '1.1.0';
1338
+ const baseParams = {
1339
+ service: 'WFS',
1340
+ request: 'GetFeature',
1341
+ version: wfsVersion,
1342
+ typeName: config.typeName,
1343
+ outputFormat: config.outputFormat ?? 'application/json',
1344
+ bbox: extent.join(','),
1345
+ srsName: config.srsName ?? this.projection,
1346
+ };
1347
+ const params = { ...baseParams, ...(config.params ?? {}) };
1348
+ const requestUrl = this.appendParams(config.url, params);
1349
+ return requestUrl;
1350
+ };
1351
+ }
1352
+ /**
1353
+ * Erstellt eine WCS GetCoverage URL mit dynamischem BBOX für WCS 2.0.1 und 1.x.x
1354
+ */
1355
+ getWCSGetCoverageUrl(config, resolution) {
1356
+ return (extent) => {
1357
+ const wcsVersion = config.version ?? '2.0.1';
1358
+ const format = config.format ?? 'image/tiff';
1359
+ const projection = config.projection ?? this.projection;
1360
+ const params = {
1361
+ SERVICE: 'WCS',
1362
+ REQUEST: 'GetCoverage',
1363
+ VERSION: wcsVersion,
1364
+ FORMAT: format,
1365
+ };
1366
+ // WCS 2.0.1 verwendet andere Parameter als 1.x.x
1367
+ if (wcsVersion.startsWith('2.0')) {
1368
+ // WCS 2.0.1: coverageId und subset Parameter
1369
+ params.coverageId = config.coverageName;
1370
+ // BBOX als subset Parameter für WCS 2.0.1
1371
+ // subset=X(minx,maxx)&subset=Y(miny,maxy)
1372
+ const [minx, miny, maxx, maxy] = extent;
1373
+ params['subset'] = `X(${minx},${maxx})`;
1374
+ params['subset2'] = `Y(${miny},${maxy})`;
1375
+ // Ausgabeformat-Optionen für GeoTIFF FLOAT32
1376
+ if (format.includes('tiff') || format.includes('geotiff')) {
1377
+ // Für GeoTIFF können wir geotiff:compression etc. in params übergeben
1378
+ params['geotiff:compression'] = 'LZW';
1379
+ }
1380
+ }
1381
+ else {
1382
+ // WCS 1.x.x: COVERAGE und BBOX Parameter
1383
+ params.COVERAGE = config.coverageName;
1384
+ params.BBOX = extent.join(',');
1385
+ params.CRS = projection;
1386
+ // Width und Height für 1.x.x berechnen
1387
+ const width = Math.round((extent[2] - extent[0]) / resolution);
1388
+ const height = Math.round((extent[3] - extent[1]) / resolution);
1389
+ params.WIDTH = width;
1390
+ params.HEIGHT = height;
1391
+ }
1392
+ // Zusätzliche Parameter aus config hinzufügen (nur string/number)
1393
+ if (config.params) {
1394
+ Object.entries(config.params).forEach(([key, value]) => {
1395
+ if (typeof value === 'string' || typeof value === 'number') {
1396
+ params[key] = value;
1397
+ }
1398
+ });
1399
+ }
1400
+ // Für WCS 2.0.1 müssen subset Parameter speziell behandelt werden
1401
+ if (wcsVersion.startsWith('2.0')) {
1402
+ const subset2 = params['subset2'];
1403
+ delete params['subset2'];
1404
+ const query = new URLSearchParams();
1405
+ Object.entries(params).forEach(([key, value]) => {
1406
+ if (value !== undefined && value !== null) {
1407
+ query.append(key, String(value));
1408
+ }
1409
+ });
1410
+ // Zweiten subset Parameter hinzufügen
1411
+ if (subset2) {
1412
+ query.append('subset', String(subset2));
1413
+ }
1414
+ const baseUrl = config.url;
1415
+ return `${baseUrl}${baseUrl.includes('?') ? '&' : '?'}${query.toString()}`;
1416
+ }
1417
+ else {
1418
+ return this.appendParams(config.url, params);
1419
+ }
1420
+ };
1421
+ }
1422
+ // private async fetchWFSFromUrl(
1423
+ // config: Extract<LayerConfig, { type: 'wfs' }>,
1424
+ // ): Promise<any> {
1425
+ // const wfsVersion = config.version ?? '1.1.0';
1426
+ // const baseParams = {
1427
+ // service: 'WFS',
1428
+ // request: 'GetFeature',
1429
+ // version: wfsVersion,
1430
+ // typeName: config.typeName,
1431
+ // outputFormat: config.outputFormat ?? 'application/json',
1432
+ // srsName: config.srsName ?? (this.projection as string),
1433
+ // };
1434
+ // const params = { ...baseParams, ...(config.params ?? {}) };
1435
+ // const requestUrl = this.appendParams(config.url, params);
1436
+ // const response = await fetch(requestUrl);
1437
+ // if (!response.ok) {
1438
+ // throw new Error(
1439
+ // `WFS request failed (${response.status} ${response.statusText})`,
1440
+ // );
1441
+ // }
1442
+ // const outputFormat = (
1443
+ // config.outputFormat ?? 'application/json'
1444
+ // ).toLowerCase();
1445
+ // // Handle JSON formats
1446
+ // if (
1447
+ // outputFormat.includes('json') ||
1448
+ // outputFormat.includes('geojson') ||
1449
+ // outputFormat === 'application/json'
1450
+ // ) {
1451
+ // return await response.json();
1452
+ // }
1453
+ // // Handle GML formats using OpenLayers WFS parser
1454
+ // if (outputFormat.includes('gml') || outputFormat.includes('xml')) {
1455
+ // const text = await response.text();
1456
+ // const [
1457
+ // { default: WFS },
1458
+ // { default: GeoJSON },
1459
+ // { default: GML2 },
1460
+ // { default: GML3 },
1461
+ // { default: GML32 },
1462
+ // ] = await Promise.all([
1463
+ // import('ol/format/WFS'),
1464
+ // import('ol/format/GeoJSON'),
1465
+ // import('ol/format/GML2'),
1466
+ // import('ol/format/GML3'),
1467
+ // import('ol/format/GML32'),
1468
+ // ]);
1469
+ // const wfsOptions: any = {};
1470
+ // wfsOptions.version = wfsVersion;
1471
+ // switch (outputFormat) {
1472
+ // case 'gml2':
1473
+ // wfsOptions.gmlFormat = new GML2();
1474
+ // break;
1475
+ // case 'gml3':
1476
+ // wfsOptions.gmlFormat = new GML3();
1477
+ // break;
1478
+ // case 'gml32':
1479
+ // wfsOptions.gmlFormat = new GML32();
1480
+ // break;
1481
+ // }
1482
+ // const wfsFormat = new WFS(wfsOptions);
1483
+ // const features = wfsFormat.readFeatures(text);
1484
+ // // Convert features to GeoJSON
1485
+ // const geojsonFormat = new GeoJSON();
1486
+ // const geojson = JSON.parse(
1487
+ // geojsonFormat.writeFeatures(features, {
1488
+ // featureProjection: this.projection,
1489
+ // dataProjection: config.srsName ?? (this.projection as string),
1490
+ // }),
1491
+ // );
1492
+ // return geojson;
1493
+ // }
1494
+ // // Default: try to parse as JSON
1495
+ // return await response.json();
1496
+ // }
1497
+ // private async createVectorSourceFromGeoJSON(
1498
+ // geojson: any,
1499
+ // ): Promise<VectorSource> {
1500
+ // const [{ default: VectorSource }, { default: GeoJSON }] = await Promise.all(
1501
+ // [import('ol/source/Vector'), import('ol/format/GeoJSON')],
1502
+ // );
1503
+ // const format = new GeoJSON({ featureProjection: this.projection });
1504
+ // return new VectorSource({
1505
+ // features: format.readFeatures(geojson),
1506
+ // });
1507
+ // }
1508
+ mergeLayerConfig(layer, key, data) {
1509
+ const previous = layer.get(key) ?? {};
1510
+ const merged = { ...previous, ...data };
1511
+ layer.set(key, merged, false);
1512
+ return merged;
1513
+ }
1514
+ appendParams(baseUrl, params) {
1515
+ const query = new URLSearchParams();
1516
+ Object.entries(params).forEach(([key, value]) => {
1517
+ if (value !== undefined && value !== null) {
1518
+ query.set(key, String(value));
1519
+ }
1520
+ });
1521
+ if (!query.toString())
1522
+ return baseUrl;
1523
+ return `${baseUrl}${baseUrl.includes('?') ? '&' : '?'}${query.toString()}`;
1524
+ }
1525
+ /**
1526
+ * Erstellt eine WCS Image Source mit dynamischem BBOX-basierten Loading
1527
+ * Unterstützt WCS 2.0.1 und 1.x.x mit GeoTIFF FLOAT32
1528
+ */
1529
+ async createWcsSource(config) {
1530
+ const projection = config.projection ?? this.projection;
1531
+ const resolution = this.map?.getView()?.getResolution() ?? 1;
1532
+ const urlFunction = this.getWCSGetCoverageUrl(config, resolution);
1533
+ // Custom Image Source für WCS mit dynamischem BBOX
1534
+ class WCSImageSource extends ImageSource {
1535
+ urlFunction_;
1536
+ constructor(urlFunction) {
1537
+ super({
1538
+ projection: projection,
1539
+ resolutions: config.resolutions,
1540
+ // imageLoadFunction wird automatisch verwendet wenn url() implementiert ist
1541
+ });
1542
+ this.urlFunction_ = urlFunction;
1543
+ }
1544
+ // Überschreibe url()-Methode für dynamische URL-Generierung
1545
+ getImageInternal(extent, resolution, pixelRatio, _projection) {
1546
+ const url = this.urlFunction_(extent);
1547
+ // Erstelle Image mit der generierten URL
1548
+ const image = new OlImageWrapper(extent, resolution, pixelRatio, url);
1549
+ // Setze Custom Loader für CORS
1550
+ image.load = () => {
1551
+ const img = image.getImage();
1552
+ if (img.src !== url) {
1553
+ img.crossOrigin = 'anonymous';
1554
+ img.src = url;
1555
+ }
1556
+ };
1557
+ return image;
1558
+ }
1559
+ }
1560
+ return new WCSImageSource(urlFunction);
1561
+ }
1562
+ async createArcGISLayer(config) {
1563
+ const params = {
1564
+ ...(config.params ?? {}),
1565
+ };
1566
+ if (config.token) {
1567
+ params.token = config.token;
1568
+ }
1569
+ const sourceOptions = {
1570
+ url: config.url,
1571
+ params,
1572
+ ...(config.options ?? {}),
1573
+ };
1574
+ const layer = new TileLayer({
1575
+ source: new TileArcGISRest(sourceOptions),
1576
+ visible: config.visible ?? true,
1577
+ });
1578
+ return layer;
1579
+ }
1580
+ async updateGeoTIFFLayer(layer, data) {
1581
+ if (!data.url) {
1582
+ throw new Error('GeoTIFF update requires a URL');
1583
+ }
1584
+ const srcInfo = {
1585
+ url: data.url,
1586
+ };
1587
+ if (data.nodata !== null && data.nodata !== undefined && !isNaN(data.nodata)) {
1588
+ srcInfo.nodata = data.nodata;
1589
+ }
1590
+ const CustomGeoTiff = await createCustomGeoTiff({
1591
+ sources: [srcInfo],
1592
+ wrapX: false, // Prevent rendering tiles beyond extent
1593
+ });
1594
+ const source = new CustomGeoTiff();
1595
+ await source.registerProjectionIfNeeded();
1596
+ // Update source on the layer
1597
+ layer.setSource(source);
1598
+ }
1599
+ getMap() {
1600
+ return this.map;
1601
+ }
1602
+ }
1603
+
1604
+ exports.OpenLayersProvider = OpenLayersProvider;