A vector layer for displaying weather alerts. Create a new instance with the ALKMaps.Layer.WeatherAlerts constructor.
ALKMaps. | A vector layer for displaying weather alerts. |
Properties | |
legendDisplayClass | {String} CSS class name can be used to override default style for the legend control. |
optionDisplayClass | {String} CSS class name can be used to override default style for the option control. |
externalDivForLegend | {DOMElement} The DOM element (DIV) that contains the legend control. |
externalDivForOption | {DOMElement} The DOM element (DIV) that contains the option control. |
alertFilters | {Object} Use this to override default weather alert filters. |
legendControl | {DOMElement} Legend control. |
optionControl | {DOMElement} Option control. |
weatherAlertEvents | An array of weather alerts |
refreshInterval | {Number} The features on this layer will be cached at least for the duration of the interval. |
lastUpdated | Last updated time |
bbox | {ALKMaps.Bounds} Gets weather alerts within this bounds. |
Constructor | |
ALKMaps. | A class for weather alerts layer. |
Functions | |
destroy | Clean up this layer. |
setVisibility | Hide or show the option control(s) or the legend control when the layer visibility is changed. |
featureunselected | Event handler. |
setMap | Add the option control for each weather alerts layer. |
selectAlertFeatures | Gets all weather alert features with the same event name. |
getNewAlerts | Call this method to decide whether to get new alerts or not. |
{Object} Use this to override default weather alert filters. Like {urgency: “All”, severity: “All”, certainty: “All”, eventNames: [“Winter Storm Warning”, “Flood Watch”], startTime: “2015-08-29T13:45:30-07:00”, endTime: “2015-08-31T13:45:30-07:00”}. Available values for “severity” are “All”, “Extreme”, “Severe”, “Moderate”, “Minor”, “Unknown”. Available values for “urgency” are “All”, “Immediate”, “Expected”, “Future”, “Past”, “Unknown”. Available values for “certainty” are “All”, “Observed”, “Likely”, “Possible”, “Unlikely”, “Unknown”. Available values for “eventNames” are array of event names such as [“Winter Storm Warning”, “Flood Watch”]. For “startTime” use standard formats such as ISO8601(“2015-08-29T13:45:30-07:00”) or RFC1123(“Sat, 29 Aug 2015 20:45:30 GMT”). For “endTime” use standard formats such as ISO8601(“2015-08-29T13:45:30-07:00”) or RFC1123(“Sat, 29 Aug 2015 20:45:30 GMT”).
{ALKMaps.Bounds} Gets weather alerts within this bounds.
A class for weather alerts layer.
name | {String} Used to identify this layer. |
options | {Object} Optional object whose properties will be set on the instance. |
alertFilters | {Object} Like {urgency: “All”, severity: “All”, certainty: “All”, eventNames: [“Winter Storm Warning”, “Flood Watch”], startTime: “2015-08-29T13:45:30-07:00”, endTime: “2015-08-31T13:45:30-07:00”} |
legendDisplayClass | {String} |
optionDisplayClass | {String} |
legendControlVisible | {Boolean} If it is false, the control will always be hidden. Default is true. |
optionControlVisible | {Boolean} If it is false, the control will always be hidden. Default is true. |
externalDivForLegend | {DOMElement} |
externalDivForOption | {DOMElement} |
onErrorCallback | {Function} |
onSuccessCallback | {Function} |
refreshInterval | {Number} The features on this layer will cache at least for the duration of the interval. After the time is expired, the alerts may get updated when map is zoomed or panned. The unit is in minutes. Default is 0.1 minutes. |
bbox | {ALKMaps.Bounds} The bounds can be used on restricting the number of alerts returned. |
styleMap | {Object} |
var weatherAlertsLayer = new ALKMaps.Layer.WeatherAlerts("Weather Alerts"); var weatherAlertsLayer = new ALKMaps.Layer.WeatherAlerts("Weather Alerts", { alertFilters: {urgency: "All", severity: "All", certainty: "All", eventNames: ["Winter Storm Warning", "Flood Watch"]} , legendDisplayClass: "customCSSClassName", optionDisplayClass: "customCSSClassName", legendControlVisible: true, optionControlVisible: true, externalDivForLegend: document.getElementById("externalDiv"), externalDivForOption: document.getElementById("externalDiv"), onErrorCallback: function(err) { // console.log(err); }, onSuccessCallback: function(data){ //console.log(data); }, styleMap: new ALKMaps.StyleMap({ "default": new ALKMaps.Style({ fillColor: "${fill}", strokeColor: "${stroke}", strokeWidth: 0, fillOpacity: 0.2, strokeOpacity: 0.2 }, { context: { fill: function (feature) { return ALKMaps.WeatherAlertColor[feature.attributes.weatherAlertEvent.AlertEvent]; }, stroke: function (feature) { return ALKMaps.WeatherAlertColor[feature.attributes.weatherAlertEvent.AlertEvent]; } } }), "select": new ALKMaps.Style({ fillColor: "${fill}", strokeColor: "${stroke}", strokeWidth: 0, fillOpacity: 0.8, strokeOpacity: 0.8 }, { context: { fill: function (feature) { return ALKMaps.WeatherAlertColor[feature.attributes.weatherAlertEvent.AlertEvent]; }, stroke: function (feature) { return ALKMaps.WeatherAlertColor[feature.attributes.weatherAlertEvent.AlertEvent]; } } }) }); });
setMap: function( map )
Add the option control for each weather alerts layer. Add the legend control. Make sure there is one for all weather alerts layers.
map | {ALKMaps.Map} |
selectAlertFeatures: function( feature, selectControl, addPopup )
Gets all weather alert features with the same event name. Highlight them. Add optional popup.
feature | {ALKMaps.Feature.Vector} |
selectControl | {ALKMaps.Control.FeatureEvent} |
addPopup | {Boolean} Set to false, the default popup will not show. |
Clean up this layer.
destroy: function()
Hide or show the option control(s) or the legend control when the layer visibility is changed.
setVisibility: function( visibility )
Event handler.
featureunselected: function( e )
Add the option control for each weather alerts layer.
setMap: function( map )
Gets all weather alert features with the same event name.
selectAlertFeatures: function( feature, selectControl, addPopup )
Call this method to decide whether to get new alerts or not.
getNewAlerts: function()