Skip to main content

Classes

A class is a thematic group of a layer's features — for example "rock venues" versus "jazz venues". Each class has an optional expression that decides which features it matches, and contains the styles and labels used to render them. A class maps to a MapServer CLASS block.

Features are matched against classes in sortid order. When the layer property theme_column is set, a simple string expression like rock is compared against that column; without a theme_column, use logical expressions like ([capacity] > 1000). A class without an expression matches all features.

Get classes

All classes of a layer
GET https://api.centia.io/api/v4/layers/rockhall.venues.the_geom/classes HTTP/1.1
Accept: application/json; charset=utf-8
Authorization: Bearer abc123
A specific class
GET https://api.centia.io/api/v4/layers/rockhall.venues.the_geom/classes/1 HTTP/1.1
Accept: application/json; charset=utf-8
Authorization: Bearer abc123

Add a class

The server assigns the class id — a request that includes an id is rejected with 400.

Add a class with a nested style
POST https://api.centia.io/api/v4/layers/rockhall.venues.the_geom/classes HTTP/1.1
Content-Type: application/json
Authorization: Bearer abc123

{
"name": "Large rock venues",
"expression": "([capacity] > 1000)",
"minscaledenom": "1000",
"maxscaledenom": "250000",
"styles": [
{
"symbol": "circle",
"color": "#FF0000",
"size": "14"
}
]
}

Update a class

PATCH merges the keys you send into the class. Styles and labels are managed through their own routes — see Styles and Labels.

Change the expression
PATCH https://api.centia.io/api/v4/layers/rockhall.venues.the_geom/classes/1 HTTP/1.1
Content-Type: application/json
Authorization: Bearer abc123

{
"expression": "([capacity] > 2000)"
}

Delete a class

DELETE https://api.centia.io/api/v4/layers/rockhall.venues.the_geom/classes/1 HTTP/1.1
Authorization: Bearer abc123

Class properties

PropertyDescription
idFixed, server-assigned id.
nameClass name, shown in the WMS legend.
expressionMapServer class expression. A plain string is matched against the layer's theme_column; logical expressions like ([capacity] > 1000) work without one.
sortidRender/display order.
minscaledenom / maxscaledenomScale range in which the class is drawn.
leaderBoolean. Enables a MapServer LEADER block that connects a label to its feature with a line when the label is offset from its anchor.
leader_colorColor of the leader line. Defaults to black.
leader_gridstepGrid step used to search for a valid label position. Defaults to 5.
leader_maxdistanceMaximum distance in pixels the label may be moved from the feature. Defaults to 30.
stylesThe class's style entries.
labelsThe class's label entries.