Skip to content

Commit

Permalink
Adding NHC Hurricane Tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
eflowbeach committed Aug 31, 2015
1 parent 0383211 commit 0803c96
Showing 1 changed file with 63 additions and 48 deletions.
111 changes: 63 additions & 48 deletions js/mobileweather.js
Original file line number Diff line number Diff line change
@@ -1,61 +1,68 @@
// Written by: Jonathan Wolfe
// Date: 8/31/2015

// Current End Time
var endDate = new Date();
endDate.setUTCMinutes(0, 0, 0);

var map = L.map('map', {
zoom: 4,
scrollWheelZoom: true,
inertia: true,
inertiaDeceleration: 2000,
fullscreenControl: false,
center: [38.0, -90.50],
timeDimension: true,
timeDimensionControl: true,
timeDimensionControlOptions: {
autoPlay: true,
playerOptions: {
buffer: 10,
transitionTime: 200,
loop: true
},
speedSlider: false
autoPlay: true,
playerOptions: {
buffer: 10,
transitionTime: 200,
loop: true
},
speedSlider: false
},
timeDimensionOptions: {
timeInterval: "PT2H/" + endDate.toISOString(),
period: "PT5M"
},
loop: true
});

// Basemap
var layer = L.esri.basemapLayer("DarkGray", {
detectRetina: true
}).addTo(map);
detectRetina: true
}).addTo(map);

// Geo-locate
map.locate({setView: true, maxZoom: 16});

var testWMS = "http://new.nowcoast.noaa.gov/arcgis/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer/WMSServer"
var testLayer = L.nonTiledLayer.wms(testWMS, {
// Radar time-enabled WMS
var wmsUrl = "http://new.nowcoast.noaa.gov/arcgis/services/nowcoast/radar_meteo_imagery_nexrad_time/MapServer/WMSServer"
var radarWMS = L.nonTiledLayer.wms(wmsUrl, {
layers: '1',
format: 'image/png',
transparent: true,
opacity:0.8,
opacity: 0.8,
attribution: 'nowCOAST'
});
var testTimeLayer = L.timeDimension.layer.wms(testLayer);
var testTimeLayer = L.timeDimension.layer.wms(radarWMS);
testTimeLayer.addTo(map);

var testLegend = L.control({
var theLegend = L.control({
position: 'topright'
});


testLegend.onAdd = function(map) {
theLegend.onAdd = function(map) {
var src = "http://new.nowcoast.noaa.gov/images/legends/radar.png";
var div = L.DomUtil.create('div', 'info legend');
div.style.width = '270px';
div.style.height = '50px';
div.innerHTML += '<b>Legend</b><br><img src="' + src + '" alt="legend">';

div.innerHTML += '<b>Legend</b><br><img src="' + src + '" alt="legend">';
return div;
};
testLegend.addTo(map);
theLegend.addTo(map);

L.control.coordinates({
position: "bottomright",
Expand All @@ -66,39 +73,47 @@ L.control.coordinates({
enableUserInput: true
}).addTo(map);

// Basemap labels
var labels = L.esri.basemapLayer('DarkGrayLabels').addTo(map);
labels.setZIndex(1000);


// State overlay
function style(feature) {
return {
weight: 2,
opacity: 1,
color: 'white',
dashArray: '3',
fillOpacity: 0//,
//fillColor: getColor(feature.properties.density)
};
}


function zoomToFeature(e) {
map.fitBounds(e.target.getBounds());
}

function onEachFeature(feature, layer) {
layer.on({
click: zoomToFeature
});
}

geojson = L.geoJson(statesData, {
style: style,
onEachFeature: onEachFeature
}).addTo(map);
return {
weight: 2,
opacity: 1,
color: 'white',
dashArray: '3',
fillOpacity: 0
};
}

function zoomToFeature(e) {
map.fitBounds(e.target.getBounds());
}

function onEachFeature(feature, layer) {
layer.on({
click: zoomToFeature
});
}

var geojson = L.geoJson(statesData, {
style: style,
onEachFeature: onEachFeature
}).addTo(map);

map.on('layeradd', function(e) {
geojson.bringToFront()
});

map.on('layeradd', function(e) {
geojson.bringToFront()
});
// NHC Hurricane Tracks
var nhcTracks = L.tileLayer.wms("http://new.nowcoast.noaa.gov/arcgis/services/nowcoast/wwa_meteocean_tropicalcyclones_trackintensityfcsts_time/MapServer/WMSServer", {
layers: '0,1,2,3,4,5,6,7,8',
format: 'image/png',
transparent: true,
opacity: 0.5,
format: 'image/png32',
attribution: 'nowCOAST'
});
nhcTracks.addTo(map);

0 comments on commit 0803c96

Please sign in to comment.