@@ -624,47 +624,61 @@ $(window).ready(function() {
624624
625625 // weather feature
626626
627- // north america overlays
627+ // list of overlays
628628 var overlayList = [
629- [ 'nexrad-n0q-900913' , 'NEXRAD Base Reflectivity' ] ,
630- [ 'goes-ir-4km-900913' , 'GOES NA Infrared ~4km' ] ,
631- [ 'goes-wv-4km-900913' , 'GOES NA Water Vapor ~4km' ] ,
632- [ 'goes-vis-1km-900913' , 'GOES NA Visible ~1km' ] ,
633- [ 'goes-east-ir-4km-900913' , 'GOES East CONUS Infrared' ] ,
634- [ 'goes-east-wv-4km-900913' , 'GOES East CONUS Water Vapor' ] ,
635- [ 'goes-east-vis-1km-900913' , 'GOES East CONUS Visible' ] ,
636- [ 'goes-west-ir-4km-900913' , 'GOES West CONUS Infrared' ] ,
637- [ 'goes-west-wv-4km-900913' , 'GOES West CONUS Water Vapor' ] ,
638- [ 'goes-west-vis-1km-900913' , 'GOES West CONUS Visible' ] ,
639- [ 'hawaii-vis-900913' , 'GOES West Hawaii Visible' ] ,
640- [ 'alaska-vis-900913' , 'GOES West Alaska Visible' ] ,
641- [ 'alaska-ir-900913' , 'GOES West Alaska IR' ] ,
642- [ 'alaska-wv-900913' , 'GOES West Alaska Water Vapor' ] ,
643- [ 'q2-n1p-900913' , 'Q2 1 Hour Precipitation' ] ,
644- [ 'q2-p24h-900913' , 'Q2 24 Hour Precipitation' ] ,
645- [ 'q2-p48h-900913' , 'Q2 48 Hour Precipitation' ] ,
646- [ 'q2-p72h-900913' , 'Q2 72 Hour Precipitation' ] ,
647- [ 'q2-hsr-900913' , 'MRMS Hybrid-Scan Reflectivity Composite.' ] ,
629+ [ 'Europe/Africa' , [
630+ [ 'meteosat-Odeg-MPE' , 'METEOSAT Precip. Estimate' ]
631+ ] ] ,
632+ [ 'Indian Ocean' , [
633+ [ 'meteosat-iodc-MPE' , 'METEOSAT IODC Precip. Est.' ]
634+ ] ] ,
635+ [ 'North America' , [
636+ [ 'nexrad-n0q-900913' , 'NEXRAD Base Reflectivity' ] ,
637+ [ 'goes-ir-4km-900913' , 'GOES NA Infrared ~4km' ] ,
638+ [ 'goes-wv-4km-900913' , 'GOES NA Water Vapor ~4km' ] ,
639+ [ 'goes-vis-1km-900913' , 'GOES NA Visible ~1km' ] ,
640+ [ 'goes-east-ir-4km-900913' , 'GOES East CONUS Infrared' ] ,
641+ [ 'goes-east-wv-4km-900913' , 'GOES East CONUS Water Vapor' ] ,
642+ [ 'goes-east-vis-1km-900913' , 'GOES East CONUS Visible' ] ,
643+ [ 'goes-west-ir-4km-900913' , 'GOES West CONUS Infrared' ] ,
644+ [ 'goes-west-wv-4km-900913' , 'GOES West CONUS Water Vapor' ] ,
645+ [ 'goes-west-vis-1km-900913' , 'GOES West CONUS Visible' ] ,
646+ [ 'hawaii-vis-900913' , 'GOES West Hawaii Visible' ] ,
647+ [ 'alaska-vis-900913' , 'GOES West Alaska Visible' ] ,
648+ [ 'alaska-ir-900913' , 'GOES West Alaska IR' ] ,
649+ [ 'alaska-wv-900913' , 'GOES West Alaska Water Vapor' ] ,
650+ [ 'q2-n1p-900913' , 'Q2 1 Hour Precipitation' ] ,
651+ [ 'q2-p24h-900913' , 'Q2 24 Hour Precipitation' ] ,
652+ [ 'q2-p48h-900913' , 'Q2 48 Hour Precipitation' ] ,
653+ [ 'q2-p72h-900913' , 'Q2 72 Hour Precipitation' ] ,
654+ [ 'q2-hsr-900913' , 'MRMS Hybrid-Scan Reflectivity Composite.' ]
655+ ] ]
648656 ] ;
649657
650658 // generate the list of switches for each overlay
651659 var elm = $ ( "#weatherbox .slimContainer" ) ;
652- elm . append ( "<h4>North America</h4><hr>" ) ;
653-
654- var i ;
655- for ( i in overlayList ) {
656- var id = overlayList [ i ] [ 0 ] ;
657- var name = overlayList [ i ] [ 1 ] ;
658-
659- var html = '<div class="row option">'
660- + '<span><b>' + name + '</b></span>'
661- + '<div class="switch off" id="sw_weather_' + id + '" data-weatherid="' + id + '">'
662- + '<span class="thumb"></span>'
663- + '<input type="checkbox" id="opt_weather_' + id + '">'
664- + '</div>'
665- + '</div>' ;
666-
667- elm . append ( html ) ;
660+ var j ;
661+ for ( j in overlayList ) {
662+ var region = overlayList [ j ] [ 0 ] ;
663+ var switches = overlayList [ j ] [ 1 ] ;
664+
665+ elm . append ( "<h4>" + region + "</h4><hr>" ) ;
666+
667+ var i ;
668+ for ( i in switches ) {
669+ var id = switches [ i ] [ 0 ] ;
670+ var name = switches [ i ] [ 1 ] ;
671+
672+ var html = '<div class="row option">'
673+ + '<span><b>' + name + '</b></span>'
674+ + '<div class="switch off" id="sw_weather_' + id + '">'
675+ + '<span class="thumb"></span>'
676+ + '<input type="checkbox" id="opt_weather_' + id + '">'
677+ + '</div>'
678+ + '</div>' ;
679+
680+ elm . append ( html ) ;
681+ }
668682 }
669683
670684 // the magic that makes the switches do things
@@ -683,12 +697,21 @@ $(window).ready(function() {
683697 e . removeClass ( 'off' ) . addClass ( 'on' ) ;
684698 on = 1 ;
685699 }
700+ weatherMETEOSAT_MPE . setMap ( null ) ;
701+ weatherMETEOSAT_IODC_MPE . setMap ( null ) ;
702+ map . overlayMapTypes . setAt ( "0" , null ) ;
686703
687704 if ( on ) {
705+ if ( id == "meteosat-Odeg-MPE" ) {
706+ weatherMETEOSAT_MPE . setMap ( map ) ;
707+ return ;
708+ } else if ( id == "meteosat-iodc-MPE" ) {
709+ weatherMETEOSAT_IODC_MPE . setMap ( map ) ;
710+ return ;
711+ }
712+
688713 weatherOverlayId = id ;
689714 map . overlayMapTypes . setAt ( "0" , weatherOverlay ) ;
690- } else {
691- map . overlayMapTypes . setAt ( "0" , null ) ;
692715 }
693716 } ) ;
694717} ) ;
0 commit comments