FRAMES | NO FRAMES | Description | Parameters | Examples | Response |
URL | http://<mapservice-url>/legend |
---|---|
Parent Resource | Map Service |
Required Capability | Map |
The legend resource represents a map service's legend. It returns the legend information for all layers in the service. Each layer's legend information includes the symbol images and labels for each symbol. Each symbol is an image of size 20 x 20 pixels at 96 DPI. Additional information for each layer such as the layer ID, name, and min and max scales are also included.
The legend symbols include the base64 encoded imageData
as well as a
url
that could be used to retrieve the image from the server.
Note that this is a relative URL. It can be dereferenced by accessing the
map layer image resource.
height
and width
for symbols.values
json array for layers that are symbolized using either class breaks or unique value renderer. values
contains the class maximum value. values
contains the list of ungrouped unique values.dynamicLayers
was added.Parameter | Details |
---|---|
f | Description: The
response format. The default response format is html. Values: html | json |
dynamicLayers | //This option was added at 10.1 Description: Dynamic layers definition. This parameter is required only for generating a legend for dynamic layers. Note: supportsDynamicLayers on the map service resource should be true to use dynamicLayers property when requesting a legend.
Syntax: |
Example 1:
Example 2:
{ "layers": [ { "layerId": <layerId1>, "layerName": "<layerName1>", "layerType" : "<layerType1>", "minScale": <minScale1>, "maxScale": <maxScale1>, "legend": [ { "label": "<label11>", "url" : "<imageUrl11>", //Relative URL for static layers and full URL for dynamic layers. Access relative URL using http://<mapservice-url>/<layerId1>/images/<imageUrl11> "imageData" : "<base64EncodedImageData11>", "contentType" : "<contentType11>", "height": <height>, //new at 10.1 SP1; "width": <width>, //new at 10.1 SP1; "values": [<maximum value1>] //In case of classBreaks renderervalues
will contain classMaxValue }, { "label": "<label12>", "url" : "<imageUrl12>", "imageData" : "<base64EncodedImageData12>", "contentType" : "<contentType12>", "height": <height>, "width": <width>, "values": [<maximum value2>] } ] }, { "layerId": <layerId2>, "layerName": "<layerName2>", "layerType" : "<layerType2>", "minScale": <minScale2>, "maxScale": <maxScale2>, "legend": [ { "label": "<label21>", "url" : "<imageUrl21>", //Relative URL for static layers and full URL for dynamic layers. Access relative URL using http://<mapservice-url>/<layerId2>/images/<imageUrl21> "imageData" : "<base64EncodedImageData21>", "contentType" : "<contentType21>", "height": <height>, "width": <width>, "values": ["uniqueValue1"] //In case of uniqueValue renderervalues
will contain ungrouped unique values. }, { "label": "<label22>", "url" : "<imageUrl22>", "imageData" : "<base64EncodedImageData22>", "contentType" : "<contentType22>", "height": <height>, "width": <width>, "values": ["uniqueValue2", "uniqueValue3"] } ] } ] }
{ "layers": [ { "layerId": 0, "layerName": "Census Block Points", "layerType": "Feature Layer", "minScale": 99999, "maxScale": 0, "legend": [ { "label": "0 - 61", "url": "16c1750c363249f0a97da4bfd6d99a49", "imageData": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAFNJREFUOI1jYaAyYBk1cNRAOPiPxGak1MD/JZsR5vX4Mv7HZyghA1EMY2BgYCjZ/B+voUM/Uhh7fBnRw5CBgYIwhBuKzKfEhUQZQo6BRINRAykHADL/FCzY81v0AAAAAElFTkSuQmCC", "contentType": "image/png", "height": 20, "width": 20, "values": [ 61 ] }, { "label": "62 - 264", "url": "96b1e45aea277d25d6759101c5a568f2", "imageData": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAGRJREFUOI3t0cEJwDAMA0AZsp63yRjeJgO6v35iOU0oJZToKfA9rIKXUw74CehBJ6ug19Z7puIMzcAQA4DanKIMpNgI/cfKe4JiKukwpgJMrJyiDBuBNxr17ODJD+nxKjiV/cELXCYgLEwEnd4AAAAASUVORK5CYII=", "contentType": "image/png", "height": 20, "width": 20, "values": [ 264 ] }, { "label": "265 - 759", "url": "eec6c4375388bb67e0bd976a7476bbcf", "imageData": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAIdJREFUOI3d1MEJwCAMBdAEXM9tOobbdMD0YorGH2ulIjRHTR8fEhvo4wo7QAFnPAMKEdFxtl6KrIcNjEAX0tI7BMOEPcz2pViHtKCMYgYVTbl0yq/TaZUpt+zhj0FOkacGk3dx/doQTaQs0yHwbhpB7bPzQM7Nvb9N1fsEQhjdoRoZivsxqgsOTDUsDDFUxQAAAABJRU5ErkJggg==", "contentType": "image/png", "height": 20, "width": 20, "values": [ 759 ] }, { "label": "760 - 1900", "url": "2b73fd7416e13da8cdec1865ca48ca1f", "imageData": "iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAIlJREFUOI3t1cENgCAMBdDfhPXYxjHYxgHxQglWWhXKwcReCy8/aQMBdmWjR1ojWNi262aKxM0L3kOzhXHxmYKfYIk+AiUu4RZ9DWowo8NgD9YGNVUBDim5OO2ypD/6EZRSJJe1SpGAlcsPOKTllC06BbegRIdgCfbQCgO3L389L3vaoKhcHPqjDhqnRC6j0pDtAAAAAElFTkSuQmCC", "contentType": "image/png", "height": 20, "width": 20, "values": [ 1900 ] }, { "label": "1901 - 9409", "url": "0f3caba8a8bff54af2f795d36fa00b64", "imageData": "iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAKBJREFUSInt1sENgCAMBdDfhPXYxjHYxgHxVIOVFtCiF/61TV5+gISAjxIGdrMxIw8oA8C2606KxEMVtKAmwOEdC9Sg3AM0wAtWgx4hEpSYhF4jGjZy616lhNzacMpWnzdyb8PhVr+c0YIWBACgFGnKFU+RgD8eLDChFbeR0NRIyK1V2aYGuWAS0aATA/r+DAK4IRZ0LveAFtADVUFrx8oBsCBQQjt9MuwAAAAASUVORK5CYII=", "contentType": "image/png", "height": 20, "width": 20, "values": [ 9409 ] } ] }, { "layerId": 1, "layerName": "Census Block Group", "layerType": "Feature Layer", "minScale": 1000000, "maxScale": 0, "legend": [ { "label": "", "url": "9f9da73612bae8cabdfccb9dc9ebb5ec", "imageData": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAADpJREFUOI1jYaAyYKGZgU1NTf8pNayuro6RBV2AXMNgDqKdl0cNHDVw1MBRA3EaSEmZCCv6WNAFKAUAXT0NzOV1EscAAAAASUVORK5CYII=", "contentType": "image/png", "height": 20, "width": 20 } ] }, { "layerId": 2, "layerName": "Detailed Counties", "layerType": "Feature Layer", "minScale": 0, "maxScale": 0, "legend": [ { "label": "", "url": "98fb6d62c20377d8d861e56ede28766f", "imageData": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAADZJREFUOI1jYaAyYKGlgf+pYB4jugsZKTDsPwMDjb08auCogaMGjhqI00BKykRGdAMpKQvhAABd0QNSDPGCHwAAAABJRU5ErkJggg==", "contentType": "image/png", "height": 20, "width": 20 } ] }, { "layerId": 3, "layerName": "states", "layerType": "Feature Layer", "minScale": 0, "maxScale": 0, "legend": [ { "label": "", "url": "bb835639802a7005b5d50553e8a13dce", "imageData": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAADdJREFUOI1jYaAyYIHS/6lkHiMLYTWkAXQDGck0B+5Dmrtw1MBRA0cNHB4GUlwu0syF5JaDGAAABzUDUfxbIJcAAAAASUVORK5CYII=", "contentType": "image/png", "height": 20, "width": 20 } ] } ] }
{ "layers": [ { "layerId": 101, "layerName": "states", "layerType": "Feature Layer", "minScale": 0, "maxScale": 0, "legend": [ { "label": "0.170778% - 0.441503%", "url": "http://servicesbeta2.esri.com/arcgis/rest/directories/arcgisoutput/Census_MapServer/_ags_legend_be1f0e6f9480468a9d7e7b6f43f9dbe3.png", "imageData": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAHZJREFUOI2108sOgCAMRNFpwv//cl0oCdTaB62zNZ5cAw40b6TfYDAAgEA1cELObNBCGKxV6mCwRtsOZiGlclSL5PKnLCcqb5BAXZX1wk+wUrl89o+F1T2VO9hwOD2Fr2sjH0Yrw//yAWSDWqWB+OAB5INJaO4CLn4gU6oOM3wAAAAASUVORK5CYII=", "contentType": "image/png", "height": 20, "width": 20, "values": [ 0.44150279569103434 ] }, { "label": "0.441504% - 0.969258%", "url": "http://servicesbeta2.esri.com/arcgis/rest/directories/arcgisoutput/Census_MapServer/_ags_legend_b78cba0cf8ee4f2499b01018e7f43f09.png", "imageData": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAHdJREFUOI2100sOgDAIRVFIunB2jgPbxCLyKfimxpNrWgc0b6TfYGIAAEDCGrggZzZoIUysVepgsEbbDmYhpXJUi+TypywnKm8QCbsq64WfYKXy8dk/FlY3K3ew4XB6Cl/XRj6MVob/5QPIBrVKA/HBA8gHk9DaBR97MNOpuBjQAAAAAElFTkSuQmCC", "contentType": "image/png", "height": 20, "width": 20, "values": [ 0.96925841549663927 ] }, { "label": "0.969259% - 1.749832%", "url": "http://servicesbeta2.esri.com/arcgis/rest/directories/arcgisoutput/Census_MapServer/_ags_legend_63250b4a6f8d4c99aae77d4ca275501b.png", "imageData": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAHZJREFUOI2108sOgCAMRNFpwv//cl0oCdTaB62zNZ5cAw40b6TfYGYAABHVwAk5s0ELYWatUgeDNdp2MAsplaNaJJc/ZTlReYNE1FVZL/wEK5XLZ/9YWN1TuYMNh9NT+Lo28mG0MvwvH0A2qFUaiA8eQD6YhOYuvaAwVEoxj/0AAAAASUVORK5CYII=", "contentType": "image/png", "height": 20, "width": 20, "values": [ 1.7498315560693791 ] }, { "label": "1.749833% - 2.902452%", "url": "http://servicesbeta2.esri.com/arcgis/rest/directories/arcgisoutput/Census_MapServer/_ags_legend_28618eb5d5ed444c8159679a43cf0f7e.png", "imageData": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAHZJREFUOI21k0sOwCAIBUvCwb05XVSTllI+PjobF8bJGJSPZrh8YohcKxEmXKIAX+hJhohVaQuTNRZPYVVkVDJapKlPWaMqZyFRVyVe+ClEKm/X/rEQZVaqd4gPp6fw9Wz0ZrYy/Zc3RL7QqnQksXBDFAuLosUJH/ow03WzBn8AAAAASUVORK5CYII=", "contentType": "image/png", "height": 20, "width": 20, "values": [ 2.9024522191624871 ] }, { "label": "2.902453% - 12.235569%", "url": "http://servicesbeta2.esri.com/arcgis/rest/directories/arcgisoutput/Census_MapServer/_ags_legend_a3e7573e466c4249a41bc34d34de059e.png", "imageData": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAHRJREFUOI2100EOgCAMRFGb9P5XrgskhNJCy9TZuDC+fIPyUzzOPyLSrkQg2KH9DuAOEbEqHTBWY02BWWitZLRI7+KU9ebKDySqqiwodEGkcrz2n4XoWqUC8cMpKlw+G30zWhn+l/PQAbQqfSQA5qEAmIP6Xh59IFML5CgnAAAAAElFTkSuQmCC", "contentType": "image/png", "height": 20, "width": 20, "values": [ 12.235568653358957 ] } ] } ] }