style


URI

<tempLayer_uri>/style[.<format>]

Supported methods

GET, PUT, HEAD

Parent resource

tempLayer

Introduction

As a child resource of the tempLayer resource, the style resource is the style of the temporary map layer. By implementing a PUT request on the style resource, one can modify the style of the temporary layer. Only SuperMap vector layers (UGCVectorLayer) allow style settings.

Supported methods

Supported output formats: rjson, json, html, xml.

GIS Services Resource Hierarchy

root maps map tempLayersSet tempLayers tempLayer style.htm

HTTP request methods

Below is the implementation of a HTTP request on the following URI, where rjson is the output format, supermapiserver is the name of the server, WorldMap is the name of the map (mapName), 1 is a temporary layer in WorldMap (tempLayersID), URI is the set of temporary layers in WorldMap with an ID equal to 1 (i.e. the tempLayers resource), Capitals@world is a sublayer of the World layer in the temporary layer set, and URI is the style of Capitals@world.

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

GET Request

Gets the style of the temporary layer.

Request parameters

Field Type Definition
_cache boolean [Optional parameters]
Whether to use cache, the default is True. False means close all the caches.

Response structure

When implementing GET on the style resource, if the temporary layer is a SuperMap vector layer (UGCVectorLayer), it supports style setting and returns the resource representation in the following structure (expressed in the body of the response message).   

Name Type Description
markerSymbolID int ID of the marker symbol, i.e. the ID of the marker style in the symbol library.
markerSize double Size of the marker symbol.
markerAngle double Rotation of the marker symbol.
lineWidth double Outline width.
lineSymbolID int ID of the line symbol, i.e. the ID of the style in the line symbol library.
lineColor Color Outline color.
fillSymbolID int ID of the fill symbol, i.e. the ID of the style in the fill symbol library.
fillOpaqueRate int Opacity of the fill, a valid setting should be an integer between 0 and 100.
fillGradientOffsetRatioX double Horizontal offset percentage of the gradient fill center in relation to the center of the fill area.
fillGradientOffsetRatioY double Vertical offset percentage of the gradient fill center in relation to the center of the fill area.
fillGradientMode FillGradientMode Gradient type of the gradient fill.
fillGradientAngle double Rotation of the gradient fill.
fillForeColor Color Foreground color.
fillBackOpaque boolean Whether the current background is opaque.
fillBackColor Color Background color of the fill symbol.

If the temporary layer is not a SuperMap vector layer (UGCVectorLayer), it does not support style setting and returns the resource representation in the following structure:

Name Type Description
succeed boolean

False, meaning the map layer does not support style setting.

error HttpError Error message.

 

Example of response

Implementing GET on the queryable resource with http://supermapiserver:8090/iserver/services/map-world/rest/maps/WorldMap/tempLayersSet/1/Capitals@World@@WorldMap/style.rjson to get the style of the temporary layer Capitals@world, as shown below:

{

    "fillBackColor": {

        "blue": 255,

        "green": 255,

        "red": 255

    },

    "fillBackOpaque": true,

    "fillForeColor": {

        "blue": 196,

        "green": 196,

        "red": 196

    },

    "fillGradientAngle": 0,

    "fillGradientMode": "NONE",

    "fillGradientOffsetRatioX": 0,

    "fillGradientOffsetRatioY": 0,

    "fillOpaqueRate": 100,

    "fillSymbolID": 0,

    "lineColor": {

        "blue": 0,

        "green": 0,

        "red": 0

    },

    "lineSymbolID": 0,

    "lineWidth": 0.1,

    "markerAngle": 0,

    "markerSize": 2,

    "markerSymbolID": 12

}

PUT request

Modifies the style of the temporary layer, which must be a SuperMap vector layers (UGCVectorLayer).

Request parameters

When implementing PUT on the style resource, the following parameters must be included in the request. If the parameters are valid, the server will modify the style of the temporary layer according to these parameters.   

Name Type Definition
markerSymbolID int ID of the marker symbol, i.e. the ID of the marker style in the symbol library.
markerSize double Size of the marker symbol.
markerAngle double Rotation of the marker symbol.
lineWidth double Outline width.
lineSymbolID int ID of the line symbol, i.e. the ID of the style in the line symbol library.
lineColor Color The outline color if the symbol is a line symbol; the marker color if the symbol is a marker.
fillSymbolID int ID of the fill symbol, i.e. the ID of the style in the fill symbol library.
fillOpaqueRate int Opacity of the fill, a valid setting should be an integer between 0 and 100.
fillGradientOffsetRatioX double Horizontal offset percentage of the gradient fill center in relation to the center of the fill area.
fillGradientOffsetRatioY double Vertical offset percentage of the gradient fill center in relation to the center of the fill area.
fillGradientMode FillGradientMode Gradient type of the gradient fill.
fillGradientAngle double Rotation of the gradient fill.
fillForeColor Color Foreground color.
fillBackOpaque boolean Whether the current background is opaque.
fillBackColor Color Background color of the fill symbol.

Response structure

When implementing PUT on the style resource, it returns the representation in the following structure (expressed in the body of the response message):

Name Type Description
succeed boolean

Whether the modify style of the layer is successful. If not, there would be an error message.

error HttpError The error message. If the modification is successful, the field will be absent.

Example of response

Implement a POST request on the style resource with http://supermapiserver:8090/iserver/services/map-world/rest/maps/WorldMap/tempLayersSet/1/Capitals@World@@WorldMap/style.rjson to modify the style of the temporary layer Capitals@world (SuperMap vector layer) (line width to 0.3):

{

    "fillBackColor": {

        "blue": 255,

        "green": 255,

        "red": 255

    },

    "fillBackOpaque": true,

    "fillForeColor": {

        "blue": 196,

        "green": 196,

        "red": 196

    },

    "fillGradientAngle": 0,

    "fillGradientMode": "NONE",

    "fillGradientOffsetRatioX": 0,

    "fillGradientOffsetRatioY": 0,

    "fillOpaqueRate": 100,

    "fillSymbolID": 0,

    "lineColor": {

        "blue": 0,

        "green": 0,

        "red": 0

    },

    "lineSymbolID": 0,

    "lineWidth": 0.3,

    "markerAngle": 0,

    "markerSize": 2,

    "markerSymbolID": 12

}

When the modification is successful, it returns the following resource representation in rjson format:

{

    "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.

HEAD request can be used to check if the style resource exists, or if the resource can be accessed by clients. It can also determine if the style resource supports an output format <format> if performed on a URI with .<format> included.

See