Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Spire’s implementation of the OGC WMS standard, providing access to weather data as map layers.

Endpoint

MethodEndpointDescription
GET/ows/wmsOGC WMS service

Authentication

The WMS endpoint supports three authentication methods to accommodate different client applications:

Shell
Python
Node.js
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'

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:

ParameterTypeRequiredDescription
servicestringYesMust be WMS
requeststringYesGetCapabilities or GetMap
productstringYesProduct identifier (currently only sof-d)
bundlestringYesData bundle to access

Supported Bundles

Not all data bundles support WMS. The following bundles are available as WMS layers:

BundleDescription
basicStandard meteorological variables
precipitationPrecipitation data
maritimeMarine parameters
maritime-waveWave parameters
maritime-wave-extExtended wave parameters
maritime-atmosMaritime atmospheric parameters
cloudsCloud cover (excluding ceiling)
thunderstormConvective parameters
upper-airUpper-air data
agriculturalAgricultural parameters
wind-energyWind energy parameters
solar-energySolar radiation data

GetCapabilities

Retrieve metadata about the WMS service, including supported operations, available layers, and layer parameters.

Example — Basic Bundle

Shell
Python
Node.js
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'

Example — Maritime Bundle

Shell
Python
Node.js
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'

GetMap

Retrieve a rendered map image for a specific layer, time, and geographic extent.

Additional Parameters for GetMap

ParameterTypeRequiredDescription
versionstringYesWMS version (e.g., 1.3.0)
layersstringYesLayer identifier
crsstringYesCoordinate reference system (e.g., EPSG:4326)
bboxstringYesBounding box (min_lat,min_lon,max_lat,max_lon)
widthintegerYesImage width in pixels
heightintegerYesImage height in pixels
FORMATstringYesOutput format (e.g., image/png)
TIMEstringYesISO 8601 timestamp for the data
stylesstringNoRendering style
TRANSPARENTbooleanNoTransparent background
EXCEPTIONSstringNoException format

Example — 2m Temperature Map

Shell
Python
Node.js
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.png

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.