Constraints¶
The Constraints section of a layer card defines additional raster masks that limit where a layer is rendered, based on threshold values pulled from another COG. A typical example: only show a vegetation index where elevation is below 2000 m, or where a land-cover class equals "forest".

When to use¶
- Hide pixels outside a numeric range (continuous constraint).
- Show only specific class values (categorical constraint).
- Combine ranges with named labels for a UI slider (combined constraint).
If the user does not need to mask the layer interactively, leave Constraints empty.
Configure¶
Expand Constraints in the layer card and add one or more entries. Each ConstraintSourceItem has:
- URL — the constraint COG.
- Format —
cog(only COG is supported). - Label — display name shown in the viewer's constraint UI.
- Type — one of:
continuous— numeric range withmin,max, optionalunits.categorical— discrete values listed inconstrainToas{ label, value }.combined— named ranges inconstrainToas{ label, min, max }.
- Interactive — when
true, the viewer exposes a slider/picker so the user can change the constraint at runtime. Whenfalse, the constraint is fixed. - Band index — optional, defaults to band 1.
To expose the slider control set layout.layerCard.controls.constraintSlider: true.
Validation¶
url,format,label, andtypeare required.- For
continuous, bothminandmaxshould be set so the slider has a defined range. - For
categorical,constrainToentries needvalue; forcombinedthey needmin/max. - The constraint COG should align spatially with the displayed layer; misalignment causes apparent dropouts.
Related¶
- Statistics — same data-source shape, different role.
- COG data sources