Add style

Description

Adds a style to a vector layer.

Endpoint

/path/{pathId}/vector/style

Method

POST

Access Level Rules

Access Level

edit+

Processing Units

Processing units

2

Parameters

Name
Description
Required
Default

pathId

The id of the vector layer.

true

name

The name of the new style.

true

default

Boolean whether the style should be the default style.

true

method

The method of the style. Must be one of "rules", "transitionPoints", "'random", "singleColor" or "fromColorProperty".

true

parameters

A JSON containing the parameters of the style. Below table defines the style parameters, whose content differs between methods.

true

Sample requests for different methods

//Assings the same color to all vectors
{
    "name": "Vector Style",
    "dashedLine": null,
    "method": "singleColor",
    "popupProperty":"propertyToDisplayAsTextLabel",
    "parameters": {
        "alpha": 0.5,
        "width": 2,
        "radius": {
            "method": "constant",
            "parameters": {
                "value": 7
            }
        },
        "color": "#c75b1c",
        "pattern":null,
        "icon":null,
        "borderColor": "#934314"        
        }
}

The circle radius can be made dependent on the property of a vector using the method "onProperty" this dependency can be made linear or logarithmic.

Example:

radius = {"method":"onProperty","parameters":{"property":"propertyToUse","bias":0,"weight":1,"logarithmic":false}}

If dashedLine is not null lines will become dashed lines. In this case dashedLine should be an array with two floats. The first float indicates the length of the open spaces the second the length of the dashes.

Example:

dashedLine=[1,3]

A pattern must be an object with:

  • type: One of solid, diagonal, horizontal or vertical

  • width: a float between 1 and 50

  • backgroundColor: a hex color, optional.

Example:

pattern = {"type":"diagonal", "width": 2, "backgroundColor":"#934314"}

Alternatively the pattern can be an object of type drive. In this case you need to include a pathId of a png that is stored on the Drive.

Example:

pattern = {"type":"drive", "pathId":"4d695990-ace7-434e-b703-e1d5ae006800"}

In this case the png will be used as pattern.

An icon must be an object with

  • name: the name of the icon as a string.

All valid inputs for name can be listed with

GET /image/listIcons

Example:

icon = {"name":"dog"}

Alternatively the icon can be an object of type drive. In this case you need to include a pathId of a png that is stored on the Drive.

Example:

pattern = {"type":"drive", "pathId":"4d695990-ace7-434e-b703-e1d5ae006800"}

In this case the png will be used as icon.

Last updated