Our new AerisWeather Javascript Weather SDK provides you with tons of features so you can easily add weather data and imagery into your custom applications. From performing simple API data requests to full-featured interactive weather maps, our SDK makes it easy and painless. But what if you wanted to combine all of the many features of the SDK into a single, cohesive and highly flexible weather mapping application?
We’re excited to announce version 1.2.0 of our Javascript SDK includes a complete weather mapping application. And it’s all built into the SDK so you can take advantage of this new component immediately! We released 1.2.0 earlier this month, and some of the key features of this release include:
Read on to learn more about the map application component.
Aeris JS Weather SDK – Interactive Weather Mapping Application
The AerisWeather JavaScript SDK includes a fully-functional, feature-rich interactive weather mapping application, which can serve as your own weather dashboard or be integrated into your custom weather applications. At the core of this new application feature is the SDK’s interactive map component, which we detailed in a recent article. The application is a container layer on top of an interactive map that provides additional functionality through the use of panel views. The following are the panel views available with an interactive map application:
By default, an interactive map application already has these panels set up and configured for you. For instance, a user can search for a particular location using the place search panel. When selecting a location, the info panel appears with information relevant to that location. The interactive map application and its panels are also fully stylable and customizable. Refer to our configuration documentation for more information regarding the configuration options.
Setting up a weather map application is similar to that of the core interactive map component setup except that you’ll be working with the new apps module of the SDK. So you’ll first need to complete the following steps:
Once you’ve completed the above steps, you should have a result similar to:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>AerisJS Interactive Map App</title> <script src="https://cdn.aerisapi.com/sdk/js/latest/aerisweather.min.js" defer></script> <link rel="stylesheet" href="https://cdn.aerisapi.com/sdk/js/latest/aerisweather.css"> <style> html, body { height: 100%; margin: 0; padding: 0; width: 100%; } #map-app { height: 100%; width: 100%; } </style> </head> <body> <div id="map-app"></div> <script> window.onload = () => { const aeris = new AerisWeather('CLIENT_ID', 'CLIENT_SECRET'); }; </script> </body> </html>
Now we can add our weather mapping application.
Above, we have assigned our configured instance of the library to a local
aeris
 variable. We now need to use the
apps()
 method on that instance to access the Apps module and its InteractiveMapApp component, which returns a Promise:
aeris.apps().then((apps) => { // config will go here });
We’re now ready to create our application. For this basic example, we’re just going to configure our application to render layer toggle controls for the radar, satellite, and alerts AMP layers. The configuration also enables the radar layer initially by default. We’ll also set the initial map zoom to level 4 using the Leaflet map strategy:
aeris.apps().then((apps) => { const map = new apps.InteractiveMapApp('#map-app', { map: { strategy: 'leaflet', zoom: 4, layers: 'radar' }, panels: { layers: { buttons: [{ id: 'radar', value: 'radar:80', title: 'Radar' },{ id: 'satellite', value: 'satellite:75', title: 'Satellite' },{ id: 'alerts', value: 'alerts', title: 'Alerts' }] } } }); });
You should now have your basic interactive weather mapping application:
Aeris JS Weather SDK – Basic Weather Mapping Application
Now you can test out the many different features available with your application. You can toggle layers on and off, search for and select locations to view weather details, view map data for different time periods along the timeline and view the map legends:
And here’s the complete HTML code snippet:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>AerisJS Interactive Map App</title> <script src="https://cdn.aerisapi.com/sdk/js/latest/aerisweather.min.js" defer></script> <link rel="stylesheet" href="https://cdn.aerisapi.com/sdk/js/latest/aerisweather.css"> <style> html, body { height: 100%; margin: 0; padding: 0; width: 100%; } #map-app { height: 100%; width: 100%; } </style> </head> <body> <div id="map-app"></div> <script> window.onload = () => { const aeris = new AerisWeather('CLIENT_ID', 'CLIENT_SECRET'); aeris.apps().then((apps) => { const map = new apps.InteractiveMapApp('#app', { map: { strategy: 'leaflet', zoom: 4, layers: 'radar' }, panels: { layers: { buttons: [{ id: 'radar', value: 'radar:80', title: 'Radar' },{ id: 'satellite', value: 'satellite:75', title: 'Satellite' },{ id: 'alerts', value: 'alerts', title: 'Alerts' }] } } }); }); }; </script> </body> </html>
The above was just a basic example of setting up an interactive map application. However, you can take yours even further by:
Be sure to review our extensive online documentation for our AerisWeather Javascript SDK. Our documentation covers many more features are available for your weather-related applications and Aeris subscription not covered here.
We’d love to learn more about what you’re building with our AerisWeather Javascript SDK, so please reach out to our team or hit us up on Twitter!
No comments yet.
Be the first to respond to this article.