Package com.mapbox.mapboxsdk.style.expressions
Contains the Mapbox Maps Android Expression API classes.
Types
Name | Summary |
---|---|
Expression | open class Expression The value for any layout property, paint property, or filter may be specified as an expression. |
Expression
open class Expression
The value for any layout property, paint property, or filter may be specified as an expression. An expression defines a formula for computing the value of the property using the operators described below. The set of expression operators provided by Mapbox GL includes:
- Element
- Mathematical operators for performing arithmetic and other operations on numeric values
- Logical operators for manipulating boolean values and making conditional decisions
- String operators for manipulating strings
- Data operators, providing access to the properties of source features
- Camera operators, providing access to the parameters defining the current map view
Expressions are represented as JSON arrays. The first element of an expression array is a string naming the expression operator, e.g. “*“or “case”. Subsequent elements (if any) are the arguments to the expression. Each argument is either a literal value (a string, number, boolean, or null), or another expression array.
Data expression: a data expression is any expression that access feature data – that is, any expression that uses one of the data operators:get,has,id,geometry-type, or properties. Data expressions allow a feature’s properties to determine its appearance. They can be used to differentiate features within the same layer and to create data visualizations.
Camera expression: a camera expression is any expression that uses the zoom operator. Such expressions allow the the appearance of a layer to change with the map’s zoom level. Camera expressions can be used to create the appearance of depth and to control data density.
Composition: a single expression may use a mix of data operators, camera operators, and other operators. Such composite expressions allows a layer’s appearance to be determined by a combination of the zoom level and individual feature properties.
Example expression:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setProperties( fillColor( interpolate( linear(), zoom(), stop(12, step(get(“stroke-width”), color(Color.BLACK), stop(1f, color(Color.RED)), stop(2f, color(Color.WHITE)), stop(3f, color(Color.BLUE)) )), stop(15, step(get(“stroke-width”), color(Color.BLACK), stop(1f, color(Color.YELLOW)), stop(2f, color(Color.LTGRAY)), stop(3f, color(Color.CYAN)) )), stop(18, step(get(“stroke-width”), color(Color.BLACK), stop(1f, color(Color.WHITE)), stop(2f, color(Color.GRAY)), stop(3f, color(Color.GREEN)) )) ) ) ); }
Constructors
Name | Summary |
---|---|
Expression | open fun Expression()Creates an empty expression for expression literals |
Expression | open fun Expression(operator: String, arguments: Array<Expression>)Creates an expression from its operator and varargs expressions. |
Types
Name | Summary |
---|---|
Array | open class Array Expression array type. |
Converter | class Converter Converts a JsonArray or a raw expression to a Java expression. |
ExpressionLiteral | open class ExpressionLiteral : Expression, Expression.ValueExpression ExpressionLiteral wraps an object to be used as a literal in an expression. |
FormatEntry | open class FormatEntry Holds format entries used in a format expression. |
FormatOption | open class FormatOption : Expression.Option Holds format options used in a formatEntry that buildsa format expression. |
Interpolator | open class Interpolator : Expression Expression interpolator type. |
NumberFormatOption | open class NumberFormatOption : Expression.Option Holds format options used in a numberFormat expression. |
Stop | open class Stop Expression stop type. |
Functions
Name | Summary |
---|---|
abs | open fun abs(expression: Expression): Expression open fun abs(number: Number): Expression Returns the absolute value of the input. |
accumulated | open fun accumulated(): Expression Gets the value of a cluster property accumulated so far. |
acos | open fun acos(number: Expression): Expression open fun acos(number: Number): Expression Returns the arccosine of the input. |
all | open fun all(input: Array<Expression>): Expression Returns true if all the inputs are true , false otherwise. |
any | open fun any(input: Array<Expression>): Expression Returns true if any of the inputs are true , false otherwise. |
array | open fun array(input: Expression): Expression 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. |
asin | open fun asin(number: Expression): Expression open fun asin(number: Number): Expression Returns the arcsine of the input. |
at | open fun at(number: Expression, expression: Expression): Expression open fun at(number: Number, expression: Expression): Expression Retrieves an item from an array. |
atan | open fun atan(number: Expression): Expression open fun atan(number: Number): Expression Returns the arctangent of the input. |
bool | open fun bool(input: Array<Expression>): Expression Asserts that the input value is a boolean.If multiple values are provided, each one is evaluated in order until a boolean value is obtained.If none of the inputs are booleans, the expression is an error.The asserted input value is returned as result. |
ceil | open fun ceil(expression: Expression): Expression open fun ceil(number: Number): Expression Returns the smallest integer that is greater than or equal to the input. |
coalesce | open fun coalesce(input: Array<Expression>): Expression Evaluates each expression in turn until the first non-null value is obtained, and returns that value. |
collator | open fun collator(caseSensitive: Boolean, diacriticSensitive: Boolean): Expression open fun collator(caseSensitive: Expression, diacriticSensitive: Expression): Expression open fun collator(caseSensitive: Boolean, diacriticSensitive: Boolean, locale: Locale): Expression open fun collator(caseSensitive: Expression, diacriticSensitive: Expression, locale: Expression): Expression 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. |
color | open fun color(color: Int): Expression Expression literal utility method to convert a color int to an color expressionExample usage:{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setProperties( fillColor(color(Color.GREEN)) ); * } |
concat | open fun concat(input: Array<Expression>): Expression open fun concat(input: Array Returns a string consisting of the concatenation of the inputs. |
cos | open fun cos(number: Expression): Expression open fun cos(number: Number): Expression Returns the cosine of the input. |
cubicBezier | open fun cubicBezier(x1: Expression, y1: Expression, x2: Expression, y2: Expression): Expression.Interpolator open fun cubicBezier(x1: Number, y1: Number, x2: Number, y2: Number): Expression.Interpolator Interpolates using the cubic bezier curve defined by the given control points. |
distance | open fun distance(geoJson: GeoJson): Expression Retrieves the shortest distance between two geometries.The returned value can be consumed as an input into another expression for changing a paint or layout propertyor filtering features by distance. |
division | open fun division(first: Expression, second: Expression): Expression open fun division(first: Number, second: Number): Expression Returns the result of floating point division of the first input by the second. |
downcase | open fun downcase(input: Expression): Expression open fun downcase(input: String): Expression Returns the input string converted to lowercase. |
e | open fun e(): Expression Returns the mathematical constant e. |
eq | open fun eq(compareOne: Expression, compareTwo: Boolean): Expression open fun eq(compareOne: Expression, compareTwo: Number): Expression open fun eq(compareOne: Expression, compareTwo: String): Expression Returns true if the input values are equal, false otherwise. open fun eq(compareOne: Expression, compareTwo: Expression): Expression open fun eq(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression open fun eq(compareOne: Expression, compareTwo: String, collator: Expression): Expression Returns true if the input values are equal, false otherwise.The inputs must be numbers, strings, or booleans, and both of the same type. |
equals | open fun equals(o: Any): Boolean Indicates whether some other object is “equal to” this one. |
exponential | open fun exponential(expression: Expression): Expression.Interpolator Interpolates exponentially between the stops just less than and just greater than the input.The parameter 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. open fun exponential(base: Number): Expression.Interpolator 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. |
floor | open fun floor(expression: Expression): Expression open fun floor(number: Number): Expression Returns the largest integer that is less than or equal to the input. |
format | open fun format(formatEntries: Array<Expression.FormatEntry>): Expression Returns formatted text containing annotations for use in mixed-format text-field entries. |
formatEntry | open fun formatEntry(text: Expression): Expression.FormatEntry open fun formatEntry(text: String): Expression.FormatEntry open fun formatEntry(text: Expression, formatOptions: Array<Expression.FormatOption>): Expression.FormatEntry open fun formatEntry(text: String, formatOptions: Array<Expression.FormatOption>): Expression.FormatEntry Returns a format entry that can be used in format to create formatted text fields. |
geometryType | open fun geometryType(): Expression Gets the feature’s geometry type: Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon. |
get | open fun get(input: Expression): Expression open fun get(input: String): Expression 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. open fun get(key: Expression, object: Expression): Expression open fun get(key: String, object: Expression): Expression Retrieves a property value from another object.Returns null if the requested property is missing. |
gt | open fun gt(compareOne: Expression, compareTwo: Expression): Expression open fun gt(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression open fun gt(compareOne: Expression, compareTwo: String, collator: Expression): Expression Returns true if the first input is strictly greater than the second, false otherwise.The inputs must be numbers or strings, and both of the same type. open fun gt(compareOne: Expression, compareTwo: Number): Expression open fun gt(compareOne: Expression, compareTwo: String): Expression Returns true if the first input is strictly greater than the second, false otherwise. |
gte | open fun gte(compareOne: Expression, compareTwo: Expression): Expression open fun gte(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression open fun gte(compareOne: Expression, compareTwo: String, collator: Expression): Expression Returns true if the first input is greater than or equal to the second, false otherwise.The inputs must be numbers or strings, and both of the same type. open fun gte(compareOne: Expression, compareTwo: Number): Expression open fun gte(compareOne: Expression, compareTwo: String): Expression Returns true if the first input is greater than or equal to the second, false otherwise. |
has | open fun has(key: Expression): Expression open fun has(key: String): Expression Tests for the presence of an property value in the current feature’s properties. open fun has(key: Expression, object: Expression): Expression open fun has(key: String, object: Expression): Expression Tests for the presence of an property value from another object. |
hashCode | open fun hashCode(): Int Returns a hash code value for the expression. |
heatmapDensity | open fun heatmapDensity(): Expression 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. |
id | open fun id(): Expression Gets the feature’s id, if it has one. |
image | open fun image(input: Expression): Expression Returns image expression for use in ‘*-pattern’ and ‘icon-image’ layer properties. |
in | open fun in(needle: Expression, haystack: Expression): Expression open fun in(needle: Number, haystack: Expression): Expression open fun in(needle: String, haystack: Expression): Expression Retrieves whether an item exists in an array or a substring exists in a string. |
interpolate | open fun interpolate(interpolation: Expression.Interpolator, number: Expression, stops: Array<Expression>): Expression open fun interpolate(interpolation: Expression.Interpolator, number: Expression, stops: Array<Expression.Stop>): Expression 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 . |
isSupportedScript | open fun isSupportedScript(expression: Expression): Expression open fun isSupportedScript(string: String): Expression 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. |
length | open fun length(expression: Expression): Expression open fun length(input: String): Expression Gets the length of an array or string. |
let | open fun let(input: Array<Expression>): Expression Binds input to named variables,which can then be referenced in the result expression using var or var. |
linear | open fun linear(): Expression.Interpolator interpolates linearly between the pair of stops just less than and just greater than the input. |
lineProgress | open fun lineProgress(): Expression Gets the progress along a gradient line. |
literal | open fun literal(bool: Boolean): Expression Create a literal boolean expression. open fun literal(number: Number): Expression Create a literal number expression. open fun literal(object: Any): Expression Create a literal object expression. open fun literal(array: Array Create a literal array expression open fun [literal](#literal)(string: String): [Expression](#expression) Create a literal string expression. |
ln | open fun ln(number: Expression): Expression open fun ln(number: Number): Expression Returns the natural logarithm of the input. |
ln2 | open fun ln2(): Expression Returns mathematical constant ln(2). |
log10 | open fun log10(number: Expression): Expression open fun log10(number: Number): Expression Returns the base-ten logarithm of the input. |
log2 | open fun log2(number: Expression): Expression open fun log2(number: Number): Expression Returns the base-two logarithm of the input. |
lt | open fun lt(compareOne: Expression, compareTwo: Expression): Expression open fun lt(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression open fun lt(compareOne: Expression, compareTwo: String, collator: Expression): Expression Returns true if the first input is strictly less than the second, false otherwise.The inputs must be numbers or strings, and both of the same type. open fun lt(compareOne: Expression, compareTwo: Number): Expression open fun lt(compareOne: Expression, compareTwo: String): Expression Returns true if the first input is strictly less than the second, false otherwise. |
lte | open fun lte(compareOne: Expression, compareTwo: Expression): Expression open fun lte(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression open fun lte(compareOne: Expression, compareTwo: String, collator: Expression): Expression Returns true if the first input is less than or equal to the second, false otherwise.The inputs must be numbers or strings, and both of the same type. open fun lte(compareOne: Expression, compareTwo: Number): Expression open fun lte(compareOne: Expression, compareTwo: String): Expression Returns true if the first input is less than or equal to the second, false otherwise. |
match | open fun match(input: Array<Expression>): Expression open fun match(input: Expression, defaultOutput: Expression, stops: Array<Expression.Stop>): Expression Selects the output whose label value matches the input value, or the fallback value if no match is found.The input can be any string or number expression.Each label can either be a single literal value or an array of values.If types of the input and keys don’t match, or the input value doesn’t exist,the expresion will fail without falling back to the default value. |
max | open fun max(numbers: Array<Expression>): Expression open fun max(numbers: Array Returns the maximum value of the inputs. |
min | open fun min(numbers: Array<Expression>): Expression open fun min(numbers: Array Returns the minimum value of the inputs. |
mod | open fun mod(first: Expression, second: Expression): Expression open fun mod(first: Number, second: Number): Expression Returns the remainder after integer division of the first input by the second. |
neq | open fun neq(compareOne: Expression, compareTwo: Boolean): Expression Returns true if the input values are equal, false otherwise. open fun neq(compareOne: Expression, compareTwo: Expression): Expression open fun neq(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression open fun neq(compareOne: Expression, compareTwo: String, collator: Expression): Expression Returns true if the input values are not equal, false otherwise.The inputs must be numbers, strings, or booleans, and both of the same type. open fun neq(compareOne: Expression, compareTwo: Number): Expression open fun neq(compareOne: Expression, compareTwo: String): Expression Returns true if the input values are not equal, false otherwise. |
not | open fun not(input: Boolean): Expression open fun not(input: Expression): Expression Logical negation. |
number | open fun number(input: Array<Expression>): Expression Asserts that the input value is a number.If multiple values are provided, each one is evaluated in order until a number value is obtained.If none of the inputs are numbers, the expression is an error.The asserted input value is returned as result. |
numberFormat | open fun numberFormat(number: Expression, options: Array<Expression.NumberFormatOption>): Expression open fun numberFormat(number: Number, options: Array<Expression.NumberFormatOption>): Expression 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 numberof fractional digits to include. |
object | open fun object(input: Expression): Expression Asserts that the input value is an object. |
pi | open fun pi(): Expression Returns the mathematical constant pi. |
pow | open fun pow(first: Expression, second: Expression): Expression open fun pow(first: Number, second: Number): Expression Returns the result of raising the first input to the power specified by the second. |
product | open fun product(numbers: Array<Expression>): Expression open fun product(numbers: Array Returns the product of the inputs. |
properties | open fun properties(): Expression Gets the feature properties object. |
raw | open fun raw(rawExpression: String): Expression Returns a DSL equivalent of a raw expression. |
resolvedLocale | open fun resolvedLocale(collator: Expression): Expression 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. |
rgb | open fun rgb(red: Expression, green: Expression, blue: Expression): Expression open fun rgb(red: Number, green: Number, blue: Number): Expression Creates a color value from red, green, and blue components, which must range between 0 and 255,and an alpha component of 1. |
rgba | open fun rgba(red: Expression, green: Expression, blue: Expression, alpha: Expression): Expression open fun rgba(red: Number, green: Number, blue: Number, alpha: Number): Expression 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. |
round | open fun round(expression: Expression): Expression open fun round(number: Number): Expression Rounds the input to the nearest integer.Halfway values are rounded away from zero.For example [\"round\", -1.5] evaluates to -2. |
sin | open fun sin(number: Expression): Expression open fun sin(number: Number): Expression Returns the sine of the input. |
sqrt | open fun sqrt(number: Expression): Expression Returns the square root of the inputExample usage:{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(sqrt(pi())) ); } open fun sqrt(number: Number): Expression Returns the square root of the inputExample usage:{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(sqrt(25.0f)) ); } |
step | open fun step(input: Expression, defaultOutput: Expression, stops: Array<Expression>): Expression open fun step(input: Expression, defaultOutput: Expression, stops: Array<Expression.Stop>): Expression open fun step(input: Expression, defaultOutput: Number, stops: Array<Expression>): Expression open fun step(input: Expression, defaultOutput: Number, stops: Array<Expression.Stop>): Expression open fun step(input: Number, defaultOutput: Expression, stops: Array<Expression>): Expression open fun step(input: Number, defaultOutput: Expression, stops: Array<Expression.Stop>): Expression open fun step(input: Number, defaultOutput: Number, stops: Array<Expression>): Expression open fun step(input: Number, defaultOutput: Number, stops: Array<Expression.Stop>): Expression Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs ofinput and output values ("stops"). |
stop | open fun stop(stop: Any, value: Any): Expression.Stop Produces a stop value. |
string | open fun string(input: Array<Expression>): Expression Asserts that the input value is a string.If multiple values are provided, each one is evaluated in order until a string value is obtained.If none of the inputs are strings, the expression is an error.The asserted input value is returned as result. |
subtract | open fun subtract(number: Expression): Expression open fun subtract(number: Number): Expression Returns the result of subtracting a number from 0. open fun subtract(first: Expression, second: Expression): Expression open fun subtract(first: Number, second: Number): Expression Returns the result of subtracting the second input from the first. |
sum | open fun sum(numbers: Array<Expression>): Expression open fun sum(numbers: Array Returns the sum of the inputs. |
switchCase | open fun switchCase(input: Array<Expression>): Expression Selects the first output whose corresponding test condition evaluates to true. |
tan | open fun tan(number: Expression): Expression open fun tan(number: Number): Expression Returns the tangent of the input. |
toArray | @NonNull() open fun toArray(): Array Converts the expression to Object array representation. |
toBool | open fun toBool(input: Expression): Expression Converts the input value to a boolean. |
toColor | open fun toColor(input: Expression): Expression Converts the input value to a color. |
toNumber | open fun toNumber(input: Expression): Expression 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. |
toRgba | open fun toRgba(expression: Expression): Expression Returns a four-element array containing the input color’s red, green, blue, and alpha components, in that order. |
toString | open fun toString(): String Returns a string representation of the object that matches the definition set in the style specification. open fun toString(input: Expression): Expression Converts the input value to a string.If the input is null, the result is null.If the input is a boolean, the result is true or false.If the input is a number, it is converted to a string by NumberToString in 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 in the ECMAScriptLanguage Specification. |
typeOf | open fun typeOf(input: Expression): Expression Returns a string describing the type of the given value. |
upcase | open fun upcase(string: Expression): Expression open fun upcase(string: String): Expression Returns the input string converted to uppercase. |
var | open fun var(expression: Expression): Expression open fun var(variableName: String): Expression References variable bound using let. |
within | open fun within(polygon: Polygon): Expression |
zoom | open fun zoom(): Expression Gets the current zoom level. |
Inheritors
Name |
---|
Expression |
Expression |
abs
open fun abs(expression: Expression): Expression
Returns the absolute value of the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(abs(subtract(pi()))) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
expression | number expression to get absolute value from |
open fun abs(number: Number): Expression
Returns the absolute value of the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(abs(-3.14159265359f)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | number to get absolute value from |
accumulated
open fun accumulated(): Expression
Gets the value of a cluster property accumulated so far. Can only be used in the clusterPropertiesoption of a clustered GeoJSON source.
Example usage:
{@code GeoJsonOptions options = new GeoJsonOptions() .withCluster(true) .withClusterProperty(“max”, max(accumulated(), get(“max”)).toArray(), get(“mag”).toArray()); }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
acos
open fun acos(number: Expression): Expression
Returns the arccosine of the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(acos(pi())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the number to calculate the arccosine for |
open fun acos(number: Number): Expression
Returns the arccosine of the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(acos(0)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the number to calculate the arccosine for |
all
open fun all(input: Array<Expression>): Expression
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.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( all(get(“keyToValue”), get(“keyToOtherValue”)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | expression input |
any
open fun any(input: Array<Expression>): Expression
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.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( any(get(“keyToValue”), get(“keyToOtherValue”)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | expression input |
array
open fun array(input: Expression): Expression
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.
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | expression input |
asin
open fun asin(number: Expression): Expression
Returns the arcsine of the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(asin(pi())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the number to calculate the arcsine for |
open fun asin(number: Number): Expression
Returns the arcsine of the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(asin(90)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the number to calculate the arcsine for |
at
open fun at(number: Expression, expression: Expression): Expression
Retrieves an item from an array.
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the index expression |
expression | the array expression |
open fun at(number: Number, expression: Expression): Expression
Retrieves an item from an array.
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the index expression |
expression | the array expression |
atan
open fun atan(number: Expression): Expression
Returns the arctangent of the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(asin(pi())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the number to calculate the arctangent for |
open fun atan(number: Number): Expression
Returns the arctangent of the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(atan(90)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the number to calculate the arctangent for |
bool
open fun bool(input: Array<Expression>): Expression
Asserts that the input value is a boolean.If multiple values are provided, each one is evaluated in order until a boolean value is obtained.If none of the inputs are booleans, the expression is an error.The asserted input value is returned as result.
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | expression input |
ceil
open fun ceil(expression: Expression): Expression
Returns the smallest integer that is greater than or equal to the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(ceil(pi())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
expression | number expression to get value from |
open fun ceil(number: Number): Expression
Returns the smallest integer that is greater than or equal to the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(ceil(3.14159265359)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | number to get value from |
coalesce
open fun coalesce(input: Array<Expression>): Expression
Evaluates each expression in turn until the first non-null value is obtained, and returns that value.
Example usage:
{@code SymbolLayer symbolLayer = new SymbolLayer(“layer-id”, “source-id”); symbolLayer.setProperties( textColor( coalesce( get(“keyToNullValue”), get(“keyToNonNullValue”) ) ) ); }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | expression input |
collator
open fun collator(caseSensitive: Boolean, diacriticSensitive: Boolean, locale: Locale): Expression
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.
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
caseSensitive | case sensitive flag |
diacriticSensitive | diacritic sensitive flag |
locale | locale |
open fun collator(caseSensitive: Boolean, diacriticSensitive: Boolean): Expression
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.
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
caseSensitive | case sensitive flag |
diacriticSensitive | diacritic sensitive flag |
open fun collator(caseSensitive: Expression, diacriticSensitive: Expression, locale: Expression): Expression
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.
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
caseSensitive | case sensitive flag |
diacriticSensitive | diacritic sensitive flag |
locale | locale |
open fun collator(caseSensitive: Expression, diacriticSensitive: Expression): Expression
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.
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
caseSensitive | case sensitive flag |
diacriticSensitive | diacritic sensitive flag |
color
open fun color(color: Int): Expression
Expression literal utility method to convert a color int to an color expression
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setProperties( fillColor(color(Color.GREEN)) ); * }
Return
the color expression
Parameters
Name | Summary |
---|---|
color | the int color |
concat
open fun concat(input: Array<Expression>): Expression
Returns a string consisting of the concatenation of the inputs.
Example usage:
{@code SymbolLayer symbolLayer = new SymbolLayer(“layer-id”, “source-id”); symbolLayer.setProperties( textField(concat(get(“key-to-string-value”), literal(“other string”))) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | expression input |
open fun concat(input: Array
Returns a string consisting of the concatenation of the inputs.
Example usage:
{@code SymbolLayer symbolLayer = new SymbolLayer(“layer-id”, “source-id”); symbolLayer.setProperties( textField(concat(“foo”, “bar”)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | expression input |
cos
open fun cos(number: Expression): Expression
Returns the cosine of the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(cos(pi())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the number to calculate the cosine for |
open fun cos(number: Number): Expression
Returns the cosine of the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(cos(0)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the number to calculate the cosine for |
cubicBezier
open fun cubicBezier(x1: Expression, y1: Expression, x2: Expression, y2: Expression): Expression.Interpolator
Interpolates using the cubic bezier curve defined by the given control points.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setProperties( fillColor( interpolate( cubicBezier(0.42f, 0.0f, 1.0f, 1.0f), zoom(), stop(1.0f, color(Color.RED)), stop(5.0f, color(Color.BLUE)), stop(10.0f, color(Color.GREEN)) ) ) ); }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
x1 | x value of the first point of a cubic bezier, ranges from 0 to 1 |
y1 | y value of the first point of a cubic bezier, ranges from 0 to 1 |
x2 | x value of the second point of a cubic bezier, ranges from 0 to 1 |
y2 | y value fo the second point of a cubic bezier, ranges from 0 to 1 |
open fun cubicBezier(x1: Number, y1: Number, x2: Number, y2: Number): Expression.Interpolator
Interpolates using the cubic bezier curve defined by the given control points.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setProperties( fillColor( interpolate( cubicBezier(0.42f, 0.0f, 1.0f, 1.0f), zoom(), stop(1.0f, color(Color.RED)), stop(5.0f, color(Color.BLUE)), stop(10.0f, color(Color.GREEN)) ) ) ); }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
x1 | x value of the first point of a cubic bezier, ranges from 0 to 1 |
y1 | y value of the first point of a cubic bezier, ranges from 0 to 1 |
x2 | x value of the second point of a cubic bezier, ranges from 0 to 1 |
y2 | y value fo the second point of a cubic bezier, ranges from 0 to 1 |
distance
open fun distance(geoJson: GeoJson): Expression
Retrieves the shortest distance between two geometries.The returned value can be consumed as an input into another expression for changing a paint or layout propertyor filtering features by distance.
Currently supports Point
, MultiPoint
, LineString
, MultiLineString
geometry types.
Return
the distance in the unit “meters”.
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
geoJson | the target feature geoJson.Currently supports Point , MultiPoint , LineString , MultiLineString , Polygon , MultiPolygon geometry types |
division
open fun division(first: Expression, second: Expression): Expression
Returns the result of floating point division of the first input by the second.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(division(literal(10.0f), pi())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
first | the first number |
second | the second number |
open fun division(first: Number, second: Number): Expression
Returns the result of floating point division of the first input by the second.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(division(10.0f, 20.0f)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
first | the first number |
second | the second number |
downcase
open fun downcase(input: Expression): Expression
Returns the input string converted to lowercase.
Follows the Unicode Default Case Conversion algorithmand the locale-insensitive case mappings in the Unicode Character Database.
Example usage:
{@code SymbolLayer symbolLayer = new SymbolLayer(“layer-id”, “source-id”); symbolLayer.setProperties( textField(downcase(get(“key-to-string-value”))) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | expression input |
open fun downcase(input: String): Expression
Returns the input string converted to lowercase.
Follows the Unicode Default Case Conversion algorithmand the locale-insensitive case mappings in the Unicode Character Database.
Example usage:
{@code SymbolLayer symbolLayer = new SymbolLayer(“layer-id”, “source-id”); symbolLayer.setProperties( textField(upcase(“key-to-string-value”)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | string to downcase |
e
open fun e(): Expression
Returns the mathematical constant e.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(product(literal(10.0f), e())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
eq
open fun eq(compareOne: Expression, compareTwo: Expression): Expression
Returns true if the input values are equal, false otherwise.The inputs must be numbers, strings, or booleans, and both of the same type.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( eq(get(“keyToValue”), get(“keyToOtherValue”)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second expression |
open fun eq(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression
Returns true if the input values are equal, false otherwise.The inputs must be numbers, strings, or booleans, and both of the same type.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( eq(get(“keyToValue”), get(“keyToOtherValue”), collator(true, false)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second expression |
collator | the collator expression |
open fun eq(compareOne: Expression, compareTwo: Boolean): Expression
Returns true if the input values are equal, false otherwise.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( eq(get(“keyToValue”), true) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second boolean |
open fun eq(compareOne: Expression, compareTwo: String): Expression
Returns true if the input values are equal, false otherwise.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( eq(get(“keyToValue”), “value”) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second number |
open fun eq(compareOne: Expression, compareTwo: String, collator: Expression): Expression
Returns true if the input values are equal, false otherwise.The inputs must be numbers, strings, or booleans, and both of the same type.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( eq(get(“keyToValue”), get(“keyToOtherValue”), collator(true, false)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second String |
collator | the collator expression |
open fun eq(compareOne: Expression, compareTwo: Number): Expression
Returns true if the input values are equal, false otherwise.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( eq(get(“keyToValue”), 2.0f) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second number |
equals
open fun equals(o: Any): Boolean
Indicates whether some other object is “equal to” this one.
Return
true if equal, false if not
Parameters
Name | Summary |
---|---|
o | the other object |
exponential
open fun exponential(base: Number): Expression.Interpolator
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.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setProperties( fillColor( interpolate( exponential(0.5f), zoom(), stop(1.0f, color(Color.RED)), stop(5.0f, color(Color.BLUE)), stop(10.0f, color(Color.GREEN)) ) ) ); }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
base | value controlling the route at which the output increases |
open fun exponential(expression: Expression): Expression.Interpolator
Interpolates exponentially between the stops just less than and just greater than the input.The parameter 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.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setProperties( fillColor( interpolate( exponential(get(“keyToValue”)), zoom(), stop(1.0f, color(Color.RED)), stop(5.0f, color(Color.BLUE)), stop(10.0f, color(Color.GREEN)) ) ) ); }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
expression | base number expression |
floor
open fun floor(expression: Expression): Expression
Returns the largest integer that is less than or equal to the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(floor(pi())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
expression | number expression to get value from |
open fun floor(number: Number): Expression
Returns the largest integer that is less than or equal to the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(floor(pi())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | number to get value from |
formatEntry
open fun formatEntry(text: Expression, formatOptions: Array<Expression.FormatOption>): Expression.FormatEntry
Returns a format entry that can be used in format to create formatted text fields.
Text is required to be of a resulting type string.
Text is required to be passed; FormatOptions are optional and will default to the base values definedfor the symbol.
Return
format entry
Parameters
Name | Summary |
---|---|
text | displayed text |
formatOptions | format options |
open fun formatEntry(text: Expression): Expression.FormatEntry
Returns a format entry that can be used in format to create formatted text fields.
Text is required to be of a resulting type string.
Text is required to be passed; FormatOptions are optional and will default to the base values definedfor the symbol.
Return
format entry
Parameters
Name | Summary |
---|---|
text | displayed text |
open fun formatEntry(text: String, formatOptions: Array<Expression.FormatOption>): Expression.FormatEntry
Returns a format entry that can be used in format to create formatted text fields.
Text is required to be of a resulting type string.
Text is required to be passed; FormatOptions are optional and will default to the base values definedfor the symbol.
Return
format entry
Parameters
Name | Summary |
---|---|
text | displayed text |
formatOptions | format options |
open fun formatEntry(text: String): Expression.FormatEntry
Returns a format entry that can be used in format to create formatted text fields.
Text is required to be of a resulting type string.
Text is required to be passed; FormatOptions are optional and will default to the base values definedfor the symbol.
Return
format entry
Parameters
Name | Summary |
---|---|
text | displayed text |
format
open fun format(formatEntries: Array<Expression.FormatEntry>): Expression
Returns formatted text containing annotations for use in mixed-format text-field entries.
To build the expression, use formatEntry.
“format” expression can be used, for example, with the textField and accepts unlimited numbers of formatted sections.
Each section consist of the input, the displayed text, and options, like font-scale and text-font.
Example usage:
{@code SymbolLayer symbolLayer = new SymbolLayer(“layer-id”, “source-id”); symbolLayer.setProperties( textField( format( formatEntry( get(“header_property”), * formatFontScale(2.0), * formatTextFont(new String[] {“DIN Offc Pro Regular”, “Arial Unicode MS Regular”}) * ), * formatEntry(concat(literal(“ “), get(“description_property”)), formatFontScale(1.5)) ) ) ); }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
formatEntries | format entries |
geometryType
open fun geometryType(): Expression
Gets the feature’s geometry type: Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon.
Example usage:
{@code SymbolLayer symbolLayer = new SymbolLayer(“layer-id”, “source-id”); symbolLayer.setProperties( textField(concat(get(“key-to-value”), literal(“ “), geometryType())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
get
open fun get(input: Expression): Expression
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.
Example usage:
{@code SymbolLayer symbolLayer = new SymbolLayer(“layer-id”, “source-id”); symbolLayer.setProperties( textField(get(“key-to-feature”)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | expression input |
open fun get(input: String): Expression
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.
Example usage:
{@code SymbolLayer symbolLayer = new SymbolLayer(“layer-id”, “source-id”); symbolLayer.setProperties( textField(get(“key-to-feature”)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | string input |
open fun get(key: Expression, object: Expression): Expression
Retrieves a property value from another object.Returns null if the requested property is missing.
Example usage:
{@code SymbolLayer symbolLayer = new SymbolLayer(“layer-id”, “source-id”); symbolLayer.setProperties( textField(get(“key-to-property”, get(“key-to-object”))) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
key | a property value key |
object | an expression object |
open fun get(key: String, object: Expression): Expression
Retrieves a property value from another object.Returns null if the requested property is missing.
Example usage:
{@code SymbolLayer symbolLayer = new SymbolLayer(“layer-id”, “source-id”); symbolLayer.setProperties( textField(get(“key-to-property”, get(“key-to-object”))) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
key | a property value key |
object | an expression object |
gt
open fun gt(compareOne: Expression, compareTwo: Expression): Expression
Returns true if the first input is strictly greater than the second, false otherwise.The inputs must be numbers or strings, and both of the same type.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( gt(get(“keyToValue”), get(“keyToOtherValue”)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second expression |
open fun gt(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression
Returns true if the first input is strictly greater than the second, false otherwise.The inputs must be numbers or strings, and both of the same type.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( gt(get(“keyToValue”), get(“keyToOtherValue”), collator(true, false)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second expression |
collator | the collator expression |
open fun gt(compareOne: Expression, compareTwo: Number): Expression
Returns true if the first input is strictly greater than the second, false otherwise.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( gt(get(“keyToValue”), 2.0f) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second number |
open fun gt(compareOne: Expression, compareTwo: String): Expression
Returns true if the first input is strictly greater than the second, false otherwise.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( gt(get(“keyToValue”), “value”) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second string |
open fun gt(compareOne: Expression, compareTwo: String, collator: Expression): Expression
Returns true if the first input is strictly greater than the second, false otherwise.The inputs must be numbers or strings, and both of the same type.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( gt(get(“keyToValue”), get(“keyToOtherValue”), collator(true, false)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second String |
collator | the collator expression |
gte
open fun gte(compareOne: Expression, compareTwo: Expression): Expression
Returns true if the first input is greater than or equal to the second, false otherwise.The inputs must be numbers or strings, and both of the same type.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( gte(get(“keyToValue”), get(“keyToOtherValue”)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second expression |
open fun gte(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression
Returns true if the first input is greater than or equal to the second, false otherwise.The inputs must be numbers or strings, and both of the same type.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( gte(get(“keyToValue”), get(“keyToOtherValue”), collator(true, false)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second expression |
collator | the collator expression |
open fun gte(compareOne: Expression, compareTwo: Number): Expression
Returns true if the first input is greater than or equal to the second, false otherwise.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( gte(get(“keyToValue”), 2.0f) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second number |
open fun gte(compareOne: Expression, compareTwo: String): Expression
Returns true if the first input is greater than or equal to the second, false otherwise.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( neq(get(“keyToValue”), “value”) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second string |
open fun gte(compareOne: Expression, compareTwo: String, collator: Expression): Expression
Returns true if the first input is greater than or equal to the second, false otherwise.The inputs must be numbers or strings, and both of the same type.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( gte(get(“keyToValue”), get(“keyToOtherValue”), collator(true, false)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second String |
collator | the collator expression |
has
open fun has(key: Expression): Expression
Tests for the presence of an property value in the current feature’s properties.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( has(get(“keyToValue”)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
key | the expression property value key |
open fun has(key: String): Expression
Tests for the presence of an property value in the current feature’s properties.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( has(“keyToValue”) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
key | the property value key |
open fun has(key: Expression, object: Expression): Expression
Tests for the presence of an property value from another object.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( has(get(“keyToValue”), get(“keyToObject”)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
key | the expression property value key |
object | an expression object |
open fun has(key: String, object: Expression): Expression
Tests for the presence of an property value from another object.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( has(“keyToValue”, get(“keyToObject”)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
key | the property value key |
object | an expression object |
hashCode
open fun hashCode(): Int
Returns a hash code value for the expression.
Return
a hash code value for this expression
heatmapDensity
open fun heatmapDensity(): Expression
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.
Example usage:
{@code HeatmapLayer layer = new HeatmapLayer(“layer-id”, “source-id”); layer.setProperties( heatmapColor(interpolate(linear(), heatmapDensity(), literal(0), rgba(33, 102, 172, 0), literal(0.2), rgb(103, 169, 207), literal(0.4), rgb(209, 229, 240), literal(0.6), rgb(253, 219, 199), literal(0.8), rgb(239, 138, 98), literal(1), rgb(178, 24, 43)) ) ); }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
id
open fun id(): Expression
Gets the feature’s id, if it has one.
Example usage:
{@code SymbolLayer symbolLayer = new SymbolLayer(“layer-id”, “source-id”); symbolLayer.setProperties( textField(id()) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
image
open fun image(input: Expression): Expression
Returns image expression for use in ‘*-pattern’ and ‘icon-image’ layer properties. Compared tostring literals that can be used to represent an image, image expression allows to determine animage’s availability at runtime, thus, can be used in conditional coalesce operator.
Example usage:
{@code SymbolLayer symbolLayer = new SymbolLayer(“layer-id”, “source-id”); symbolLayer.setProperties( iconImage(image(get(“key-to-feature”))) ); * }
Example usage with coalesce operator:
{@code SymbolLayer symbolLayer = new SymbolLayer(“layer-id”, “source-id”); symbolLayer.setProperties( iconImage( coalesce( image(literal(“maki-11”)), image(literal(“bicycle-15”)), image(literal(“default-icon”)) ) ) ); * }
Return
expression
See also
Name | Summary |
---|---|
Image expression | Image expression |
Parameters
Name | Summary |
---|---|
input | expression input |
in
open fun in(needle: Expression, haystack: Expression): Expression
Retrieves whether an item exists in an array or a substring exists in a string.
Return
true if exists.
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
needle | the item expression |
haystack | the array or string expression |
open fun in(needle: Number, haystack: Expression): Expression
Retrieves whether an item exists in an array or a substring exists in a string.
Return
true if exists.
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
needle | the item expression |
haystack | the array or string expression |
open fun in(needle: String, haystack: Expression): Expression
Retrieves whether an item exists in an array or a substring exists in a string.
Return
true if exists.
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
needle | the item expression |
haystack | the array or string expression |
interpolate
open fun interpolate(interpolation: Expression.Interpolator, number: Expression, stops: Array<Expression>): Expression
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
.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setProperties( fillColor( interpolate(exponential(0.5f), zoom(), stop(1.0f, color(Color.RED)), stop(5.0f, color(Color.BLUE)), stop(10.0f, color(Color.GREEN) ) ) ) ); }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
interpolation | type of interpolation |
number | the input expression |
stops | pair of input and output values |
open fun interpolate(interpolation: Expression.Interpolator, number: Expression, stops: Array<Expression.Stop>): Expression
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
.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setProperties( fillColor( interpolate( exponential(0.5f), zoom(), stop(1.0f, color(Color.RED)), stop(5.0f, color(Color.BLUE)), stop(10.0f, color(Color.GREEN)) ) ) ); }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
interpolation | type of interpolation |
number | the input expression |
stops | pair of input and output values |
isSupportedScript
open fun isSupportedScript(expression: Expression): Expression
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).
Example usage:
{@code mapboxMap.getStyle().addLayer(new SymbolLayer(“layer-id”, “source-id”) .withProperties( textField( switchCase( isSupportedScript(get(“name_property”)), get(“name_property”), literal(“not-compatible”) ) ) )); }
Return
expression
See also
Name | Summary |
---|---|
Style | Stylespecification |
Parameters
Name | Summary |
---|---|
expression | the expression to evaluate |
open fun isSupportedScript(string: String): Expression
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).
Example usage:
{@code mapboxMap.getStyle().addLayer(new SymbolLayer(“layer-id”, “source-id”) .withProperties( textField( switchCase( isSupportedScript(“ಗೌರವಾರ್ಥವಾಗಿ”), literal(“ಗೌರವಾರ್ಥವಾಗಿ”), literal(“not-compatible”)) ) ) ); }
Return
expression
See also
Name | Summary |
---|---|
Style | Stylespecification |
Parameters
Name | Summary |
---|---|
string | the string to evaluate |
length
open fun length(expression: Expression): Expression
Gets the length of an array or string.
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
expression | an expression object or expression string |
open fun length(input: String): Expression
Gets the length of an array or string.
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | a string |
let
open fun let(input: Array<Expression>): Expression
Binds input to named variables,which can then be referenced in the result expression using var or var.
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | expression input |
lineProgress
open fun lineProgress(): Expression
Gets the progress along a gradient line. Can only be used in the line-gradient property.
Example usage:
{@code LineLayer layer = new LineLayer(“layer-id”, “source-id”); layer.setProperties( lineGradient(interpolate( linear(), lineProgress(), stop(0f, rgb(0, 0, 255)), stop(0.5f, rgb(0, 255, 0)), stop(1f, rgb(255, 0, 0))) ) ); }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
linear
open fun linear(): Expression.Interpolator
interpolates linearly between the pair of stops just less than and just greater than the input.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setProperties( fillColor( interpolate( linear(), zoom(), stop(1.0f, color(Color.RED)), stop(5.0f, color(Color.BLUE)), stop(10.0f, color(Color.GREEN)) ) ) ); }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
literal
open fun literal(number: Number): Expression
Create a literal number expression.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(literal(10.0f)) ); * }
Return
the expression
Parameters
Name | Summary |
---|---|
number | the number |
open fun literal(string: String): Expression
Create a literal string expression.
Example usage:
{@code SymbolLayer symbolLayer = new SymbolLayer(“layer-id”, “source-id”); symbolLayer.setProperties( textField(literal(“Text”)) ); * }
Return
the expression
Parameters
Name | Summary |
---|---|
string | the string |
open fun literal(bool: Boolean): Expression
Create a literal boolean expression.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setProperties( fillAntialias(literal(true)) ); * }
Return
the expression
Parameters
Name | Summary |
---|---|
bool | the boolean |
open fun literal(object: Any): Expression
Create a literal object expression.
Return
the expression
Parameters
Name | Summary |
---|---|
object | the object |
open fun literal(array: Array
Create a literal array expression
Return
the expression
Parameters
Name | Summary |
---|---|
array | the array |
ln
open fun ln(number: Expression): Expression
Returns the natural logarithm of the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(ln(pi())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the number to take natural logarithm from |
open fun ln(number: Number): Expression
Returns the natural logarithm of the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(ln(10)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the number to take natural logarithm from |
ln2
open fun ln2(): Expression
Returns mathematical constant ln(2).
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(product(literal(10.0f), ln2())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
log10
open fun log10(number: Expression): Expression
Returns the base-ten logarithm of the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(log10(pi())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the number to take base-ten logarithm from |
open fun log10(number: Number): Expression
Returns the base-ten logarithm of the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(log10(10)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the number to take base-ten logarithm from |
log2
open fun log2(number: Expression): Expression
Returns the base-two logarithm of the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(log2(pi())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the number to take base-two logarithm from |
open fun log2(number: Number): Expression
Returns the base-two logarithm of the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(log2(2)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the number to take base-two logarithm from |
lt
open fun lt(compareOne: Expression, compareTwo: Expression): Expression
Returns true if the first input is strictly less than the second, false otherwise.The inputs must be numbers or strings, and both of the same type.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( lt(get(“keyToValue”), get(“keyToOtherValue”), collator(true, false)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second expression |
open fun lt(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression
Returns true if the first input is strictly less than the second, false otherwise.The inputs must be numbers or strings, and both of the same type.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( lt(get(“keyToValue”), get(“keyToOtherValue”), collator(true, false)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second number |
collator | the collator expression |
open fun lt(compareOne: Expression, compareTwo: Number): Expression
Returns true if the first input is strictly less than the second, false otherwise.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( lt(get(“keyToValue”), 2.0f) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second number |
open fun lt(compareOne: Expression, compareTwo: String): Expression
Returns true if the first input is strictly less than the second, false otherwise.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( lt(get(“keyToValue”), “value”) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second string |
open fun lt(compareOne: Expression, compareTwo: String, collator: Expression): Expression
Returns true if the first input is strictly less than the second, false otherwise.The inputs must be numbers or strings, and both of the same type.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( lt(get(“keyToValue”), get(“keyToOtherValue”), collator(true, false)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second String |
collator | the collator expression |
lte
open fun lte(compareOne: Expression, compareTwo: Expression): Expression
Returns true if the first input is less than or equal to the second, false otherwise.The inputs must be numbers or strings, and both of the same type.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( lte(get(“keyToValue”), get(“keyToOtherValue”)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second expression |
open fun lte(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression
Returns true if the first input is less than or equal to the second, false otherwise.The inputs must be numbers or strings, and both of the same type.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( lte(get(“keyToValue”), get(“keyToOtherValue”), collator(true, false)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second expression |
collator | the collator expression |
open fun lte(compareOne: Expression, compareTwo: Number): Expression
Returns true if the first input is less than or equal to the second, false otherwise.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( lte(get(“keyToValue”), 2.0f) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second number |
open fun lte(compareOne: Expression, compareTwo: String): Expression
Returns true if the first input is less than or equal to the second, false otherwise.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( lte(get(“keyToValue”), “value”) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second string |
open fun lte(compareOne: Expression, compareTwo: String, collator: Expression): Expression
Returns true if the first input is less than or equal to the second, false otherwise.The inputs must be numbers or strings, and both of the same type.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( lte(get(“keyToValue”), get(“keyToOtherValue”), collator(true, false)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second String |
collator | the collator expression |
match
open fun match(input: Array<Expression>): Expression
Selects the output whose label value matches the input value, or the fallback value if no match is found.The input
can be any string or number expression.Each label can either be a single literal value or an array of values.If types of the input and keys don’t match, or the input value doesn’t exist,the expresion will fail without falling back to the default value.
Example usage:
{@code SymbolLayer symbolLayer = new SymbolLayer(“layer-id”, “source-id”); symbolLayer.setProperties( textColor( match(get(“keyToValue”), literal(1), rgba(255, 0, 0, 1.0f), literal(2), rgba(0, 0, 255.0f, 1.0f), rgba(0.0f, 255.0f, 0.0f, 1.0f) ) ) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | expression input |
open fun match(input: Expression, defaultOutput: Expression, stops: Array<Expression.Stop>): Expression
Selects the output whose label value matches the input value, or the fallback value if no match is found.The input
can be any string or number expression.Each label can either be a single literal value or an array of values.If types of the input and keys don’t match, or the input value doesn’t exist,the expresion will fail without falling back to the default value.
Example usage:
{@code SymbolLayer symbolLayer = new SymbolLayer(“layer-id”, “source-id”); symbolLayer.setProperties( textColor( match(get(“keyToValue”), rgba(0.0f, 255.0f, 0.0f, 1.0f), stop(1f, rgba(255, 0, 0, 1.0f)), stop(2f, rgba(0, 0, 255.0f, 1.0f)) ) ) ); }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | expression input |
max
open fun max(numbers: Array<Expression>): Expression
Returns the maximum value of the inputs.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(max(pi(), product(pi(), pi()))) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
numbers | varargs of numbers to get the maximum from |
open fun max(numbers: Array
Returns the maximum value of the inputs.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(max(3.141, 3.14f, 3.15f)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
numbers | varargs of numbers to get the maximum from |
min
open fun min(numbers: Array<Expression>): Expression
Returns the minimum value of the inputs.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(min(pi(), literal(3.14f), literal(3.15f))) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
numbers | varargs of numbers to get the minimum from |
open fun min(numbers: Array
Returns the minimum value of the inputs.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(min(3.141, 3.14f, 3.15f)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
numbers | varargs of numbers to get the minimum from |
mod
open fun mod(first: Expression, second: Expression): Expression
Returns the remainder after integer division of the first input by the second.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(mod(literal(10.0f), pi())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
first | the first number |
second | the second number |
open fun mod(first: Number, second: Number): Expression
Returns the remainder after integer division of the first input by the second.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(mod(10.0f, 10.0f)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
first | the first number |
second | the second number |
neq
open fun neq(compareOne: Expression, compareTwo: Expression): Expression
Returns true if the input values are not equal, false otherwise.The inputs must be numbers, strings, or booleans, and both of the same type.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( neq(get(“keyToValue”), get(“keyToOtherValue”)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second expression |
open fun neq(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression
Returns true if the input values are not equal, false otherwise.The inputs must be numbers, strings, or booleans, and both of the same type.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( neq(get(“keyToValue”), get(“keyToOtherValue”), collator(true, false)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second expression |
collator | the collator expression |
open fun neq(compareOne: Expression, compareTwo: Boolean): Expression
Returns true if the input values are equal, false otherwise.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( neq(get(“keyToValue”), true) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second boolean |
open fun neq(compareOne: Expression, compareTwo: String): Expression
Returns true
if the input values are not equal, false
otherwise.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( neq(get(“keyToValue”), “value”) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second string |
open fun neq(compareOne: Expression, compareTwo: String, collator: Expression): Expression
Returns true if the input values are not equal, false otherwise.The inputs must be numbers, strings, or booleans, and both of the same type.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( neq(get(“keyToValue”), get(“keyToOtherValue”), collator(true, false)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second String |
collator | the collator expression |
open fun neq(compareOne: Expression, compareTwo: Number): Expression
Returns true
if the input values are not equal, false
otherwise.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( neq(get(“keyToValue”), 2.0f) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
compareOne | the first expression |
compareTwo | the second number |
not
open fun not(input: Expression): Expression
Logical negation. Returns true
if the input is false
, and false
if the input is true
.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( not(get(“keyToValue”)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | expression input |
open fun not(input: Boolean): Expression
Logical negation. Returns true
if the input is false
, and false
if the input is true
.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setFilter( not(false) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | boolean input |
numberFormat
open fun numberFormat(number: Expression, options: Array<Expression.NumberFormatOption>): Expression
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 numberof fractional digits to include.
Return
expression
Parameters
Name | Summary |
---|---|
number | number expression |
options | number formatting options |
open fun numberFormat(number: Number, options: Array<Expression.NumberFormatOption>): Expression
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 numberof fractional digits to include.
Return
expression
Parameters
Name | Summary |
---|---|
number | number expression |
options | number formatting options |
number
open fun number(input: Array<Expression>): Expression
Asserts that the input value is a number.If multiple values are provided, each one is evaluated in order until a number value is obtained.If none of the inputs are numbers, the expression is an error.The asserted input value is returned as result.
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | expression input |
object
open fun object(input: Expression): Expression
Asserts that the input value is an object. If it is not, the expression is an errorThe asserted input value is returned as result.
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | expression input |
pi
open fun pi(): Expression
Returns the mathematical constant pi.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(product(literal(10.0f), pi())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
pow
open fun pow(first: Expression, second: Expression): Expression
Returns the result of raising the first input to the power specified by the second.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(pow(pi(), literal(2.0f))) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
first | the first number |
second | the second number |
open fun pow(first: Number, second: Number): Expression
Returns the result of raising the first input to the power specified by the second.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(pow(5.0f, 2.0f)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
first | the first number |
second | the second number |
product
open fun product(numbers: Array<Expression>): Expression
Returns the product of the inputs.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(product(literal(10.0f), ln2())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
numbers | the numbers to calculate the product for |
open fun product(numbers: Array
Returns the product of the inputs.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(product(10.0f, 2.0f)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
numbers | the numbers to calculate the product for |
properties
open fun properties(): Expression
Gets the feature properties object.
Note that in some cases, it may be more efficient to use get} instead.
Example usage:
{@code SymbolLayer symbolLayer = new SymbolLayer(“layer-id”, “source-id”); symbolLayer.setProperties( textField(get(“key-to-value”, properties())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
raw
open fun raw(rawExpression: String): Expression
Returns a DSL equivalent of a raw expression.
If your raw expression contains a coma (,) delimited literal it has to be enclosed with double quotes (“),for example
{@code [“to-color”, “rgba(255, 0, 0, 255)”] }
Return
the resulting expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
rawExpression | the raw expression |
resolvedLocale
open fun resolvedLocale(collator: Expression): Expression
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.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleColor(switchCase( eq(literal(“it”), resolvedLocale(collator(true, true, Locale.ITALY))), literal(ColorUtils.colorToRgbaString (Color.GREEN)), literal(ColorUtils.colorToRgbaString(Color.RED)))) ); }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
collator | the collator expression |
rgb
open fun rgb(red: Expression, green: Expression, blue: Expression): Expression
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.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setProperties( fillColor( rgb( literal(255.0f), literal(255.0f), literal(255.0f) ) ) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
red | red color expression |
green | green color expression |
blue | blue color expression |
open fun rgb(red: Number, green: Number, blue: Number): Expression
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.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setProperties( fillColor( rgb(255.0f, 255.0f, 255.0f) ) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
red | red color value |
green | green color value |
blue | blue color value |
rgba
open fun rgba(red: Expression, green: Expression, blue: Expression, alpha: Expression): Expression
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.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setProperties( fillColor( rgba( literal(255.0f), literal(255.0f), literal(255.0f), literal(1.0f) ) ) ); }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
red | red color value |
green | green color value |
blue | blue color value |
alpha | alpha color value |
open fun rgba(red: Number, green: Number, blue: Number, alpha: Number): Expression
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.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setProperties( fillColor( rgba(255.0f, 255.0f, 255.0f, 1.0f) ) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
red | red color value |
green | green color value |
blue | blue color value |
alpha | alpha color value |
round
open fun round(expression: Expression): Expression
Rounds the input to the nearest integer.Halfway values are rounded away from zero.For example [\"round\", -1.5]
evaluates to -2.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(round(pi())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
expression | number expression to round |
open fun round(number: Number): Expression
Rounds the input to the nearest integer.Halfway values are rounded away from zero.For example [\"round\", -1.5]
evaluates to -2.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(round(3.14159265359f)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | number to round |
sin
open fun sin(number: Expression): Expression
Returns the sine of the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(sin(pi())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the number to calculate the sine for |
open fun sin(number: Number): Expression
Returns the sine of the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(sin(90.0f)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the number to calculate the sine for |
sqrt
open fun sqrt(number: Expression): Expression
Returns the square root of the input
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(sqrt(pi())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the number to take the square root from |
open fun sqrt(number: Number): Expression
Returns the square root of the input
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(sqrt(25.0f)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the number to take the square root from |
step
open fun step(input: Number, defaultOutput: Expression, stops: Array<Expression>): Expression
Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs ofinput 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 input if the input is less than the first stop.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius( step(zoom(), literal(0.0f), literal(1.0f), literal(2.5f), literal(10.0f), literal(5.0f)) ) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | the input value |
defaultOutput | the default output expression |
stops | pair of input and output values |
open fun step(input: Expression, defaultOutput: Expression, stops: Array<Expression>): Expression
Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs ofinput 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 input if the input is less than the first stop.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius( step(zoom(), literal(0.0f), literal(1.0f), literal(2.5f), literal(10.0f), literal(5.0f)) ) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | the input expression |
defaultOutput | the default output expression |
stops | pair of input and output values |
open fun step(input: Number, defaultOutput: Expression, stops: Array<Expression.Stop>): Expression
Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs ofinput 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 input if the input is less than the first stop.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius( step(zoom(), literal(0.0f), stop(1, 2.5f), stop(10, 5.0f)) ) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | the input value |
defaultOutput | the default output expression |
stops | pair of input and output values |
open fun step(input: Expression, defaultOutput: Expression, stops: Array<Expression.Stop>): Expression
Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs ofinput 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 input if the input is less than the first stop.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius( step(zoom(), literal(0.0f), stop(1, 2.5f), stop(10, 5.0f)) ) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | the input value |
defaultOutput | the default output expression |
stops | pair of input and output values |
open fun step(input: Number, defaultOutput: Number, stops: Array<Expression>): Expression
Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs ofinput 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 input if the input is less than the first stop.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius( step(1.0f, 0.0f, literal(1.0f), literal(2.5f), literal(10.0f), literal(5.0f)) ) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | the input value |
defaultOutput | the default output expression |
stops | pair of input and output values |
open fun step(input: Expression, defaultOutput: Number, stops: Array<Expression>): Expression
Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs ofinput 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 input if the input is less than the first stop.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius( step(zoom(), 0.0f, literal(1.0f), literal(2.5f), literal(10.0f), literal(5.0f)) ) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | the input expression |
defaultOutput | the default output expression |
stops | pair of input and output values |
open fun step(input: Number, defaultOutput: Number, stops: Array<Expression.Stop>): Expression
Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs ofinput 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 input if the input is less than the first stop.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius( step(zoom(), 0.0f, stop(1, 2.5f), stop(10, 5.0f)) ) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | the input value |
defaultOutput | the default output expression |
stops | pair of input and output values |
open fun step(input: Expression, defaultOutput: Number, stops: Array<Expression.Stop>): Expression
Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs ofinput 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 input if the input is less than the first stop.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius( step(zoom(), 0.0f, stop(1, 2.5f), stop(10, 5.0f)) ) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | the input value |
defaultOutput | the default output expression |
stops | pair of input and output values |
stop
open fun stop(stop: Any, value: Any): Expression.Stop
Produces a stop value.
Can be used for stop as part of varargs parameter in step or interpolate.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius( step(zoom(), literal(0.0f), stop(1.0f, 2.5f), stop(10.0f, 5.0f)) ) ); * }
Return
the stop
Parameters
Name | Summary |
---|---|
stop | the stop input |
value | the stop output |
string
open fun string(input: Array<Expression>): Expression
Asserts that the input value is a string.If multiple values are provided, each one is evaluated in order until a string value is obtained.If none of the inputs are strings, the expression is an error.The asserted input value is returned as result.
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | expression input |
subtract
open fun subtract(number: Expression): Expression
Returns the result of subtracting a number from 0.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(subtract(pi())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the number subtract from 0 |
open fun subtract(number: Number): Expression
Returns the result of subtracting a number from 0.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(subtract(10.0f)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the number subtract from 0 |
open fun subtract(first: Expression, second: Expression): Expression
Returns the result of subtracting the second input from the first.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(subtract(literal(10.0f), pi())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
first | the first number |
second | the second number |
open fun subtract(first: Number, second: Number): Expression
Returns the result of subtracting the second input from the first.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(subtract(10.0f, 20.0f)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
first | the first number |
second | the second number |
sum
open fun sum(numbers: Array<Expression>): Expression
Returns the sum of the inputs.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(sum(literal(10.0f), ln2(), pi())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
numbers | the numbers to calculate the sum for |
open fun sum(numbers: Array
Returns the sum of the inputs.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(sum(10.0f, 5.0f, 3.0f)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
numbers | the numbers to calculate the sum for |
switchCase
open fun switchCase(input: Array<Expression>): Expression
Selects the first output whose corresponding test condition evaluates to true.
For each case a condition and an output should be provided.The last parameter should provide the default output.
Example usage:
{@code SymbolLayer symbolLayer = new SymbolLayer(“layer-id”, “source-id”); symbolLayer.setProperties( iconSize( switchCase( get(KEY_TO_BOOLEAN), literal(3.0f), get(KEY_TO_OTHER_BOOLEAN), literal(5.0f), * literal(1.0f) // default value * ) * ) * ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | expression input |
tan
open fun tan(number: Expression): Expression
Returns the tangent of the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(tan(pi())) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the number to calculate the tangent for |
open fun tan(number: Number): Expression
Returns the tangent of the input.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(tan(45.0f)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
number | the number to calculate the tangent for |
toArray
@NonNull()
open fun toArray(): Array
Converts the expression to Object array representation.
The output will later be converted to a JSON Object array.
Return
the converted object array expression
toBool
open fun toBool(input: Expression): Expression
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.
Example usage:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(toBool(get(“key-to-value”))) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | expression input |
toColor
open fun toColor(input: Expression): Expression
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.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setProperties( fillColor(toColor(get(“keyStringValue”))) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | expression input |
toNumber
open fun toNumber(input: Expression): Expression
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:
{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(toNumber(get(“key-to-string-value”))) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | expression input |
toRgba
open fun toRgba(expression: Expression): Expression
Returns a four-element array containing the input color’s red, green, blue, and alpha components, in that order.
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
expression | an expression to convert to a color |
toString
open fun toString(input: Expression): Expression
Converts the input value to a string.If the input is null, the result is null.If the input is a boolean, the result is true or false.If the input is a number, it is converted to a string by NumberToString in 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 in the ECMAScriptLanguage Specification.
Example usage:
{@code SymbolLayer symbolLayer = new SymbolLayer(“layer-id”, “source-id”); symbolLayer.setProperties( textField(get(“key-to-number-value”)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | expression input |
open fun toString(): String
Returns a string representation of the object that matches the definition set in the style specification.
If this expression contains a coma (,) delimited literal, like ‘rgba(r, g, b, a)`,it will be enclosed with double quotes (“).
Return
a string representation of the object.
typeOf
open fun typeOf(input: Expression): Expression
Returns a string describing the type of the given value.
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
input | expression input |
upcase
open fun upcase(string: Expression): Expression
Returns the input string converted to uppercase.
Follows the Unicode Default Case Conversion algorithmand the locale-insensitive case mappings in the Unicode Character Database.
Example usage:
{@code SymbolLayer symbolLayer = new SymbolLayer(“layer-id”, “source-id”); symbolLayer.setProperties( textField(upcase(get(“key-to-string-value”))) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
string | the string to upcase |
open fun upcase(string: String): Expression
Returns the input string converted to uppercase.
Follows the Unicode Default Case Conversion algorithmand the locale-insensitive case mappings in the Unicode Character Database.
Example usage:
{@code SymbolLayer symbolLayer = new SymbolLayer(“layer-id”, “source-id”); symbolLayer.setProperties( textField(upcase(“text”)) ); * }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
string | string to upcase |
var
open fun var(expression: Expression): Expression
References variable bound using let.
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
expression | the variable naming expression that was bound with using let |
open fun var(variableName: String): Expression
References variable bound using let.
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
variableName | the variable naming that was bound with using let |
within
open fun within(polygon: Polygon): Expression
zoom
open fun zoom(): Expression
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.
Example usage:
{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setProperties( fillColor( interpolate( exponential(0.5f), zoom(), stop(1.0f, color(Color.RED)), stop(5.0f, color(Color.BLUE)), stop(10.0f, color(Color.GREEN)) ) ) ); }
Return
expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Array
open class Array
Expression array type.
Converter
class Converter
Converts a JsonArray or a raw expression to a Java expression.
Functions
Name | Summary |
---|---|
convert | open fun convert(jsonArray: JsonArray): Expression Converts a JsonArray to an expression open fun convert(jsonElement: JsonElement): Expression Converts a JsonElement to an expression open fun convert(rawExpression: String): Expression Converts a raw expression to a DSL equivalent. |
convert
open fun convert(jsonArray: JsonArray): Expression
Converts a JsonArray to an expression
Return
the expression
Parameters
Name | Summary |
---|---|
jsonArray | the json array to convert |
open fun convert(jsonElement: JsonElement): Expression
Converts a JsonElement to an expression
Return
the expression
Parameters
Name | Summary |
---|---|
jsonElement | the json element to convert |
open fun convert(rawExpression: String): Expression
Converts a raw expression to a DSL equivalent.
Return
the resulting expression
See also
Name | Summary |
---|---|
Style specification | Style specification |
Parameters
Name | Summary |
---|---|
rawExpression | the raw expression to convert |
ExpressionLiteral
open class ExpressionLiteral : Expression, Expression.ValueExpression
ExpressionLiteral wraps an object to be used as a literal in an expression.
ExpressionLiteral is created with literal, literal, literal and literal.
Constructors
Name | Summary |
---|---|
ExpressionLiteral | open fun ExpressionLiteral(object: Any)Create an expression literal. |
Functions
Name | Summary |
---|---|
abs | open fun abs(expression: Expression): Expression open fun abs(number: Number): Expression Returns the absolute value of the input. |
accumulated | open fun accumulated(): Expression Gets the value of a cluster property accumulated so far. |
acos | open fun acos(number: Expression): Expression open fun acos(number: Number): Expression Returns the arccosine of the input. |
all | open fun all(input: Array<Expression>): Expression Returns true if all the inputs are true , false otherwise. |
any | open fun any(input: Array<Expression>): Expression Returns true if any of the inputs are true , false otherwise. |
array | open fun array(input: Expression): Expression 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. |
asin | open fun asin(number: Expression): Expression open fun asin(number: Number): Expression Returns the arcsine of the input. |
at | open fun at(number: Expression, expression: Expression): Expression open fun at(number: Number, expression: Expression): Expression Retrieves an item from an array. |
atan | open fun atan(number: Expression): Expression open fun atan(number: Number): Expression Returns the arctangent of the input. |
bool | open fun bool(input: Array<Expression>): Expression Asserts that the input value is a boolean.If multiple values are provided, each one is evaluated in order until a boolean value is obtained.If none of the inputs are booleans, the expression is an error.The asserted input value is returned as result. |
ceil | open fun ceil(expression: Expression): Expression open fun ceil(number: Number): Expression Returns the smallest integer that is greater than or equal to the input. |
coalesce | open fun coalesce(input: Array<Expression>): Expression Evaluates each expression in turn until the first non-null value is obtained, and returns that value. |
collator | open fun collator(caseSensitive: Boolean, diacriticSensitive: Boolean): Expression open fun collator(caseSensitive: Expression, diacriticSensitive: Expression): Expression open fun collator(caseSensitive: Boolean, diacriticSensitive: Boolean, locale: Locale): Expression open fun collator(caseSensitive: Expression, diacriticSensitive: Expression, locale: Expression): Expression 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. |
color | open fun color(color: Int): Expression Expression literal utility method to convert a color int to an color expressionExample usage:{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setProperties( fillColor(color(Color.GREEN)) ); * } |
concat | open fun concat(input: Array<Expression>): Expression open fun concat(input: Array Returns a string consisting of the concatenation of the inputs. |
cos | open fun cos(number: Expression): Expression open fun cos(number: Number): Expression Returns the cosine of the input. |
cubicBezier | open fun cubicBezier(x1: Expression, y1: Expression, x2: Expression, y2: Expression): Expression.Interpolator open fun cubicBezier(x1: Number, y1: Number, x2: Number, y2: Number): Expression.Interpolator Interpolates using the cubic bezier curve defined by the given control points. |
distance | open fun distance(geoJson: GeoJson): Expression Retrieves the shortest distance between two geometries.The returned value can be consumed as an input into another expression for changing a paint or layout propertyor filtering features by distance. |
division | open fun division(first: Expression, second: Expression): Expression open fun division(first: Number, second: Number): Expression Returns the result of floating point division of the first input by the second. |
downcase | open fun downcase(input: Expression): Expression open fun downcase(input: String): Expression Returns the input string converted to lowercase. |
e | open fun e(): Expression Returns the mathematical constant e. |
eq | open fun eq(compareOne: Expression, compareTwo: Boolean): Expression open fun eq(compareOne: Expression, compareTwo: Number): Expression open fun eq(compareOne: Expression, compareTwo: String): Expression Returns true if the input values are equal, false otherwise. open fun eq(compareOne: Expression, compareTwo: Expression): Expression open fun eq(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression open fun eq(compareOne: Expression, compareTwo: String, collator: Expression): Expression Returns true if the input values are equal, false otherwise.The inputs must be numbers, strings, or booleans, and both of the same type. |
equals | open fun equals(o: Any): Boolean Indicates whether some other object is “equal to” this one. |
exponential | open fun exponential(expression: Expression): Expression.Interpolator Interpolates exponentially between the stops just less than and just greater than the input.The parameter 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. open fun exponential(base: Number): Expression.Interpolator 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. |
floor | open fun floor(expression: Expression): Expression open fun floor(number: Number): Expression Returns the largest integer that is less than or equal to the input. |
format | open fun format(formatEntries: Array<Expression.FormatEntry>): Expression Returns formatted text containing annotations for use in mixed-format text-field entries. |
formatEntry | open fun formatEntry(text: Expression): Expression.FormatEntry open fun formatEntry(text: String): Expression.FormatEntry open fun formatEntry(text: Expression, formatOptions: Array<Expression.FormatOption>): Expression.FormatEntry open fun formatEntry(text: String, formatOptions: Array<Expression.FormatOption>): Expression.FormatEntry Returns a format entry that can be used in format to create formatted text fields. |
geometryType | open fun geometryType(): Expression Gets the feature’s geometry type: Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon. |
get | open fun get(input: Expression): Expression open fun get(input: String): Expression 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. open fun get(key: Expression, object: Expression): Expression open fun get(key: String, object: Expression): Expression Retrieves a property value from another object.Returns null if the requested property is missing. |
gt | open fun gt(compareOne: Expression, compareTwo: Expression): Expression open fun gt(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression open fun gt(compareOne: Expression, compareTwo: String, collator: Expression): Expression Returns true if the first input is strictly greater than the second, false otherwise.The inputs must be numbers or strings, and both of the same type. open fun gt(compareOne: Expression, compareTwo: Number): Expression open fun gt(compareOne: Expression, compareTwo: String): Expression Returns true if the first input is strictly greater than the second, false otherwise. |
gte | open fun gte(compareOne: Expression, compareTwo: Expression): Expression open fun gte(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression open fun gte(compareOne: Expression, compareTwo: String, collator: Expression): Expression Returns true if the first input is greater than or equal to the second, false otherwise.The inputs must be numbers or strings, and both of the same type. open fun gte(compareOne: Expression, compareTwo: Number): Expression open fun gte(compareOne: Expression, compareTwo: String): Expression Returns true if the first input is greater than or equal to the second, false otherwise. |
has | open fun has(key: Expression): Expression open fun has(key: String): Expression Tests for the presence of an property value in the current feature’s properties. open fun has(key: Expression, object: Expression): Expression open fun has(key: String, object: Expression): Expression Tests for the presence of an property value from another object. |
hashCode | open fun hashCode(): Int Returns a hash code value for the expression literal. |
heatmapDensity | open fun heatmapDensity(): Expression 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. |
id | open fun id(): Expression Gets the feature’s id, if it has one. |
image | open fun image(input: Expression): Expression Returns image expression for use in ‘*-pattern’ and ‘icon-image’ layer properties. |
in | open fun in(needle: Expression, haystack: Expression): Expression open fun in(needle: Number, haystack: Expression): Expression open fun in(needle: String, haystack: Expression): Expression Retrieves whether an item exists in an array or a substring exists in a string. |
interpolate | open fun interpolate(interpolation: Expression.Interpolator, number: Expression, stops: Array<Expression>): Expression open fun interpolate(interpolation: Expression.Interpolator, number: Expression, stops: Array<Expression.Stop>): Expression 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 . |
isSupportedScript | open fun isSupportedScript(expression: Expression): Expression open fun isSupportedScript(string: String): Expression 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. |
length | open fun length(expression: Expression): Expression open fun length(input: String): Expression Gets the length of an array or string. |
let | open fun let(input: Array<Expression>): Expression Binds input to named variables,which can then be referenced in the result expression using var or var. |
linear | open fun linear(): Expression.Interpolator interpolates linearly between the pair of stops just less than and just greater than the input. |
lineProgress | open fun lineProgress(): Expression Gets the progress along a gradient line. |
literal | open fun literal(bool: Boolean): Expression Create a literal boolean expression. open fun literal(number: Number): Expression Create a literal number expression. open fun literal(object: Any): Expression Create a literal object expression. open fun literal(array: Array Create a literal array expression open fun [literal](#literal)(string: String): [Expression](../) Create a literal string expression. |
ln | open fun ln(number: Expression): Expression open fun ln(number: Number): Expression Returns the natural logarithm of the input. |
ln2 | open fun ln2(): Expression Returns mathematical constant ln(2). |
log10 | open fun log10(number: Expression): Expression open fun log10(number: Number): Expression Returns the base-ten logarithm of the input. |
log2 | open fun log2(number: Expression): Expression open fun log2(number: Number): Expression Returns the base-two logarithm of the input. |
lt | open fun lt(compareOne: Expression, compareTwo: Expression): Expression open fun lt(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression open fun lt(compareOne: Expression, compareTwo: String, collator: Expression): Expression Returns true if the first input is strictly less than the second, false otherwise.The inputs must be numbers or strings, and both of the same type. open fun lt(compareOne: Expression, compareTwo: Number): Expression open fun lt(compareOne: Expression, compareTwo: String): Expression Returns true if the first input is strictly less than the second, false otherwise. |
lte | open fun lte(compareOne: Expression, compareTwo: Expression): Expression open fun lte(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression open fun lte(compareOne: Expression, compareTwo: String, collator: Expression): Expression Returns true if the first input is less than or equal to the second, false otherwise.The inputs must be numbers or strings, and both of the same type. open fun lte(compareOne: Expression, compareTwo: Number): Expression open fun lte(compareOne: Expression, compareTwo: String): Expression Returns true if the first input is less than or equal to the second, false otherwise. |
match | open fun match(input: Array<Expression>): Expression open fun match(input: Expression, defaultOutput: Expression, stops: Array<Expression.Stop>): Expression Selects the output whose label value matches the input value, or the fallback value if no match is found.The input can be any string or number expression.Each label can either be a single literal value or an array of values.If types of the input and keys don’t match, or the input value doesn’t exist,the expresion will fail without falling back to the default value. |
max | open fun max(numbers: Array<Expression>): Expression open fun max(numbers: Array Returns the maximum value of the inputs. |
min | open fun min(numbers: Array<Expression>): Expression open fun min(numbers: Array Returns the minimum value of the inputs. |
mod | open fun mod(first: Expression, second: Expression): Expression open fun mod(first: Number, second: Number): Expression Returns the remainder after integer division of the first input by the second. |
neq | open fun neq(compareOne: Expression, compareTwo: Boolean): Expression Returns true if the input values are equal, false otherwise. open fun neq(compareOne: Expression, compareTwo: Expression): Expression open fun neq(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression open fun neq(compareOne: Expression, compareTwo: String, collator: Expression): Expression Returns true if the input values are not equal, false otherwise.The inputs must be numbers, strings, or booleans, and both of the same type. open fun neq(compareOne: Expression, compareTwo: Number): Expression open fun neq(compareOne: Expression, compareTwo: String): Expression Returns true if the input values are not equal, false otherwise. |
not | open fun not(input: Boolean): Expression open fun not(input: Expression): Expression Logical negation. |
number | open fun number(input: Array<Expression>): Expression Asserts that the input value is a number.If multiple values are provided, each one is evaluated in order until a number value is obtained.If none of the inputs are numbers, the expression is an error.The asserted input value is returned as result. |
numberFormat | open fun numberFormat(number: Expression, options: Array<Expression.NumberFormatOption>): Expression open fun numberFormat(number: Number, options: Array<Expression.NumberFormatOption>): Expression 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 numberof fractional digits to include. |
object | open fun object(input: Expression): Expression Asserts that the input value is an object. |
pi | open fun pi(): Expression Returns the mathematical constant pi. |
pow | open fun pow(first: Expression, second: Expression): Expression open fun pow(first: Number, second: Number): Expression Returns the result of raising the first input to the power specified by the second. |
product | open fun product(numbers: Array<Expression>): Expression open fun product(numbers: Array Returns the product of the inputs. |
properties | open fun properties(): Expression Gets the feature properties object. |
raw | open fun raw(rawExpression: String): Expression Returns a DSL equivalent of a raw expression. |
resolvedLocale | open fun resolvedLocale(collator: Expression): Expression 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. |
rgb | open fun rgb(red: Expression, green: Expression, blue: Expression): Expression open fun rgb(red: Number, green: Number, blue: Number): Expression Creates a color value from red, green, and blue components, which must range between 0 and 255,and an alpha component of 1. |
rgba | open fun rgba(red: Expression, green: Expression, blue: Expression, alpha: Expression): Expression open fun rgba(red: Number, green: Number, blue: Number, alpha: Number): Expression 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. |
round | open fun round(expression: Expression): Expression open fun round(number: Number): Expression Rounds the input to the nearest integer.Halfway values are rounded away from zero.For example [\"round\", -1.5] evaluates to -2. |
sin | open fun sin(number: Expression): Expression open fun sin(number: Number): Expression Returns the sine of the input. |
sqrt | open fun sqrt(number: Expression): Expression Returns the square root of the inputExample usage:{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(sqrt(pi())) ); } open fun sqrt(number: Number): Expression Returns the square root of the inputExample usage:{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(sqrt(25.0f)) ); } |
step | open fun step(input: Expression, defaultOutput: Expression, stops: Array<Expression>): Expression open fun step(input: Expression, defaultOutput: Expression, stops: Array<Expression.Stop>): Expression open fun step(input: Expression, defaultOutput: Number, stops: Array<Expression>): Expression open fun step(input: Expression, defaultOutput: Number, stops: Array<Expression.Stop>): Expression open fun step(input: Number, defaultOutput: Expression, stops: Array<Expression>): Expression open fun step(input: Number, defaultOutput: Expression, stops: Array<Expression.Stop>): Expression open fun step(input: Number, defaultOutput: Number, stops: Array<Expression>): Expression open fun step(input: Number, defaultOutput: Number, stops: Array<Expression.Stop>): Expression Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs ofinput and output values ("stops"). |
stop | open fun stop(stop: Any, value: Any): Expression.Stop Produces a stop value. |
string | open fun string(input: Array<Expression>): Expression Asserts that the input value is a string.If multiple values are provided, each one is evaluated in order until a string value is obtained.If none of the inputs are strings, the expression is an error.The asserted input value is returned as result. |
subtract | open fun subtract(number: Expression): Expression open fun subtract(number: Number): Expression Returns the result of subtracting a number from 0. open fun subtract(first: Expression, second: Expression): Expression open fun subtract(first: Number, second: Number): Expression Returns the result of subtracting the second input from the first. |
sum | open fun sum(numbers: Array<Expression>): Expression open fun sum(numbers: Array Returns the sum of the inputs. |
switchCase | open fun switchCase(input: Array<Expression>): Expression Selects the first output whose corresponding test condition evaluates to true. |
tan | open fun tan(number: Expression): Expression open fun tan(number: Number): Expression Returns the tangent of the input. |
toArray | @NonNull() open fun toArray(): Array Converts the expression to Object array representation. |
toBool | open fun toBool(input: Expression): Expression Converts the input value to a boolean. |
toColor | open fun toColor(input: Expression): Expression Converts the input value to a color. |
toNumber | open fun toNumber(input: Expression): Expression 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. |
toRgba | open fun toRgba(expression: Expression): Expression Returns a four-element array containing the input color’s red, green, blue, and alpha components, in that order. |
toString | open fun toString(): String Returns a string representation of the expression literal. open fun toString(input: Expression): Expression Converts the input value to a string.If the input is null, the result is null.If the input is a boolean, the result is true or false.If the input is a number, it is converted to a string by NumberToString in 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 in the ECMAScriptLanguage Specification. |
toValue | open fun toValue(): Any Get the literal object. |
typeOf | open fun typeOf(input: Expression): Expression Returns a string describing the type of the given value. |
upcase | open fun upcase(string: Expression): Expression open fun upcase(string: String): Expression Returns the input string converted to uppercase. |
var | open fun var(expression: Expression): Expression open fun var(variableName: String): Expression References variable bound using let. |
within | open fun within(polygon: Polygon): Expression |
zoom | open fun zoom(): Expression Gets the current zoom level. |
equals
open fun equals(o: Any): Boolean
Indicates whether some other object is “equal to” this one.
Return
true if equal, false if not
Parameters
Name | Summary |
---|---|
o | the other object |
hashCode
open fun hashCode(): Int
Returns a hash code value for the expression literal.
Return
a hash code value for this expression literal
toArray
@NonNull()
open fun toArray(): Array
Converts the expression to Object array representation.
The output will later be converted to a JSON Object array.
Return
the converted object array expression
toString
open fun toString(): String
Returns a string representation of the expression literal.
Return
a string representation of the object.
toValue
open fun toValue(): Any
Get the literal object.
Return
the literal object
FormatEntry
open class FormatEntry
Holds format entries used in a format expression.
Constructors
Name | Summary |
---|---|
FormatEntry | open fun FormatEntry(text: Expression, options: Array<Expression.FormatOption>) |
FormatOption
open class FormatOption : Expression.Option
Holds format options used in a formatEntry that buildsa format expression.
If an option is not set, it defaults to the base value defined for the symbol.
Constructors
Name | Summary |
---|---|
FormatOption | open fun FormatOption(type: String, value: Expression) |
Functions
Name | Summary |
---|---|
formatFontScale | @NonNull() open fun formatFontScale(expression: Expression): Expression.FormatOption @NonNull() open fun formatFontScale(scale: Double): Expression.FormatOption If set, the font-scale argument specifies a scaling factor relative to the text-sizespecified in the root layout properties. |
formatTextColor | @NonNull() open fun formatTextColor(expression: Expression): Expression.FormatOption @NonNull() open fun formatTextColor(color: Int): Expression.FormatOption If set, the text-color argument overrides the color specified by the root paint properties. |
formatTextFont | @NonNull() open fun formatTextFont(expression: Expression): Expression.FormatOption @NonNull() open fun formatTextFont(fontStack: Array If set, the text-font argument overrides the font specified by the root layout properties. |
formatFontScale
@NonNull()
open fun formatFontScale(expression: Expression): Expression.FormatOption
If set, the font-scale argument specifies a scaling factor relative to the text-sizespecified in the root layout properties.
“font-scale” is required to be of a resulting type number.
Return
format option
Parameters
Name | Summary |
---|---|
expression | expression |
@NonNull()
open fun formatFontScale(scale: Double): Expression.FormatOption
If set, the font-scale argument specifies a scaling factor relative to the text-sizespecified in the root layout properties.
“font-scale” is required to be of a resulting type number.
Return
format option
Parameters
Name | Summary |
---|---|
scale | value |
formatTextColor
@NonNull()
open fun formatTextColor(expression: Expression): Expression.FormatOption
If set, the text-color argument overrides the color specified by the root paint properties.
Return
format option
Parameters
Name | Summary |
---|---|
expression | expression |
@NonNull()
open fun formatTextColor(color: Int): Expression.FormatOption
If set, the text-color argument overrides the color specified by the root paint properties.
Return
format option
Parameters
Name | Summary |
---|---|
color | value |
formatTextFont
@NonNull()
open fun formatTextFont(expression: Expression): Expression.FormatOption
If set, the text-font argument overrides the font specified by the root layout properties.
“text-font” is required to be a literal array.
The requested font stack has to be a part of the used style.For more information see the documentation.
Return
format option
Parameters
Name | Summary |
---|---|
expression | expression |
@NonNull()
open fun formatTextFont(fontStack: Array
If set, the text-font argument overrides the font specified by the root layout properties.
“text-font” is required to be a literal array.
The requested font stack has to be a part of the used style.For more information see the documentation.
Return
format option
Parameters
Name | Summary |
---|---|
fontStack | value |
Interpolator
open class Interpolator : Expression
Expression interpolator type.
Is used for first parameter of interpolate.
Constructors
Name | Summary |
---|---|
Interpolator | open fun Interpolator(operator: String, arguments: Array<Expression>) |
Functions
Name | Summary |
---|---|
abs | open fun abs(expression: Expression): Expression open fun abs(number: Number): Expression Returns the absolute value of the input. |
accumulated | open fun accumulated(): Expression Gets the value of a cluster property accumulated so far. |
acos | open fun acos(number: Expression): Expression open fun acos(number: Number): Expression Returns the arccosine of the input. |
all | open fun all(input: Array<Expression>): Expression Returns true if all the inputs are true , false otherwise. |
any | open fun any(input: Array<Expression>): Expression Returns true if any of the inputs are true , false otherwise. |
array | open fun array(input: Expression): Expression 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. |
asin | open fun asin(number: Expression): Expression open fun asin(number: Number): Expression Returns the arcsine of the input. |
at | open fun at(number: Expression, expression: Expression): Expression open fun at(number: Number, expression: Expression): Expression Retrieves an item from an array. |
atan | open fun atan(number: Expression): Expression open fun atan(number: Number): Expression Returns the arctangent of the input. |
bool | open fun bool(input: Array<Expression>): Expression Asserts that the input value is a boolean.If multiple values are provided, each one is evaluated in order until a boolean value is obtained.If none of the inputs are booleans, the expression is an error.The asserted input value is returned as result. |
ceil | open fun ceil(expression: Expression): Expression open fun ceil(number: Number): Expression Returns the smallest integer that is greater than or equal to the input. |
coalesce | open fun coalesce(input: Array<Expression>): Expression Evaluates each expression in turn until the first non-null value is obtained, and returns that value. |
collator | open fun collator(caseSensitive: Boolean, diacriticSensitive: Boolean): Expression open fun collator(caseSensitive: Expression, diacriticSensitive: Expression): Expression open fun collator(caseSensitive: Boolean, diacriticSensitive: Boolean, locale: Locale): Expression open fun collator(caseSensitive: Expression, diacriticSensitive: Expression, locale: Expression): Expression 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. |
color | open fun color(color: Int): Expression Expression literal utility method to convert a color int to an color expressionExample usage:{@code FillLayer fillLayer = new FillLayer(“layer-id”, “source-id”); fillLayer.setProperties( fillColor(color(Color.GREEN)) ); * } |
concat | open fun concat(input: Array<Expression>): Expression open fun concat(input: Array Returns a string consisting of the concatenation of the inputs. |
cos | open fun cos(number: Expression): Expression open fun cos(number: Number): Expression Returns the cosine of the input. |
cubicBezier | open fun cubicBezier(x1: Expression, y1: Expression, x2: Expression, y2: Expression): Expression.Interpolator open fun cubicBezier(x1: Number, y1: Number, x2: Number, y2: Number): Expression.Interpolator Interpolates using the cubic bezier curve defined by the given control points. |
distance | open fun distance(geoJson: GeoJson): Expression Retrieves the shortest distance between two geometries.The returned value can be consumed as an input into another expression for changing a paint or layout propertyor filtering features by distance. |
division | open fun division(first: Expression, second: Expression): Expression open fun division(first: Number, second: Number): Expression Returns the result of floating point division of the first input by the second. |
downcase | open fun downcase(input: Expression): Expression open fun downcase(input: String): Expression Returns the input string converted to lowercase. |
e | open fun e(): Expression Returns the mathematical constant e. |
eq | open fun eq(compareOne: Expression, compareTwo: Boolean): Expression open fun eq(compareOne: Expression, compareTwo: Number): Expression open fun eq(compareOne: Expression, compareTwo: String): Expression Returns true if the input values are equal, false otherwise. open fun eq(compareOne: Expression, compareTwo: Expression): Expression open fun eq(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression open fun eq(compareOne: Expression, compareTwo: String, collator: Expression): Expression Returns true if the input values are equal, false otherwise.The inputs must be numbers, strings, or booleans, and both of the same type. |
equals | open fun equals(o: Any): Boolean Indicates whether some other object is “equal to” this one. |
exponential | open fun exponential(expression: Expression): Expression.Interpolator Interpolates exponentially between the stops just less than and just greater than the input.The parameter 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. open fun exponential(base: Number): Expression.Interpolator 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. |
floor | open fun floor(expression: Expression): Expression open fun floor(number: Number): Expression Returns the largest integer that is less than or equal to the input. |
format | open fun format(formatEntries: Array<Expression.FormatEntry>): Expression Returns formatted text containing annotations for use in mixed-format text-field entries. |
formatEntry | open fun formatEntry(text: Expression): Expression.FormatEntry open fun formatEntry(text: String): Expression.FormatEntry open fun formatEntry(text: Expression, formatOptions: Array<Expression.FormatOption>): Expression.FormatEntry open fun formatEntry(text: String, formatOptions: Array<Expression.FormatOption>): Expression.FormatEntry Returns a format entry that can be used in format to create formatted text fields. |
geometryType | open fun geometryType(): Expression Gets the feature’s geometry type: Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon. |
get | open fun get(input: Expression): Expression open fun get(input: String): Expression 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. open fun get(key: Expression, object: Expression): Expression open fun get(key: String, object: Expression): Expression Retrieves a property value from another object.Returns null if the requested property is missing. |
gt | open fun gt(compareOne: Expression, compareTwo: Expression): Expression open fun gt(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression open fun gt(compareOne: Expression, compareTwo: String, collator: Expression): Expression Returns true if the first input is strictly greater than the second, false otherwise.The inputs must be numbers or strings, and both of the same type. open fun gt(compareOne: Expression, compareTwo: Number): Expression open fun gt(compareOne: Expression, compareTwo: String): Expression Returns true if the first input is strictly greater than the second, false otherwise. |
gte | open fun gte(compareOne: Expression, compareTwo: Expression): Expression open fun gte(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression open fun gte(compareOne: Expression, compareTwo: String, collator: Expression): Expression Returns true if the first input is greater than or equal to the second, false otherwise.The inputs must be numbers or strings, and both of the same type. open fun gte(compareOne: Expression, compareTwo: Number): Expression open fun gte(compareOne: Expression, compareTwo: String): Expression Returns true if the first input is greater than or equal to the second, false otherwise. |
has | open fun has(key: Expression): Expression open fun has(key: String): Expression Tests for the presence of an property value in the current feature’s properties. open fun has(key: Expression, object: Expression): Expression open fun has(key: String, object: Expression): Expression Tests for the presence of an property value from another object. |
hashCode | open fun hashCode(): Int Returns a hash code value for the expression. |
heatmapDensity | open fun heatmapDensity(): Expression 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. |
id | open fun id(): Expression Gets the feature’s id, if it has one. |
image | open fun image(input: Expression): Expression Returns image expression for use in ‘*-pattern’ and ‘icon-image’ layer properties. |
in | open fun in(needle: Expression, haystack: Expression): Expression open fun in(needle: Number, haystack: Expression): Expression open fun in(needle: String, haystack: Expression): Expression Retrieves whether an item exists in an array or a substring exists in a string. |
interpolate | open fun interpolate(interpolation: Expression.Interpolator, number: Expression, stops: Array<Expression>): Expression open fun interpolate(interpolation: Expression.Interpolator, number: Expression, stops: Array<Expression.Stop>): Expression 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 . |
isSupportedScript | open fun isSupportedScript(expression: Expression): Expression open fun isSupportedScript(string: String): Expression 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. |
length | open fun length(expression: Expression): Expression open fun length(input: String): Expression Gets the length of an array or string. |
let | open fun let(input: Array<Expression>): Expression Binds input to named variables,which can then be referenced in the result expression using var or var. |
linear | open fun linear(): Expression.Interpolator interpolates linearly between the pair of stops just less than and just greater than the input. |
lineProgress | open fun lineProgress(): Expression Gets the progress along a gradient line. |
literal | open fun literal(bool: Boolean): Expression Create a literal boolean expression. open fun literal(number: Number): Expression Create a literal number expression. open fun literal(object: Any): Expression Create a literal object expression. open fun literal(array: Array Create a literal array expression open fun [literal](#literal)(string: String): [Expression](../) Create a literal string expression. |
ln | open fun ln(number: Expression): Expression open fun ln(number: Number): Expression Returns the natural logarithm of the input. |
ln2 | open fun ln2(): Expression Returns mathematical constant ln(2). |
log10 | open fun log10(number: Expression): Expression open fun log10(number: Number): Expression Returns the base-ten logarithm of the input. |
log2 | open fun log2(number: Expression): Expression open fun log2(number: Number): Expression Returns the base-two logarithm of the input. |
lt | open fun lt(compareOne: Expression, compareTwo: Expression): Expression open fun lt(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression open fun lt(compareOne: Expression, compareTwo: String, collator: Expression): Expression Returns true if the first input is strictly less than the second, false otherwise.The inputs must be numbers or strings, and both of the same type. open fun lt(compareOne: Expression, compareTwo: Number): Expression open fun lt(compareOne: Expression, compareTwo: String): Expression Returns true if the first input is strictly less than the second, false otherwise. |
lte | open fun lte(compareOne: Expression, compareTwo: Expression): Expression open fun lte(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression open fun lte(compareOne: Expression, compareTwo: String, collator: Expression): Expression Returns true if the first input is less than or equal to the second, false otherwise.The inputs must be numbers or strings, and both of the same type. open fun lte(compareOne: Expression, compareTwo: Number): Expression open fun lte(compareOne: Expression, compareTwo: String): Expression Returns true if the first input is less than or equal to the second, false otherwise. |
match | open fun match(input: Array<Expression>): Expression open fun match(input: Expression, defaultOutput: Expression, stops: Array<Expression.Stop>): Expression Selects the output whose label value matches the input value, or the fallback value if no match is found.The input can be any string or number expression.Each label can either be a single literal value or an array of values.If types of the input and keys don’t match, or the input value doesn’t exist,the expresion will fail without falling back to the default value. |
max | open fun max(numbers: Array<Expression>): Expression open fun max(numbers: Array Returns the maximum value of the inputs. |
min | open fun min(numbers: Array<Expression>): Expression open fun min(numbers: Array Returns the minimum value of the inputs. |
mod | open fun mod(first: Expression, second: Expression): Expression open fun mod(first: Number, second: Number): Expression Returns the remainder after integer division of the first input by the second. |
neq | open fun neq(compareOne: Expression, compareTwo: Boolean): Expression Returns true if the input values are equal, false otherwise. open fun neq(compareOne: Expression, compareTwo: Expression): Expression open fun neq(compareOne: Expression, compareTwo: Expression, collator: Expression): Expression open fun neq(compareOne: Expression, compareTwo: String, collator: Expression): Expression Returns true if the input values are not equal, false otherwise.The inputs must be numbers, strings, or booleans, and both of the same type. open fun neq(compareOne: Expression, compareTwo: Number): Expression open fun neq(compareOne: Expression, compareTwo: String): Expression Returns true if the input values are not equal, false otherwise. |
not | open fun not(input: Boolean): Expression open fun not(input: Expression): Expression Logical negation. |
number | open fun number(input: Array<Expression>): Expression Asserts that the input value is a number.If multiple values are provided, each one is evaluated in order until a number value is obtained.If none of the inputs are numbers, the expression is an error.The asserted input value is returned as result. |
numberFormat | open fun numberFormat(number: Expression, options: Array<Expression.NumberFormatOption>): Expression open fun numberFormat(number: Number, options: Array<Expression.NumberFormatOption>): Expression 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 numberof fractional digits to include. |
object | open fun object(input: Expression): Expression Asserts that the input value is an object. |
pi | open fun pi(): Expression Returns the mathematical constant pi. |
pow | open fun pow(first: Expression, second: Expression): Expression open fun pow(first: Number, second: Number): Expression Returns the result of raising the first input to the power specified by the second. |
product | open fun product(numbers: Array<Expression>): Expression open fun product(numbers: Array Returns the product of the inputs. |
properties | open fun properties(): Expression Gets the feature properties object. |
raw | open fun raw(rawExpression: String): Expression Returns a DSL equivalent of a raw expression. |
resolvedLocale | open fun resolvedLocale(collator: Expression): Expression 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. |
rgb | open fun rgb(red: Expression, green: Expression, blue: Expression): Expression open fun rgb(red: Number, green: Number, blue: Number): Expression Creates a color value from red, green, and blue components, which must range between 0 and 255,and an alpha component of 1. |
rgba | open fun rgba(red: Expression, green: Expression, blue: Expression, alpha: Expression): Expression open fun rgba(red: Number, green: Number, blue: Number, alpha: Number): Expression 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. |
round | open fun round(expression: Expression): Expression open fun round(number: Number): Expression Rounds the input to the nearest integer.Halfway values are rounded away from zero.For example [\"round\", -1.5] evaluates to -2. |
sin | open fun sin(number: Expression): Expression open fun sin(number: Number): Expression Returns the sine of the input. |
sqrt | open fun sqrt(number: Expression): Expression Returns the square root of the inputExample usage:{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(sqrt(pi())) ); } open fun sqrt(number: Number): Expression Returns the square root of the inputExample usage:{@code CircleLayer circleLayer = new CircleLayer(“layer-id”, “source-id”); circleLayer.setProperties( circleRadius(sqrt(25.0f)) ); } |
step | open fun step(input: Expression, defaultOutput: Expression, stops: Array<Expression>): Expression open fun step(input: Expression, defaultOutput: Expression, stops: Array<Expression.Stop>): Expression open fun step(input: Expression, defaultOutput: Number, stops: Array<Expression>): Expression open fun step(input: Expression, defaultOutput: Number, stops: Array<Expression.Stop>): Expression open fun step(input: Number, defaultOutput: Expression, stops: Array<Expression>): Expression open fun step(input: Number, defaultOutput: Expression, stops: Array<Expression.Stop>): Expression open fun step(input: Number, defaultOutput: Number, stops: Array<Expression>): Expression open fun step(input: Number, defaultOutput: Number, stops: Array<Expression.Stop>): Expression Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs ofinput and output values ("stops"). |
stop | open fun stop(stop: Any, value: Any): Expression.Stop Produces a stop value. |
string | open fun string(input: Array<Expression>): Expression Asserts that the input value is a string.If multiple values are provided, each one is evaluated in order until a string value is obtained.If none of the inputs are strings, the expression is an error.The asserted input value is returned as result. |
subtract | open fun subtract(number: Expression): Expression open fun subtract(number: Number): Expression Returns the result of subtracting a number from 0. open fun subtract(first: Expression, second: Expression): Expression open fun subtract(first: Number, second: Number): Expression Returns the result of subtracting the second input from the first. |
sum | open fun sum(numbers: Array<Expression>): Expression open fun sum(numbers: Array Returns the sum of the inputs. |
switchCase | open fun switchCase(input: Array<Expression>): Expression Selects the first output whose corresponding test condition evaluates to true. |
tan | open fun tan(number: Expression): Expression open fun tan(number: Number): Expression Returns the tangent of the input. |
toArray | @NonNull() open fun toArray(): Array Converts the expression to Object array representation. |
toBool | open fun toBool(input: Expression): Expression Converts the input value to a boolean. |
toColor | open fun toColor(input: Expression): Expression Converts the input value to a color. |
toNumber | open fun toNumber(input: Expression): Expression 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. |
toRgba | open fun toRgba(expression: Expression): Expression Returns a four-element array containing the input color’s red, green, blue, and alpha components, in that order. |
toString | open fun toString(): String Returns a string representation of the object that matches the definition set in the style specification. open fun toString(input: Expression): Expression Converts the input value to a string.If the input is null, the result is null.If the input is a boolean, the result is true or false.If the input is a number, it is converted to a string by NumberToString in 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 in the ECMAScriptLanguage Specification. |
typeOf | open fun typeOf(input: Expression): Expression Returns a string describing the type of the given value. |
upcase | open fun upcase(string: Expression): Expression open fun upcase(string: String): Expression Returns the input string converted to uppercase. |
var | open fun var(expression: Expression): Expression open fun var(variableName: String): Expression References variable bound using let. |
within | open fun within(polygon: Polygon): Expression |
zoom | open fun zoom(): Expression Gets the current zoom level. |
NumberFormatOption
open class NumberFormatOption : Expression.Option
Holds format options used in a numberFormat expression.
Constructors
Name | Summary |
---|---|
NumberFormatOption | open fun NumberFormatOption(type: String, value: Expression) |
Functions
Name | Summary |
---|---|
currency | @NonNull() open fun currency(string: Expression): Expression.NumberFormatOption Number formatting option for specifying the currency to use, an ISO 4217 code. @NonNull() open fun currency(string: String): Expression.NumberFormatOption Number formatting options for specifying the currency to use, an ISO 4217 code. |
locale | @NonNull() open fun locale(string: Expression): Expression.NumberFormatOption @NonNull() open fun locale(string: String): Expression.NumberFormatOption Number formatting option for specifying the locale to use, as a BCP 47 language tag. |
maxFractionDigits | @NonNull() open fun maxFractionDigits(number: Expression): Expression.NumberFormatOption @NonNull() open fun maxFractionDigits(number: Int): Expression.NumberFormatOption Number formatting options for specifying the maximum fraction digits to include. |
minFractionDigits | @NonNull() open fun minFractionDigits(number: Expression): Expression.NumberFormatOption @NonNull() open fun minFractionDigits(number: Int): Expression.NumberFormatOption Number formatting options for specifying the minimum fraction digits to include. |
currency
@NonNull()
open fun currency(string: Expression): Expression.NumberFormatOption
Number formatting option for specifying the currency to use, an ISO 4217 code.
Return
number format option
Parameters
Name | Summary |
---|---|
string | the currency to use while performing number formatting |
@NonNull()
open fun currency(string: String): Expression.NumberFormatOption
Number formatting options for specifying the currency to use, an ISO 4217 code.
Return
number format option
Parameters
Name | Summary |
---|---|
string | the currency to use while performing number formatting |
locale
@NonNull()
open fun locale(string: Expression): Expression.NumberFormatOption
Number formatting option for specifying the locale to use, as a BCP 47 language tag.
Return
number format option
Parameters
Name | Summary |
---|---|
string | the locale to use while performing number formatting |
@NonNull()
open fun locale(string: String): Expression.NumberFormatOption
Number formatting option for specifying the locale to use, as a BCP 47 language tag.
Return
number format option
Parameters
Name | Summary |
---|---|
string | the locale to use while performing number formatting |
maxFractionDigits
@NonNull()
open fun maxFractionDigits(number: Expression): Expression.NumberFormatOption
Number formatting options for specifying the maximum fraction digits to include.
Return
number format option
Parameters
Name | Summary |
---|---|
number | the amount of minimum fraction digits to include |
@NonNull()
open fun maxFractionDigits(number: Int): Expression.NumberFormatOption
Number formatting options for specifying the maximum fraction digits to include.
Return
number format option
Parameters
Name | Summary |
---|---|
number | the amount of minimum fraction digits to include |
minFractionDigits
@NonNull()
open fun minFractionDigits(number: Expression): Expression.NumberFormatOption
Number formatting options for specifying the minimum fraction digits to include.
Return
number format option
Parameters
Name | Summary |
---|---|
number | the amount of minimum fraction digits to include |
@NonNull()
open fun minFractionDigits(number: Int): Expression.NumberFormatOption
Number formatting options for specifying the minimum fraction digits to include.
Return
number format option
Parameters
Name | Summary |
---|---|
number | the amount of minimum fraction digits to include |
Stop
open class Stop
Expression stop type.
Can be used for stop as part of varargs parameter in step or interpolate.
Constructors
Name | Summary |
---|---|
Stop | open fun Stop(value: Any, output: Any) |
Functions
Name | Summary |
---|---|
toExpressionArray | @NonNull() open fun toExpressionArray(stops: Array<Expression.Stop>): Array<Expression> Converts a varargs of Stops to a Expression array. |
toExpressionArray
@NonNull()
open fun toExpressionArray(stops: Array<Expression.Stop>): Array<Expression>
Converts a varargs of Stops to a Expression array.
Return
the converted stops as an expression array
Parameters
Name | Summary |
---|---|
stops | the stops to convert |
Android SDK
API Reference
- Root
- attribution
- camera
- constants
- exceptions
- geometry
- http
- location
- location.engine
- location.modes
- location.permissions
- log
- maps
- maps.renderer
- maps.renderer.egl
- maps.renderer.glsurfaceview
- maps.renderer.textureview
- maps.widgets
- module.http
- module.loader
- net
- offline
- snapshotter
- storage
- style.expressions
- style.layers
- style.light
- style.sources
- style.types
- text
- utils