Spire’s implementation of the OGC WMS standard, providing access to weather data as map layers.
Overview¶
WMS (Web Map Service) is an OGC standard for delivering map layers over the internet. Spire’s WMS layers are pre-styled, geo-referenced weather visualizations—images that can be displayed on a map. They are well-suited for integration with existing geospatial software (e.g., ArcGIS, QGIS, Mapbox, Leaflet, OpenLayers).
Spire’s WMS implementation allows you to choose from several styles for each layer and compose multiple views of the same information. Visualizations are created for each valid time in a forecast, so you can select which time to view or play through them sequentially.
For a quick overview and style walkthrough, see Spire WMS and the WMS walkthrough.
Endpoint¶
| Method | Endpoint | Description |
|---|---|---|
| GET | /ows/wms | OGC WMS service |
Authentication¶
The WMS endpoint supports three authentication methods to accommodate different client applications:
API Key in Header (recommended)¶
curl -X GET \
'https://api.wx.spire.com/ows/wms?service=WMS&request=GetCapabilities&product=sof-d&bundle=basic' \
-H 'spire-api-key: YOUR_API_KEY'import requests
response = requests.get(
"https://api.wx.spire.com/ows/wms",
params={
"service": "WMS",
"request": "GetCapabilities",
"product": "sof-d",
"bundle": "basic",
},
headers={"spire-api-key": "YOUR_API_KEY"},
)const params = new URLSearchParams({
service: "WMS",
request: "GetCapabilities",
product: "sof-d",
bundle: "basic",
});
const response = await fetch(
`https://api.wx.spire.com/ows/wms?${params}`,
{ headers: { "spire-api-key": "YOUR_API_KEY" } }
);API Key in Query Parameter¶
curl -X GET \
'https://api.wx.spire.com/ows/wms?service=WMS&request=GetCapabilities&product=sof-d&bundle=basic&spire-api-key=YOUR_API_KEY'HTTP Basic Authentication¶
The username is the same as the API key. Contact Spire Weather support for a password if you prefer this method.
curl -X GET \
'https://api.wx.spire.com/ows/wms?service=WMS&request=GetCapabilities&product=sof-d&bundle=basic' \
-u 'YOUR_API_KEY:YOUR_PASSWORD'Required Parameters¶
These parameters are mandatory for all WMS requests:
| Parameter | Type | Required | Description |
|---|---|---|---|
service | string | Yes | Must be WMS |
request | string | Yes | GetCapabilities or GetMap |
product | string | Yes | Product identifier (currently only sof-d) |
bundle | string | Yes | Data bundle to access |
Supported Bundles¶
Not all data bundles support WMS. The following bundles are available as WMS layers:
| Bundle | Description |
|---|---|
basic | Standard meteorological variables |
precipitation | Precipitation data |
maritime | Marine parameters |
maritime-wave | Wave parameters |
maritime-wave-ext | Extended wave parameters |
maritime-atmos | Maritime atmospheric parameters |
clouds | Cloud cover (excluding ceiling) |
thunderstorm | Convective parameters |
upper-air | Upper-air data |
agricultural | Agricultural parameters |
wind-energy | Wind energy parameters |
solar-energy | Solar radiation data |
GetCapabilities¶
Retrieve metadata about the WMS service, including supported operations, available layers, and layer parameters.
Example — Basic Bundle¶
curl -X GET \
'https://api.wx.spire.com/ows/wms?service=WMS&request=GetCapabilities&product=sof-d&bundle=basic' \
-H 'spire-api-key: YOUR_API_KEY'import requests
response = requests.get(
"https://api.wx.spire.com/ows/wms",
params={
"service": "WMS",
"request": "GetCapabilities",
"product": "sof-d",
"bundle": "basic",
},
headers={"spire-api-key": "YOUR_API_KEY"},
)const params = new URLSearchParams({
service: "WMS",
request: "GetCapabilities",
product: "sof-d",
bundle: "basic",
});
const response = await fetch(
`https://api.wx.spire.com/ows/wms?${params}`,
{ headers: { "spire-api-key": "YOUR_API_KEY" } }
);Example — Maritime Bundle¶
curl -X GET \
'https://api.wx.spire.com/ows/wms?service=WMS&request=GetCapabilities&product=sof-d&bundle=maritime' \
-H 'spire-api-key: YOUR_API_KEY'import requests
response = requests.get(
"https://api.wx.spire.com/ows/wms",
params={
"service": "WMS",
"request": "GetCapabilities",
"product": "sof-d",
"bundle": "maritime",
},
headers={"spire-api-key": "YOUR_API_KEY"},
)const params = new URLSearchParams({
service: "WMS",
request: "GetCapabilities",
product: "sof-d",
bundle: "maritime",
});
const response = await fetch(
`https://api.wx.spire.com/ows/wms?${params}`,
{ headers: { "spire-api-key": "YOUR_API_KEY" } }
);GetMap¶
Retrieve a rendered map image for a specific layer, time, and geographic extent.
Additional Parameters for GetMap¶
| Parameter | Type | Required | Description |
|---|---|---|---|
version | string | Yes | WMS version (e.g., 1.3.0) |
layers | string | Yes | Layer identifier |
crs | string | Yes | Coordinate reference system (e.g., EPSG:4326) |
bbox | string | Yes | Bounding box (min_lat,min_lon,max_lat,max_lon) |
width | integer | Yes | Image width in pixels |
height | integer | Yes | Image height in pixels |
FORMAT | string | Yes | Output format (e.g., image/png) |
TIME | string | Yes | ISO 8601 timestamp for the data |
styles | string | No | Rendering style |
TRANSPARENT | boolean | No | Transparent background |
EXCEPTIONS | string | No | Exception format |
Example — 2m Temperature Map¶
curl -X GET \
'https://api.wx.spire.com/ows/wms?service=WMS&request=GetMap&product=sof-d&bundle=basic&version=1.3.0&width=3072&height=1536&crs=EPSG:4326&bbox=-90,-180,90,180&FORMAT=image/png&TRANSPARENT=true&TIME=2024-01-15T12:00:00.000Z&layers=sof-d/20240115/12/t2m:K&styles=temp:K/nearest' \
-H 'spire-api-key: YOUR_API_KEY' \
-o temperature_map.pngimport requests
response = requests.get(
"https://api.wx.spire.com/ows/wms",
params={
"service": "WMS",
"request": "GetMap",
"product": "sof-d",
"bundle": "basic",
"version": "1.3.0",
"width": 3072,
"height": 1536,
"crs": "EPSG:4326",
"bbox": "-90,-180,90,180",
"FORMAT": "image/png",
"TRANSPARENT": "true",
"TIME": "2024-01-15T12:00:00.000Z",
"layers": "sof-d/20240115/12/t2m:K",
"styles": "temp:K/nearest",
},
headers={"spire-api-key": "YOUR_API_KEY"},
)
with open("temperature_map.png", "wb") as f:
f.write(response.content)import { writeFile } from "fs/promises";
const params = new URLSearchParams({
service: "WMS",
request: "GetMap",
product: "sof-d",
bundle: "basic",
version: "1.3.0",
width: "3072",
height: "1536",
crs: "EPSG:4326",
bbox: "-90,-180,90,180",
FORMAT: "image/png",
TRANSPARENT: "true",
TIME: "2024-01-15T12:00:00.000Z",
layers: "sof-d/20240115/12/t2m:K",
styles: "temp:K/nearest",
});
const response = await fetch(
`https://api.wx.spire.com/ows/wms?${params}`,
{ headers: { "spire-api-key": "YOUR_API_KEY" } }
);
const buffer = Buffer.from(await response.arrayBuffer());
await writeFile("temperature_map.png", buffer);Layer Naming¶
Layer names are available through the GetCapabilities response. They typically follow the pattern:
{product}/{date}/{hour}/{variable}:{unit}For example: sof-d/20240115/12/t2m:K represents the 2-meter temperature in Kelvin from the January 15, 2024 12Z model run.
Python Example¶
Fetch and display a WMS map:
import requests
from PIL import Image
from io import BytesIO
headers = {'spire-api-key': 'YOUR_API_KEY'}
# First, get capabilities to discover available layers
capabilities = requests.get(
'https://api.wx.spire.com/ows/wms',
headers=headers,
params={
'service': 'WMS',
'request': 'GetCapabilities',
'product': 'sof-d',
'bundle': 'basic'
}
)
# Fetch a temperature map
response = requests.get(
'https://api.wx.spire.com/ows/wms',
headers=headers,
params={
'service': 'WMS',
'request': 'GetMap',
'product': 'sof-d',
'bundle': 'basic',
'version': '1.3.0',
'layers': 'sof-d/20240115/12/t2m:K',
'crs': 'EPSG:4326',
'bbox': '-90,-180,90,180',
'width': 1024,
'height': 512,
'FORMAT': 'image/png',
'TRANSPARENT': 'true',
'TIME': '2024-01-15T12:00:00.000Z',
'styles': 'temp:K/nearest'
}
)
# Display the image
img = Image.open(BytesIO(response.content))
img.show()Use with Mapping Libraries¶
WMS layers can be consumed directly by mapping libraries such as Leaflet, OpenLayers, or QGIS using the WMS endpoint URL and your authentication credentials. WMS-compatible software will add necessary URL parameters automatically; you typically only need to provide the base URL: https://api.wx.spire.com/ows/wms.
For an open-source example integrating WMS layers into a custom web application with OpenLayers, see the weather-app repository.