layers


URI

<map_uri>/layers[.<format>]

Supported methods

GET, PUT, HEAD

Parent resource

ERROR: Variable (map_link) is undefined.

Child resources

layer

Introduction

The layers resource corresponds to the layer collection of a map, through which the layer information of the map can be got.

Please refer to Gets the map images for information about this resource usage.

Supported Methods:

Supported output formats: RJSON, JSON, HTML, XML.

Resource Hierarchy

resources.htm maps.htm map.htm layers.htm

HTTP request methods

Here is an example of performing an HTTP request on the following URI, with rjson as the output format. In the URI, supermapiserver is the server name,  "WorldMap" is the map name ({mapName}). Therefore, the URI is the layer collection contained in "WorldMap", namely the layers resource.

http://supermapiserver:8090/iserver/services/map-world/rest/maps/WorldMap/layers.rjson

GET request

Request parameter

Name Type Description
_cache boolean [Optional]
Whether to use caches. The default is true. If it is false, close all caches.

Response structure

A GET request is performed on the layers resource, and the layer information contained in the map is returned. The returned resource is a layer description array. The layers described by the elements in the array, may be a MapLayer, WMSLayer or WFSLayer of SuperMap, respectively corresponding to the Java class: UGCMapLayer, WMSLayer or WFSLayer. In the Java class, UGCMapLayer contains all the layers represented in the SuperMap data, existing in the form of sublayer of UGCMapLayer (field content of subLayers).

The UGCMapLayer is taken as an example, and the structure of child elements of UGCMapLayer in the response collection is as follows:

Name Type Meaning
name String The layer name. The layer name is the only identifier of this layer in the map. The identifier is not case-sensitive.
bounds double The layer extent.
caption String

The layer title. The default is that it is consistent with name. In the legend and layer control list, the layer name is the value of caption. Note: Distinguish with name.

description String The layer description.
queryable boolean Whether or not the object of the layer can be queried. True indicates the object can be queried, while false indicates the objects can not be queried.
visible boolean The layer visibility. When the layer is not visible, the setting of all the other attributes will be invalid.
type LayerType The layer type. There are four types of layers provided by SuperMap iserver java 6R currently: SuperMap UGCLayer, WFSLayer, WMS Layer and CustomLayer.
subLayers LayerCollection The sublayer set. UGCMapLayer indicates the layers set of SuperMap data.
completeLineSymbolDisplayed boolean The display of complete line symbol. True indicates display, while false indicates no display.
maxScale double The layer maximum visible scale. The maximum visible scale can not be negative. If the current display scale of the map is larger than its maximum visible scale, the layer will not be displayed. Default is 0.
minScale double The layer minimum visible scale. The minimum visible scale can not be negative. If the current display scale of the map is smaller than its minimum visible scale, the layer will not be displayed. Default is 0.
minVisibleGeometrySize double The minimum visible size of geometry object. Unit: Pixels
opaqueRate int The layer opacity, 0-100.
symbolScalable boolean Whether or not the symbol size of layer can zoom with the image. True indicates the symbol zooms in or out when the image zooms in or out; false indicates the symbol does not zoom in or out when the image zooms in or out.
symbolScale double The zoom reference scale of layer symbols. The reference scale of the symbol is valid when symbols are set to zoom with the map. The reference scale designates the display scale of the map when the symbol is at the specified symbol size.

Example usage

Here is an example of performing a GET request on the example usage layers resource: http://supermapiserver:8090/iserver/services/map-world/rest/maps/WorldMap/layers.rjson, and the returned resource description in rjson output format is as follows:

PUT request

Used to modify layer's information. The name property and its corresponding expected value after modified need to be cotained in the request body.

Request parameter

To modify the layer's information resource, parameters must be included in PUT request body, if they are legal, SuperMap iServer will modify the layer resource according to the parameters.

Where, the parameters in the PUT request body are the expected descriptions of layers or its sublayers after modified. For representation structure of layers resource, see: GET request Response Structure; For representation structure of layer resource, see: GET request Response Structure.

Response structure

Performing a PUT request on tempLayer resource, the following fields will be contained in the response entity of the returned result.

Field Type Description
succeed boolean

Marks if the modification is successful. If not, error message will be returned.

error HttpError Error message. If modification succeeded, error field won't appear in the result.

Example

On layers resource: http://supermapiserver:8090/iserver/services/map-world/rest/maps/WorldMap/layers.rjson, perform a PUT request, modify the information of continent_T@World layer, modify the property of lineColor, the parameters included in the request body are as follows:

the returned resource description in rjson format is as follows:

{

    "succeed": true

}

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 layers 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 layers resource supports the representation in <format> or not.

See