Method

MaplibreNativeFfiStyleExpressionevaluate

Declaration [src]

char*
maplibre_native_ffi_style_expression_evaluate (
  MaplibreNativeFfiStyleExpression* self,
  MaplibreNativeFfiStyleExpressionInputs* inputs,
  GError** error
)

Description [src]

Evaluates a style expression and writes its result as JSON.

A number in the result that isn’t finite becomes null. A color is ["rgba", r, g, b, a], with red, green, and blue from 0 to 255 and alpha from 0 to 1, each exact only to single precision. Formatted text is a ["format", …] expression, an image is {"name": …, "available": …}, padding is [top, right, bottom, left], and a variable anchor offset is [anchor, [x, y], …].

See mln_style_expression_evaluate in the C API reference.

It fails with these errors:

  • MAPLIBRE_NATIVE_FFI_ERROR_INVALID_ARGUMENT when the expression fails to evaluate, such as when it reads an input that inputs doesn’t set.

Parameters

inputs

Type: MaplibreNativeFfiStyleExpressionInputs

The value, or NULL.

The argument can be NULL.
The data is owned by the caller of the method.
error

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will be left initialized to NULL by the method if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: char*

The text.

The caller of the method takes ownership of the returned data, and is responsible for freeing it.
The value is a NUL terminated UTF-8 string.