Class Expression

java.lang.Object
com.trimblemaps.mapsdk.style.expressions.Expression
Direct Known Subclasses:
Expression.ExpressionLiteral, Expression.Interpolator

public class Expression extends Object
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 TrimbleMaps 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:

 
 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))
       ))
     )
   )
 );
 
 
  • Constructor Details

    • Expression

      public Expression(@NonNull String operator, @Nullable Expression... arguments)
      Creates an expression from its operator and varargs expressions.
      Parameters:
      operator - the expression operator
      arguments - expressions input
  • Method Details

    • literal

      public static Expression literal(@NonNull Number number)
      Create a literal number expression.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(literal(10.0f))
       );
       
       
      Parameters:
      number - the number
      Returns:
      the expression
    • literal

      public static Expression literal(@NonNull String string)
      Create a literal string expression.

      Example usage:

       
       SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
       symbolLayer.setProperties(
           textField(literal("Text"))
       );
       
       
      Parameters:
      string - the string
      Returns:
      the expression
    • literal

      public static Expression literal(boolean bool)
      Create a literal boolean expression.

      Example usage:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setProperties(
           fillAntialias(literal(true))
       );
       
       
      Parameters:
      bool - the boolean
      Returns:
      the expression
    • literal

      public static Expression literal(@NonNull Object object)
      Create a literal object expression.
      Parameters:
      object - the object
      Returns:
      the expression
    • literal

      public static Expression literal(@NonNull Object[] array)
      Create a literal array expression
      Parameters:
      array - the array
      Returns:
      the expression
    • color

      public static Expression color(@ColorInt int color)
      Expression literal utility method to convert a color int to an color expression

      Example usage:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setProperties(
           fillColor(color(Color.GREEN))
       );
       
       
      Parameters:
      color - the int color
      Returns:
      the color expression
    • rgb

      public static Expression rgb(@NonNull Expression red, @NonNull Expression green, @NonNull Expression blue)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setProperties(
           fillColor(
               rgb(
                   literal(255.0f),
                   literal(255.0f),
                   literal(255.0f)
               )
           )
       );
       
       
      Parameters:
      red - red color expression
      green - green color expression
      blue - blue color expression
      Returns:
      expression
    • rgb

      public static Expression rgb(@NonNull Number red, @NonNull Number green, @NonNull Number blue)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setProperties(
           fillColor(
               rgb(255.0f, 255.0f, 255.0f)
           )
       );
       
       
      Parameters:
      red - red color value
      green - green color value
      blue - blue color value
      Returns:
      expression
    • rgba

      public static Expression rgba(@NonNull Expression red, @NonNull Expression green, @NonNull Expression blue, @NonNull Expression alpha)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setProperties(
           fillColor(
               rgba(
                   literal(255.0f),
                   literal(255.0f),
                   literal(255.0f),
                   literal(1.0f)
               )
           )
       );
       
       
      Parameters:
      red - red color value
      green - green color value
      blue - blue color value
      alpha - alpha color value
      Returns:
      expression
    • rgba

      public static Expression rgba(@NonNull Number red, @NonNull Number green, @NonNull Number blue, @NonNull Number alpha)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setProperties(
           fillColor(
               rgba(255.0f, 255.0f, 255.0f, 1.0f)
           )
       );
       
       
      Parameters:
      red - red color value
      green - green color value
      blue - blue color value
      alpha - alpha color value
      Returns:
      expression
    • toRgba

      public static Expression toRgba(@NonNull Expression expression)
      Returns a four-element array containing the input color's red, green, blue, and alpha components, in that order.
      Parameters:
      expression - an expression to convert to a color
      Returns:
      expression
    • eq

      public static Expression eq(@NonNull Expression compareOne, @NonNull Expression compareTwo)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           eq(get("keyToValue"), get("keyToOtherValue"))
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second expression
      Returns:
      expression
    • eq

      public static Expression eq(@NonNull Expression compareOne, @NonNull Expression compareTwo, @NonNull Expression collator)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           eq(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second expression
      collator - the collator expression
      Returns:
      expression
    • eq

      public static Expression eq(@NonNull Expression compareOne, boolean compareTwo)
      Returns true if the input values are equal, false otherwise.

      Example usage:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           eq(get("keyToValue"), true)
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second boolean
      Returns:
      expression
    • eq

      public static Expression eq(@NonNull Expression compareOne, @NonNull String compareTwo)
      Returns true if the input values are equal, false otherwise.

      Example usage:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           eq(get("keyToValue"), "value")
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second number
      Returns:
      expression
    • eq

      public static Expression eq(@NonNull Expression compareOne, @NonNull String compareTwo, @NonNull Expression collator)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           eq(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second String
      collator - the collator expression
      Returns:
      expression
    • eq

      public static Expression eq(@NonNull Expression compareOne, @NonNull Number compareTwo)
      Returns true if the input values are equal, false otherwise.

      Example usage:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           eq(get("keyToValue"), 2.0f)
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second number
      Returns:
      expression
    • neq

      public static Expression neq(@NonNull Expression compareOne, @NonNull Expression compareTwo)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           neq(get("keyToValue"), get("keyToOtherValue"))
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second expression
      Returns:
      expression
    • neq

      public static Expression neq(@NonNull Expression compareOne, @NonNull Expression compareTwo, @NonNull Expression collator)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           neq(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second expression
      collator - the collator expression
      Returns:
      expression
    • neq

      public static Expression neq(Expression compareOne, boolean compareTwo)
      Returns true if the input values are equal, false otherwise.

      Example usage:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           neq(get("keyToValue"), true)
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second boolean
      Returns:
      expression
    • neq

      public static Expression neq(@NonNull Expression compareOne, @NonNull String compareTwo)
      Returns `true` if the input values are not equal, `false` otherwise.

      Example usage:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           neq(get("keyToValue"), "value")
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second string
      Returns:
      expression
    • neq

      public static Expression neq(@NonNull Expression compareOne, @NonNull String compareTwo, @NonNull Expression collator)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           neq(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second String
      collator - the collator expression
      Returns:
      expression
    • neq

      public static Expression neq(@NonNull Expression compareOne, @NonNull Number compareTwo)
      Returns `true` if the input values are not equal, `false` otherwise.

      Example usage:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           neq(get("keyToValue"), 2.0f)
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second number
      Returns:
      expression
    • gt

      public static Expression gt(@NonNull Expression compareOne, @NonNull Expression compareTwo)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           gt(get("keyToValue"), get("keyToOtherValue"))
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second expression
      Returns:
      expression
    • gt

      public static Expression gt(@NonNull Expression compareOne, @NonNull Expression compareTwo, @NonNull Expression collator)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           gt(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second expression
      collator - the collator expression
      Returns:
      expression
    • gt

      public static Expression gt(@NonNull Expression compareOne, @NonNull Number compareTwo)
      Returns true if the first input is strictly greater than the second, false otherwise.

      Example usage:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           gt(get("keyToValue"), 2.0f)
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second number
      Returns:
      expression
    • gt

      public static Expression gt(@NonNull Expression compareOne, @NonNull String compareTwo)
      Returns true if the first input is strictly greater than the second, false otherwise.

      Example usage:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           gt(get("keyToValue"), "value")
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second string
      Returns:
      expression
    • gt

      public static Expression gt(@NonNull Expression compareOne, @NonNull String compareTwo, @NonNull Expression collator)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           gt(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second String
      collator - the collator expression
      Returns:
      expression
    • lt

      public static Expression lt(@NonNull Expression compareOne, @NonNull Expression compareTwo)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           lt(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second expression
      Returns:
      expression
    • lt

      public static Expression lt(@NonNull Expression compareOne, @NonNull Expression compareTwo, @NonNull Expression collator)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           lt(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second number
      collator - the collator expression
      Returns:
      expression
    • lt

      public static Expression lt(@NonNull Expression compareOne, @NonNull Number compareTwo)
      Returns true if the first input is strictly less than the second, false otherwise.

      Example usage:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           lt(get("keyToValue"), 2.0f)
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second number
      Returns:
      expression
    • lt

      public static Expression lt(@NonNull Expression compareOne, @NonNull String compareTwo)
      Returns true if the first input is strictly less than the second, false otherwise.

      Example usage:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           lt(get("keyToValue"), "value")
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second string
      Returns:
      expression
    • lt

      public static Expression lt(@NonNull Expression compareOne, @NonNull String compareTwo, @NonNull Expression collator)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           lt(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second String
      collator - the collator expression
      Returns:
      expression
    • gte

      public static Expression gte(@NonNull Expression compareOne, @NonNull Expression compareTwo)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           gte(get("keyToValue"), get("keyToOtherValue"))
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second expression
      Returns:
      expression
    • gte

      public static Expression gte(@NonNull Expression compareOne, @NonNull Expression compareTwo, @NonNull Expression collator)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           gte(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second expression
      collator - the collator expression
      Returns:
      expression
    • gte

      public static Expression gte(@NonNull Expression compareOne, @NonNull Number compareTwo)
      Returns true if the first input is greater than or equal to the second, false otherwise.

      Example usage:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           gte(get("keyToValue"), 2.0f)
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second number
      Returns:
      expression
    • gte

      public static Expression gte(@NonNull Expression compareOne, @NonNull String compareTwo)
      Returns true if the first input is greater than or equal to the second, false otherwise.

      Example usage:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           neq(get("keyToValue"), "value")
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second string
      Returns:
      expression
    • gte

      public static Expression gte(@NonNull Expression compareOne, @NonNull String compareTwo, @NonNull Expression collator)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           gte(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second String
      collator - the collator expression
      Returns:
      expression
    • lte

      public static Expression lte(@NonNull Expression compareOne, @NonNull Expression compareTwo)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           lte(get("keyToValue"), get("keyToOtherValue"))
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second expression
      Returns:
      expression
    • lte

      public static Expression lte(@NonNull Expression compareOne, @NonNull Expression compareTwo, @NonNull Expression collator)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           lte(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second expression
      collator - the collator expression
      Returns:
      expression
    • lte

      public static Expression lte(@NonNull Expression compareOne, @NonNull Number compareTwo)
      Returns true if the first input is less than or equal to the second, false otherwise.

      Example usage:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           lte(get("keyToValue"), 2.0f)
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second number
      Returns:
      expression
    • lte

      public static Expression lte(@NonNull Expression compareOne, @NonNull String compareTwo)
      Returns true if the first input is less than or equal to the second, false otherwise.

      Example usage:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           lte(get("keyToValue"), "value")
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second string
      Returns:
      expression
    • lte

      public static Expression lte(@NonNull Expression compareOne, @NonNull String compareTwo, @NonNull Expression collator)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           lte(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
       );
       
       
      Parameters:
      compareOne - the first expression
      compareTwo - the second String
      collator - the collator expression
      Returns:
      expression
    • all

      public static Expression all(@NonNull Expression... input)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           all(get("keyToValue"), get("keyToOtherValue"))
       );
       
       
      Parameters:
      input - expression input
      Returns:
      expression
    • any

      public static Expression any(@NonNull Expression... input)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           any(get("keyToValue"), get("keyToOtherValue"))
       );
       
       
      Parameters:
      input - expression input
      Returns:
      expression
    • not

      public static Expression not(@NonNull Expression input)
      Logical negation. Returns `true` if the input is `false`, and `false` if the input is `true`.

      Example usage:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           not(get("keyToValue"))
       );
       
       
      Parameters:
      input - expression input
      Returns:
      expression
    • not

      public static Expression not(boolean input)
      Logical negation. Returns `true` if the input is `false`, and `false` if the input is `true`.

      Example usage:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           not(false)
       );
       
       
      Parameters:
      input - boolean input
      Returns:
      expression
    • switchCase

      public static Expression switchCase(@NonNull @Size(min=1L) Expression... input)
      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:

       
       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
               )
           )
       );
       
       
      Parameters:
      input - expression input
      Returns:
      expression
    • match

      public static Expression match(@NonNull @Size(min=2L) Expression... input)
      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:

       
       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)
               )
           )
       );
       
       
      Parameters:
      input - expression input
      Returns:
      expression
    • match

      public static Expression match(@NonNull Expression input, @NonNull Expression defaultOutput, @NonNull Expression.Stop... stops)
      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:

       
       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))
           )
         )
       );
       
       
      Parameters:
      input - expression input
      Returns:
      expression
    • coalesce

      public static Expression coalesce(@NonNull Expression... input)
      Evaluates each expression in turn until the first non-null value is obtained, and returns that value.

      Example usage:

       
       SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
       symbolLayer.setProperties(
           textColor(
               coalesce(
                   get("keyToNullValue"),
                   get("keyToNonNullValue")
               )
           )
       );
       
       
      Parameters:
      input - expression input
      Returns:
      expression
    • properties

      public static Expression properties()
      Gets the feature properties object.

      Note that in some cases, it may be more efficient to use get(Expression)} instead.

      Example usage:

       
       SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
       symbolLayer.setProperties(
           textField(get("key-to-value", properties()))
       );
       
       
      Returns:
      expression
    • geometryType

      public static Expression geometryType()
      Gets the feature's geometry type: Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon.

      Example usage:

       
       SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
       symbolLayer.setProperties(
           textField(concat(get("key-to-value"), literal(" "), geometryType()))
       );
       
       
      Returns:
      expression
    • id

      public static Expression id()
      Gets the feature's id, if it has one.

      Example usage:

       
       SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
       symbolLayer.setProperties(
           textField(id())
       );
       
       
      Returns:
      expression
    • accumulated

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

      Example usage:

       
        GeoJsonOptions options = new GeoJsonOptions()
                                    .withCluster(true)
                                    .withClusterProperty("max", max(accumulated(), get("max")).toArray(), get("mag").toArray());
       
       
      Returns:
      expression
    • heatmapDensity

      public static Expression heatmapDensity()
      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:

       
       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))
           )
       );
       
       
      Returns:
      expression
    • lineProgress

      public static Expression lineProgress()
      Gets the progress along a gradient line. Can only be used in the line-gradient property.

      Example usage:

       
       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)))
           )
       );
       
       
      Returns:
      expression
    • at

      public static Expression at(@NonNull Expression number, @NonNull Expression expression)
      Retrieves an item from an array.
      Parameters:
      number - the index expression
      expression - the array expression
      Returns:
      expression
    • at

      public static Expression at(@NonNull Number number, @NonNull Expression expression)
      Retrieves an item from an array.
      Parameters:
      number - the index expression
      expression - the array expression
      Returns:
      expression
    • in

      public static Expression in(@NonNull Expression needle, @NonNull Expression haystack)
      Retrieves whether an item exists in an array or a substring exists in a string.
      Parameters:
      needle - the item expression
      haystack - the array or string expression
      Returns:
      true if exists.
    • indexOf

      public static Expression indexOf(@NonNull Expression keyword, @NonNull Expression input)
      Returns the first position at which a `needle` can be found in a `haystack`.
      Parameters:
      keyword - the item expression
      input - the array or string expression
      Returns:
      position in the array or string or -1 if not found.
    • indexOf

      public static Expression indexOf(@NonNull Expression keyword, @NonNull Expression input, @NonNull Expression fromIndex)
      Returns the first position at which a `needle` can be found in a `haystack`.
      Parameters:
      keyword - the item expression
      input - the array or string expression
      fromIndex - the index to start searching from
      Returns:
      position in the array or string or -1 if not found.
    • slice

      public static Expression slice(@NonNull Expression input, @NonNull Expression fromIndex)
      Returns items from an array or a substring from a string from a specified start index. The return value is inclusive of the start index.
      Parameters:
      input - the array or string expression
      fromIndex - the index to start slice from
      Returns:
      array or string
    • slice

      public static Expression slice(@NonNull Expression input, @NonNull Expression fromIndex, @NonNull Expression toIndex)
      Returns items from an array or a substring from a string between a start index and an end index if set. The return value is inclusive of the start index, but not of the end index.
      Parameters:
      input - the array or string expression
      fromIndex - the index to start slice from
      toIndex - the index to end slice at
      Returns:
      array or string
    • in

      public static Expression in(@NonNull Number needle, @NonNull Expression haystack)
      Retrieves whether an item exists in an array or a substring exists in a string.
      Parameters:
      needle - the item expression
      haystack - the array or string expression
      Returns:
      true if exists.
    • in

      public static Expression in(@NonNull String needle, @NonNull Expression haystack)
      Retrieves whether an item exists in an array or a substring exists in a string.
      Parameters:
      needle - the item expression
      haystack - the array or string expression
      Returns:
      true if exists.
    • distance

      public static Expression distance(@NonNull com.trimblemaps.geojson.GeoJson geoJson)
      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 property or filtering features by distance.

      Currently supports `Point`, `MultiPoint`, `LineString`, `MultiLineString` geometry types.

      Parameters:
      geoJson - the target feature geoJson. Currently supports `Point`, `MultiPoint`, `LineString`, `MultiLineString`, `Polygon`, `MultiPolygon` geometry types
      Returns:
      the distance in the unit "meters".
    • within

      public static Expression within(@NonNull com.trimblemaps.geojson.Polygon polygon)
    • get

      public static Expression get(@NonNull Expression input)
      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:

       
       SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
       symbolLayer.setProperties(
           textField(get("key-to-feature"))
       );
       
       
      Parameters:
      input - expression input
      Returns:
      expression
    • get

      public static Expression get(@NonNull String input)
      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:

       
       SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
       symbolLayer.setProperties(
           textField(get("key-to-feature"))
       );
       
       
      Parameters:
      input - string input
      Returns:
      expression
    • get

      public static Expression get(@NonNull Expression key, @NonNull Expression object)
      Retrieves a property value from another object. Returns null if the requested property is missing.

      Example usage:

       
       SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
       symbolLayer.setProperties(
           textField(get("key-to-property", get("key-to-object")))
       );
       
       
      Parameters:
      key - a property value key
      object - an expression object
      Returns:
      expression
    • get

      public static Expression get(@NonNull String key, @NonNull Expression object)
      Retrieves a property value from another object. Returns null if the requested property is missing.

      Example usage:

       
       SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
       symbolLayer.setProperties(
           textField(get("key-to-property", get("key-to-object")))
       );
       
       
      Parameters:
      key - a property value key
      object - an expression object
      Returns:
      expression
    • has

      public static Expression has(@NonNull Expression key)
      Tests for the presence of an property value in the current feature's properties.

      Example usage:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           has(get("keyToValue"))
       );
       
       
      Parameters:
      key - the expression property value key
      Returns:
      expression
    • has

      public static Expression has(@NonNull String key)
      Tests for the presence of an property value in the current feature's properties.

      Example usage:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           has("keyToValue")
       );
       
       
      Parameters:
      key - the property value key
      Returns:
      expression
    • has

      public static Expression has(@NonNull Expression key, @NonNull Expression object)
      Tests for the presence of an property value from another object.

      Example usage:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           has(get("keyToValue"), get("keyToObject"))
       );
       
       
      Parameters:
      key - the expression property value key
      object - an expression object
      Returns:
      expression
    • has

      public static Expression has(@NonNull String key, @NonNull Expression object)
      Tests for the presence of an property value from another object.

      Example usage:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setFilter(
           has("keyToValue", get("keyToObject"))
       );
       
       
      Parameters:
      key - the property value key
      object - an expression object
      Returns:
      expression
    • length

      public static Expression length(@NonNull Expression expression)
      Gets the length of an array or string.
      Parameters:
      expression - an expression object or expression string
      Returns:
      expression
    • length

      public static Expression length(@NonNull String input)
      Gets the length of an array or string.
      Parameters:
      input - a string
      Returns:
      expression
    • ln2

      public static Expression ln2()
      Returns mathematical constant ln(2).

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(product(literal(10.0f), ln2()))
       );
       
       
      Returns:
      expression
    • pi

      public static Expression pi()
      Returns the mathematical constant pi.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(product(literal(10.0f), pi()))
       );
       
       
      Returns:
      expression
    • e

      public static Expression e()
      Returns the mathematical constant e.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(product(literal(10.0f), e()))
       );
       
       
      Returns:
      expression
    • sum

      public static Expression sum(@Size(min=2L) Expression... numbers)
      Returns the sum of the inputs.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(sum(literal(10.0f), ln2(), pi()))
       );
       
       
      Parameters:
      numbers - the numbers to calculate the sum for
      Returns:
      expression
    • sum

      public static Expression sum(@Size(min=2L) Number... numbers)
      Returns the sum of the inputs.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(sum(10.0f, 5.0f, 3.0f))
       );
       
       
      Parameters:
      numbers - the numbers to calculate the sum for
      Returns:
      expression
    • product

      public static Expression product(@Size(min=2L) Expression... numbers)
      Returns the product of the inputs.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(product(literal(10.0f), ln2()))
       );
       
       
      Parameters:
      numbers - the numbers to calculate the product for
      Returns:
      expression
    • product

      public static Expression product(@Size(min=2L) Number... numbers)
      Returns the product of the inputs.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(product(10.0f, 2.0f))
       );
       
       
      Parameters:
      numbers - the numbers to calculate the product for
      Returns:
      expression
    • subtract

      public static Expression subtract(@NonNull Expression number)
      Returns the result of subtracting a number from 0.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(subtract(pi()))
       );
       
       
      Parameters:
      number - the number subtract from 0
      Returns:
      expression
    • subtract

      public static Expression subtract(@NonNull Number number)
      Returns the result of subtracting a number from 0.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(subtract(10.0f))
       );
       
       
      Parameters:
      number - the number subtract from 0
      Returns:
      expression
    • subtract

      public static Expression subtract(@NonNull Expression first, @NonNull Expression second)
      Returns the result of subtracting the second input from the first.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(subtract(literal(10.0f), pi()))
       );
       
       
      Parameters:
      first - the first number
      second - the second number
      Returns:
      expression
    • subtract

      public static Expression subtract(@NonNull Number first, @NonNull Number second)
      Returns the result of subtracting the second input from the first.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(subtract(10.0f, 20.0f))
       );
       
       
      Parameters:
      first - the first number
      second - the second number
      Returns:
      expression
    • division

      public static Expression division(@NonNull Expression first, @NonNull Expression second)
      Returns the result of floating point division of the first input by the second.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(division(literal(10.0f), pi()))
       );
       
       
      Parameters:
      first - the first number
      second - the second number
      Returns:
      expression
    • division

      public static Expression division(@NonNull Number first, @NonNull Number second)
      Returns the result of floating point division of the first input by the second.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(division(10.0f, 20.0f))
       );
       
       
      Parameters:
      first - the first number
      second - the second number
      Returns:
      expression
    • mod

      public static Expression mod(@NonNull Expression first, @NonNull Expression second)
      Returns the remainder after integer division of the first input by the second.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(mod(literal(10.0f), pi()))
       );
       
       
      Parameters:
      first - the first number
      second - the second number
      Returns:
      expression
    • mod

      public static Expression mod(@NonNull Number first, @NonNull Number second)
      Returns the remainder after integer division of the first input by the second.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(mod(10.0f, 10.0f))
       );
       
       
      Parameters:
      first - the first number
      second - the second number
      Returns:
      expression
    • pow

      public static Expression pow(@NonNull Expression first, @NonNull Expression second)
      Returns the result of raising the first input to the power specified by the second.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(pow(pi(), literal(2.0f)))
       );
       
       
      Parameters:
      first - the first number
      second - the second number
      Returns:
      expression
    • pow

      public static Expression pow(@NonNull Number first, @NonNull Number second)
      Returns the result of raising the first input to the power specified by the second.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(pow(5.0f, 2.0f))
       );
       
       
      Parameters:
      first - the first number
      second - the second number
      Returns:
      expression
    • sqrt

      public static Expression sqrt(@NonNull Expression number)
      Returns the square root of the input

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(sqrt(pi()))
       );
       
       
      Parameters:
      number - the number to take the square root from
      Returns:
      expression
    • sqrt

      public static Expression sqrt(@NonNull Number number)
      Returns the square root of the input

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(sqrt(25.0f))
       );
       
       
      Parameters:
      number - the number to take the square root from
      Returns:
      expression
    • log10

      public static Expression log10(@NonNull Expression number)
      Returns the base-ten logarithm of the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(log10(pi()))
       );
       
       
      Parameters:
      number - the number to take base-ten logarithm from
      Returns:
      expression
    • log10

      public static Expression log10(@NonNull Number number)
      Returns the base-ten logarithm of the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(log10(10))
       );
       
       
      Parameters:
      number - the number to take base-ten logarithm from
      Returns:
      expression
    • ln

      public static Expression ln(Expression number)
      Returns the natural logarithm of the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(ln(pi()))
       );
       
       
      Parameters:
      number - the number to take natural logarithm from
      Returns:
      expression
    • ln

      public static Expression ln(@NonNull Number number)
      Returns the natural logarithm of the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(ln(10))
       );
       
       
      Parameters:
      number - the number to take natural logarithm from
      Returns:
      expression
    • log2

      public static Expression log2(@NonNull Expression number)
      Returns the base-two logarithm of the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(log2(pi()))
       );
       
       
      Parameters:
      number - the number to take base-two logarithm from
      Returns:
      expression
    • log2

      public static Expression log2(@NonNull Number number)
      Returns the base-two logarithm of the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(log2(2))
       );
       
       
      Parameters:
      number - the number to take base-two logarithm from
      Returns:
      expression
    • sin

      public static Expression sin(@NonNull Expression number)
      Returns the sine of the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(sin(pi()))
       );
       
       
      Parameters:
      number - the number to calculate the sine for
      Returns:
      expression
    • sin

      public static Expression sin(@NonNull Number number)
      Returns the sine of the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(sin(90.0f))
       );
       
       
      Parameters:
      number - the number to calculate the sine for
      Returns:
      expression
    • cos

      public static Expression cos(@NonNull Expression number)
      Returns the cosine of the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(cos(pi()))
       );
       
       
      Parameters:
      number - the number to calculate the cosine for
      Returns:
      expression
    • cos

      public static Expression cos(@NonNull Number number)
      Returns the cosine of the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(cos(0))
       );
       
       
      Parameters:
      number - the number to calculate the cosine for
      Returns:
      expression
    • tan

      public static Expression tan(@NonNull Expression number)
      Returns the tangent of the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(tan(pi()))
       );
       
       
      Parameters:
      number - the number to calculate the tangent for
      Returns:
      expression
    • tan

      public static Expression tan(@NonNull Number number)
      Returns the tangent of the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(tan(45.0f))
       );
       
       
      Parameters:
      number - the number to calculate the tangent for
      Returns:
      expression
    • asin

      public static Expression asin(@NonNull Expression number)
      Returns the arcsine of the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(asin(pi()))
       );
       
       
      Parameters:
      number - the number to calculate the arcsine for
      Returns:
      expression
    • asin

      public static Expression asin(@NonNull Number number)
      Returns the arcsine of the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(asin(90))
       );
       
       
      Parameters:
      number - the number to calculate the arcsine for
      Returns:
      expression
    • acos

      public static Expression acos(@NonNull Expression number)
      Returns the arccosine of the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(acos(pi()))
       );
       
       
      Parameters:
      number - the number to calculate the arccosine for
      Returns:
      expression
    • acos

      public static Expression acos(@NonNull Number number)
      Returns the arccosine of the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(acos(0))
       );
       
       
      Parameters:
      number - the number to calculate the arccosine for
      Returns:
      expression
    • atan

      public static Expression atan(@NonNull Expression number)
      Returns the arctangent of the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(asin(pi()))
       );
       
       
      Parameters:
      number - the number to calculate the arctangent for
      Returns:
      expression
    • atan

      public static Expression atan(@NonNull Number number)
      Returns the arctangent of the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(atan(90))
       );
       
       
      Parameters:
      number - the number to calculate the arctangent for
      Returns:
      expression
    • min

      public static Expression min(@Size(min=1L) Expression... numbers)
      Returns the minimum value of the inputs.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(min(pi(), literal(3.14f), literal(3.15f)))
       );
       
       
      Parameters:
      numbers - varargs of numbers to get the minimum from
      Returns:
      expression
    • min

      public static Expression min(@Size(min=1L) Number... numbers)
      Returns the minimum value of the inputs.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(min(3.141, 3.14f, 3.15f))
       );
       
       
      Parameters:
      numbers - varargs of numbers to get the minimum from
      Returns:
      expression
    • max

      public static Expression max(@Size(min=1L) Expression... numbers)
      Returns the maximum value of the inputs.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(max(pi(), product(pi(), pi())))
       );
       
       
      Parameters:
      numbers - varargs of numbers to get the maximum from
      Returns:
      expression
    • max

      public static Expression max(@Size(min=1L) Number... numbers)
      Returns the maximum value of the inputs.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(max(3.141, 3.14f, 3.15f))
       );
       
       
      Parameters:
      numbers - varargs of numbers to get the maximum from
      Returns:
      expression
    • round

      public static Expression round(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:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(round(pi()))
       );
       
       
      Parameters:
      expression - number expression to round
      Returns:
      expression
    • round

      public static Expression round(@NonNull Number number)
      Rounds the input to the nearest integer. Halfway values are rounded away from zero. For example `[\"round\", -1.5]` evaluates to -2.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(round(3.14159265359f))
       );
       
       
      Parameters:
      number - number to round
      Returns:
      expression
    • abs

      public static Expression abs(Expression expression)
      Returns the absolute value of the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(abs(subtract(pi())))
       );
       
       
      Parameters:
      expression - number expression to get absolute value from
      Returns:
      expression
    • abs

      public static Expression abs(@NonNull Number number)
      Returns the absolute value of the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(abs(-3.14159265359f))
       );
       
       
      Parameters:
      number - number to get absolute value from
      Returns:
      expression
    • ceil

      public static Expression ceil(Expression expression)
      Returns the smallest integer that is greater than or equal to the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(ceil(pi()))
       );
       
       
      Parameters:
      expression - number expression to get value from
      Returns:
      expression
    • ceil

      public static Expression ceil(@NonNull Number number)
      Returns the smallest integer that is greater than or equal to the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(ceil(3.14159265359))
       );
       
       
      Parameters:
      number - number to get value from
      Returns:
      expression
    • floor

      public static Expression floor(Expression expression)
      Returns the largest integer that is less than or equal to the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(floor(pi()))
       );
       
       
      Parameters:
      expression - number expression to get value from
      Returns:
      expression
    • floor

      public static Expression floor(@NonNull Number number)
      Returns the largest integer that is less than or equal to the input.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(floor(pi()))
       );
       
       
      Parameters:
      number - number to get value from
      Returns:
      expression
    • resolvedLocale

      public static Expression resolvedLocale(Expression collator)
      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:

       
       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))))
       );
       
       
      Parameters:
      collator - the collator expression
      Returns:
      expression
    • isSupportedScript

      public static Expression isSupportedScript(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 TrimbleMaps GL JS).

      Example usage:

       
       trimbleMapsMap.getStyle().addLayer(new SymbolLayer("layer-id", "source-id")
         .withProperties(
           textField(
             switchCase(
               isSupportedScript(get("name_property")), get("name_property"),
               literal("not-compatible")
             )
           )
         ));
       
       
      Parameters:
      expression - the expression to evaluate
      Returns:
      expression
    • isSupportedScript

      public static Expression isSupportedScript(@NonNull String string)
      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 TrimbleMaps GL JS).

      Example usage:

       
       trimbleMapsMap.getStyle().addLayer(new SymbolLayer("layer-id", "source-id")
       .withProperties(
         textField(
           switchCase(
             isSupportedScript("ಗೌರವಾರ್ಥವಾಗಿ"), literal("ಗೌರವಾರ್ಥವಾಗಿ"),
             literal("not-compatible"))
           )
         )
       );
       
       
      Parameters:
      string - the string to evaluate
      Returns:
      expression
    • upcase

      public static Expression upcase(@NonNull Expression string)
      Returns the input string converted to uppercase.

      Follows the Unicode Default Case Conversion algorithm and the locale-insensitive case mappings in the Unicode Character Database.

      Example usage:

       
       SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
       symbolLayer.setProperties(
           textField(upcase(get("key-to-string-value")))
       );
       
       
      Parameters:
      string - the string to upcase
      Returns:
      expression
    • upcase

      public static Expression upcase(@NonNull String string)
      Returns the input string converted to uppercase.

      Follows the Unicode Default Case Conversion algorithm and the locale-insensitive case mappings in the Unicode Character Database.

      Example usage:

       
       SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
       symbolLayer.setProperties(
           textField(upcase("text"))
       );
       
       
      Parameters:
      string - string to upcase
      Returns:
      expression
    • downcase

      public static Expression downcase(@NonNull Expression input)
      Returns the input string converted to lowercase.

      Follows the Unicode Default Case Conversion algorithm and the locale-insensitive case mappings in the Unicode Character Database.

      Example usage:

       
       SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
       symbolLayer.setProperties(
           textField(downcase(get("key-to-string-value")))
       );
       
       
      Parameters:
      input - expression input
      Returns:
      expression
    • downcase

      public static Expression downcase(@NonNull String input)
      Returns the input string converted to lowercase.

      Follows the Unicode Default Case Conversion algorithm and the locale-insensitive case mappings in the Unicode Character Database.

      Example usage:

       
       SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
       symbolLayer.setProperties(
           textField(upcase("key-to-string-value"))
       );
       
       
      Parameters:
      input - string to downcase
      Returns:
      expression
    • concat

      public static Expression concat(@NonNull Expression... input)
      Returns a string consisting of the concatenation of the inputs.

      Example usage:

       
       SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
       symbolLayer.setProperties(
           textField(concat(get("key-to-string-value"), literal("other string")))
       );
       
       
      Parameters:
      input - expression input
      Returns:
      expression
    • concat

      public static Expression concat(@NonNull String... input)
      Returns a string consisting of the concatenation of the inputs.

      Example usage:

       
       SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
       symbolLayer.setProperties(
           textField(concat("foo", "bar"))
       );
       
       
      Parameters:
      input - expression input
      Returns:
      expression
    • array

      public static Expression array(@NonNull Expression input)
      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.
      Parameters:
      input - expression input
      Returns:
      expression
    • typeOf

      public static Expression typeOf(@NonNull Expression input)
      Returns a string describing the type of the given value.
      Parameters:
      input - expression input
      Returns:
      expression
    • string

      public static Expression string(@NonNull Expression... input)
      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.
      Parameters:
      input - expression input
      Returns:
      expression
    • number

      public static Expression number(@NonNull Expression... input)
      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.
      Parameters:
      input - expression input
      Returns:
      expression
    • numberFormat

      public static Expression numberFormat(@NonNull Expression number, @NonNull Expression.NumberFormatOption... options)
      Converts the input number into a string representation using the providing formatting rules. If set, the locale argument specifies the locale to use, as a BCP 47 language tag. If set, the currency argument specifies an ISO 4217 code to use for currency-style formatting. If set, the min-fraction-digits and max-fraction-digits arguments specify the minimum and maximum number of fractional digits to include.
      Parameters:
      number - number expression
      options - number formatting options
      Returns:
      expression
    • numberFormat

      public static Expression numberFormat(@NonNull Number number, @NonNull Expression.NumberFormatOption... options)
      Converts the input number into a string representation using the providing formatting rules. If set, the locale argument specifies the locale to use, as a BCP 47 language tag. If set, the currency argument specifies an ISO 4217 code to use for currency-style formatting. If set, the min-fraction-digits and max-fraction-digits arguments specify the minimum and maximum number of fractional digits to include.
      Parameters:
      number - number expression
      options - number formatting options
      Returns:
      expression
    • bool

      public static Expression bool(@NonNull Expression... input)
      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.
      Parameters:
      input - expression input
      Returns:
      expression
    • collator

      public static Expression collator(boolean caseSensitive, boolean diacriticSensitive, Locale locale)
      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.
      Parameters:
      caseSensitive - case sensitive flag
      diacriticSensitive - diacritic sensitive flag
      locale - locale
      Returns:
      expression
    • collator

      public static Expression collator(boolean caseSensitive, boolean diacriticSensitive)
      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.
      Parameters:
      caseSensitive - case sensitive flag
      diacriticSensitive - diacritic sensitive flag
      Returns:
      expression
    • collator

      public static Expression collator(Expression caseSensitive, Expression diacriticSensitive, Expression locale)
      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.
      Parameters:
      caseSensitive - case sensitive flag
      diacriticSensitive - diacritic sensitive flag
      locale - locale
      Returns:
      expression
    • collator

      public static Expression collator(Expression caseSensitive, Expression diacriticSensitive)
      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.
      Parameters:
      caseSensitive - case sensitive flag
      diacriticSensitive - diacritic sensitive flag
      Returns:
      expression
    • format

      public static Expression format(@NonNull Expression.FormatEntry... formatEntries)
      Returns formatted text containing annotations for use in mixed-format text-field entries.

      To build the expression, use formatEntry(Expression, FormatOption...).

      "format" expression can be used, for example, with the PropertyFactory.textField(Expression) 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:

       
       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("\n"), get("description_property")), formatFontScale(1.5))
           )
         )
       );
       
       
      Parameters:
      formatEntries - format entries
      Returns:
      expression
    • formatEntry

      public static Expression.FormatEntry formatEntry(@NonNull Expression text, @Nullable Expression.FormatOption... formatOptions)
      Returns a format entry that can be used in format(FormatEntry...) to create formatted text fields.

      Text is required to be of a resulting type string.

      Text is required to be passed; Expression.FormatOptions are optional and will default to the base values defined for the symbol.

      Parameters:
      text - displayed text
      formatOptions - format options
      Returns:
      format entry
    • formatEntry

      public static Expression.FormatEntry formatEntry(@NonNull Expression text)
      Returns a format entry that can be used in format(FormatEntry...) to create formatted text fields.

      Text is required to be of a resulting type string.

      Text is required to be passed; Expression.FormatOptions are optional and will default to the base values defined for the symbol.

      Parameters:
      text - displayed text
      Returns:
      format entry
    • formatEntry

      public static Expression.FormatEntry formatEntry(@NonNull String text, @Nullable Expression.FormatOption... formatOptions)
      Returns a format entry that can be used in format(FormatEntry...) to create formatted text fields.

      Text is required to be of a resulting type string.

      Text is required to be passed; Expression.FormatOptions are optional and will default to the base values defined for the symbol.

      Parameters:
      text - displayed text
      formatOptions - format options
      Returns:
      format entry
    • formatEntry

      public static Expression.FormatEntry formatEntry(@NonNull String text)
      Returns a format entry that can be used in format(FormatEntry...) to create formatted text fields.

      Text is required to be of a resulting type string.

      Text is required to be passed; Expression.FormatOptions are optional and will default to the base values defined for the symbol.

      Parameters:
      text - displayed text
      Returns:
      format entry
    • image

      public static Expression image(@NonNull Expression input)
      Returns image expression for use in '*-pattern' and 'icon-image' layer properties. Compared to string literals that can be used to represent an image, image expression allows to determine an image's availability at runtime, thus, can be used in conditional coalesce operator.

      Example usage:

       
       SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
       symbolLayer.setProperties(
           iconImage(image(get("key-to-feature")))
       );
       
       

      Example usage with coalesce operator:

       
       SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
       symbolLayer.setProperties(
           iconImage(
               coalesce(
                   image(literal("maki-11")),
                   image(literal("bicycle-15")),
                   image(literal("default-icon"))
               )
           )
       );
       
       
      Parameters:
      input - expression input
      Returns:
      expression
      See Also:
    • object

      public static Expression object(@NonNull Expression input)
      Asserts that the input value is an object. If it is not, the expression is an error The asserted input value is returned as result.
      Parameters:
      input - expression input
      Returns:
      expression
    • toString

      public static Expression toString(@NonNull Expression input)
      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 ECMAScript Language Specification.

      Example usage:

       
       SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
       symbolLayer.setProperties(
           textField(get("key-to-number-value"))
       );
       
       
      Parameters:
      input - expression input
      Returns:
      expression
    • toNumber

      public static Expression toNumber(@NonNull Expression input)
      Converts the input value to a number, if possible. If the input is null or false, the result is 0. If the input is true, the result is 1. If the input is a string, it is converted to a number as specified by the ECMAScript Language Specification. If multiple values are provided, each one is evaluated in order until the first successful conversion is obtained. If none of the inputs can be converted, the expression is an error.

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(toNumber(get("key-to-string-value")))
       );
       
       
      Parameters:
      input - expression input
      Returns:
      expression
    • toBool

      public static Expression toBool(@NonNull Expression input)
      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:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(toBool(get("key-to-value")))
       );
       
       
      Parameters:
      input - expression input
      Returns:
      expression
    • toColor

      public static Expression toColor(@NonNull Expression input)
      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:

       
       FillLayer fillLayer = new FillLayer("layer-id", "source-id");
       fillLayer.setProperties(
           fillColor(toColor(get("keyStringValue")))
       );
       
       
      Parameters:
      input - expression input
      Returns:
      expression
    • let

      public static Expression let(@Size(min=1L) Expression... input)
      Binds input to named variables, which can then be referenced in the result expression using var(String) or var(Expression).
      Parameters:
      input - expression input
      Returns:
      expression
    • var

      public static Expression var(@NonNull Expression expression)
      References variable bound using let.
      Parameters:
      expression - the variable naming expression that was bound with using let
      Returns:
      expression
    • var

      public static Expression var(@NonNull String variableName)
      References variable bound using let.
      Parameters:
      variableName - the variable naming that was bound with using let
      Returns:
      expression
    • zoom

      public static Expression zoom()
      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:

       
       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))
             )
           )
       );
       
       
      Returns:
      expression
    • stop

      public static Expression.Stop stop(@NonNull Object stop, @NonNull Object value)
      Produces a stop value.

      Can be used for stop(Object, Object) as part of varargs parameter in step(Number, Expression, Stop...) or interpolate(Interpolator, Expression, Stop...).

      Example usage:

       
       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))
           )
       );
       
       
      Parameters:
      stop - the stop input
      value - the stop output
      Returns:
      the stop
    • step

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

      Example usage:

       
       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))
           )
       );
       
       
      Parameters:
      input - the input value
      defaultOutput - the default output expression
      stops - pair of input and output values
      Returns:
      expression
    • step

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

      Example usage:

       
       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))
           )
       );
       
       
      Parameters:
      input - the input expression
      defaultOutput - the default output expression
      stops - pair of input and output values
      Returns:
      expression
    • step

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

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(
               step(zoom(), literal(0.0f),
               stop(1, 2.5f),
               stop(10, 5.0f))
           )
       );
       
       
      Parameters:
      input - the input value
      defaultOutput - the default output expression
      stops - pair of input and output values
      Returns:
      expression
    • step

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

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(
               step(zoom(), literal(0.0f),
               stop(1, 2.5f),
               stop(10, 5.0f))
           )
       );
       
       
      Parameters:
      input - the input value
      defaultOutput - the default output expression
      stops - pair of input and output values
      Returns:
      expression
    • step

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

      Example usage:

       
       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))
           )
       );
       
       
      Parameters:
      input - the input value
      defaultOutput - the default output expression
      stops - pair of input and output values
      Returns:
      expression
    • step

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

      Example usage:

       
       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))
           )
       );
       
       
      Parameters:
      input - the input expression
      defaultOutput - the default output expression
      stops - pair of input and output values
      Returns:
      expression
    • step

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

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(
               step(zoom(), 0.0f,
               stop(1, 2.5f),
               stop(10, 5.0f))
           )
       );
       
       
      Parameters:
      input - the input value
      defaultOutput - the default output expression
      stops - pair of input and output values
      Returns:
      expression
    • step

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

      Example usage:

       
       CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
       circleLayer.setProperties(
           circleRadius(
               step(zoom(), 0.0f,
               stop(1, 2.5f),
               stop(10, 5.0f))
           )
       );
       
       
      Parameters:
      input - the input value
      defaultOutput - the default output expression
      stops - pair of input and output values
      Returns:
      expression
    • interpolate

      public static Expression interpolate(@NonNull Expression.Interpolator interpolation, @NonNull Expression number, @NonNull Expression... stops)
      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:

       
       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)
             )
           )
         )
       );
       
       
      Parameters:
      interpolation - type of interpolation
      number - the input expression
      stops - pair of input and output values
      Returns:
      expression
    • interpolate

      public static Expression interpolate(@NonNull Expression.Interpolator interpolation, @NonNull Expression number, Expression.Stop... stops)
      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:

       
       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))
             )
           )
       );
       
       
      Parameters:
      interpolation - type of interpolation
      number - the input expression
      stops - pair of input and output values
      Returns:
      expression
    • linear

      public static Expression.Interpolator linear()
      interpolates linearly between the pair of stops just less than and just greater than the input.

      Example usage:

       
       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))
             )
           )
       );
       
       
      Returns:
      expression
    • exponential

      public static Expression.Interpolator exponential(@NonNull Number base)
      Interpolates exponentially between the stops just less than and just greater than the input. `base` controls the rate at which the output increases: higher values make the output increase more towards the high end of the range. With values close to 1 the output increases linearly.

      Example usage:

       
       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))
             )
           )
       );
       
       
      Parameters:
      base - value controlling the route at which the output increases
      Returns:
      expression
    • exponential

      public static Expression.Interpolator exponential(@NonNull Expression expression)
      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:

       
       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))
             )
           )
       );
       
       
      Parameters:
      expression - base number expression
      Returns:
      expression
    • cubicBezier

      public static Expression.Interpolator cubicBezier(@NonNull Expression x1, @NonNull Expression y1, @NonNull Expression x2, @NonNull Expression y2)
      Interpolates using the cubic bezier curve defined by the given control points.

      Example usage:

       
       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))
             )
           )
       );
       
       
      Parameters:
      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
      Returns:
      expression
    • cubicBezier

      public static Expression.Interpolator cubicBezier(@NonNull Number x1, @NonNull Number y1, @NonNull Number x2, @NonNull Number y2)
      Interpolates using the cubic bezier curve defined by the given control points.

      Example usage:

       
       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))
             )
           )
       );
       
       
      Parameters:
      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
      Returns:
      expression
    • toArray

      @NonNull public Object[] toArray()
      Converts the expression to Object array representation.

      The output will later be converted to a JSON Object array.

      Returns:
      the converted object array expression
    • toString

      public String toString()
      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 (").

      Overrides:
      toString in class Object
      Returns:
      a string representation of the object.
    • raw

      public static Expression raw(@NonNull String rawExpression)
      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

         
         ["to-color", "rgba(255, 0, 0, 255)"]
         
       
      Parameters:
      rawExpression - the raw expression
      Returns:
      the resulting expression
    • equals

      public boolean equals(@Nullable Object o)
      Indicates whether some other object is "equal to" this one.
      Overrides:
      equals in class Object
      Parameters:
      o - the other object
      Returns:
      true if equal, false if not
    • hashCode

      public int hashCode()
      Returns a hash code value for the expression.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this expression