The Variable Legend Request
Variable Legends
This section will cover how to use the dataserver API to obtain color legends to display the values of a requested weather variable.
Example Weather Variable Legend Request:
http://datacloud.wxc.com/?datatype=forecast&vs=0.9&passkey=123456789&type=legend&var=temperature&format=explicit&values=
0,10,20,30,40,50,60,70,80,90,100&labels=0s,10s,20s,30s,40s,50s,60s,70s,80s,90s,100s&fontsize=10
Example Weather Variable Legend Response:
![]()
REQUIRED PARAMETERS
type
This specifies that this request is asking for a variable legend.
type=legend
datatype
This defines the weather datatype for which you are requesting a variable legend. Variable legends are available for the following datatypes: radar, forecast and satellite.
Examples:
datatype=radar
datatype=forecast
datatype=satellite
var
Weather variable name of the data you are requesting a legend for. This can be found using the variable inventory request method
Example:
var=Temperature
Multiple Variables can be requested by using a comma as a separator.
Example:
var=Temperature,WindSpeed
format
This defines the format of the colortable. Blended will ramp the colortable over a range, while explicit lets you select specific colorpots. The default format is similar to the explicit format, but the values and associated labels are chosen for you.
Examples:
format=blended
format=explicit format=default
If format=blended you can do the following:
range
This picks the range of values you wish to ramp the colors of the colortable over. For example, 30 to 100 degrees for temperature.
Example:
range=30,100
If you have multiple variables you can indicate multiple ranges, separated by a pipe:
range=30,100|1.5,7
step
This picks the step of the labels in the blended format.
Example:
step=5
If you have multiple variables you can indicate multiple steps, separated by a pipe:
step=5|10
If format=explicit you can do the following:
values
This picks the colorpots you want to use in the legend in the explicit format. The number of values defines the number of pots.
Example:
values=10,20,30,40,50
If you have multiple variables you can indicate multiple colorpots for each, separated by a pipe:
values=10,20,30|20,40,60
labels
This picks the text labels in the explicit format.
Example:
labels=10s,20s,30s,40s,50s
If you have multiple variables you can indicate multiple steps, separated by a pipe:
labels=10s,20s,30s|20mph,40mph,60mph
OPTIONAL PARAMETERS FOR A LEGEND REQUEST
orientation
This defines the orientation of the legend. Default horizontal.
Examples:
orientation=horizontal
orientation=vertical_ascending
orientation=vertical_descending
units
This provides a way to easily convert and round the data to common units such as English and Metric. Default is English. The currently supported options are:
units=english
units=metric
units=metric_alt1
units=raw
For more information on units please see the Weather 101: Unit Explanations section.
font size
This defines the size of the font used for the legend values. Default is 10.
Example:
fontsize=12
height
This defines the height of the legend, in pixels.
Examples:
height=20
width
This defines the width of the legend, in pixels.
Examples:
width=500
borderwidth
This defines the width of the optional border around the legend, in pixels.
Examples:
borderwidth=2
bordercolor
This defines the color of the optional border around the legend. Default is black.
Examples:
bordercolor=blue
