InterpolatorBuilder

Builder for Interpolate Expression.

class InterpolatorBuilder(operator: String) : Expression.ExpressionBuilder

Parameters

operator

compulsory operator field for the builder

Constructors

InterpolatorBuilder
Link copied to clipboard

compulsory operator field for the builder

fun InterpolatorBuilder(operator: String)

Functions

abs
Link copied to clipboard

Returns the absolute value of the input.

override fun abs(value: Double)
override fun abs(block: Expression.ExpressionBuilder.() -> Unit)
accumulated
Link copied to clipboard

Gets the value of a cluster property accumulated so far. Can only be used in the clusterProperties option of a clustered GeoJSON source.

override fun accumulated()
acos
Link copied to clipboard

Returns the arccosine of the input.

override fun acos(value: Double)
override fun acos(block: Expression.ExpressionBuilder.() -> Unit)
addArgument
Link copied to clipboard

Add an Expression to the builder.

override fun addArgument(expression: Expression): Expression.ExpressionBuilder
all
Link copied to clipboard

Returns true if all the inputs are true, false otherwise. The inputs are evaluated in order, and evaluation is short-circuiting: once an input expression evaluates to false, the result is false and no further input expressions are evaluated.

override fun all(block: Expression.ExpressionBuilder.() -> Unit)
any
Link copied to clipboard

Returns true if any of the inputs are true, false otherwise. The inputs are evaluated in order, and evaluation is short-circuiting: once an input expression evaluates to true, the result is true and no further input expressions are evaluated.

override fun any(block: Expression.ExpressionBuilder.() -> Unit)
array
Link copied to clipboard

Asserts that the input is an array (optionally with a specific item type and length). If, when the input expression is evaluated, it is not of the asserted type, then this assertion will cause the whole expression to be aborted.

override fun array(block: Expression.ExpressionBuilder.() -> Unit)
asin
Link copied to clipboard

Returns the arcsine of the input.

override fun asin(value: Double)
override fun asin(block: Expression.ExpressionBuilder.() -> Unit)
at
Link copied to clipboard

Retrieves an item from an array.

override fun at(block: Expression.ExpressionBuilder.() -> Unit)
override fun at(index: Double, array: Expression)
atan
Link copied to clipboard

Returns the arctangent of the input.

override fun atan(value: Double)
override fun atan(block: Expression.ExpressionBuilder.() -> Unit)
boolean
Link copied to clipboard

Asserts that the input value is a boolean. If multiple values are provided, each one is evaluated in order until a boolean is obtained. If none of the inputs are booleans, the expression is an error.

override fun boolean(block: Expression.ExpressionBuilder.() -> Unit)
build
Link copied to clipboard

Build the Expression with the settings.

open override fun build(): Expression
ceil
Link copied to clipboard

Returns the smallest integer that is greater than or equal to the input.

override fun ceil(value: Double)
override fun ceil(block: Expression.ExpressionBuilder.() -> Unit)
coalesce
Link copied to clipboard

Evaluates each expression in turn until the first non-null value is obtained, and returns that value.

override fun coalesce(block: Expression.ExpressionBuilder.() -> Unit)
collator
Link copied to clipboard

Returns a collator for use in locale-dependent comparison operations. The case-sensitive and diacritic-sensitive options default to false. The locale argument specifies the IETF language tag of the locale to use. If none is provided, the default locale is used. If the requested locale is not available, the collator will use a system-defined fallback locale. Use resolved-locale to test the results of locale fallback behavior.

override fun collator(block: Expression.CollatorBuilder.() -> Unit)
color
Link copied to clipboard

Add a color expression to the current expression builder.

override fun color(intColor: Int)
concat
Link copied to clipboard

Returns a string consisting of the concatenation of the inputs.

override fun concat(vararg values: Array<out String>)

Returns a string consisting of the concatenation of the inputs. Each input is converted to a string as if by to-string.

override fun concat(block: Expression.ExpressionBuilder.() -> Unit)
cos
Link copied to clipboard

Returns the cosine of the input.

override fun cos(value: Double)
override fun cos(block: Expression.ExpressionBuilder.() -> Unit)
cubicBezier
Link copied to clipboard

Interpolates using the cubic bezier curve defined by the given control points.

fun cubicBezier(block: Expression.ExpressionBuilder.() -> Unit)
distance
Link copied to clipboard

Returns the shortest distance in meters between the evaluated feature and the input geometry. The input value can be a valid GeoJSON of type Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, Feature, or FeatureCollection. Distance values returned may vary in precision due to loss in precision from encoding geometries, particularly below zoom level 13.

override fun distance(geojson: GeoJson)
division
Link copied to clipboard

Returns the result of floating point division of the first input by the second.

override fun division(block: Expression.ExpressionBuilder.() -> Unit)
override fun division(first: Double, second: Double)
downcase
Link copied to clipboard

Returns the input string converted to lowercase. Follows the Unicode Default Case Conversion algorithm and the locale-insensitive case mappings in the Unicode Character Database.

override fun downcase(block: Expression.ExpressionBuilder.() -> Unit)
override fun downcase(value: String)
e
Link copied to clipboard

Returns the mathematical constant e.

override fun e()
eq
Link copied to clipboard

Returns true if the input values are equal, false otherwise. The comparison is strictly typed: values of different runtime types are always considered unequal. Cases where the types are known to be different at parse time are considered invalid and will produce a parse error. Accepts an optional collator argument to control locale-dependent string comparisons.

override fun eq(block: Expression.ExpressionBuilder.() -> Unit)
equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
exponential
Link copied to clipboard

Interpolates exponentially between the stops just less than and just greater than the input. base controls the rate at which the output increases: higher values make the output increase more towards the high end of the range. With values close to 1 the output increases linearly.

fun exponential(block: Expression.ExpressionBuilder.() -> Unit)
featureState
Link copied to clipboard

Retrieves a property value from the current feature's state. Returns null if the requested property is not present on the feature's state. A feature's state is not part of the GeoJSON or vector tile data, and must be set programmatically on each feature. Features are identified by their id attribute, which must be an integer or a string that can be cast to an integer. Note that "feature-state" can only be used with paint properties that support data-driven styling.

override fun featureState(block: Expression.ExpressionBuilder.() -> Unit)
floor
Link copied to clipboard

Returns the largest integer that is less than or equal to the input.

override fun floor(value: Double)
override fun floor(block: Expression.ExpressionBuilder.() -> Unit)
format
Link copied to clipboard

Returns a formatted string for displaying mixed-format text in the text-field property. The input may contain a string literal or expression, including an #types-image expression. Strings may be followed by a style override object that supports the following properties:

  • "text-font": Overrides the font stack specified by the root layout property.

  • "text-color": Overrides the color specified by the root paint property.

  • "font-scale": Applies a scaling factor on text-size as specified by the root layout property.

override fun format(block: Expression.FormatBuilder.() -> Unit)
geometryType
Link copied to clipboard

Gets the feature's geometry type: Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon.

override fun geometryType()
get
Link copied to clipboard

Retrieves a property value from the current feature's properties, or from another object if a second argument is provided. Returns null if the requested property is missing.

override fun get(block: Expression.ExpressionBuilder.() -> Unit)
override fun get(key: String, expression: Expression)

Retrieves a property value from the current feature's properties. Returns null if the requested property is missing.

override fun get(key: String)
gt
Link copied to clipboard

Returns true if the first input is strictly greater than the second, false otherwise. The arguments are required to be either both strings or both numbers; if during evaluation they are not, expression evaluation produces an error. Cases where this constraint is known not to hold at parse time are considered in valid and will produce a parse error. Accepts an optional collator argument to control locale-dependent string comparisons.

override fun gt(block: Expression.ExpressionBuilder.() -> Unit)
gte
Link copied to clipboard

Returns true if the first input is greater than or equal to the second, false otherwise. The arguments are required to be either both strings or both numbers; if during evaluation they are not, expression evaluation produces an error. Cases where this constraint is known not to hold at parse time are considered in valid and will produce a parse error. Accepts an optional collator argument to control locale-dependent string comparisons.

override fun gte(block: Expression.ExpressionBuilder.() -> Unit)
has
Link copied to clipboard

Tests for the presence of an property value in the current feature's properties, or from another object if a second argument is provided.

override fun has(block: Expression.ExpressionBuilder.() -> Unit)
override fun has(string: String, expression: Expression)

Tests for the presence of an property value in the current feature's properties

override fun has(string: String)
hashCode
Link copied to clipboard
open override fun hashCode(): Int
heatmapDensity
Link copied to clipboard

Gets the kernel density estimation of a pixel in a heatmap layer, which is a relative measure of how many data points are crowded around a particular pixel. Can only be used in the heatmap-color property.

override fun heatmapDensity()
id
Link copied to clipboard

Gets the feature's id, if it has one.

override fun id()
image
Link copied to clipboard

Returns an image type for use in icon-image, --pattern entries and as a section in the format expression. If set, the image argument will check that the requested image exists in the style and will return either the resolved image name or null, depending on whether or not the image is currently in the style. This validation process is synchronous and requires the image to have been added to the style before requesting it in the image argument.

override fun image(block: Expression.ExpressionBuilder.() -> Unit)
inExpression
Link copied to clipboard

Determines whether an item exists in an array or a substring exists in a string.

override fun inExpression(block: Expression.ExpressionBuilder.() -> Unit)
override fun inExpression(needle: Double, haystack: Expression)
override fun inExpression(needle: String, haystack: Expression)
interpolate
Link copied to clipboard

Produces continuous, smooth results by interpolating between pairs of input and output values ("stops"). The input may be any numeric expression (e.g., ["get", "population"]). Stop inputs must be numeric literals in strictly ascending order. The output type must be number, array<number>, or color.

Interpolation types:

  • ["linear"]: Interpolates linearly between the pair of stops just less than and just greater than the input.

  • ["exponential", base]: Interpolates exponentially between the stops just less than and just greater than the input. base controls the rate at which the output increases: higher values make the output increase more towards the high end of the range. With values close to 1 the output increases linearly.

  • ["cubic-bezier", x1, y1, x2, y2]: Interpolates using the cubic bezier curve defined by the given control points.

override fun interpolate(block: Expression.InterpolatorBuilder.() -> Unit)
isSupportedScript
Link copied to clipboard

Returns true if the input string is expected to render legibly. Returns false if the input string contains sections that cannot be rendered without potential loss of meaning (e.g. Indic scripts that require complex text shaping, or right-to-left scripts if the the mapbox-gl-rtl-text plugin is not in use in Mapbox GL JS).

override fun isSupportedScript(block: Expression.ExpressionBuilder.() -> Unit)
override fun isSupportedScript(script: String)
length
Link copied to clipboard

Gets the length of an array or string.

override fun length(block: Expression.ExpressionBuilder.() -> Unit)

Gets the length of an string.

override fun length(string: String)
letExpression
Link copied to clipboard

Binds expressions to named variables, which can then be referenced in the result expression using "var", "variable_name".

override fun letExpression(block: Expression.ExpressionBuilder.() -> Unit)
linear
Link copied to clipboard

Interpolates linearly between the pair of stops just less than and just greater than the input.

fun linear()
lineProgress
Link copied to clipboard

Gets the progress along a gradient line. Can only be used in the line-gradient property.

override fun lineProgress()
literal
Link copied to clipboard

Provides a literal array or object value.

override fun literal(value: HashMap<String, Any>)
override fun literal(value: Boolean)
override fun literal(value: Double)
override fun literal(value: Long)
override fun literal(value: String)
override fun literal(value: List<Any>)
ln
Link copied to clipboard

Returns the natural logarithm of the input.

override fun ln(value: Double)
override fun ln(block: Expression.ExpressionBuilder.() -> Unit)
ln2
Link copied to clipboard

Returns mathematical constant ln(2).

override fun ln2()
log10
Link copied to clipboard

Returns the base-ten logarithm of the input.

override fun log10(value: Double)
override fun log10(block: Expression.ExpressionBuilder.() -> Unit)
log2
Link copied to clipboard

Returns the base-two logarithm of the input.

override fun log2(value: Double)
override fun log2(block: Expression.ExpressionBuilder.() -> Unit)
lt
Link copied to clipboard

Returns true if the first input is strictly less than the second, false otherwise. The arguments are required to be either both strings or both numbers; if during evaluation they are not, expression evaluation produces an error. Cases where this constraint is known not to hold at parse time are considered in valid and will produce a parse error. Accepts an optional collator argument to control locale-dependent string comparisons.

override fun lt(block: Expression.ExpressionBuilder.() -> Unit)
lte
Link copied to clipboard

Returns true if the first input is less than or equal to the second, false otherwise. The arguments are required to be either both strings or both numbers; if during evaluation they are not, expression evaluation produces an error. Cases where this constraint is known not to hold at parse time are considered in valid and will produce a parse error. Accepts an optional collator argument to control locale-dependent string comparisons.

override fun lte(block: Expression.ExpressionBuilder.() -> Unit)
match
Link copied to clipboard

Selects the output whose label value matches the input value, or the fallback value if no match is found. The input can be any expression (e.g. ["get", "building_type"]). Each label must be either:

  • a single literal value; or

  • an array of literal values, whose values must be all strings or all numbers (e.g. [100, 101] or ["c", "b"]). The input matches if any of the values in the array matches, similar to the "in" operator. Each label must be unique. If the input type does not match the type of the labels, the result will be the fallback value.

override fun match(block: Expression.ExpressionBuilder.() -> Unit)
max
Link copied to clipboard

Returns the maximum value of the inputs.

override fun max(vararg values: DoubleArray)
override fun max(block: Expression.ExpressionBuilder.() -> Unit)
min
Link copied to clipboard

Returns the minimum value of the inputs.

override fun min(vararg values: DoubleArray)
override fun min(block: Expression.ExpressionBuilder.() -> Unit)
mod
Link copied to clipboard

Returns the remainder after integer division of the first input by the second.

override fun mod(block: Expression.ExpressionBuilder.() -> Unit)
override fun mod(first: Double, second: Double)
neq
Link copied to clipboard

Returns true if the input values are not equal, false otherwise. The comparison is strictly typed: values of different runtime types are always considered unequal. Cases where the types are known to be different at parse time are considered invalid and will produce a parse error. Accepts an optional collator argument to control locale-dependent string comparisons.

override fun neq(block: Expression.ExpressionBuilder.() -> Unit)
not
Link copied to clipboard

Logical negation. Returns true if the input is false, and false if the input is true.

override fun not(bool: Boolean)
override fun not(block: Expression.ExpressionBuilder.() -> Unit)
number
Link copied to clipboard

Asserts that the input value is a number. If multiple values are provided, each one is evaluated in order until a number is obtained. If none of the inputs are numbers, the expression is an error.

override fun number(block: Expression.ExpressionBuilder.() -> Unit)
numberFormat
Link copied to clipboard

Converts the input number into a string representation using the providing formatting rules. If set, the locale argument specifies the locale to use, as a BCP 47 language tag. If set, the currency argument specifies an ISO 4217 code to use for currency-style formatting. If set, the min-fraction-digits and max-fraction-digits arguments specify the minimum and maximum number of fractional digits to include.

override fun numberFormat(input: Expression, block: Expression.NumberFormatBuilder.() -> Unit)
override fun numberFormat(value: Double, block: Expression.NumberFormatBuilder.() -> Unit)
objectExpression
Link copied to clipboard

Asserts that the input value is an object. If multiple values are provided, each one is evaluated in order until an object is obtained. If none of the inputs are objects, the expression is an error.

override fun objectExpression(block: Expression.ExpressionBuilder.() -> Unit)
pi
Link copied to clipboard

Returns the mathematical constant pi.

override fun pi()
pow
Link copied to clipboard

Returns the result of raising the first input to the power specified by the second.

override fun pow(block: Expression.ExpressionBuilder.() -> Unit)
override fun pow(first: Double, second: Double)
product
Link copied to clipboard

Returns the product of the inputs.

override fun product(vararg double: DoubleArray)
override fun product(block: Expression.ExpressionBuilder.() -> Unit)
properties
Link copied to clipboard

Gets the feature properties object. Note that in some cases, it may be more efficient to use "get", "property_name" directly.

override fun properties()
resolvedLocale
Link copied to clipboard

Returns the IETF language tag of the locale being used by the provided collator. This can be used to determine the default system locale, or to determine if a requested locale was successfully loaded.

override fun resolvedLocale(block: Expression.ExpressionBuilder.() -> Unit)
rgb
Link copied to clipboard

Creates a color value from red, green, and blue components, which must range between 0 and 255, and an alpha component of 1. If any component is out of range, the expression is an error.

override fun rgb(block: Expression.ExpressionBuilder.() -> Unit)

Add a RGB color expression from numbers to the current expression builder.

override fun rgb(red: Double, green: Double, blue: Double)
rgba
Link copied to clipboard

Creates a color value from red, green, blue components, which must range between 0 and 255, and an alpha component which must range between 0 and 1. If any component is out of range, the expression is an error.

override fun rgba(block: Expression.ExpressionBuilder.() -> Unit)

Add a RGBA color expression from numbers to the current expression builder.

override fun rgba(red: Double, green: Double, blue: Double, alpha: Double)
round
Link copied to clipboard

Rounds the input to the nearest integer. Halfway values are rounded away from zero. For example, ["round", -1.5] evaluates to -2.

override fun round(value: Double)
override fun round(block: Expression.ExpressionBuilder.() -> Unit)
sin
Link copied to clipboard

Returns the sine of the input.

override fun sin(value: Double)
override fun sin(block: Expression.ExpressionBuilder.() -> Unit)
skyRadialProgress
Link copied to clipboard

Gets the distance of a point on the sky from the sun position. Returns 0 at sun position and 1 when the distance reaches sky-gradient-radius. Can only be used in the sky-gradient property.

override fun skyRadialProgress()
sqrt
Link copied to clipboard

Returns the square root of the input.

override fun sqrt(value: Double)
override fun sqrt(block: Expression.ExpressionBuilder.() -> Unit)
step
Link copied to clipboard

Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs of input and output values ("stops"). The input may be any numeric expression (e.g., ["get", "population"]). Stop inputs must be numeric literals in strictly ascending order. Returns the output value of the stop just less than the input, or the first output if the input is less than the first stop.

override fun step(block: Expression.ExpressionBuilder.() -> Unit)
stop
Link copied to clipboard

Add a pair of input and output values. The input may be any numeric expression (e.g., ["get", "population"]). Stop inputs must be numeric literals in strictly ascending order. Returns the output value of the stop just less than the input, or the first output if the input is less than the first stop.

It is to be used as part of parameters in the step expression.

override fun stop(block: Expression.ExpressionBuilder.() -> Unit)
string
Link copied to clipboard

Asserts that the input value is a string. If multiple values are provided, each one is evaluated in order until a string is obtained. If none of the inputs are strings, the expression is an error.

override fun string(block: Expression.ExpressionBuilder.() -> Unit)
subtract
Link copied to clipboard

Returns the result of subtracting it from 0.

override fun subtract(value: Double)

For two inputs, returns the result of subtracting the second input from the first. For a single input, returns the result of subtracting it from 0.

override fun subtract(block: Expression.ExpressionBuilder.() -> Unit)

Returns the result of subtracting the second input from the first.

override fun subtract(first: Double, second: Double)
sum
Link copied to clipboard

Returns the sum of the inputs.

override fun sum(vararg double: DoubleArray)
override fun sum(block: Expression.ExpressionBuilder.() -> Unit)
switchCase
Link copied to clipboard

Selects the first output whose corresponding test condition evaluates to true, or the fallback value otherwise.

override fun switchCase(block: Expression.ExpressionBuilder.() -> Unit)
tan
Link copied to clipboard

Returns the tangent of the input.

override fun tan(value: Double)
override fun tan(block: Expression.ExpressionBuilder.() -> Unit)
toBoolean
Link copied to clipboard

Converts the input value to a boolean. The result is false when then input is an empty string, 0, false, null, or NaN; otherwise it is true.

override fun toBoolean(block: Expression.ExpressionBuilder.() -> Unit)
toColor
Link copied to clipboard

Converts the input value to a color. 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.

override fun toColor(block: Expression.ExpressionBuilder.() -> Unit)
toNumber
Link copied to clipboard

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 "ToNumber Applied to * the String Type" algorithm of 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.

override fun toNumber(block: Expression.ExpressionBuilder.() -> Unit)
toRgba
Link copied to clipboard

Returns a four-element array containing the input color's red, green, blue, and alpha components, in that order.

override fun toRgba(block: Expression.ExpressionBuilder.() -> Unit)
toString
Link copied to clipboard
open override fun toString(): String

Converts the input value to a string. If the input is null, the result is "". If the input is a boolean, the result is "true" or "false". If the input is a number, it is converted to a string as specified by the "NumberToString" algorithm of the ECMAScript Language Specification. If the input is a color, it is converted to a string of the form "rgba(r,g,b,a)", where r, g, and b are numerals ranging from 0 to 255, and a ranges from 0 to 1. Otherwise, the input is converted to a string in the format specified by the JSON.stringify function of the ECMAScript Language Specification.

override fun toString(block: Expression.ExpressionBuilder.() -> Unit)
typeofExpression
Link copied to clipboard

Returns a string describing the type of the given value.

override fun typeofExpression(block: Expression.ExpressionBuilder.() -> Unit)
upcase
Link copied to clipboard

Returns the input string converted to uppercase. Follows the Unicode Default Case Conversion algorithm and the locale-insensitive case mappings in the Unicode Character Database.

override fun upcase(block: Expression.ExpressionBuilder.() -> Unit)
override fun upcase(value: String)
varExpression
Link copied to clipboard

References variable bound using "let".

override fun varExpression(block: Expression.ExpressionBuilder.() -> Unit)
override fun varExpression(value: String)
within
Link copied to clipboard

Returns true if the evaluated feature is fully contained inside a boundary of the input geometry, false otherwise. The input value can be a valid GeoJSON of type Polygon, MultiPolygon, Feature, or FeatureCollection. Supported features for evaluation:

  • Point: Returns false if a point is on the boundary or falls outside the boundary.

  • LineString: Returns false if any part of a line falls outside the boundary, the line intersects the boundary, or a line's endpoint is on the boundary.

override fun within(geometry: Geometry)
zoom
Link copied to clipboard

Gets the current zoom level. Note that in style layout and paint properties, "zoom" may only appear as the input to a top-level "step" or "interpolate" expression.

override fun zoom()