The LegendService class provides an interface to request legend data from the Spatial Server REST service.
| Method Attributes | Method Name and Description |
|---|---|
|
getLegendData(overlay)
Gets the legend data for the given overlay.
|
overlayData := {
"LegendResponse": [layerData...]
}
layerData := {
"layerName": String, // Name of the layer used by Spatial
// Server
"rows": [row...] // Nested rows of swatches
}
row := {
"description": String, // Descriptive label for the swatch
"swatch": String // Data URI representation of Swatch Image
// of the following format
// data:[][;base64],
}
{
"LegendResponse": [
{
"layerName": "Cities",
"rows": [
{
"description": "Capital",
"swatch": "http://example.com/icon1.png"
},
{
"description": "Population > 1 Mio",
"swatch": "http://example.com/icon2.png"
}
]
},
{
"layerName": "Boundaries",
"rows": [
{
"description": "District",
"swatch": "http://example.com/icon1.png"
}
]
},
]
}