Skip to content

Commit

Permalink
wms fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sirmmo committed Jun 23, 2024
1 parent 21dc1d2 commit a08942b
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 46 deletions.
71 changes: 36 additions & 35 deletions src/app/components/Map/ThreddsWrapperLayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,35 +27,35 @@ export const ThreddsWrapperLayer = (props: any) => {
if (layer && !onlyRemove) {
layer.bringToFront();
}
try {
// eslint-disable-next-line array-callback-return
Object.keys(map._layers).map((l: any) => {
l = map._layers[l];
if (l && l._url && l._url.includes(`public.places_cities.geometry`)) {
l.bringToFront();
}
if (
l &&
l._url &&
l._url.includes(`${V2_WMS_PROXY_URL}`) &&
!l._url.includes(map.selected_path)
) {
map.removeLayer(l);
}
if (
l &&
l.currentLayer &&
l.currentLayer._url &&
l.currentLayer._url.includes(`${V2_WMS_PROXY_URL}`) &&
!l.currentLayer._url.includes(map.selected_path)
) {
l.currentLayer.hide();
map.removeLayer(l);
}
});
} catch (e) {
console.log(e);
}
//try {
// // eslint-disable-next-line array-callback-return
// Object.keys(map._layers).map((l: any) => {
// l = map._layers[l];
// if (l && l._url && l._url.includes(`public.places_cities.geometry`)) {
// l.bringToFront();
// }
// if (
// l &&
// l._url &&
// //l._url.includes(`${V2_WMS_PROXY_URL}`) &&
// !l._url.includes(map.selected_path)
// ) {
// map.removeLayer(l);
// }
// if (
// l &&
// l.currentLayer &&
// l.currentLayer._url &&
// //l.currentLayer._url.includes(`${V2_WMS_PROXY_URL}`) &&
// !l.currentLayer._url.includes(map.selected_path)
// ) {
// l.currentLayer.hide();
// map.removeLayer(l);
// }
// });
//} catch (e) {
// console.log(e);
//}
};

useMapEvent('baselayerchange', () =>
Expand Down Expand Up @@ -98,16 +98,17 @@ export const ThreddsWrapperLayer = (props: any) => {
//}
let tdWmsLayer = null;
const params = {
layers: selected_map_path,
format: 'image/gif',
service: 'WMS',
layers: 'tas',
format: 'image/png',
//numcolorbands: '100',
//version: '1.3.0',
version: '1.3.0',
//colorscalerange: `${selected_map.color_scale_min},${selected_map.color_scale_max}`,
//logscale: 'false',
//styles: `default-scalar/${selected_map.palette}`,
// elevation: null,
styles: `default-scalar/default`,
//elevation: null,
//width: 256,
//transparent: true,
transparent: true,
crs: L.CRS.EPSG3857,
//bounds: selected_map.bbox,
};
Expand Down
24 changes: 13 additions & 11 deletions src/app/components/TimeSeriesDialog/TSDataContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ const TSDataContainer = (props: TSDataContainerProps) => {
rcp85: 'rgb(231,60,60)',
},
{
histo: 'rgba(69,50,27, 0.4)',
rcp26: 'rgba(46,105,193, 0.4)',
rcp45: 'rgba(243, 156, 18, 0.4)',
rcp85: 'rgba(231,60,60, 0.4)',
histo: 'rgb(82, 73, 62)',
rcp26: 'rgb(146, 166, 196)',
rcp45: 'rgb(250, 226, 187)',
rcp85: 'rgb(232, 169, 169)',
},
];

Expand Down Expand Up @@ -180,9 +180,7 @@ const TSDataContainer = (props: TSDataContainerProps) => {
let ret = {};
const legend = timeseries
?.filter(x => x.name.indexOf('_BOUND_') < 0)
.map(x => {
ret[x.name] = x.info.smoothing === 'no_smoothing';
});
.map(x => (ret[x.name] = x.info.smoothing === 'no_smoothing'));
return ret;
};

Expand Down Expand Up @@ -242,11 +240,15 @@ const TSDataContainer = (props: TSDataContainerProps) => {
: dataset.name;
};
const getAreaStyle = dataset => {
return dataset.name.indexOf('_UPPER_BOUND_') > 0
? {
color: '#ffc3c3',
if (dataset.name.indexOf('_UPPER_BOUND_') > 0) {
for (let k in colors[1]) {
if (dataset.name.indexOf(k) >= 0) {
return colors[1][k];
}
: null;
}
} else {
return null;
}
};

const getXAxis = () => {
Expand Down

0 comments on commit a08942b

Please sign in to comment.