Weather Alerts
The weather alerts layer allows you to display weather alerts data on the map. (North America only) By adding theWeatherAlertClickControl
, a weather alert message pop up shows after clicking on an alert. WeatherAlertFilterControl
allows you to filter alerts by category, severity, urgency and certainty.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <link rel="stylesheet" href="https://maps-sdk.trimblemaps.com/v3/trimblemaps-3.21.0.css" /> <script src="https://maps-sdk.trimblemaps.com/v3/trimblemaps-3.21.0.js"></script> <style> body { margin: 0; padding: 0; } #map { position: absolute; top: 0; bottom: 0; width: 100%; } </style> </head> <body> <div id="map"></div> <script> TrimbleMaps.APIKey = 'YOUR_API_KEY_HERE'; const map = new TrimbleMaps.Map({ container: 'map', // container id style: TrimbleMaps.Common.Style.TRANSPORTATION, // hosted style id center: [-98.38, 38.69], // starting position zoom: 3 // starting zoom }); const ctrlClick = new TrimbleMaps.WeatherAlertClickControl(); map.addControl(ctrlClick); const ctrlFilter = new TrimbleMaps.WeatherAlertFilterControl(); map.addControl(ctrlFilter, 'top-left'); map.on('load', function() { map.setWeatherAlertVisibility(true); }); </script> </body> </html>
Weather Alerts
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <link rel="stylesheet" href="https://maps-sdk.trimblemaps.com/v3/trimblemaps-3.21.0.css" /> <script src="https://maps-sdk.trimblemaps.com/v3/trimblemaps-3.21.0.js"></script> <style> body { margin: 0; padding: 0; } #map { position: absolute; top: 0; bottom: 0; width: 100%; } </style> </head> <body> <div id="map"></div> <script> TrimbleMaps.APIKey = 'YOUR_API_KEY_HERE'; const map = new TrimbleMaps.Map({ container: 'map', // container id style: TrimbleMaps.Common.Style.TRANSPORTATION, // hosted style id center: [-98.38, 38.69], // starting position zoom: 3 // starting zoom }); const ctrlClick = new TrimbleMaps.WeatherAlertClickControl(); map.addControl(ctrlClick); const ctrlFilter = new TrimbleMaps.WeatherAlertFilterControl(); map.addControl(ctrlFilter, 'top-left'); map.on('load', function() { map.setWeatherAlertVisibility(true); }); </script> </body> </html>