@opengeoweb/webmap-react 21.0.0 → 21.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.
@@ -1,5 +1,6 @@
1
1
  import type { Position, Source } from '@opengeoweb/shared';
2
- import type { LayerProps } from '@opengeoweb/webmap';
2
+ import { LayerType } from '@opengeoweb/webmap';
3
+ import type { LayerFoundation, LayerProps } from '@opengeoweb/webmap';
3
4
  export interface LayerInfoDialogProps {
4
5
  layer: LayerProps;
5
6
  serviceName: string;
@@ -12,6 +13,9 @@ export interface LayerInfoDialogProps {
12
13
  dialogHeight?: number;
13
14
  startPosition?: Position;
14
15
  selectedStyle?: string;
16
+ layerType?: LayerType;
17
+ layerOpacity?: number;
18
+ stacLayer?: Pick<LayerFoundation, 'service' | 'id' | 'style'>;
15
19
  showLayerLegend: boolean;
16
20
  onToggleLayerLegendVisibility: (showLegend: boolean) => void;
17
21
  edrParameterMetadata?: {
@@ -1,7 +1,12 @@
1
+ import type { LayerFoundation } from '@opengeoweb/webmap';
2
+ import { LayerType } from '@opengeoweb/webmap';
1
3
  export interface LayerInfoLegendProps {
2
4
  title: string;
3
5
  legendURL?: string;
4
6
  showLayerLegend: boolean;
5
7
  onToggleLayerLegendVisibility: (showLegend: boolean) => void;
8
+ layerType?: LayerType;
9
+ stacLayer?: Pick<LayerFoundation, 'service' | 'id' | 'style'>;
10
+ layerOpacity?: number;
6
11
  }
7
12
  export declare const LayerInfoLegend: React.FC<LayerInfoLegendProps>;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import type { LayerFoundation } from '@opengeoweb/webmap';
3
+ interface StacLegendCanvasProps {
4
+ layer: Pick<LayerFoundation, 'service' | 'id' | 'style'>;
5
+ height: number;
6
+ width: number;
7
+ opacity: number;
8
+ onHeightChange: (height: number) => void;
9
+ onWidthChange?: (width: number) => void;
10
+ }
11
+ export declare const StacLegendCanvas: React.FC<StacLegendCanvasProps>;
12
+ export {};
@@ -2,3 +2,4 @@ export * from './Legend';
2
2
  export * from './LegendLayout';
3
3
  export * from './LegendDialog';
4
4
  export * from './LegendButton';
5
+ export * from './StacLegendCanvas';
@@ -9,5 +9,8 @@ export interface TiledWMSLayerProps {
9
9
  shouldRender?: boolean;
10
10
  geotiffStyle?: object;
11
11
  normalize?: boolean;
12
+ nodata?: number;
13
+ min?: number;
14
+ max?: number;
12
15
  }
13
16
  export declare const GeoTIFFLayer: React.FC<TiledWMSLayerProps>;
@@ -1,5 +1,5 @@
1
1
  import ImageLayer from 'ol/layer/Image';
2
- import type { Dimension } from '@opengeoweb/webmap';
2
+ import type { Dimension, Style } from '@opengeoweb/webmap';
3
3
  import type { OnInitializeLayerProps } from '../utils/types';
4
4
  interface TimeawareImageSourceWMSLayerProps {
5
5
  layerId?: string;
@@ -15,5 +15,6 @@ interface TimeawareImageSourceWMSLayerProps {
15
15
  debugMode?: boolean;
16
16
  extentRatio?: number;
17
17
  }
18
+ export declare const getWMSStyleName: (styleName: string | undefined, styles: Style[]) => string;
18
19
  export declare const TimeawareImageSourceWMSLayer: React.FC<TimeawareImageSourceWMSLayerProps>;
19
20
  export {};
@@ -1,10 +1,26 @@
1
1
  import type { Geometry } from 'geojson';
2
2
  import type { LayerProps } from '@opengeoweb/webmap';
3
+ export interface STACRasterBand {
4
+ name?: string;
5
+ unit?: string;
6
+ scale?: number;
7
+ offset?: number;
8
+ nodata?: number | string;
9
+ data_type?: string;
10
+ statistics?: {
11
+ minimum?: number;
12
+ maximum?: number;
13
+ mean?: number;
14
+ stdev?: number;
15
+ valid_percent?: number;
16
+ };
17
+ }
3
18
  interface Properties extends Record<string, unknown> {
4
19
  datetime: string | null;
5
20
  'proj:wkt2'?: string;
6
21
  'proj:code'?: string;
7
22
  'proj:epsg'?: number;
23
+ 'raster:bands'?: STACRasterBand[];
8
24
  }
9
25
  export interface STACAsset {
10
26
  href: string;
@@ -12,6 +28,7 @@ export interface STACAsset {
12
28
  created?: string;
13
29
  title?: string;
14
30
  roles?: string[];
31
+ 'raster:bands'?: STACRasterBand[];
15
32
  }
16
33
  export type STACItemAssets = Record<string, STACAsset>;
17
34
  export type STACItemAssetDefinitions = Record<string, Omit<STACAsset, 'href'> & {
@@ -40,17 +57,49 @@ export interface STACItem {
40
57
  links: STACLink[];
41
58
  assets?: STACItemAssets;
42
59
  }
60
+ /** Prefer asset metadata, with support for legacy item-level raster metadata. */
61
+ export declare const getStacRasterBands: (item: STACItem, assetKey: string) => STACRasterBand[] | undefined;
43
62
  export type STACColormapEntry = [number, number, number, number];
63
+ export type STACPaletteColormap = Record<string, STACColormapEntry>;
64
+ export interface STACIntervalColormap {
65
+ intervals: [[min: number, max: number], STACColormapEntry][];
66
+ }
67
+ export type STACColormap = STACPaletteColormap | STACIntervalColormap;
68
+ export interface STACCubeVariable {
69
+ dimensions: string[];
70
+ type: string;
71
+ unit?: string;
72
+ description?: string;
73
+ extent?: [min: number, max: number];
74
+ }
44
75
  export interface STACRenderEntry {
45
76
  title?: string;
46
77
  assets: string[];
47
78
  rescale?: number[][];
48
- colormap?: Record<string, STACColormapEntry>;
79
+ colormap?: STACColormap;
80
+ nodata?: number | string;
81
+ 'geoweb:style'?: {
82
+ type: 'gradient';
83
+ entries: {
84
+ value: number;
85
+ color: STACColormapEntry;
86
+ label?: string;
87
+ }[];
88
+ } | {
89
+ type: 'intervals';
90
+ entries: {
91
+ min: number;
92
+ max: number;
93
+ color: STACColormapEntry;
94
+ label?: string;
95
+ }[];
96
+ };
49
97
  }
50
98
  export interface STACCollection {
51
99
  type: 'Collection';
52
100
  stac_version: string;
53
101
  id: string;
102
+ title?: string;
54
103
  description: string;
55
104
  license: string;
56
105
  keywords?: string[];
@@ -60,8 +109,12 @@ export interface STACCollection {
60
109
  features: STACItem[];
61
110
  numberMatched?: number;
62
111
  numberReturned?: number;
112
+ 'cube:variables'?: Record<string, STACCubeVariable>;
63
113
  renders?: Record<string, STACRenderEntry>;
64
114
  item_assets?: STACItemAssetDefinitions;
115
+ summaries?: Record<string, unknown> & {
116
+ 'raster:bands'?: STACRasterBand[];
117
+ };
65
118
  }
66
119
  export declare const STAC_ITEM_PAGE_LIMIT = 1000;
67
120
  export declare const STAC_TEMPORAL_STEP_SAMPLE_LIMIT = 11;
@@ -88,6 +141,7 @@ export interface STACCatalogCollection {
88
141
  description?: string;
89
142
  extent?: STACExtent;
90
143
  keywords?: string[];
144
+ 'cube:variables'?: Record<string, STACCubeVariable>;
91
145
  links: STACLink[];
92
146
  renders?: Record<string, STACRenderEntry>;
93
147
  item_assets?: STACItemAssetDefinitions;
@@ -1,4 +1,6 @@
1
1
  export * from './api';
2
2
  export * from './hooks';
3
3
  export * from './utils/stacColormapToOlStyle';
4
+ export * from './utils/stacLegendUtils';
4
5
  export * from './utils/styleSelection';
6
+ export * from './utils/stacLegendMetadata';
@@ -0,0 +1,2 @@
1
+ import type { STACColormapEntry } from '../api';
2
+ export declare const stacColorToRgba: ([red, green, blue, alpha,]: STACColormapEntry) => string;
@@ -1,5 +1,5 @@
1
1
  import type { Style } from '@opengeoweb/webmap';
2
- import type { STACColormapEntry, STACItemAssetDefinitions, STACRenderEntry } from '../api';
2
+ import type { STACColormap, STACItemAssetDefinitions, STACRenderEntry } from '../api';
3
3
  export declare const STAC_ASSET_STYLE_PREFIX = "asset:";
4
4
  export declare const getStacAssetKeyFromStyle: (styleName?: string) => string | undefined;
5
5
  export declare const isGeoTIFFAsset: (asset: {
@@ -10,13 +10,9 @@ export declare const isBrowserReadableGeoTIFFAsset: (asset: {
10
10
  href?: string;
11
11
  type?: string;
12
12
  }) => boolean;
13
- /**
14
- * Converts a STAC render extension colormap to an OpenLayers WebGLTile palette style.
15
- *
16
- * The STAC colormap maps pixel values (0–255) to RGBA arrays where each channel is 0–255.
17
- * The returned object is suitable for use as the `style` option of `ol/layer/WebGLTile`.
18
- */
19
- export declare const stacColormapToOlStyle: (colormap: Record<string, STACColormapEntry>) => object;
13
+ export declare const stacColormapToOlStyle: (colormap: STACColormap) => object;
14
+ /** Nodata samples can become zero in band 1; their alpha band is authoritative. */
15
+ export declare const applyStacNodataMask: (style: object, alphaBand: number) => object;
20
16
  /**
21
17
  * Returns a grayscale WebGLTile style where band-1 value maps from black (0)
22
18
  * to white (255). Used as a safe default when no STAC render colormap exists.
@@ -0,0 +1,7 @@
1
+ import type { STACRasterBand } from '../api';
2
+ export interface STACLegendMetadata {
3
+ assetKey?: string;
4
+ band?: STACRasterBand;
5
+ }
6
+ /** Asset and band of the STAC item currently displayed for the layer, if any. */
7
+ export declare const getStacLegendMetadata: (layerId?: string) => STACLegendMetadata | undefined;
@@ -0,0 +1,43 @@
1
+ import type { STACCubeVariable, STACRenderEntry, STACRasterBand } from '../api';
2
+ export interface STACLegendInterval {
3
+ min: number;
4
+ max: number;
5
+ color: string;
6
+ label?: string;
7
+ }
8
+ export interface STACContinuousLegend {
9
+ type: 'continuous';
10
+ min: number;
11
+ max: number;
12
+ colors: string[];
13
+ showLabels?: boolean;
14
+ stops?: {
15
+ value: number;
16
+ color: string;
17
+ label?: string;
18
+ }[];
19
+ unit?: string;
20
+ title?: string;
21
+ }
22
+ export interface STACIntervalLegend {
23
+ type: 'intervals';
24
+ entries: STACLegendInterval[];
25
+ unit?: string;
26
+ title?: string;
27
+ }
28
+ export type STACLegendModel = STACContinuousLegend | STACIntervalLegend;
29
+ /** Return known normalization bounds, leaving TIFF detection to OpenLayers otherwise. */
30
+ export declare const getStacGrayscaleRange: (renderEntry: STACRenderEntry, band?: STACRasterBand, variable?: STACCubeVariable) => [number, number] | undefined;
31
+ /**
32
+ * Returns the stored sample range used by GeoTIFF normalization. STAC band
33
+ * statistics describe physical values when scale/offset are present, while
34
+ * OpenLayers normalizes the encoded samples before applying the display style.
35
+ */
36
+ export declare const getStacGrayscaleSampleRange: (renderEntry: STACRenderEntry, band?: STACRasterBand, variable?: STACCubeVariable) => [number, number] | undefined;
37
+ export declare const makeStacLegendModel: (props: {
38
+ renderEntry: STACRenderEntry;
39
+ variable?: STACCubeVariable;
40
+ band?: STACRasterBand;
41
+ }) => STACLegendModel;
42
+ export declare const getStacLegendWidth: (model: STACLegendModel, ctx: CanvasRenderingContext2D) => number;
43
+ export declare const renderStacLegend: (model: STACLegendModel, ctx: CanvasRenderingContext2D, opacity?: number) => number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/webmap-react",
3
- "version": "21.0.0",
3
+ "version": "21.1.0",
4
4
  "description": "GeoWeb react wrapper for webmap",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -20,9 +20,9 @@
20
20
  }
21
21
  },
22
22
  "dependencies": {
23
- "@opengeoweb/webmap": "21.0.0",
24
- "@opengeoweb/theme": "21.0.0",
25
- "@opengeoweb/shared": "21.0.0",
23
+ "@opengeoweb/webmap": "21.1.0",
24
+ "@opengeoweb/theme": "21.1.0",
25
+ "@opengeoweb/shared": "21.1.0",
26
26
  "lodash": "^4.18.1",
27
27
  "ol": "^10.4.0",
28
28
  "proj4": "^2.9.2",