1. Help Center
  2. Spire Weather
  3. Spire Weather Demo Applications

How can Spire's Maritime Weather data be used in an application?

This article showcases an example web application used to request, visualize, and analyze data from Spire's API products in the Maritime Weather context.

This web application demo is currently hosted live and can be experienced here.

The code is entirely open-source. It can be viewed and downloaded here. The code is provided only as a reference for interested developers, as-is, and without guarantees.

All weather data comes directly from Spire Weather's /forecast/point API endpoint, using the Maritime and Basic data bundles.

All AIS vessel data comes directly from Spire Maritime's Vessels API product.

Authenticating with a Spire API Token

To use this web application, you must first provide a Spire API token that is valid for Spire Weather's /forecast/point and /ows/wms/ API endpoints and Spire Maritime's Vessels API product. If you do not have such a token and would like to receive one, please contact us here. This video shows how you can use your browser's built-in password storage to save the API token for the next time you visit the page:

HubSpot Video


Requesting Last Known Vessel Positions

Spire Maritime's Vessels API allows users to request vessels in a specified area of interest using the last_known_position_within parameter. The code enabling the functionality in this video creates a GeoJSON Polygon geometry from the area drawn on the map and passes it into the Vessels API as the value of that parameter. Note that for the purposes of this demo, we also use a parameter of limit=500 to reduce the total number of vessels returned by the Vessels API for each specified area.

(NB: You can also use the Latest Vessel Position instead of the Vessels API to achieve the same purpose.)

HubSpot Video


Inspecting Data for Individual Vessels

Every blue point drawn on the map represents a single vessel returned by the Vessels API. Any of these points can be clicked on to inspect the data returned for that vessel:

HubSpot Video


Viewing a Weather Point Forecast for Individual Vessels

While inspecting an individual vessel's data, it is possible to trigger an API request to Spire Weather's /forecast/point API endpoint. This API endpoint expects latitude and longitude parameters which, in this example, are taken directly from the individual vessel's last_known_position. Note that the red and yellow thresholds depicted in these graphs are set to arbitrary values, and are merely included as an example of possible functionality:

HubSpot Video


Viewing a Weather Point Forecast for Any Map Location

Spire Weather's /forecast/point API endpoint works with any latitude and longitude coordinate in the world. This video shows how a weather forecast can be retrieved with a simple click on the map. The code enabling the functionality in this video just takes the latitude and longitude values from the clicked map location and passes them directly into the /forecast/point API:

HubSpot Video

Configuring Weather WMS Layers

Spire Weather's /ows/wms API endpoint returns pre-styled, geo-referenced weather visualizations. Using a standardized Web Map Service format developed by the international Open Geospatial Consortium, the WMS data is perfect for integrating with existing map software. This video shows an example of how to add WMS layers, crop the layers to a specific region, switch between pre-configured styles (e.g. contour lines, vectors, wind barbs), and toggle the legend image unique to each style:

HubSpot Video

Change Time for WMS Layers

Spire Weather's WMS layers are also time-enabled. This video shows an example time control interface for viewing WMS layers of forecasted weather data up to 7 days in the future:

HubSpot Video

Next Steps

This demo application only shows integration with 2 data bundles from 1 of Spire Weather's offered API endpoints, /forecast/point. Spire Weather offers several other bundles of data variables, all of which can be used with the /forecast/file endpoint to retrieve GRIB2 data files for custom processing.

This demo application also lacks functionality for updating vessel positions or forecast data over time. A production application intended to make the most of Spire's data would likely implement this update feature, along with additional UI components such as a time slider to navigate through data in the temporal domain or other API filters like vessel type and size.

Implementing this functionality is currently left as an exercise for the reader.

For questions about how your organization can make the most of Spire's data, please feel free to contact us directly and someone from our dedicated Customer Success team will get back to you soon.