vectorStyle


URI

<vectorStyles_uri>/{layerName}[.<format>]

Supported methods

GET, PUT, HEAD

Parent resource

vectorStyles

Introduction

vectorStyle represents the style information of a layer, which is identified by the layer name in the URI.

Supported Methods:

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

Resource hierarchy

HTTP request methods

Implement the HTTP request on the following URI, where supermapiserver is the server name, with rjson being the output format.

http://supermapiserver:8090/iserver/services/map-China400/rest/maps/China/tileFeature/vectorstyles/China_Nation_txt_1@China.rjson

GET request

Get the style information for the layer.

Request parameter

Request a GET request for a vectorStyle resource to get the style information for the specified layer in the map. You need to include the relevant parameters in the URI. If no parameters are specified, the style information for all the layers in the map is acquired by default. The parameters are:

Name Type Description
type VectorStyleType The description language type of the layer style. Currently only supports CartoCSS language.

Response structure

Return the layer style information.

Field Type Description
type VectorStyleType The description language type of the layer style.
style String The layer style information. It includes the layer name and its style.

Response example

To request the style information of the China_Nation_txt_1@China layer in the China map on the vectorStyle resource, it is needed to perform GET request: http://supermapiserver:8090/iserver/services/map-China400/rest/maps/China/tileFeature/vectorStyles/China_Nation_txt_1@China.rjson?type=cartoCSS

Te returned …… is as follows:

{

    "style":

"#China_Nation_txt_1@China[zoom<=1.3521308572821239E-8][zoom>=6.760654286410611E-9]

{

text-placement-type:simple;

text-placements:\"E,NE,SE,W,NW,SW\";

line-color:rgba(245,243,240,1);line-width:1;

line-pattern-file:url(SYMBOLLINE__China_Nation_txt_1@China__64__64__true__605218360.png);

polygon-fill:rgba(208,255,240,1);

polygon-pattern-file:url(SYMBOLFILL__China_Nation_txt_1@China__64__64__true__605218360.png);

point-file:url(SYMBOLMARKER__China_Nation_txt_1@China__64__64__true__605218360.png);

polygon-opacity:1;polygon-pattern-opacity:3;}",

    "type": "cartoCSS"

}

PUT request

It means to create the layer and its style or modify the layer style information. When the vectorStyle resource does not exist, it means to create, otherwise it means to modify.

Note: the PUT request is supported only for map services whose service provider is SVTiles.

Request parameter

When the vectorStyle resource does not exist, for a new URI, such as: http: // supermapiserver: 8090 / iserver / services / map-svtiles-China / rest / maps / China / tileFeature / vectorStyles / china_1 @ China? ReturnPutAction = true, if sending a PUT request on it, you need to enter the style information in the request body when creating the dataset. Examples are as follows:

{

    "style": "#China_1@China[zoom<=1.3521308572821239E-8][zoom>=6.760654286410611E-9]{text-placement-type:simple;text-placements:\"E,NE,SE,W,NW,SW\";line-color:rgba(245,243,240,1);line-width:1;line-pattern-file:url(SYMBOLLINE__China_Nation_txt_1@China__64__64__true__605218360.png);polygon-fill:rgba(208,255,240,1);polygon-pattern-file:url(SYMBOLFILL__China_Nation_txt_1@China__64__64__true__605218360.png);point-file:url(SYMBOLMARKER__China_Nation_txt_1@China__64__64__true__605218360.png);polygon-opacity:1;polygon-pattern-opacity:3;}",

    "type": "cartoCSS"

}

When modifying the vectorStyle resource, modify the parameter value in the request body.

Response structure

When the modifications are successful, the created or modified style information will be returned. Expressed in rjson format as follows:

{

    "style": "#China_1@China[zoom<=1.3521308572821239E-8][zoom>=6.760654286410611E-9]{text-placement-type:simple;text-placements:\"E,NE,SE,W,NW,SW\";line-color:rgba(245,243,240,1);line-width:1;line-pattern-file:url(SYMBOLLINE__China_Nation_txt_1@China__64__64__true__605218360.png);polygon-fill:rgba(208,255,240,1);polygon-pattern-file:url(SYMBOLFILL__China_Nation_txt_1@China__64__64__true__605218360.png);point-file:url(SYMBOLMARKER__China_Nation_txt_1@China__64__64__true__605218360.png);polygon-opacity:1;polygon-pattern-opacity:3;}",

    "type": "cartoCSS"

}

HEAD request

Returns the same HTTP response header as the GET request, but does not have the response entity. It can get the metadata information in the response header without transferring the whole response content. Metadata information includes media type, character encoding, compression encoding, entity content length, and so on.

The HEAD request can be used to determine whether the vectorStyle resource exists or whether the client has authority to access the resource. It can quickly determine whether the vectorStyle resource supports the representation in <format> format by performing HEAD request on URI with <format>.

See