Skip to content

Commit

Permalink
Populate & show lightning layear only when there are lightnings in th…
Browse files Browse the repository at this point in the history
…e data set
  • Loading branch information
heikkipora committed Dec 31, 2023
1 parent 67b688c commit ea2c05e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/client/map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,12 @@ export function showRadarFrame(map: Map, {image, lightnings}: Frame) {
const radarLayer = map.getLayers().getArray()[1] as ImageLayer<ImageStatic>
radarLayer.setSource(radarImageSource)
radarLayer.setVisible(true)
if (lightnings) {

const hasLightnings = lightnings.length > 0
const lightningLayer = map.getLayers().getArray()[2] as VectorLayer<VectorSource<Feature<Geometry>>>
lightningLayer.setVisible(hasLightnings)
if (hasLightnings) {
const lightningLayer = map.getLayers().getArray()[2] as VectorLayer<VectorSource<Feature<Geometry>>>
lightningLayer.setVisible(true)
const featureObj = {
type: 'Feature',
geometry: {
Expand Down

0 comments on commit ea2c05e

Please sign in to comment.