Skip to content

An external map module to be used with the InteractiveMap and InteractiveMapApp of the AerisWeather Javascript SDK.

License

Notifications You must be signed in to change notification settings

hwleeh/awxjs-severe-weather-module

 
 

Repository files navigation

Aeris JS SDK - Severe Weather Module

Starting with version 1.3.0 of the Aeris Javascript SDK, you can now create and add map source modules to easily include custom data sources and layers to your InteractiveMapApp and InteractiveMap instances.

We've created this Severe module as an example for you to reference when creating your own custom modules for your mapping applications. Feel free to use this module in your own projects, whether you're using our precompiled SDK scripts or importing our NPM package into your Javascript projects.

AerisWeather JS - Severe Module

Using the Module

The method for adding the Severe module to your project depends on how your project is setup, either as a module-based/NodeJS project or using precompiled scripts in an HTML file. Follow the appropriate examples below for your project's use case.

Module/NodeJS Project

If you are developing your own JavaScript application using a NodeJS server or using NPM libraries, you can use the source files in this repository and import them as needed within your maps.

NOTE: This module is written using Typescript and modern ES6 Javascript syntax. If you need the module's Typescript source compiled to Javascript, use the source files located within the dist/src/ directory or run yarn build from the root of this project's directory to recompile the source files.

The following is an example of importing and using the project source files in your Javascript project:

import AerisWeather from '@aerisweather/javascript-sdk/dist/AerisWeather';
import InteractiveMapApp from '@aerisweather/javascript-sdk/dist/apps/InteractiveMapApp';
import Severe from 'path/to/awxjs-severe-weather-module/dist/src/Severe';

const aeris = new AerisWeather('CLIENT_ID', 'CLIENT_SECRET');

const app = new apps.InteractiveMapApp('#app', {
    account: aeris.account(),
    // config options...
});
app.on('ready', () => {
    app.modules.add(new Severe());
});

Precompiled Script

To start using our Severe module quickly and easily, just load our precompiled script into your HTML and add it to your maps:

awxjs-severe-weather.min.js

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, user-scalable=no">
	<title>Aeris JS - Severe Module</title>

    <link rel="stylesheet" href="https://cdn.aerisapi.com/sdk/js/latest/aerisweather.css">
	<style>
	html, body {
		height: 100%;
		margin: 0;
		padding: 0;
		width: 100%;
	}
    #app {
        height: 100%;
        width: 100%;
    }
	</style>
</head>
<body>

    <div id="app"></div>

<script>
window.addEventListener('load', () => {

    const aeris = new AerisWeather('CLIENT_ID', 'CLIENT_SECRET');

    aeris.apps().then((apps) => {
        const app = new apps.InteractiveMapApp('#app', {
            // config options...
        });
        app.on('ready', () => {
            app.modules.add(new Severe());
        });
    });

});
</script>

<script src="https://cdn.aerisapi.com/sdk/js/latest/aerisweather.min.js"></script>
<script src="https://cdn.aerisapi.com/sdk/js/modules/awxjs-severe-weather.min.js"></script>

</body>
</html>

Utilizing the Storm Threats Infopanel

AerisWeather JS - Severe Module

By default, the Interactive Map App will open an infopanel filled with local weather information when clicking the map. A configuration option allows you to click on the map and view localized threat information from the AerisWeather API's threats endpoint. To enable this, just pass in the {showThreats:true} option when instantiating the Severe module:

app.modules.add(new Severe( {showThreats: true}));

Map Module Documentation

We have extensive documentation online when using map modules with InteractiveMapApp and InteractiveMap instances, which will go into more detail on the various options available to you related to map modules.

Support

Feel free to submit a new ticket with any questions, bug reports or feature suggestions you have. You can also reach out to us on Twitter at @AerisWeather.

About

An external map module to be used with the InteractiveMap and InteractiveMapApp of the AerisWeather Javascript SDK.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 85.1%
  • JavaScript 9.9%
  • HTML 5.0%