ol 9.2.5-sh.2 → 10.0.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 (672) hide show
  1. package/Collection.d.ts +1 -1
  2. package/Collection.d.ts.map +1 -1
  3. package/DataTile.d.ts +15 -1
  4. package/DataTile.d.ts.map +1 -1
  5. package/DataTile.js +26 -1
  6. package/Feature.d.ts +1 -1
  7. package/Feature.d.ts.map +1 -1
  8. package/Geolocation.d.ts +2 -2
  9. package/Geolocation.d.ts.map +1 -1
  10. package/Geolocation.js +1 -0
  11. package/Image.d.ts +4 -4
  12. package/Image.d.ts.map +1 -1
  13. package/ImageCanvas.d.ts +2 -1
  14. package/ImageCanvas.d.ts.map +1 -1
  15. package/ImageCanvas.js +2 -0
  16. package/ImageTile.d.ts.map +1 -1
  17. package/ImageTile.js +1 -1
  18. package/Map.d.ts +5 -4
  19. package/Map.d.ts.map +1 -1
  20. package/Map.js +15 -14
  21. package/MapBrowserEvent.d.ts +4 -2
  22. package/MapBrowserEvent.d.ts.map +1 -1
  23. package/MapBrowserEvent.js +4 -0
  24. package/MapBrowserEventHandler.d.ts +4 -1
  25. package/MapBrowserEventHandler.d.ts.map +1 -1
  26. package/MapBrowserEventHandler.js +4 -0
  27. package/MapBrowserEventType.d.ts +1 -1
  28. package/MapEvent.d.ts.map +1 -1
  29. package/MapEventType.d.ts +1 -1
  30. package/Object.d.ts.map +1 -1
  31. package/ObjectEventType.d.ts +1 -1
  32. package/Observable.d.ts +2 -2
  33. package/Observable.d.ts.map +1 -1
  34. package/Overlay.d.ts +2 -2
  35. package/Overlay.d.ts.map +1 -1
  36. package/Overlay.js +2 -2
  37. package/README.md +1 -1
  38. package/Tile.d.ts +10 -30
  39. package/Tile.d.ts.map +1 -1
  40. package/Tile.js +6 -79
  41. package/TileCache.d.ts +2 -1
  42. package/TileCache.d.ts.map +1 -1
  43. package/TileCache.js +4 -0
  44. package/TileQueue.d.ts +3 -2
  45. package/TileQueue.d.ts.map +1 -1
  46. package/TileQueue.js +7 -4
  47. package/VectorRenderTile.d.ts +8 -13
  48. package/VectorRenderTile.d.ts.map +1 -1
  49. package/VectorRenderTile.js +19 -24
  50. package/VectorTile.d.ts +6 -6
  51. package/VectorTile.d.ts.map +1 -1
  52. package/VectorTile.js +5 -4
  53. package/View.d.ts +1 -1
  54. package/View.d.ts.map +1 -1
  55. package/array.d.ts +2 -2
  56. package/array.d.ts.map +1 -1
  57. package/asserts.d.ts.map +1 -1
  58. package/centerconstraint.d.ts.map +1 -1
  59. package/color.d.ts.map +1 -1
  60. package/color.js +2 -2
  61. package/console.d.ts +1 -1
  62. package/console.d.ts.map +1 -1
  63. package/control/Attribution.d.ts.map +1 -1
  64. package/control/Attribution.js +5 -12
  65. package/control/Control.d.ts.map +1 -1
  66. package/control/Control.js +4 -6
  67. package/control/FullScreen.d.ts +1 -1
  68. package/control/FullScreen.d.ts.map +1 -1
  69. package/control/FullScreen.js +1 -0
  70. package/control/MousePosition.d.ts +1 -1
  71. package/control/MousePosition.d.ts.map +1 -1
  72. package/control/MousePosition.js +1 -0
  73. package/control/OverviewMap.d.ts.map +1 -1
  74. package/control/OverviewMap.js +16 -13
  75. package/control/Rotate.d.ts +4 -1
  76. package/control/Rotate.d.ts.map +1 -1
  77. package/control/Rotate.js +3 -0
  78. package/control/ScaleLine.d.ts +3 -3
  79. package/control/ScaleLine.d.ts.map +1 -1
  80. package/control/ZoomSlider.d.ts.map +1 -1
  81. package/control/ZoomSlider.js +1 -0
  82. package/control/ZoomToExtent.d.ts.map +1 -1
  83. package/control/defaults.d.ts.map +1 -1
  84. package/coordinate.d.ts +1 -1
  85. package/coordinate.d.ts.map +1 -1
  86. package/css.d.ts.map +1 -1
  87. package/dist/ol.d.ts +10 -8
  88. package/dist/ol.d.ts.map +1 -1
  89. package/dist/ol.js +1 -3
  90. package/dist/ol.js.map +1 -1
  91. package/dom.d.ts +0 -5
  92. package/dom.d.ts.map +1 -1
  93. package/dom.js +1 -9
  94. package/events/SnapEvent.d.ts.map +1 -1
  95. package/events/Target.d.ts.map +1 -1
  96. package/events/Target.js +1 -0
  97. package/events/condition.d.ts +2 -2
  98. package/events/condition.d.ts.map +1 -1
  99. package/events/condition.js +1 -1
  100. package/events.d.ts.map +1 -1
  101. package/events.js +6 -4
  102. package/expr/cpu.d.ts +1 -1
  103. package/expr/cpu.d.ts.map +1 -1
  104. package/expr/cpu.js +2 -16
  105. package/expr/expression.d.ts +8 -15
  106. package/expr/expression.d.ts.map +1 -1
  107. package/expr/expression.js +388 -508
  108. package/expr/gpu.d.ts +3 -3
  109. package/expr/gpu.d.ts.map +1 -1
  110. package/expr/gpu.js +1 -14
  111. package/extent.d.ts +2 -2
  112. package/extent.d.ts.map +1 -1
  113. package/featureloader.d.ts +6 -6
  114. package/featureloader.d.ts.map +1 -1
  115. package/featureloader.js +3 -3
  116. package/format/EsriJSON.d.ts +9 -5
  117. package/format/EsriJSON.d.ts.map +1 -1
  118. package/format/EsriJSON.js +7 -0
  119. package/format/Feature.d.ts +12 -12
  120. package/format/Feature.d.ts.map +1 -1
  121. package/format/Feature.js +7 -5
  122. package/format/GML2.d.ts.map +1 -1
  123. package/format/GML2.js +7 -9
  124. package/format/GML3.d.ts +2 -1
  125. package/format/GML3.d.ts.map +1 -1
  126. package/format/GML3.js +23 -31
  127. package/format/GML32.d.ts.map +1 -1
  128. package/format/GML32.js +1 -0
  129. package/format/GMLBase.d.ts.map +1 -1
  130. package/format/GMLBase.js +3 -0
  131. package/format/GPX.d.ts.map +1 -1
  132. package/format/GPX.js +3 -0
  133. package/format/GeoJSON.d.ts +17 -13
  134. package/format/GeoJSON.d.ts.map +1 -1
  135. package/format/GeoJSON.js +17 -14
  136. package/format/IGC.d.ts +1 -1
  137. package/format/IGC.d.ts.map +1 -1
  138. package/format/IGC.js +2 -0
  139. package/format/IIIFInfo.d.ts.map +1 -1
  140. package/format/JSONFeature.d.ts +15 -11
  141. package/format/JSONFeature.d.ts.map +1 -1
  142. package/format/JSONFeature.js +17 -11
  143. package/format/KML.d.ts +6 -6
  144. package/format/KML.d.ts.map +1 -1
  145. package/format/KML.js +5 -1
  146. package/format/MVT.d.ts +15 -13
  147. package/format/MVT.d.ts.map +1 -1
  148. package/format/MVT.js +15 -14
  149. package/format/OSMXML.d.ts.map +1 -1
  150. package/format/OSMXML.js +1 -0
  151. package/format/OWS.d.ts.map +1 -1
  152. package/format/OWS.js +1 -0
  153. package/format/Polyline.d.ts +6 -3
  154. package/format/Polyline.d.ts.map +1 -1
  155. package/format/Polyline.js +6 -0
  156. package/format/TextFeature.d.ts +9 -5
  157. package/format/TextFeature.d.ts.map +1 -1
  158. package/format/TextFeature.js +8 -0
  159. package/format/TopoJSON.d.ts +1 -1
  160. package/format/TopoJSON.d.ts.map +1 -1
  161. package/format/TopoJSON.js +2 -0
  162. package/format/WFS.d.ts.map +1 -1
  163. package/format/WFS.js +3 -0
  164. package/format/WKB.d.ts +9 -5
  165. package/format/WKB.d.ts.map +1 -1
  166. package/format/WKB.js +8 -0
  167. package/format/WKT.d.ts.map +1 -1
  168. package/format/WKT.js +6 -0
  169. package/format/WMSCapabilities.d.ts.map +1 -1
  170. package/format/WMSCapabilities.js +1 -0
  171. package/format/WMSGetFeatureInfo.d.ts.map +1 -1
  172. package/format/WMSGetFeatureInfo.js +1 -0
  173. package/format/WMTSCapabilities.d.ts.map +1 -1
  174. package/format/WMTSCapabilities.js +1 -0
  175. package/format/XMLFeature.d.ts +11 -6
  176. package/format/XMLFeature.d.ts.map +1 -1
  177. package/format/XMLFeature.js +8 -0
  178. package/format/filter/Bbox.d.ts.map +1 -1
  179. package/format/filter/Comparison.d.ts.map +1 -1
  180. package/format/filter/ComparisonBinary.d.ts.map +1 -1
  181. package/format/filter/Contains.d.ts.map +1 -1
  182. package/format/filter/DWithin.d.ts.map +1 -1
  183. package/format/filter/Disjoint.d.ts.map +1 -1
  184. package/format/filter/During.d.ts.map +1 -1
  185. package/format/filter/EqualTo.d.ts.map +1 -1
  186. package/format/filter/Filter.d.ts.map +1 -1
  187. package/format/filter/GreaterThan.d.ts.map +1 -1
  188. package/format/filter/GreaterThanOrEqualTo.d.ts.map +1 -1
  189. package/format/filter/Intersects.d.ts.map +1 -1
  190. package/format/filter/IsBetween.d.ts.map +1 -1
  191. package/format/filter/IsLike.d.ts.map +1 -1
  192. package/format/filter/IsNull.d.ts.map +1 -1
  193. package/format/filter/LessThan.d.ts.map +1 -1
  194. package/format/filter/LessThanOrEqualTo.d.ts.map +1 -1
  195. package/format/filter/LogicalNary.d.ts.map +1 -1
  196. package/format/filter/Not.d.ts.map +1 -1
  197. package/format/filter/NotEqualTo.d.ts.map +1 -1
  198. package/format/filter/ResourceId.d.ts.map +1 -1
  199. package/format/filter/Spatial.d.ts.map +1 -1
  200. package/format/filter/Within.d.ts.map +1 -1
  201. package/format/filter.d.ts.map +1 -1
  202. package/functions.d.ts +2 -2
  203. package/functions.d.ts.map +1 -1
  204. package/functions.js +6 -5
  205. package/geom/Circle.d.ts +10 -3
  206. package/geom/Circle.d.ts.map +1 -1
  207. package/geom/Circle.js +13 -0
  208. package/geom/Geometry.d.ts +2 -2
  209. package/geom/GeometryCollection.d.ts +6 -3
  210. package/geom/GeometryCollection.d.ts.map +1 -1
  211. package/geom/GeometryCollection.js +13 -0
  212. package/geom/LineString.d.ts +9 -5
  213. package/geom/LineString.d.ts.map +1 -1
  214. package/geom/LineString.js +7 -0
  215. package/geom/LinearRing.d.ts +8 -4
  216. package/geom/LinearRing.d.ts.map +1 -1
  217. package/geom/LinearRing.js +7 -0
  218. package/geom/MultiLineString.d.ts +8 -4
  219. package/geom/MultiLineString.d.ts.map +1 -1
  220. package/geom/MultiLineString.js +7 -0
  221. package/geom/MultiPoint.d.ts +6 -3
  222. package/geom/MultiPoint.d.ts.map +1 -1
  223. package/geom/MultiPoint.js +6 -0
  224. package/geom/MultiPolygon.d.ts +8 -4
  225. package/geom/MultiPolygon.d.ts.map +1 -1
  226. package/geom/MultiPolygon.js +8 -0
  227. package/geom/Point.d.ts +4 -2
  228. package/geom/Point.d.ts.map +1 -1
  229. package/geom/Point.js +7 -0
  230. package/geom/Polygon.d.ts +8 -4
  231. package/geom/Polygon.d.ts.map +1 -1
  232. package/geom/Polygon.js +8 -0
  233. package/geom/SimpleGeometry.d.ts +2 -1
  234. package/geom/SimpleGeometry.d.ts.map +1 -1
  235. package/geom/SimpleGeometry.js +6 -0
  236. package/geom/flat/area.d.ts.map +1 -1
  237. package/geom/flat/area.js +9 -7
  238. package/geom/flat/center.d.ts.map +1 -1
  239. package/geom/flat/closest.d.ts.map +1 -1
  240. package/geom/flat/contains.d.ts.map +1 -1
  241. package/geom/flat/deflate.d.ts.map +1 -1
  242. package/geom/flat/flip.d.ts.map +1 -1
  243. package/geom/flat/geodesic.d.ts.map +1 -1
  244. package/geom/flat/inflate.d.ts.map +1 -1
  245. package/geom/flat/interiorpoint.d.ts.map +1 -1
  246. package/geom/flat/interpolate.d.ts.map +1 -1
  247. package/geom/flat/intersectsextent.d.ts.map +1 -1
  248. package/geom/flat/length.d.ts.map +1 -1
  249. package/geom/flat/linechunk.d.ts.map +1 -1
  250. package/geom/flat/orient.d.ts.map +1 -1
  251. package/geom/flat/reverse.d.ts.map +1 -1
  252. package/geom/flat/segments.d.ts +1 -1
  253. package/geom/flat/segments.d.ts.map +1 -1
  254. package/geom/flat/simplify.d.ts.map +1 -1
  255. package/geom/flat/straightchunk.d.ts.map +1 -1
  256. package/geom/flat/textpath.d.ts.map +1 -1
  257. package/geom/flat/topology.d.ts.map +1 -1
  258. package/geom/flat/transform.d.ts.map +1 -1
  259. package/interaction/DblClickDragZoom.d.ts.map +1 -1
  260. package/interaction/DblClickDragZoom.js +1 -0
  261. package/interaction/DoubleClickZoom.d.ts.map +1 -1
  262. package/interaction/DoubleClickZoom.js +1 -0
  263. package/interaction/DragAndDrop.d.ts +4 -3
  264. package/interaction/DragAndDrop.d.ts.map +1 -1
  265. package/interaction/DragAndDrop.js +2 -0
  266. package/interaction/DragBox.d.ts +3 -3
  267. package/interaction/DragBox.d.ts.map +1 -1
  268. package/interaction/DragBox.js +6 -2
  269. package/interaction/DragPan.d.ts +6 -4
  270. package/interaction/DragPan.d.ts.map +1 -1
  271. package/interaction/DragPan.js +6 -1
  272. package/interaction/DragRotate.d.ts +3 -3
  273. package/interaction/DragRotate.d.ts.map +1 -1
  274. package/interaction/DragRotate.js +5 -2
  275. package/interaction/DragRotateAndZoom.d.ts +2 -2
  276. package/interaction/DragRotateAndZoom.d.ts.map +1 -1
  277. package/interaction/DragRotateAndZoom.js +4 -1
  278. package/interaction/DragZoom.d.ts +3 -3
  279. package/interaction/DragZoom.d.ts.map +1 -1
  280. package/interaction/DragZoom.js +3 -2
  281. package/interaction/Draw.d.ts +8 -7
  282. package/interaction/Draw.d.ts.map +1 -1
  283. package/interaction/Draw.js +9 -5
  284. package/interaction/Extent.d.ts +4 -3
  285. package/interaction/Extent.d.ts.map +1 -1
  286. package/interaction/Extent.js +6 -1
  287. package/interaction/Interaction.d.ts +1 -1
  288. package/interaction/Interaction.d.ts.map +1 -1
  289. package/interaction/KeyboardPan.d.ts +2 -2
  290. package/interaction/KeyboardPan.d.ts.map +1 -1
  291. package/interaction/KeyboardPan.js +2 -1
  292. package/interaction/KeyboardZoom.d.ts +2 -2
  293. package/interaction/KeyboardZoom.d.ts.map +1 -1
  294. package/interaction/KeyboardZoom.js +2 -1
  295. package/interaction/Link.d.ts +1 -1
  296. package/interaction/Link.d.ts.map +1 -1
  297. package/interaction/Link.js +4 -0
  298. package/interaction/Modify.d.ts +13 -10
  299. package/interaction/Modify.d.ts.map +1 -1
  300. package/interaction/Modify.js +11 -3
  301. package/interaction/MouseWheelZoom.d.ts +3 -3
  302. package/interaction/MouseWheelZoom.d.ts.map +1 -1
  303. package/interaction/MouseWheelZoom.js +2 -1
  304. package/interaction/PinchRotate.d.ts.map +1 -1
  305. package/interaction/PinchRotate.js +3 -0
  306. package/interaction/PinchZoom.d.ts.map +1 -1
  307. package/interaction/PinchZoom.js +3 -0
  308. package/interaction/Pointer.d.ts.map +1 -1
  309. package/interaction/Pointer.js +1 -0
  310. package/interaction/Select.d.ts +14 -14
  311. package/interaction/Select.d.ts.map +1 -1
  312. package/interaction/Select.js +8 -6
  313. package/interaction/Snap.d.ts +3 -2
  314. package/interaction/Snap.d.ts.map +1 -1
  315. package/interaction/Snap.js +3 -0
  316. package/interaction/Translate.d.ts +11 -10
  317. package/interaction/Translate.d.ts.map +1 -1
  318. package/interaction/Translate.js +9 -4
  319. package/interaction/defaults.d.ts.map +1 -1
  320. package/layer/Base.d.ts +1 -1
  321. package/layer/Base.d.ts.map +1 -1
  322. package/layer/Base.js +1 -0
  323. package/layer/BaseImage.d.ts.map +1 -1
  324. package/layer/BaseTile.d.ts +22 -5
  325. package/layer/BaseTile.d.ts.map +1 -1
  326. package/layer/BaseTile.js +23 -3
  327. package/layer/BaseVector.d.ts.map +1 -1
  328. package/layer/BaseVector.js +3 -0
  329. package/layer/Graticule.d.ts +2 -1
  330. package/layer/Graticule.d.ts.map +1 -1
  331. package/layer/Graticule.js +1 -0
  332. package/layer/Group.d.ts +2 -2
  333. package/layer/Group.d.ts.map +1 -1
  334. package/layer/Group.js +3 -0
  335. package/layer/Heatmap.d.ts +8 -3
  336. package/layer/Heatmap.d.ts.map +1 -1
  337. package/layer/Heatmap.js +18 -7
  338. package/layer/Image.d.ts.map +1 -1
  339. package/layer/Image.js +4 -0
  340. package/layer/Layer.d.ts +4 -4
  341. package/layer/Layer.d.ts.map +1 -1
  342. package/layer/Layer.js +7 -8
  343. package/layer/Tile.d.ts +5 -2
  344. package/layer/Tile.d.ts.map +1 -1
  345. package/layer/Tile.js +6 -1
  346. package/layer/Vector.d.ts.map +1 -1
  347. package/layer/Vector.js +3 -0
  348. package/layer/VectorImage.d.ts +1 -1
  349. package/layer/VectorImage.d.ts.map +1 -1
  350. package/layer/VectorImage.js +3 -0
  351. package/layer/VectorTile.d.ts +32 -7
  352. package/layer/VectorTile.d.ts.map +1 -1
  353. package/layer/VectorTile.js +38 -6
  354. package/layer/WebGLPoints.d.ts +1 -2
  355. package/layer/WebGLPoints.d.ts.map +1 -1
  356. package/layer/WebGLPoints.js +3 -0
  357. package/layer/WebGLTile.d.ts +9 -12
  358. package/layer/WebGLTile.d.ts.map +1 -1
  359. package/layer/WebGLTile.js +20 -21
  360. package/loadingstrategy.d.ts.map +1 -1
  361. package/math.d.ts.map +1 -1
  362. package/net.d.ts.map +1 -1
  363. package/obj.d.ts.map +1 -1
  364. package/ol.css +4 -0
  365. package/package.json +4 -4
  366. package/pixel.d.ts.map +1 -1
  367. package/proj/Projection.d.ts +1 -1
  368. package/proj/Projection.d.ts.map +1 -1
  369. package/proj/Units.d.ts +1 -1
  370. package/proj/epsg3857.d.ts.map +1 -1
  371. package/proj/epsg4326.d.ts.map +1 -1
  372. package/proj/proj4.d.ts.map +1 -1
  373. package/proj.d.ts.map +1 -1
  374. package/render/Box.d.ts.map +1 -1
  375. package/render/Box.js +1 -0
  376. package/render/Event.d.ts.map +1 -1
  377. package/render/EventType.d.ts +2 -2
  378. package/render/Feature.d.ts +6 -4
  379. package/render/Feature.d.ts.map +1 -1
  380. package/render/Feature.js +2 -0
  381. package/render/canvas/Builder.d.ts.map +1 -1
  382. package/render/canvas/Builder.js +2 -0
  383. package/render/canvas/BuilderGroup.d.ts.map +1 -1
  384. package/render/canvas/Executor.d.ts +6 -27
  385. package/render/canvas/Executor.d.ts.map +1 -1
  386. package/render/canvas/Executor.js +7 -13
  387. package/render/canvas/ExecutorGroup.d.ts +4 -5
  388. package/render/canvas/ExecutorGroup.d.ts.map +1 -1
  389. package/render/canvas/ExecutorGroup.js +2 -1
  390. package/render/canvas/ImageBuilder.d.ts +2 -1
  391. package/render/canvas/ImageBuilder.d.ts.map +1 -1
  392. package/render/canvas/ImageBuilder.js +4 -0
  393. package/render/canvas/Immediate.d.ts +24 -12
  394. package/render/canvas/Immediate.d.ts.map +1 -1
  395. package/render/canvas/Immediate.js +14 -0
  396. package/render/canvas/Instruction.d.ts.map +1 -1
  397. package/render/canvas/LineStringBuilder.d.ts.map +1 -1
  398. package/render/canvas/LineStringBuilder.js +4 -0
  399. package/render/canvas/PolygonBuilder.d.ts.map +1 -1
  400. package/render/canvas/PolygonBuilder.js +4 -0
  401. package/render/canvas/TextBuilder.d.ts +4 -2
  402. package/render/canvas/TextBuilder.d.ts.map +1 -1
  403. package/render/canvas/TextBuilder.js +4 -0
  404. package/render/canvas/ZIndexContext.d.ts +2 -1
  405. package/render/canvas/ZIndexContext.d.ts.map +1 -1
  406. package/render/canvas/ZIndexContext.js +1 -0
  407. package/render/canvas/hitdetect.d.ts +1 -1
  408. package/render/canvas/hitdetect.d.ts.map +1 -1
  409. package/render/canvas/style.d.ts +3 -3
  410. package/render/canvas/style.d.ts.map +1 -1
  411. package/render/canvas/style.js +6 -5
  412. package/render/canvas.d.ts +1 -1
  413. package/render/canvas.d.ts.map +1 -1
  414. package/render/canvas.js +2 -1
  415. package/render/webgl/MixedGeometryBatch.d.ts +4 -1
  416. package/render/webgl/MixedGeometryBatch.d.ts.map +1 -1
  417. package/render/webgl/MixedGeometryBatch.js +4 -0
  418. package/render/webgl/VectorStyleRenderer.d.ts +56 -30
  419. package/render/webgl/VectorStyleRenderer.d.ts.map +1 -1
  420. package/render/webgl/VectorStyleRenderer.js +39 -0
  421. package/render/webgl/renderinstructions.d.ts +4 -4
  422. package/render/webgl/utils.d.ts +1 -1
  423. package/render/webgl/utils.d.ts.map +1 -1
  424. package/render.d.ts.map +1 -1
  425. package/renderer/Composite.d.ts +3 -2
  426. package/renderer/Composite.d.ts.map +1 -1
  427. package/renderer/Composite.js +10 -4
  428. package/renderer/Layer.d.ts +22 -29
  429. package/renderer/Layer.d.ts.map +1 -1
  430. package/renderer/Layer.js +33 -37
  431. package/renderer/Map.d.ts +1 -1
  432. package/renderer/Map.d.ts.map +1 -1
  433. package/renderer/canvas/ImageLayer.d.ts +6 -4
  434. package/renderer/canvas/ImageLayer.d.ts.map +1 -1
  435. package/renderer/canvas/ImageLayer.js +12 -9
  436. package/renderer/canvas/Layer.d.ts +4 -9
  437. package/renderer/canvas/Layer.d.ts.map +1 -1
  438. package/renderer/canvas/Layer.js +1 -6
  439. package/renderer/canvas/TileLayer.d.ts +105 -41
  440. package/renderer/canvas/TileLayer.d.ts.map +1 -1
  441. package/renderer/canvas/TileLayer.js +545 -329
  442. package/renderer/canvas/VectorImageLayer.d.ts +6 -3
  443. package/renderer/canvas/VectorImageLayer.d.ts.map +1 -1
  444. package/renderer/canvas/VectorImageLayer.js +10 -3
  445. package/renderer/canvas/VectorLayer.d.ts +6 -3
  446. package/renderer/canvas/VectorLayer.d.ts.map +1 -1
  447. package/renderer/canvas/VectorLayer.js +8 -0
  448. package/renderer/canvas/VectorTileLayer.d.ts +16 -14
  449. package/renderer/canvas/VectorTileLayer.d.ts.map +1 -1
  450. package/renderer/canvas/VectorTileLayer.js +78 -53
  451. package/renderer/vector.d.ts.map +1 -1
  452. package/renderer/webgl/Layer.d.ts +1 -6
  453. package/renderer/webgl/Layer.d.ts.map +1 -1
  454. package/renderer/webgl/Layer.js +2 -6
  455. package/renderer/webgl/PointsLayer.d.ts +23 -8
  456. package/renderer/webgl/PointsLayer.d.ts.map +1 -1
  457. package/renderer/webgl/PointsLayer.js +22 -1
  458. package/renderer/webgl/TileLayer.d.ts +16 -5
  459. package/renderer/webgl/TileLayer.d.ts.map +1 -1
  460. package/renderer/webgl/TileLayer.js +18 -0
  461. package/renderer/webgl/TileLayerBase.d.ts +7 -16
  462. package/renderer/webgl/TileLayerBase.d.ts.map +1 -1
  463. package/renderer/webgl/TileLayerBase.js +69 -84
  464. package/renderer/webgl/VectorLayer.d.ts +32 -8
  465. package/renderer/webgl/VectorLayer.d.ts.map +1 -1
  466. package/renderer/webgl/VectorLayer.js +53 -0
  467. package/renderer/webgl/VectorTileLayer.d.ts +34 -29
  468. package/renderer/webgl/VectorTileLayer.d.ts.map +1 -1
  469. package/renderer/webgl/VectorTileLayer.js +27 -0
  470. package/renderer/webgl/worldUtil.d.ts.map +1 -1
  471. package/reproj/DataTile.d.ts.map +1 -1
  472. package/reproj/DataTile.js +121 -119
  473. package/reproj/Image.d.ts +2 -1
  474. package/reproj/Image.d.ts.map +1 -1
  475. package/reproj/Image.js +4 -2
  476. package/reproj/Tile.d.ts.map +1 -1
  477. package/reproj/Tile.js +16 -19
  478. package/reproj/Triangulation.d.ts.map +1 -1
  479. package/reproj.d.ts +1 -1
  480. package/reproj.d.ts.map +1 -1
  481. package/resolution.d.ts.map +1 -1
  482. package/resolutionconstraint.d.ts.map +1 -1
  483. package/rotationconstraint.d.ts.map +1 -1
  484. package/size.d.ts.map +1 -1
  485. package/source/BingMaps.d.ts +3 -3
  486. package/source/BingMaps.d.ts.map +1 -1
  487. package/source/BingMaps.js +1 -2
  488. package/source/CartoDB.d.ts +2 -2
  489. package/source/CartoDB.d.ts.map +1 -1
  490. package/source/CartoDB.js +1 -1
  491. package/source/Cluster.d.ts +5 -5
  492. package/source/Cluster.d.ts.map +1 -1
  493. package/source/Cluster.js +5 -2
  494. package/source/DataTile.d.ts +51 -22
  495. package/source/DataTile.d.ts.map +1 -1
  496. package/source/DataTile.js +67 -9
  497. package/source/GeoTIFF.d.ts +4 -7
  498. package/source/GeoTIFF.d.ts.map +1 -1
  499. package/source/GeoTIFF.js +4 -3
  500. package/source/Google.d.ts +2 -1
  501. package/source/Google.d.ts.map +1 -1
  502. package/source/Google.js +4 -2
  503. package/source/IIIF.d.ts +1 -1
  504. package/source/IIIF.js +1 -1
  505. package/source/Image.d.ts +3 -2
  506. package/source/Image.d.ts.map +1 -1
  507. package/source/Image.js +1 -0
  508. package/source/ImageArcGISRest.d.ts.map +1 -1
  509. package/source/ImageArcGISRest.js +4 -0
  510. package/source/ImageCanvas.d.ts +2 -1
  511. package/source/ImageCanvas.d.ts.map +1 -1
  512. package/source/ImageCanvas.js +1 -0
  513. package/source/ImageMapGuide.d.ts.map +1 -1
  514. package/source/ImageMapGuide.js +4 -0
  515. package/source/ImageStatic.d.ts.map +1 -1
  516. package/source/ImageStatic.js +1 -0
  517. package/source/ImageTile.d.ts +102 -0
  518. package/source/ImageTile.d.ts.map +1 -0
  519. package/source/ImageTile.js +206 -0
  520. package/source/ImageWMS.d.ts.map +1 -1
  521. package/source/ImageWMS.js +4 -0
  522. package/source/OGCMapTile.d.ts +2 -2
  523. package/source/OGCMapTile.js +1 -1
  524. package/source/OGCVectorTile.d.ts +4 -4
  525. package/source/OGCVectorTile.d.ts.map +1 -1
  526. package/source/OGCVectorTile.js +2 -2
  527. package/source/OSM.d.ts +2 -7
  528. package/source/OSM.d.ts.map +1 -1
  529. package/source/OSM.js +1 -3
  530. package/source/Raster.d.ts +41 -26
  531. package/source/Raster.d.ts.map +1 -1
  532. package/source/Raster.js +83 -102
  533. package/source/Source.d.ts +1 -1
  534. package/source/Source.d.ts.map +1 -1
  535. package/source/Source.js +5 -14
  536. package/source/StadiaMaps.d.ts +2 -2
  537. package/source/StadiaMaps.d.ts.map +1 -1
  538. package/source/StadiaMaps.js +2 -18
  539. package/source/Tile.d.ts +7 -36
  540. package/source/Tile.d.ts.map +1 -1
  541. package/source/Tile.js +9 -69
  542. package/source/TileArcGISRest.d.ts +2 -2
  543. package/source/TileArcGISRest.d.ts.map +1 -1
  544. package/source/TileArcGISRest.js +2 -1
  545. package/source/TileDebug.d.ts.map +1 -1
  546. package/source/TileDebug.js +0 -1
  547. package/source/TileEventType.d.ts +1 -1
  548. package/source/TileImage.d.ts +9 -12
  549. package/source/TileImage.d.ts.map +1 -1
  550. package/source/TileImage.js +21 -43
  551. package/source/TileJSON.d.ts +2 -2
  552. package/source/TileJSON.d.ts.map +1 -1
  553. package/source/TileJSON.js +1 -1
  554. package/source/TileWMS.d.ts +2 -2
  555. package/source/TileWMS.d.ts.map +1 -1
  556. package/source/TileWMS.js +3 -4
  557. package/source/UTFGrid.d.ts +5 -3
  558. package/source/UTFGrid.d.ts.map +1 -1
  559. package/source/UTFGrid.js +7 -8
  560. package/source/UrlTile.d.ts +16 -13
  561. package/source/UrlTile.d.ts.map +1 -1
  562. package/source/UrlTile.js +13 -7
  563. package/source/Vector.d.ts +10 -10
  564. package/source/Vector.d.ts.map +1 -1
  565. package/source/Vector.js +8 -5
  566. package/source/VectorEventType.d.ts +1 -1
  567. package/source/VectorTile.d.ts +8 -20
  568. package/source/VectorTile.d.ts.map +1 -1
  569. package/source/VectorTile.js +16 -85
  570. package/source/WMTS.d.ts +3 -3
  571. package/source/WMTS.d.ts.map +1 -1
  572. package/source/WMTS.js +5 -4
  573. package/source/XYZ.d.ts +14 -17
  574. package/source/XYZ.d.ts.map +1 -1
  575. package/source/XYZ.js +8 -8
  576. package/source/Zoomify.d.ts +5 -4
  577. package/source/Zoomify.d.ts.map +1 -1
  578. package/source/Zoomify.js +5 -2
  579. package/source/arcgisRest.d.ts +4 -4
  580. package/source/arcgisRest.d.ts.map +1 -1
  581. package/source/arcgisRest.js +5 -5
  582. package/source/mapguide.d.ts +3 -3
  583. package/source/mapguide.d.ts.map +1 -1
  584. package/source/mapguide.js +11 -8
  585. package/source/ogcTileUtil.d.ts +2 -2
  586. package/source/ogcTileUtil.d.ts.map +1 -1
  587. package/source/ogcTileUtil.js +7 -7
  588. package/source/static.d.ts +3 -3
  589. package/source/static.d.ts.map +1 -1
  590. package/source/static.js +7 -7
  591. package/source/wms.d.ts +2 -2
  592. package/source/wms.d.ts.map +1 -1
  593. package/source/wms.js +16 -19
  594. package/source.d.ts +1 -0
  595. package/source.d.ts.map +1 -1
  596. package/source.js +1 -0
  597. package/sphere.d.ts +1 -1
  598. package/structs/LRUCache.d.ts.map +1 -1
  599. package/structs/PriorityQueue.d.ts.map +1 -1
  600. package/structs/RBush.d.ts +10 -32
  601. package/structs/RBush.d.ts.map +1 -1
  602. package/structs/RBush.js +9 -12
  603. package/style/Circle.d.ts +2 -1
  604. package/style/Circle.d.ts.map +1 -1
  605. package/style/Circle.js +2 -1
  606. package/style/Fill.d.ts +3 -3
  607. package/style/Fill.d.ts.map +1 -1
  608. package/style/Fill.js +1 -1
  609. package/style/Icon.d.ts +8 -5
  610. package/style/Icon.d.ts.map +1 -1
  611. package/style/Icon.js +21 -0
  612. package/style/IconImage.d.ts.map +1 -1
  613. package/style/IconImage.js +3 -2
  614. package/style/IconImageCache.d.ts.map +1 -1
  615. package/style/Image.d.ts +3 -3
  616. package/style/Image.d.ts.map +1 -1
  617. package/style/RegularShape.d.ts +11 -5
  618. package/style/RegularShape.d.ts.map +1 -1
  619. package/style/RegularShape.js +23 -5
  620. package/style/Stroke.d.ts.map +1 -1
  621. package/style/Style.d.ts +5 -5
  622. package/style/Style.d.ts.map +1 -1
  623. package/style/Style.js +2 -2
  624. package/style/Text.d.ts +2 -2
  625. package/style/Text.d.ts.map +1 -1
  626. package/style/flat.d.ts.map +1 -1
  627. package/style/webgl.d.ts.map +1 -1
  628. package/tilecoord.d.ts +7 -0
  629. package/tilecoord.d.ts.map +1 -1
  630. package/tilecoord.js +11 -1
  631. package/tilegrid/TileGrid.d.ts +1 -1
  632. package/tilegrid/TileGrid.d.ts.map +1 -1
  633. package/tilegrid/WMTS.d.ts.map +1 -1
  634. package/tilegrid/WMTS.js +1 -1
  635. package/tileurlfunction.d.ts +3 -7
  636. package/tileurlfunction.d.ts.map +1 -1
  637. package/tileurlfunction.js +14 -47
  638. package/transform.d.ts +15 -15
  639. package/transform.d.ts.map +1 -1
  640. package/uri.d.ts +23 -3
  641. package/uri.d.ts.map +1 -1
  642. package/uri.js +75 -0
  643. package/util.d.ts.map +1 -1
  644. package/util.js +1 -1
  645. package/vec/mat4.d.ts.map +1 -1
  646. package/webgl/BaseTileRepresentation.d.ts +3 -3
  647. package/webgl/BaseTileRepresentation.d.ts.map +1 -1
  648. package/webgl/BaseTileRepresentation.js +9 -2
  649. package/webgl/Buffer.d.ts.map +1 -1
  650. package/webgl/Helper.d.ts.map +1 -1
  651. package/webgl/Helper.js +1 -0
  652. package/webgl/PostProcessingPass.d.ts +48 -12
  653. package/webgl/PostProcessingPass.d.ts.map +1 -1
  654. package/webgl/PostProcessingPass.js +42 -6
  655. package/webgl/RenderTarget.d.ts.map +1 -1
  656. package/webgl/ShaderBuilder.d.ts +1 -1
  657. package/webgl/TileGeometry.d.ts.map +1 -1
  658. package/webgl/TileGeometry.js +4 -1
  659. package/webgl/TileTexture.d.ts.map +1 -1
  660. package/webgl/TileTexture.js +14 -8
  661. package/webgl/styleparser.d.ts.map +1 -1
  662. package/webgl/styleparser.js +54 -66
  663. package/webgl.d.ts.map +1 -1
  664. package/worker/webgl.js +1 -1
  665. package/xml.d.ts.map +1 -1
  666. package/xml.js +27 -39
  667. package/source/SentinelHub.d.ts +0 -507
  668. package/source/SentinelHub.d.ts.map +0 -1
  669. package/source/SentinelHub.js +0 -616
  670. package/structs/LinkedList.d.ts +0 -130
  671. package/structs/LinkedList.d.ts.map +0 -1
  672. package/structs/LinkedList.js +0 -259
@@ -1,616 +0,0 @@
1
- /**
2
- * @module ol/source/SentinelHub
3
- */
4
-
5
- import DataTileSource from './DataTile.js';
6
- import {
7
- equivalent as equivalentProjections,
8
- get as getProjection,
9
- } from '../proj.js';
10
-
11
- const defaultProcessUrl = 'https://services.sentinel-hub.com/api/v1/process';
12
-
13
- const defaultTokenUrl =
14
- 'https://services.sentinel-hub.com/auth/realms/main/protocol/openid-connect/token';
15
-
16
- const defaultEvalscriptVersion = '3';
17
-
18
- /**
19
- * @type {import('../size.js').Size}
20
- */
21
- const defaultTileSize = [512, 512];
22
-
23
- /**
24
- * @typedef {Object} AuthConfig
25
- * @property {string} [tokenUrl='https://services.sentinel-hub.com/auth/realms/main/protocol/openid-connect/token'] The URL to get the authentication token.
26
- * @property {string} clientId The client ID.
27
- * @property {string} clientSecret The client secret.
28
- */
29
-
30
- /**
31
- * @typedef {Object} AccessTokenClaims
32
- * @property {number} exp The expiration time of the token (in seconds).
33
- */
34
-
35
- /**
36
- * @typedef {Object} Evalscript
37
- * @property {Setup} setup The setup function.
38
- * @property {EvaluatePixel} evaluatePixel The function to transform input samples into output values.
39
- * @property {UpdateOutput} [updateOutput] Optional function to adjust the output bands.
40
- * @property {UpdateOutputMetadata} [updateOutputMetadata] Optional function to update the output metadata.
41
- * @property {Collections} [preProcessScenes] Optional function called before processing.
42
- * @property {string} [version='3'] The Evalscript version.
43
- */
44
-
45
- /**
46
- * @typedef {function(): SetupResult} Setup
47
- */
48
-
49
- /**
50
- * @typedef {function(Sample|Array<Sample>, Scenes, InputMetadata, CustomData, OutputMetadata): OutputValues|Array<number>|void} EvaluatePixel
51
- */
52
-
53
- /**
54
- * @typedef {function(Object<string, UpdatedOutputDescription>): void} UpdateOutput
55
- */
56
-
57
- /**
58
- * @typedef {function(Scenes, InputMetadata, OutputMetadata): void} UpdateOutputMetadata
59
- */
60
-
61
- /**
62
- * @typedef {Object} SetupResult
63
- * @property {Array<string>|Array<InputDescription>} input Description of the input data.
64
- * @property {OutputDescription|Array<OutputDescription>} output Description of the output data.
65
- * @property {'SIMPLE'|'ORBIT'|'TILE'} [mosaicking='SIMPLE'] Control how samples from input scenes are composed.
66
- */
67
-
68
- /**
69
- * @typedef {Object} InputDescription
70
- * @property {Array<string>} bands Input band identifiers.
71
- * @property {string|Array<string>} [units] Input band units.
72
- * @property {Array<string>} [metadata] Properties to include in the input metadata.
73
- */
74
-
75
- /**
76
- * @typedef {Object} OutputDescription
77
- * @property {string} [id='default'] Output identifier.
78
- * @property {number} bands Number of output bands.
79
- * @property {SampleType} [sampleType='AUTO'] Output sample type.
80
- * @property {number} [nodataValue] Output nodata value.
81
- */
82
-
83
- /**
84
- * @typedef {Object} UpdatedOutputDescription
85
- * @property {number} bands Number of output bands.
86
- */
87
-
88
- /**
89
- * @typedef {'INT8'|'UINT8'|'INT16'|'UINT16'|'FLOAT32'|'AUTO'} SampleType
90
- */
91
-
92
- /**
93
- * @typedef {Object<string, number>} Sample
94
- */
95
-
96
- /**
97
- * @typedef {Object} Collections
98
- * @property {string} [from] For 'ORBIT' mosaicking, this will be the start of the search interval.
99
- * @property {string} [to] For 'ORBIT' mosaicking, this will be the end of the search interval.
100
- * @property {Scenes} scenes The scenes in the collection.
101
- */
102
-
103
- /**
104
- * @typedef {Object} Scenes
105
- * @property {Array<Orbit>} [orbit] Information about scenes included in the tile when 'mosaicking' is 'ORBIT'.
106
- * @property {Array<Tile>} [tiles] Information about scenes included in the tile when 'mosaicking' is 'TILE'.
107
- */
108
-
109
- /**
110
- * @typedef {Object} Orbit
111
- * @property {string} dateFrom The earliest date for all scenes included in the tile.
112
- * @property {string} dateTo The latest date for scenes included in the tile.
113
- * @property {Array} tiles Metadata for each tile.
114
- */
115
-
116
- /**
117
- * @typedef {Object} Tile
118
- * @property {string} date The date of scene used in the tile.
119
- * @property {number} cloudCoverage The estimated percentage of pixels obscured by clouds in the scene.
120
- * @property {string} dataPath The path to the data in storage.
121
- * @property {number} shId The internal identifier for the scene.
122
- */
123
-
124
- /**
125
- * @typedef {Object} InputMetadata
126
- * @property {string} serviceVersion The version of the service used for processing.
127
- * @property {number} normalizationFactor The factor used to convert digital number (DN) values to reflectance.
128
- */
129
-
130
- /**
131
- * @typedef {Object<string, unknown>} CustomData
132
- */
133
-
134
- /**
135
- * @typedef {Object} OutputMetadata
136
- * @property {Object} userData Arbitrary user data.
137
- */
138
-
139
- /**
140
- * @typedef {Object<string, Array<number>>} OutputValues
141
- */
142
-
143
- /**
144
- * @typedef {Object} ProcessRequest
145
- * @property {ProcessRequestInput} input Input data configuration.
146
- * @property {string} evalscript The Evalscript used for processing.
147
- * @property {ProcessRequestOutput} [output] The output configuration.
148
- */
149
-
150
- /**
151
- * @typedef {Object} ProcessRequestInput
152
- * @property {ProcessRequestInputBounds} bounds The bounding box of the input data.
153
- * @property {Array<ProcessRequestInputDataItem>} data The intput data.
154
- */
155
-
156
- /**
157
- * @typedef {Object} ProcessRequestInputDataItem
158
- * @property {string} [type] The type of the input data.
159
- * @property {string} [id] The identifier of the input data.
160
- * @property {DataFilter} [dataFilter] The filter to apply to the input data.
161
- * @property {Object<string, unknown>} [processing] The processing to apply to the input data.
162
- */
163
-
164
- /**
165
- * @typedef {Object} DataFilter
166
- * @property {TimeRange} [timeRange] The data time range.
167
- * @property {number} [maxCloudCoverage] The maximum cloud coverage (0-100).
168
- */
169
-
170
- /**
171
- * @typedef {Object} TimeRange
172
- * @property {string} [from] The start time (inclusive).
173
- * @property {string} [to] The end time (inclusive).
174
- */
175
-
176
- /**
177
- * @typedef {Object} ProcessRequestInputBounds
178
- * @property {Array<number>} [bbox] The bounding box of the input data.
179
- * @property {ProcessRequestInputBoundsProperties} [properties] The properties of the bounding box.
180
- * @property {import("geojson").Geometry} [geometry] The geometry of the bounding box.
181
- */
182
-
183
- /**
184
- * @typedef {Object} ProcessRequestInputBoundsProperties
185
- * @property {string} crs The coordinate reference system of the bounding box.
186
- */
187
-
188
- /**
189
- * @typedef {Object} ProcessRequestOutput
190
- * @property {number} [width] Image width in pixels.
191
- * @property {number} [height] Image height in pixels.
192
- * @property {number} [resx] Spatial resolution in the x direction.
193
- * @property {number} [resy] Spatial resolution in the y direction.
194
- * @property {Array<ProcessRequestOutputResponse>} [responses] Response configuration.
195
- */
196
-
197
- /**
198
- * @typedef {Object} ProcessRequestOutputResponse
199
- * @property {string} [identifier] Identifier used to connect results to outputs from the setup.
200
- * @property {ProcessRequestOutputFormat} [format] Response format.
201
- */
202
-
203
- /**
204
- * @typedef {Object} ProcessRequestOutputFormat
205
- * @property {string} [type] The output format type.
206
- */
207
-
208
- /**
209
- * @param {Evalscript} evalscript The object to serialize.
210
- * @return {string} The serialized Evalscript.
211
- */
212
- function serializeEvalscript(evalscript) {
213
- const version = evalscript.version || defaultEvalscriptVersion;
214
- return `//VERSION=${version}
215
- ${serializeFunction('setup', evalscript.setup)}
216
- ${serializeFunction('evaluatePixel', evalscript.evaluatePixel)}
217
- ${serializeFunction('updateOutput', evalscript.updateOutput)}
218
- `;
219
- }
220
-
221
- /**
222
- * Get a loaded image given a response.
223
- *
224
- * @param {Response} response The response.
225
- * @return {Promise<HTMLImageElement>} The image.
226
- */
227
- async function imageFromResponse(response) {
228
- const blob = await response.blob();
229
-
230
- return new Promise((resolve, reject) => {
231
- const image = new Image();
232
- const blobUrl = URL.createObjectURL(blob);
233
- image.onload = () => {
234
- URL.revokeObjectURL(blobUrl);
235
- resolve(image);
236
- };
237
- image.onerror = () => {
238
- URL.revokeObjectURL(blobUrl);
239
- reject(new Error('Failed to load image'));
240
- };
241
- image.src = blobUrl;
242
- });
243
- }
244
-
245
- /**
246
- * @param {AuthConfig} auth The authentication configuration.
247
- * @return {Promise<string>} The authentication token.
248
- */
249
- async function getToken(auth) {
250
- const url = auth.tokenUrl || defaultTokenUrl;
251
- const body = new URLSearchParams();
252
- body.append('grant_type', 'client_credentials');
253
- body.append('client_id', auth.clientId);
254
- body.append('client_secret', auth.clientSecret);
255
-
256
- /**
257
- * @type {RequestInit}
258
- */
259
- const options = {
260
- method: 'POST',
261
- headers: {'Content-Type': 'application/x-www-form-urlencoded'},
262
- body,
263
- };
264
- const response = await fetch(url, options);
265
- if (!response.ok) {
266
- throw new Error('Failed to get token');
267
- }
268
- const data = await response.json();
269
- return data.access_token;
270
- }
271
-
272
- /**
273
- * @param {string} token The access token to parse.
274
- * @return {AccessTokenClaims} The parsed token claims.
275
- */
276
- export function parseTokenClaims(token) {
277
- const base64EncodedClaims = token
278
- .split('.')[1]
279
- .replace(/-/g, '+')
280
- .replace(/_/g, '/');
281
-
282
- const chars = atob(base64EncodedClaims).split('');
283
- const count = chars.length;
284
- const uriEncodedChars = new Array(count);
285
- for (let i = 0; i < count; ++i) {
286
- const c = chars[i];
287
- uriEncodedChars[i] = '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
288
- }
289
-
290
- return JSON.parse(decodeURIComponent(uriEncodedChars.join('')));
291
- }
292
-
293
- /**
294
- * Gets a CRS identifier accepted by Sentinel Hub.
295
- * See https://docs.sentinel-hub.com/api/latest/api/process/crs/.
296
- *
297
- * @param {import("../proj/Projection.js").default} projection The projection.
298
- * @return {string} The projection identifier accepted by Sentinel Hub.
299
- */
300
- export function getProjectionIdentifier(projection) {
301
- const ogcId = 'http://www.opengis.net/def/crs/';
302
- const code = projection.getCode();
303
- if (code.startsWith(ogcId)) {
304
- return code;
305
- }
306
- if (code.startsWith('EPSG:')) {
307
- return `${ogcId}EPSG/0/${code.slice(5)}`;
308
- }
309
- if (equivalentProjections(projection, getProjection('EPSG:4326'))) {
310
- return `${ogcId}EPSG/0/4326`;
311
- }
312
-
313
- // hope for the best
314
- return code;
315
- }
316
-
317
- /**
318
- * This is intended to work with named functions, anonymous functions, arrow functions, and object methods.
319
- * Due to how the Evalscript is executed, these are serialized as function expressions using `var`.
320
- *
321
- * @param {string} name The name of the function.
322
- * @param {Function|undefined} func The function to serialize.
323
- * @return {string} The serialized function.
324
- */
325
- export function serializeFunction(name, func) {
326
- if (!func) {
327
- return '';
328
- }
329
- let expression = func.toString();
330
- if (
331
- func.name &&
332
- func.name !== 'function' &&
333
- expression.match(new RegExp('^' + func.name.replace('$', '\\$') + '\\b'))
334
- ) {
335
- // assume function came from an object property using method syntax
336
- expression = 'function ' + expression;
337
- }
338
- return `var ${name} = ${expression};`;
339
- }
340
-
341
- /**
342
- * @typedef {Object} Options
343
- * @property {AuthConfig|string} [auth] The authentication configuration with `clientId` and `clientSecret` or an access token.
344
- * See [Sentinel Hub authentication](https://docs.sentinel-hub.com/api/latest/api/overview/authentication/)
345
- * for details. If not provided in the constructor, the source will not be rendered until {@link module:ol/source/SentinelHub~SentinelHub#setAuth}
346
- * is called.
347
- * @property {Array<ProcessRequestInputDataItem>} [data] The input data configuration. If not provided in the constructor,
348
- * the source will not be rendered until {@link module:ol/source/SentinelHub~SentinelHub#setData} is called.
349
- * @property {Evalscript|string} [evalscript] The process applied to the input data. If not provided in the constructor,
350
- * the source will not be rendered until {@link module:ol/source/SentinelHub~SentinelHub#setEvalscript} is called. See the
351
- * `setEvalscript` documentation for details on the restrictions when passing process functions.
352
- * @property {number|import("../size.js").Size} [tileSize=[512, 512]] The pixel width and height of the source tiles.
353
- * @property {string} [url='https://services.sentinel-hub.com/api/v1/process'] The Sentinel Hub Processing API URL.
354
- * @property {boolean} [opaque=false] Whether the layer is opaque.
355
- * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection.
356
- * @property {boolean} [attributionsCollapsible=true] Allow the attributions to be collapsed.
357
- * @property {boolean} [interpolate=true] Use interpolated values when resampling. By default,
358
- * linear interpolation is used when resampling. Set to false to use the nearest neighbor instead.
359
- * @property {boolean} [wrapX=true] Wrap the world horizontally.
360
- * @property {number} [transition] Duration of the opacity transition for rendering.
361
- * To disable the opacity transition, pass `transition: 0`.
362
- */
363
-
364
- /**
365
- * @classdesc
366
- * A tile source that generates tiles using the Sentinel Hub [Processing API](https://docs.sentinel-hub.com/api/latest/api/process/).
367
- * All of the constructor options are optional, however the source will not be ready for rendering until the `auth`, `data`,
368
- * and `evalscript` properties are provided. These can be set after construction with the {@link module:ol/source/SentinelHub~SentinelHub#setAuth},
369
- * {@link module:ol/source/SentinelHub~SentinelHub#setData}, and {@link module:ol/source/SentinelHub~SentinelHub#setEvalscript}
370
- * methods.
371
- *
372
- * If there are errors while configuring the source or fetching an access token, the `change` event will be fired and the
373
- * source state will be set to `error`. See the {@link module:ol/source/SentinelHub~SentinelHub#getError} method for
374
- * details on handling these errors.
375
- * @api
376
- */
377
- class SentinelHub extends DataTileSource {
378
- /**
379
- * @param {Options} [options] Sentinel Hub options.
380
- */
381
- constructor(options) {
382
- /**
383
- * @type {Options}
384
- */
385
- const config = options || {};
386
-
387
- super({
388
- state: 'loading',
389
- opaque: config.opaque,
390
- projection: config.projection,
391
- attributionsCollapsible: config.attributionsCollapsible,
392
- interpolate: config.interpolate,
393
- tileSize: config.tileSize || defaultTileSize,
394
- wrapX: config.wrapX !== undefined ? config.wrapX : true,
395
- transition: config.transition,
396
- });
397
-
398
- this.setLoader(this.loadTile_.bind(this));
399
-
400
- /**
401
- * @type {Error|null}
402
- */
403
- this.error_ = null;
404
-
405
- /**
406
- * @type {string}
407
- * @private
408
- */
409
- this.evalscript_ = '';
410
-
411
- /**
412
- * @type {Array<ProcessRequestInputDataItem>|null}
413
- * @private
414
- */
415
- this.inputData_ = null;
416
-
417
- /**
418
- * @type {string}
419
- * @private
420
- */
421
- this.processUrl_ = config.url || defaultProcessUrl;
422
-
423
- /**
424
- * @type {string}
425
- * @private
426
- */
427
- this.token_ = '';
428
-
429
- /**
430
- * @type {ReturnType<typeof setTimeout>}
431
- * @private
432
- */
433
- this.tokenRenewalId_;
434
-
435
- if (config.auth) {
436
- this.setAuth(config.auth);
437
- }
438
-
439
- if (config.data) {
440
- this.setData(config.data);
441
- }
442
-
443
- if (config.evalscript) {
444
- this.setEvalscript(config.evalscript);
445
- }
446
- }
447
-
448
- /**
449
- * Set the authentication configuration for the source (if not provided in the constructor).
450
- * If an object with `clientId` and `clientSecret` is provided, an access token will be fetched
451
- * and used with processing requests. Alternatively, an access token can be supplied directly.
452
- *
453
- * @param {AuthConfig|string} auth The auth config or access token.
454
- * @api
455
- */
456
- async setAuth(auth) {
457
- clearTimeout(this.tokenRenewalId_);
458
-
459
- if (typeof auth === 'string') {
460
- this.token_ = auth;
461
- this.fireWhenReady_();
462
- return;
463
- }
464
-
465
- /**
466
- * @type {string}
467
- */
468
- let token;
469
-
470
- /**
471
- * @type {AccessTokenClaims}
472
- */
473
- let claims;
474
-
475
- try {
476
- token = await getToken(auth);
477
- claims = parseTokenClaims(token);
478
- } catch (error) {
479
- this.error_ = error;
480
- this.setState('error');
481
- }
482
- this.token_ = token;
483
-
484
- const expiry = claims.exp * 1000;
485
- const timeout = Math.max(expiry - Date.now() - 60 * 1000, 1);
486
- this.tokenRenewalId_ = setTimeout(() => this.setAuth(auth), timeout);
487
- this.fireWhenReady_();
488
- }
489
-
490
- /**
491
- * Set or update the input data used.
492
- *
493
- * @param {Array<ProcessRequestInputDataItem>} data The input data configuration.
494
- * @api
495
- */
496
- setData(data) {
497
- this.inputData_ = data;
498
- this.fireWhenReady_();
499
- }
500
-
501
- /**
502
- * Set or update the Evalscript used to process the data. Either a process object or a string
503
- * Evalscript can be provided. If a process object is provided, it will be serialized to produce the
504
- * Evalscript string. Because these functions will be serialized and executed by the Processing API,
505
- * they cannot refer to other variables or functions that are not provided by the Processing API
506
- * context.
507
- *
508
- * @param {Evalscript|string} evalscript The process to apply to the input data.
509
- * @api
510
- */
511
- setEvalscript(evalscript) {
512
- let script;
513
- if (typeof evalscript === 'string') {
514
- script = evalscript;
515
- } else {
516
- try {
517
- script = serializeEvalscript(evalscript);
518
- } catch (error) {
519
- this.error_ = error;
520
- this.setState('error');
521
- return;
522
- }
523
- }
524
- this.evalscript_ = script;
525
- this.fireWhenReady_();
526
- }
527
-
528
- fireWhenReady_() {
529
- if (!this.token_ || !this.evalscript_ || !this.inputData_) {
530
- return;
531
- }
532
- const state = this.getState();
533
- if (state === 'ready') {
534
- this.changed();
535
- return;
536
- }
537
- this.setState('ready');
538
- }
539
-
540
- /**
541
- * @param {number} z The z tile index.
542
- * @param {number} x The x tile index.
543
- * @param {number} y The y tile index.
544
- * @return {Promise<import('../DataTile.js').Data>} The composed tile data.
545
- * @private
546
- */
547
- async loadTile_(z, x, y) {
548
- const tileGrid = this.getTileGrid();
549
- const extent = tileGrid.getTileCoordExtent([z, x, y]);
550
- const tileSize = this.getTileSize(z);
551
- const projection = this.getProjection();
552
-
553
- /**
554
- * @type {ProcessRequest}
555
- */
556
- const body = {
557
- input: {
558
- bounds: {
559
- bbox: extent,
560
- properties: {crs: getProjectionIdentifier(projection)},
561
- },
562
- data: this.inputData_,
563
- },
564
- output: {
565
- width: tileSize[0],
566
- height: tileSize[1],
567
- },
568
- evalscript: this.evalscript_,
569
- };
570
-
571
- /**
572
- * @type {RequestInit}
573
- */
574
- const options = {
575
- method: 'POST',
576
- headers: {
577
- 'Content-Type': 'application/json',
578
- Authorization: `Bearer ${this.token_}`,
579
- },
580
- body: JSON.stringify(body),
581
- credentials: 'include',
582
- };
583
-
584
- const response = await fetch(this.processUrl_, options);
585
- if (!response.ok) {
586
- throw new Error(`Failed to get tile: ${response.statusText}`);
587
- }
588
-
589
- return imageFromResponse(response);
590
- }
591
-
592
- /**
593
- * When the source state is `error`, use this function to get more information about the error.
594
- * To debug a faulty configuration, you may want to use a listener like this:
595
- * ```js
596
- * source.on('change', () => {
597
- * if (source.getState() === 'error') {
598
- * console.error(source.getError());
599
- * }
600
- * });
601
- * ```
602
- *
603
- * @return {Error|null} A source loading error.
604
- * @api
605
- */
606
- getError() {
607
- return this.error_;
608
- }
609
-
610
- disposeInternal() {
611
- clearTimeout(this.tokenRenewalId_);
612
- super.disposeInternal();
613
- }
614
- }
615
-
616
- export default SentinelHub;