Skip to main content

ShapeStyle

How polygons or lines are drawn: a fill (or a stroke, for lines) coloured by a rule, with outline width, hatching, dashing and labels. Its default label type remains a plain string; feed definitions that use keyed labels use FeedShapeStyle. The legend is derived from it.

This is an interface exported by @mapcairn/core, checked against version 0.2.0.

Signature​

import type { ShapeStyle } from "@mapcairn/core";

interface ShapeStyle<T extends LayerTemplate = string>

Type parameters​

  • T? (LayerTemplate)

Properties​

colour​

readonly colour: ShapeColour;

The rule that picks each shape's colour.

dash​

readonly dash?: LineDash;

Dashing of the outline or line. Defaults to solid. A class's own dash wins.

fillOpacity​

readonly fillOpacity?: number;

Fill opacity of polygons, 0.1 to 1. Defaults to 0.55.

geometry​

readonly geometry: "area" | "line";

Whether the style draws polygons (area) or lines (line).

kind​

readonly kind: "shapes";

Always shapes; tells a shape style from a point style.

label​

readonly label?: ShapeLabel<T>;

A template for the text drawn on each shape, over the decoded fields or tile properties.

width​

readonly width?: number;

Stroke width in pixels, 0.5 to 12: a polygon's outline (default 1.5) or a line (default 2.5). A class's own width wins.

Remarks​

A style draws one geometry kind, so its legend and widths are unambiguous: area draws polygons and multipolygons, line draws lines and multilines. Features of the other kind are not drawn. A polygon's outline is the palette's ink, so the shape reads on any fill.

See also​

Source: packages/core/src/layers/definition.ts:500