Skip to content

Commit

Permalink
Merge pull request #21 from RENCI/bugfix/restrict-new-layer-visibility
Browse files Browse the repository at this point in the history
make only maxele and obs layers visible by default
  • Loading branch information
lstillwe authored May 3, 2024
2 parents 5bceeaf + 420f18c commit 8e200ab
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/components/map/default-layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ import { CircleMarker } from 'leaflet';
import { useLayers } from '@context';
import { markClicked } from '@utils/map-utils';

const newLayerDefaultState = layer => {
const { product_type } = layer.properties;

if (['obs', 'maxele63'].includes(product_type)) {
return ({
visible: true
});
}

return ({
visible: false
});
};


export const DefaultLayers = () => {

const [obsData, setObsData] = useState("");
Expand Down Expand Up @@ -92,9 +107,7 @@ export const DefaultLayers = () => {
if (layer)
layer_list.push({
...layer,
state: {
visible: true,
}
state: newLayerDefaultState(layer)
});

// TODO: do we really need to do this here??!
Expand Down

0 comments on commit 8e200ab

Please sign in to comment.