The AerisWeather JavaScript SDK is an easy-to-use library that allows developers to quickly integrate weather data and imagery from their AerisWeather subscription into their web applications. You can perform basic AerisWeather API and/or AerisWeather Maps requests, or display a fully-interactive weather map using one of the many third-party mapping libraries currently supported.

Follow our Getting Started guide to quickly add weather data and imagery to your web applications.

Requirements + Compatibility

  • Requires an active AerisWeather subscription to the AerisWeather API and/or AerisWeather Maps
  • Compatible with modern browsers and IE 11

Basic Request Example

The following is a basic example that demonstrates how easy it is to start using the AerisWeather JavaScript SDK for requesting AerisWeather API data and Maps imagery once you’re set up:

// load the latest observation for Seattle, WA
aeris.api().endpoint('observations').place('seattle,wa').get().then((result) => {
     const data = result.data.ob;
     document.getElementById('obs').innerHTML = `The current weather is ${data.weatherPrimary.toLowerCase()} and ${data.tempF} degrees.`;
});

// load the latest radar image for Seattle, WA at 500x300 pixels
aeris.map().layers('flat,radar,counties,admin').center('seattle,wa').zoom(9).size(500, 300).get().then((result) => {
     // append result image to a DOM target
     document.getElementById('map-target').appendChild(result.image);
     
     // output image valid time to a DOM target
     document.getElementById('map-metadata').innerHTML = `Valid: ${result.metadata.validDate}`;
});

Implementation Methods

The AerisWeather JavaScript SDK can be implemented either in the browser by loading the compiled library from our CDN, or by installing and importing the SDK as an NPM module and importing it into your NodeJS or JavaScript project. Review the Getting Started guide for more information about each implementation and to set up and start using the SDK.

Features

The AerisWeather JavaScript SDK offers a rich feature set, from basic data and map imagery requests to fully-functional static and interactive weather maps. The core features of the SDK are outlined below:

Feature  
Data Requests Configure and request data from the AerisWeather API. Read more about API data requests via the SDK.
Map Image Requests Configure and request map imagery from AerisWeather Maps. Read more about map requests via the SDK.
Interactive Map A fully-interactive weather map using one of several support third-party mapping libraries, including Leaflet, Mapbox, OpenLayers and Google Maps. Read more about setting up an interactive map with the SDK.
Map View A lightweight weather map using static AerisWeather Maps imagery that supports animating weather data. Read more about setting up a basic map view with the SDK.
Legends An easy-to-use view component for fetching and rendering one or more weather layer legends in association with map imagery from AerisWeather Maps. Read more about using legends within the SDK.

Last modified: August 20, 2021