Skip to content

QGIS expression support (viewer)

The publish viewer evaluates QGIS expressions in two layers: a lightweight client runtime (qgis-expr-runtime.js) and an optional server fallback (POST /api/qgis/evaluate-expression).

Client evaluation runs first. The server is used only when the client cannot parse or evaluate the expression.

Client-side

  • @user, @roles, @groups, and user attribute variables (from /api/auth/context)
  • current_user()
  • Simple comparisons (=, !=, <, >, …) and boolean logic (AND, OR, NOT)
  • coalesce()
  • Field references ("field_name" or bare identifiers)
  • Literals, IS NULL, IN (...)

Console: [qgis-expr] client

Server fallback

Used when the client fails or the expression needs functions not implemented in the browser:

  • CASE WHEN … THEN … END
  • concat()
  • regexp_match()
  • if()
  • attribute()

Console (once per top-level evaluation): [qgis-expr] server-fallback CASE concat (tags reflect functions in the expression).

Endpoint: POST /api/qgis/evaluate-expression

Known unsupported

  • Geometry expressions
  • aggregate()
  • Relation traversal (get_feature, etc.)

These remain placeholders or return null without breaking forms.