Skip to content

Commit 61eed9d

Browse files
committed
[fix] WMS layer fixes and updates
Signed-off-by: Ihor Dykhta <dikhta.igor@gmail.com>
1 parent 272fd1a commit 61eed9d

5 files changed

Lines changed: 64 additions & 37 deletions

File tree

src/components/src/modals/tilesets-modals/tileset-wms-form.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ const TilesetWMSForm: React.FC<WMSTileFormProps> = ({setResponse}) => {
7575
if (Array.isArray(layers)) {
7676
const layerOptions = layers.map((layer: any) => ({
7777
name: layer.name,
78-
title: layer.title || layer.name
78+
title: layer.title || layer.name,
79+
boundingBox: layer.geographicBoundingBox
7980
}));
8081
setAvailableLayers(layerOptions);
8182
} else {

src/constants/src/layers.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,5 @@ export const EDITOR_AVAILABLE_LAYERS: string[] = [
564564
LAYER_TYPES.arc,
565565
LAYER_TYPES.line,
566566
LAYER_TYPES.hexagonId,
567-
LAYER_TYPES.geojson,
568-
LAYER_TYPES.wms
567+
LAYER_TYPES.geojson
569568
];

src/layers/src/wms-layer/wms-layer-icon.tsx

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,43 @@ class WMSLayerIcon extends Component {
1414

1515
static defaultProps = {
1616
height: '16px',
17-
predefinedClassName: 'WMS-layer-icon',
18-
totalColor: 2
17+
predefinedClassName: 'wms-layer-icon',
18+
totalColor: 2,
19+
viewBox: '0 0 30 30'
1920
};
2021

21-
render(): React.ReactNode {
22-
const baseColor = '#e0e0e0';
23-
const lineColor = '#606060';
24-
const accentColor = '#88c0d0';
25-
22+
render(): JSX.Element {
2623
return (
2724
<Base {...this.props}>
28-
<svg
29-
width="100%"
30-
height="100%"
31-
viewBox="0 0 64 64"
32-
xmlns="http://www.w3.org/2000/svg"
33-
role="img"
34-
aria-label="WMS Layer Icon"
35-
>
36-
{/* Bottom (backmost) layer */}
37-
<rect x="16" y="16" width="36" height="36" fill="none" stroke={accentColor} strokeWidth="2" opacity="0.4" />
38-
39-
{/* Middle layer */}
40-
<rect x="12" y="12" width="36" height="36" fill="none" stroke={accentColor} strokeWidth="2" opacity="0.6" />
41-
42-
{/* Top (frontmost) tile */}
43-
<rect x="8" y="8" width="36" height="36" fill={baseColor} stroke={lineColor} strokeWidth="2" />
44-
</svg>
25+
<g clipPath="url(#clip0_13806_131258)">
26+
<path
27+
d="M14.7595 12.2358L1 19.9828L15.2405 28L29 20.2536L14.7595 12.2358Z"
28+
fill="currentColor"
29+
/>
30+
<path
31+
d="M14.7595 7.66919L1 15.4156L15.2405 23.4334L29 15.687L14.7595 7.66919Z"
32+
fill="#9DA0B9"
33+
/>
34+
<path d="M14.7595 2L1 9.74639L15.2405 17.7636L29 10.0172L14.7595 2Z" fill="#BFC0D1" />
35+
<path d="M25.9696 10.8737H4.02124V19.267H25.9696V10.8737Z" fill="currentColor" />
36+
<path
37+
d="M5.51221 12.2358H6.77682L7.643 15.9522L8.58367 12.2358H9.64733L10.629 15.9725L11.5235 12.2358H12.6784L11.3341 17.6116H10.0637L9.0693 13.8953L8.05934 17.6116H6.85362L5.51221 12.2358Z"
38+
fill="white"
39+
/>
40+
<path
41+
d="M13.4314 12.2358H15.0812L16.3689 15.5817L17.6393 12.2358H19.2561V17.6116H18.0146V13.8389L16.4884 17.6116H16.0796L14.5453 13.8389V17.6116H13.4314V12.2358Z"
42+
fill="white"
43+
/>
44+
<path
45+
d="M20.1084 15.9274H21.3037C21.3574 16.4088 21.5659 16.8069 22.383 16.8069C22.9304 16.8069 23.293 16.5141 23.293 16.0929C23.293 15.6717 23.0621 15.5141 22.2536 15.3936C20.8429 15.2134 20.2643 14.7995 20.2643 13.7606C20.2643 12.8433 21.0508 12.1592 22.2692 12.1592C23.5107 12.1592 24.2354 12.7003 24.3353 13.7679H23.1851C23.1077 13.2792 22.8149 13.0539 22.2675 13.0539C21.7201 13.0539 21.4423 13.3017 21.4423 13.6626C21.4423 14.0461 21.6196 14.2257 22.4679 14.3468C23.8018 14.5123 24.4889 14.8659 24.4889 15.9797C24.4889 16.937 23.6874 17.6938 22.3841 17.6938C20.8718 17.6943 20.1777 17.0029 20.1084 15.9274Z"
46+
fill="white"
47+
/>
48+
</g>
49+
<defs>
50+
<clipPath id="clip0_13806_131258">
51+
<rect width="28" height="26" fill="white" transform="translate(1 2)" />
52+
</clipPath>
53+
</defs>
4554
</Base>
4655
);
4756
}

src/layers/src/wms-layer/wms-layer.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export type WMSLayerVisConfig = {
3636
wmsLayer: {
3737
name: string;
3838
title: string;
39+
boundingBox: number[][];
3940
};
4041
};
4142

@@ -148,6 +149,25 @@ export default class WMSLayer extends AbstractTileLayer<WMSTile, any[]> {
148149
};
149150
}
150151

152+
_getCurrentServiceLayer(dataset: KeplerDataset) {
153+
const {visConfig} = this.config;
154+
return visConfig.wmsLayer ?? dataset.metadata?.layers?.[0] ?? null;
155+
}
156+
157+
updateLayerMeta(dataset: KeplerDataset): void {
158+
if (dataset.type !== DatasetType.WMS_TILE) {
159+
return;
160+
}
161+
162+
const currentLayer = this._getCurrentServiceLayer(dataset);
163+
if (currentLayer && currentLayer.boundingBox) {
164+
const bb = currentLayer.boundingBox;
165+
this.updateMeta({
166+
bounds: [bb[0][0], bb[0][1], bb[1][0], bb[1][1]]
167+
});
168+
}
169+
}
170+
151171
renderLayer(opts) {
152172
const {visConfig} = this.config;
153173
const {data} = opts;

src/utils/src/application-config.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@ export type KeplerApplicationConfig = {
5454
// Raster Tile layer config
5555
// Raster Tile layer is under development and not ready for production use. Disabled by default.
5656
enableRasterTileLayer?: boolean;
57-
58-
// WMS layer config -- Experimental
59-
// WMS layer is under development and not ready for production use. Disabled by default.
60-
enableWMSLayer?: boolean;
61-
6257
/** Whether to use Titiler v0.21 API endpoints instead of v0.11 */
6358
rasterServerUseLatestTitiler?: boolean;
6459
/** An array of URLs to shards of the raster tile server to be used by the raster tile layer. */
@@ -73,6 +68,10 @@ export type KeplerApplicationConfig = {
7368
rasterServerServerErrorsToRetry?: number[];
7469
/** Maximum number of simultaneous requests per raster server. 0 - no limit */
7570
rasterServerMaxPerServerRequests?: number;
71+
72+
// WMS layer config -- Experimental
73+
// WMS layer is under development and not ready for production use. Disabled by default.
74+
enableWMSLayer?: boolean;
7675
};
7776

7877
const DEFAULT_APPLICATION_CONFIG: Required<KeplerApplicationConfig> = {
@@ -117,17 +116,16 @@ const DEFAULT_APPLICATION_CONFIG: Required<KeplerApplicationConfig> = {
117116
enableRasterTileLayer: false,
118117
rasterServerUseLatestTitiler: true,
119118

120-
// WMS layer config
121-
// TODO: enabled for development purposes only, remove in production
122-
enableWMSLayer: false,
123-
124119
// TODO: provide a default free server or leave blank
125120
rasterServerUrls: [],
126121
rasterServerSupportsElevation: true,
127122
rasterServerMaxRetries: 1,
128123
rasterServerRetryDelay: 10000,
129124
rasterServerServerErrorsToRetry: [503],
130-
rasterServerMaxPerServerRequests: 0
125+
rasterServerMaxPerServerRequests: 0,
126+
127+
// WMS layer config
128+
enableWMSLayer: false
131129
};
132130

133131
const applicationConfig: Required<KeplerApplicationConfig> = DEFAULT_APPLICATION_CONFIG;

0 commit comments

Comments
 (0)