to Number
Converts the input value to a number, if possible. If the input is null or false, the result is 0. If the input is true, the result is 1. If the input is a string, it is converted to a number as specified by the ECMAScript Language Specification. If multiple values are provided, each one is evaluated in order until the first successful conversion is obtained. If none of the inputs can be converted, the expression is an error.
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(toNumber(get("key-to-string-value")))
);
Content copied to clipboard
Return
expression
Parameters
input
expression input
See also
<a href="https://maplibre. org/maplibre-style-spec/expressions/#types-to-number">Style specification</a>