11<!DOCTYPE html>
22< html >
33 < head >
4- < meta name ="viewport " content ="width=device-width, initial-scale=1 ">
5- < link rel ="stylesheet " href ="https://unpkg.com/leaflet@1.0.3 /dist/leaflet.css "/>
4+ < meta name ="viewport " content ="width=device-width, initial-scale=1 " / >
5+ < link rel ="stylesheet " href ="https://unpkg.com/leaflet@1.9.4 /dist/leaflet.css " />
66 < style >
77 # map {
88 bottom : 0 ;
1515 </ head >
1616 < body >
1717 < div id ="map "> </ div >
18- < script src ="https://unpkg.com/leaflet@1.0.3 /dist/leaflet.js "> </ script >
18+ < script src ="https://unpkg.com/leaflet@1.9.4 /dist/leaflet.js "> </ script >
1919 < script src ="https://unpkg.com/georaster "> </ script >
2020 < script src ="https://unpkg.com/chroma-js "> </ script >
2121 < script src ="https://unpkg.com/georaster-layer-for-leaflet@2 "> </ script >
2222
2323 < script >
2424 // initalize leaflet map
25- var map = L . map ( ' map' ) . setView ( [ 0 , 0 ] , 5 ) ;
25+ var map = L . map ( " map" ) . setView ( [ 0 , 0 ] , 5 ) ;
2626
2727 // add OpenStreetMap basemap
28- L . tileLayer ( ' http://{s}.tile.osm.org/{z}/{x}/{y}.png' , {
29- attribution : '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
28+ L . tileLayer ( " http://{s}.tile.osm.org/{z}/{x}/{y}.png" , {
29+ attribution : '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
3030 } ) . addTo ( map ) ;
3131
3232 // originally from https://globalwindatlas.info/downloads/gis-files
4545 var scale = chroma . scale ( "Viridis" ) ;
4646
4747 var layer = new GeoRasterLayer ( {
48- debugLevel : 4 ,
49- georaster : georaster ,
50- opacity : 0.7 ,
51- pixelValuesToColorFn : function ( pixelValues ) {
52- var pixelValue = pixelValues [ 0 ] ; // there's just one band in this raster
48+ debugLevel : 4 ,
49+ georaster : georaster ,
50+ opacity : 0.7 ,
51+ pixelValuesToColorFn : function ( pixelValues ) {
52+ var pixelValue = pixelValues [ 0 ] ; // there's just one band in this raster
5353
54- // if there's zero wind, don't return a color
55- if ( pixelValue === 0 ) return null ;
54+ // if there's zero wind, don't return a color
55+ if ( pixelValue === 0 ) return null ;
5656
57- // scale to 0 - 1 used by chroma
58- var scaledPixelValue = ( pixelValue - min ) / range ;
57+ // scale to 0 - 1 used by chroma
58+ var scaledPixelValue = ( pixelValue - min ) / range ;
5959
60- var color = scale ( scaledPixelValue ) . hex ( ) ;
60+ var color = scale ( scaledPixelValue ) . hex ( ) ;
6161
62- return color ;
63- } ,
64- resolution : 256
62+ return color ;
63+ } ,
64+ resolution : 256
6565 } ) ;
6666 console . log ( "layer:" , layer ) ;
6767 layer . addTo ( map ) ;
7171 } ) ;
7272 </ script >
7373 </ body >
74- </ html >
74+ </ html >
0 commit comments