Skip to content

core/shapePayload

Interfaces

ShapeLike

Defined in: core/shapePayload.ts:15

Minimal structural requirement for a shape payload entry.

Properties

lat?
optional lat?: number[];

Defined in: core/shapePayload.ts:16

lon?
optional lon?: number[];

Defined in: core/shapePayload.ts:17


ShapePayloadResult

Defined in: core/shapePayload.ts:20

Type Parameters

T

T extends ShapeLike

Properties

validShapes
validShapes: T[];

Defined in: core/shapePayload.ts:22

Shapes that passed lat/lon validation, in payload order.

skipped
skipped: string[];

Defined in: core/shapePayload.ts:24

Labels of entries that failed validation (dict key or array index).

isEmpty
isEmpty: boolean;

Defined in: core/shapePayload.ts:26

True when the payload was an empty/invalid dictionary envelope.

dictNames
dictNames: string[] | null;

Defined in: core/shapePayload.ts:33

All names present in a dictionary envelope (even empty or invalid entries), or null for the legacy single/array formats. The dictionary envelope carries the node's complete shape set, so a stored shape missing from this list was deleted server-side.

Functions

normalizeShapeColor()

function normalizeShapeColor(color): string | undefined;

Defined in: core/shapePayload.ts:48

Normalize a shape colour to a CSS color string.

BlueSky publishes shape colours as [r, g, b] arrays of 0-255 ints (the COLOUR command in bluesky/tools/areafilter.py), but the client Shape types declare CSS strings. Rendering happened to work only because MapLibre's to-color coercion silently accepts 0-255 arrays; anything else consuming these fields as the strings they claim to be (CSS, canvas) would break. Convert at the payload boundary so stored shapes match their types. Returns undefined for absent or malformed values, letting callers fall back to the display-option defaults.

Parameters

color

unknown

Returns

string | undefined


hasValidLatLon()

function hasValidLatLon(shape): shape is ShapeLike;

Defined in: core/shapePayload.ts:63

A shape is renderable only when it carries non-empty lat AND lon arrays.

Parameters

shape

unknown

Returns

shape is ShapeLike


parseShapePayload()

function parseShapePayload<T>(data): ShapePayloadResult<T>;

Defined in: core/shapePayload.ts:73

Normalize any of the three payload formats into a flat list of valid shapes plus the labels of the entries that failed validation.

Type Parameters

T

T extends ShapeLike

Parameters

data

unknown

Returns

ShapePayloadResult\<T>