Class ria.legend.LegendService

The LegendService class provides an interface to request legend data from the Spatial Server REST service.

Method Summary
Method Attributes Method Name and Description
getLegendData(overlay)
Gets the legend data for the given overlay.
Method Detail
{dojo.Deferred} getLegendData(overlay)
Gets the legend data for the given overlay. The legend data adheres to the following structure:
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],  
}

Here's an example of such a legend structure in JSON:
     
{
    "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"
                }
            ]
        },
    ]
}
Parameters:
{String} overlay
Name of the overlay to get the legend data for
Returns:
{dojo.Deferred} Deferred object to get hold of the legend data once the call completes