legend


URI

1. <tempLayer_uri>/legend[.<format>]

2. <tempLayer_uri>/items/{itemID}/legend[.<format>]

Supported methods

GET, HEAD

Parent resource

tempLayer

Introduction

As a child resource of the layer, the legend resource is used to display the layer style in the form of legend. The user can designate the image size of the legend through width and height.

The URI1 can be used to get the legend of the general layer, and the URI2 is used to get the subitems legends like ThemeUnique, ThemeGraph and ThemeRange, where itemID is counted from 0, and the desirable maximum is the number of subitems of theme map minus 1.

Supported methods

Supported output formats:PNG, BMP, GIF, JPG.

GIS Services Resource Hierarchy

root maps map tempLayersSet tempLayers tempLayer

HTTP request methods

Implement the HTTP request on the following URI, where supermapiserver is the name of the server, WorldMap is the name of the map (mapName), 1 is the ID of a temporary layer set (tempLayersID) in WorldMap, Capitasl@world@@WorldMap represents the WorldMap sublayer in the temporary layer set, and you can get the representation of the legend resource of the temporary layer in png format.

http://supermapiserver:8090/iserver/services/map-world/rest/maps/WorldMap/tempLayersSet/1/Capitals@World@@WorldMap/legend.png

GET Request

Gets the legend picture of the temporary layer.

Request parameters

When implementing the GET request on the legend resource to get the legend picture of the layer, you can transfer the parameters in the URI to customize the picture, or include no parameters.

URI query parameters

Field Type Definition
width int [Optional parameters]
The width of the target symbol image. The default width is 16 pixels.
height int [Optional parameters]
The width of the target symbol image. The default height is 16 pixels.
_cache boolean [Optional parameters]
Whether to use cache, the default is True. False means close all the caches.

Response structure

The response of the legend resource is a picture. The format is determined by the suffix of the URI of the resource.

Example of response

Implement the GET request on the legend resource with http://supermapiserver:8090/iserver/services/map-world/rest/maps/WorldMap/tempLayersSet/1/Capitals@World@@WorldMap/legend.png?width=30&height=30 to get the representation of the legend resource of the layer. The response in PNG format is shown as below:

It is a 30*30 pixel picture. If the picture size is not designated, a 16*16 pixel legend image will be generated by default.

Implement the GET request on the resource with http://supermapiserver:8090/iserver/services/map-world/rest/maps/WorldMap/tempLayersSet/2/Countries@World.1@@WorldMap/items/0/legend.png?width=60&height=30, where "Countries@World.1" is a temporary layer (a unique values thematic map), and you will get legend picture of its first subitem, as shown below:

The "Countries@World.1" has four subitems. When the itemID is too large, the server will return an error message in json format. As an example, implement the GET request on the resource: http://supermapiserver:8090/iserver/services/map-world/rest/maps/WorldMap/layers/unique_values@@WorldMap/items/4/legend.png?width=60&height=30 The response of HTTP status code is 404 and the entity body is:

 "succeed":false,"error":"errorMsg":" The child item index you request is not in the collection of the subitems. ","code":404  

HEAD request

Asks for the response identical to the one that would correspond to a GET request, but without the response body. This is useful for retrieving meta-information written in response headers, without having to transport the entire content. The meta-information includes the media-type, content-encoding, transfer-encoding, content-length, etc.

The HEAD request helps check the existence of the legend resource and whether it can be accessed by the client. By implementing the HEAD request on the URI, with .<format> appended to the end, we can quickly get to know whether the legend resource supports the representation in <format> or not.

See