...
- format (optional, since 2020.02): The format of the GetLegendGraphic response. Possible values are: image/png (the default) or application/json.
Response in PNG
Transparent PNG image of the requested legend graphics for the specified gridPlotId and size.
...
Code Block |
---|
http://localhost:8181/FewsWebServices/wms?SERVICE=WMS&REQUEST=GetLegendGraphic&LAYERS=Precipitation%20GPM%20%5Bmm%5D&WIDTH=150&HEIGHT=400 |
Example png response
Response in JSON with style
The following example requests a legend in json format and applies a style as well.
...
Code Block |
---|
{ "legend" : [ { "lowerValue" : 150.0, "color" : "#042333" }, { "lowerValue" : 2710.10, "color" : "#3c0912" }, { "lowerValue" : 3920.30, "color" : "#730e27" }, { "lowerValue" : 5130.40, "color" : "#a62225" }, { "lowerValue" : 6340.60, "color" : "#c0583b" }, { "lowerValue" : 7550.70, "color" : "#d08b73" }, { "lowerValue" : 8760.90, "color" : "#dfbcb0" }, { "lowerValue" : 10070.0, "color" : "#f1edec" } ] } |
Response in JSON with style and colorscalerange
The following example requests a legend in json format and applies a style and applies a colorscale range as well.
Code Block |
---|
http://localhost:8181/FewsWebServices/wms?SERVICE=WMS&request=GetLegendGraphic&layers=kzn_temperature&format=application/json&style=Class.Temperature.Extreme&colorscalerange=30.0,50.0 |
The json response is as follows:
Code Block |
---|
{
"legend" : [ {
"lowerValue" : 30.0,
"color" : "#042333"
}, {
"lowerValue" : 32.9,
"color" : "#3c0912"
}, {
"lowerValue" : 35.7,
"color" : "#730e27"
}, {
"lowerValue" : 38.6,
"color" : "#a62225"
}, {
"lowerValue" : 41.4,
"color" : "#c0583b"
}, {
"lowerValue" : 44.3,
"color" : "#d08b73"
}, {
"lowerValue" : 47.1,
"color" : "#dfbcb0"
}, {
"lowerValue" : 50.0,
"color" : "#f1edec"
} ]
} |
...