ALKMaps.Layer.WeatherAlerts

A vector layer for displaying weather alerts.  Create a new instance with the ALKMaps.Layer.WeatherAlerts constructor.

Inherits from

Summary
ALKMaps.Layer.WeatherAlertsA 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.
weatherAlertEventsAn array of weather alerts
refreshInterval{Number} The features on this layer will be cached at least for the duration of the interval.
lastUpdatedLast updated time
bbox{ALKMaps.Bounds} Gets weather alerts within this bounds.
Constructor
ALKMaps.Layer.WeatherAlertsA class for weather alerts layer.
Functions
destroyClean up this layer.
setVisibilityHide or show the option control(s) or the legend control when the layer visibility is changed.
featureunselectedEvent handler.
setMapAdd the option control for each weather alerts layer.
selectAlertFeaturesGets all weather alert features with the same event name.
getNewAlertsCall this method to decide whether to get new alerts or not.

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.  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”).

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.  After the time is expired, the alerts may get updated when map is zoomed or panned.  The unit is in minutes.

lastUpdated

Last updated time

bbox

{ALKMaps.Bounds} Gets weather alerts within this bounds.

Constructor

ALKMaps.Layer.WeatherAlerts

A class for weather alerts layer.

Parameters

name{String} Used to identify this layer.
options{Object} Optional object whose properties will be set on the instance.

Valid options include

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];
                  }
              }
          })
      });
});

Functions

destroy

destroy: function()

Clean up this layer.

setVisibility

setVisibility: function(visibility)

Hide or show the option control(s) or the legend control when the layer visibility is changed.

featureunselected

featureunselected: function(e)

Event handler.  Remove popup.

setMap

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.

Parameters

map{ALKMaps.Map}

selectAlertFeatures

selectAlertFeatures: function(feature,
selectControl,
addPopup)

Gets all weather alert features with the same event name.  Highlight them.  Add optional popup.

Parameters

feature{ALKMaps.Feature.Vector}
selectControl{ALKMaps.Control.FeatureEvent}
addPopup{Boolean} Set to false, the default popup will not show.

getNewAlerts

getNewAlerts: function()

Call this method to decide whether to get new alerts or not.

Instances of this class represent bounding boxes.
destroy: function()
Clean up this layer.
setVisibility: function(visibility)
Hide or show the option control(s) or the legend control when the layer visibility is changed.
featureunselected: function(e)
Event handler.
setMap: function(map)
Add the option control for each weather alerts layer.
selectAlertFeatures: function(feature,
selectControl,
addPopup)
Gets all weather alert features with the same event name.
getNewAlerts: function()
Call this method to decide whether to get new alerts or not.
A class for weather alerts layer.
Instances of ALKMaps.Layer.Vector are used to render vector data from a variety of sources.
Instances of ALKMaps.Map are interactive maps embedded in a web page.
Vector features use the ALKMaps.Geometry classes as geometry description.
The FeatureEvent control selects vector features from a given layer on click or hover.
Close