Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#183 Fixed blinking by tinkering some more with the ids #184

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/components/map/adcirc-raster-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SldStyleParser from 'geostyler-sld-parser';
import { getNamespacedEnvParam } from '@utils/map-utils';
import { useSettings } from '@context';

export const AdcircRasterLayer = (layer, opacity) => {
export const AdcircRasterLayer = (layer) => {
const sldParser = new SldStyleParser();
const gs_wfs_url = `${ getNamespacedEnvParam('REACT_APP_GS_DATA_URL') }`;
const gs_wms_url = gs_wfs_url + 'wms';
Expand Down Expand Up @@ -37,6 +37,12 @@ export const AdcircRasterLayer = (layer, opacity) => {
sldParser.writeStyle(geostylerStyle.output)
.then((sldStyle) => {
setCurrentStyle(sldStyle.output);
// to add intervals - use the following
// it does not work when intervals keyword directly to the default style
// because when that style get written out here, sld parser loses the intervals setting
// const styleIntervals = sldStyle.output.replace('<ColorMap>', '<ColorMap type="intervals" extended="true">');
// setCurrentStyle(styleIntervals);

});
});
}
Expand All @@ -55,8 +61,8 @@ export const AdcircRasterLayer = (layer, opacity) => {
url={gs_wms_url}
layers={layer.layer.layers}
params={wmsLayerParams}
opacity={opacity}
opacity={layer.opacity}
/>
);

};
};
5 changes: 2 additions & 3 deletions src/components/map/default-layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,11 @@ export const DefaultLayers = () => {
.map((layer, index) => {
const pieces = layer.id.split('-');
const type = pieces[pieces.length-1];
const opacity = layer.state.opacity;
if (type === "obs" && obsData !== "") {
return (
<GeoJSON
key={Math.random() + index}
//key={layer.id} for some reason this causes the click on an obs point to retrieve the old data
data={obsData}
pointToLayer={obsPointToLayer}
onEachFeature={onEachObsFeature}
Expand All @@ -186,9 +186,8 @@ export const DefaultLayers = () => {
} else if (type !== "obs") {
return (
<AdcircRasterLayer
key={Math.random() + index}
key={layer.id}
layer={layer}
opacity={opacity}
/>
);
}
Expand Down