@@ -339,7 +339,7 @@ function showMap(centerX, centerY, zoom, style, opt, source) {
339
339
function cityAreasLayer ( ) {
340
340
const baseUrl = 'https://tigerweb.geo.census.gov/arcgis/rest/services/TIGERweb/tigerWMS_Current/MapServer' + '/28' ;
341
341
function style ( feat ) {
342
- const fclr = 'rgba(255,220,255,1.0 )' ;
342
+ const fclr = 'rgba(255,220,255,0.4 )' ;
343
343
const sclr = 'rgba(155,120,155,1)' ;
344
344
return new ol . style . Style ( {
345
345
fill : new ol . style . Fill ( {
@@ -360,7 +360,7 @@ function showMap(centerX, centerY, zoom, style, opt, source) {
360
360
function unincAreasLayer ( ) {
361
361
const baseUrl = 'https://tigerweb.geo.census.gov/arcgis/rest/services/TIGERweb/tigerWMS_Current/MapServer' + '/30' ;
362
362
function style ( feat ) {
363
- const fclr = 'rgba(255,230,255,1.0 )' ;
363
+ const fclr = 'rgba(255,230,255,0.4 )' ;
364
364
const sclr = 'rgba(155,130,155,1)' ;
365
365
return new ol . style . Style ( {
366
366
fill : new ol . style . Fill ( {
@@ -517,8 +517,8 @@ function showMap(centerX, centerY, zoom, style, opt, source) {
517
517
topZindex : - 50 ,
518
518
} ,
519
519
'Last 12-24 hrs' : {
520
- sclr : 'rgba(255,165 ,0,0.6)' ,
521
- fclr : 'rgba(255,165 ,0,0.1)' ,
520
+ sclr : 'rgba(255,255 ,0,0.6)' ,
521
+ fclr : 'rgba(255,255 ,0,0.1)' ,
522
522
topZindex : - 25 ,
523
523
} ,
524
524
'Last 6-12 hrs' : {
@@ -533,32 +533,65 @@ function showMap(centerX, centerY, zoom, style, opt, source) {
533
533
} ,
534
534
} ;
535
535
536
- function infraredStyle ( time ) {
536
+ function infraredStyleRect ( time ) {
537
537
const s = infraredStyles [ time ] ;
538
538
if ( ! s ) {
539
539
return null ;
540
540
}
541
541
const sclr = s . sclr ;
542
542
const fclr = s . fclr ;
543
543
const topZindex = s . topZindex ;
544
- return [
545
- new ol . style . Style ( {
546
- zIndex : topZindex ,
547
- fill : zoom > 12.5 ? null : new ol . style . Fill ( {
548
- color : fclr ,
544
+ return function ( feat ) {
545
+ return [
546
+ new ol . style . Style ( {
547
+ zIndex : topZindex ,
548
+ fill : zoom > 12.5 ? null : new ol . style . Fill ( {
549
+ color : fclr ,
550
+ } ) ,
551
+ stroke : new ol . style . Stroke ( { color : sclr , width : zoom >= 12.5 ? 3 : 1 , lineDash : [ 3 , 3 ] } ) ,
549
552
} ) ,
550
- stroke : new ol . style . Stroke ( { color : sclr , width : zoom >= 12.5 ? 3 : 1 , lineDash : [ 3 , 3 ] } ) ,
551
- } ) ,
552
- ] ;
553
+ ] ;
554
+ } ;
553
555
}
554
556
555
- const afmStyles = {
556
- '12_to_24hr_fire' : infraredStyle ( 'Last 12-24 hrs' ) ,
557
- '06_to_12hr_fire' : infraredStyle ( 'Last 6-12 hrs' ) ,
558
- '00_to_06hr_fire' : infraredStyle ( 'Active Burning' ) ,
559
- 'prev_6_days_fire' : infraredStyle ( 'Last 24-48 hrs' ) ,
557
+ function infraredStyleIcon ( time ) {
558
+ const s = infraredStyles [ time ] ;
559
+ if ( ! s ) {
560
+ return null ;
561
+ }
562
+ const sclr = s . sclr ;
563
+ const fclr = s . fclr ;
564
+ const topZindex = s . topZindex ;
565
+ return function ( feat ) {
566
+ const c = ol . extent . getCenter ( feat . getGeometry ( ) . getExtent ( ) ) ;
567
+ return [
568
+ new ol . style . Style ( {
569
+ // latitude bounds here: https://epsg.io/3857
570
+ // we want northern items 'behind' southern ones
571
+ zIndex : topZindex + ( 20048966.10 - c [ 1 ] ) / ( 20048966.10 * 2.0 ) - 2.1 ,
572
+ fill : zoom > 12.5 ? null : new ol . style . Fill ( {
573
+ color : fclr ,
574
+ } ) ,
575
+ stroke : new ol . style . Stroke ( { color : sclr , width : zoom >= 12.5 ? 3 : 1 , lineDash : [ 3 , 3 ] } ) ,
576
+ } ) ,
577
+ new ol . style . Style ( {
578
+ geometry : new ol . geom . Point ( c ) ,
579
+ zIndex : topZindex + ( 20048966.10 - c [ 1 ] ) / ( 20048966.10 * 2.0 ) - 1.1 ,
580
+ image : new ol . style . Icon ( { src : '/imgs/redfire.png' , scale : 1.0 / 25.0 , anchor : [ 0.5 , 0.9 ] } ) ,
581
+ } ) ,
582
+ ] ;
583
+ } ;
584
+ }
585
+
586
+ const afmStylesIcons = {
587
+ '00_to_06hr_fire' : infraredStyleIcon ( 'Active Burning' ) ,
588
+ '06_to_12hr_fire' : infraredStyleIcon ( 'Last 6-12 hrs' ) ,
589
+ '12_to_24hr_fire' : infraredStyleRect ( 'Last 12-24 hrs' ) ,
590
+ // 'prev_6_days_fire': infraredStyleRect('Last 24-48 hrs'),
560
591
} ;
561
592
593
+ const afmStyles = afmStylesIcons ;
594
+
562
595
function kmlStyle ( sclr , fclr ) {
563
596
return new ol . style . Style ( {
564
597
fill : new ol . style . Fill ( {
@@ -577,17 +610,17 @@ function showMap(centerX, centerY, zoom, style, opt, source) {
577
610
} ) ,
578
611
} ;
579
612
580
- function afmKmlLayer ( url ) {
613
+ function afmKmlLayer ( url , type ) {
581
614
const modisCredit = 'MODIS (RSAC/USFS/NASA)' ;
582
615
const viirsCredit = 'VIIRS I (NASA/NOAA S-NPP)' ;
583
- const legend = 'Rectangles indicate satellite inferences of ≥1 fire in area (red: ≤12hrs, orange : ≤24hrs, as of the satellite readings which may be hours and days old)' ;
616
+ const legend = 'Rectangles and small fire icons indicate satellite inferences of ≥1 fire in area (red: ≤12hrs, yellow : ≤24hrs, as of the satellite readings which may be hours and days old)' ;
584
617
const afmCredit = 'U.S. Forest Service Active Fire Mapping' ;
585
618
586
619
function stylesFunc ( feat ) {
587
620
const name = feat . get ( 'styleUrl' ) ;
588
621
const parts = name . split ( '/' ) ;
589
622
const styleName = parts [ parts . length - 1 ] ;
590
- return afmStyles [ styleName ] || null ;
623
+ return ( afmStyles [ styleName ] || ( ( ) => null ) ) ( feat ) ;
591
624
}
592
625
return new ol . layer . Vector ( {
593
626
style : stylesFunc ,
@@ -701,10 +734,16 @@ function showMap(centerX, centerY, zoom, style, opt, source) {
701
734
'features' : events . map ( eventFeature ) ,
702
735
} ;
703
736
function style ( feat ) {
704
- return new ol . style . Style ( {
705
- // text: namedTextStyle(feat),
706
- image : new ol . style . Icon ( { src : '/imgs/fire.png' , color : '#ffffff' , scale : 1.0 / 9.0 } ) ,
707
- } ) ;
737
+ return [
738
+ new ol . style . Style ( {
739
+ // text: namedTextStyle(feat),
740
+ image : new ol . style . Icon ( { src : '/imgs/fire.png' , color : '#ffffff' , scale : 1.0 / 9.0 , anchor : [ 0.5 , 0.9 ] } ) ,
741
+ } ) ,
742
+ new ol . style . Style ( {
743
+ // text: namedTextStyle(feat),
744
+ image : new ol . style . Icon ( { src : whiteDot , color : '#ff0000' , scale : 1.0 / 3.0 } ) ,
745
+ } ) ,
746
+ ] ;
708
747
}
709
748
return new ol . layer . Vector ( {
710
749
source : new ol . source . Vector ( {
@@ -802,13 +841,13 @@ function showMap(centerX, centerY, zoom, style, opt, source) {
802
841
} else if ( config === 'Summits' ) {
803
842
return summitsVectorLayer ( ) ;
804
843
} else if ( config === 'AFM-MODIS' ) {
805
- return afmKmlLayer ( '../kml/modis.kml' ) ;
844
+ return afmKmlLayer ( '../kml/modis.kml' , 'modis' ) ;
806
845
} else if ( config === 'AFM-VIIRS-I' ) {
807
- return afmKmlLayer ( '../kml/viirs-i.kml' ) ;
846
+ return afmKmlLayer ( '../kml/viirs-i.kml' , 'viirs' ) ;
808
847
} else if ( config === 'AFM-MODIS-AK' ) {
809
- return afmKmlLayer ( '../kml/modis-alaska.kml' ) ;
848
+ return afmKmlLayer ( '../kml/modis-alaska.kml' , 'modis' ) ;
810
849
} else if ( config === 'AFM-VIIRS-I-AK' ) {
811
- return afmKmlLayer ( '../kml/viirs-i-alaska.kml' ) ;
850
+ return afmKmlLayer ( '../kml/viirs-i-alaska.kml' , 'viirs' ) ;
812
851
} else if ( config === 'Events' ) {
813
852
return eventsVectorLayer ( events ) ;
814
853
}
0 commit comments