public class Expression
extends java.lang.Object
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))
))
)
)
);
Modifier and Type | Class and Description |
---|---|
static class |
Expression.Array
Expression array type.
|
static class |
Expression.Converter
Converts a JsonArray or a raw expression to a Java expression.
|
static class |
Expression.ExpressionLiteral
ExpressionLiteral wraps an object to be used as a literal in an expression.
|
static class |
Expression.FormatEntry
Holds format entries used in a
format(FormatEntry...) expression. |
static class |
Expression.FormatOption
Holds format options used in a
formatEntry(Expression, FormatOption...) that builds
a format(FormatEntry...) expression. |
static class |
Expression.Interpolator
Expression interpolator type.
|
static class |
Expression.NumberFormatOption
Holds format options used in a
numberFormat(Number, NumberFormatOption...) expression. |
static class |
Expression.Stop
Expression stop type.
|
Constructor and Description |
---|
Expression(java.lang.String operator,
Expression... arguments)
Creates an expression from its operator and varargs expressions.
|
Modifier and Type | Method and Description |
---|---|
static Expression |
abs(Expression expression)
Returns the absolute value of the input.
|
static Expression |
abs(java.lang.Number number)
Returns the absolute value of the input.
|
static Expression |
accumulated()
Gets the value of a cluster property accumulated so far.
|
static Expression |
acos(Expression number)
Returns the arccosine of the input.
|
static Expression |
acos(java.lang.Number number)
Returns the arccosine of the input.
|
static Expression |
all(Expression... input)
Returns `true` if all the inputs are `true`, `false` otherwise.
|
static Expression |
any(Expression... input)
Returns `true` if any of the inputs are `true`, `false` otherwise.
|
static Expression |
array(Expression input)
Asserts that the input is an array (optionally with a specific item type and length).
|
static Expression |
asin(Expression number)
Returns the arcsine of the input.
|
static Expression |
asin(java.lang.Number number)
Returns the arcsine of the input.
|
static Expression |
at(Expression number,
Expression expression)
Retrieves an item from an array.
|
static Expression |
at(java.lang.Number number,
Expression expression)
Retrieves an item from an array.
|
static Expression |
atan(Expression number)
Returns the arctangent of the input.
|
static Expression |
atan(java.lang.Number number)
Returns the arctangent of the input.
|
static Expression |
bool(Expression... input)
Asserts that the input value is a boolean.
|
static Expression |
ceil(Expression expression)
Returns the smallest integer that is greater than or equal to the input.
|
static Expression |
ceil(java.lang.Number number)
Returns the smallest integer that is greater than or equal to the input.
|
static Expression |
coalesce(Expression... input)
Evaluates each expression in turn until the first non-null value is obtained, and returns that value.
|
static Expression |
collator(boolean caseSensitive,
boolean diacriticSensitive)
Returns a collator for use in locale-dependent comparison operations.
|
static Expression |
collator(boolean caseSensitive,
boolean diacriticSensitive,
java.util.Locale locale)
Returns a collator for use in locale-dependent comparison operations.
|
static Expression |
collator(Expression caseSensitive,
Expression diacriticSensitive)
Returns a collator for use in locale-dependent comparison operations.
|
static Expression |
collator(Expression caseSensitive,
Expression diacriticSensitive,
Expression locale)
Returns a collator for use in locale-dependent comparison operations.
|
static Expression |
color(int color)
Expression literal utility method to convert a color int to an color expression
|
static Expression |
concat(Expression... input)
Returns a string consisting of the concatenation of the inputs.
|
static Expression |
concat(java.lang.String... input)
Returns a string consisting of the concatenation of the inputs.
|
static Expression |
cos(Expression number)
Returns the cosine of the input.
|
static Expression |
cos(java.lang.Number number)
Returns the cosine of the input.
|
static Expression.Interpolator |
cubicBezier(Expression x1,
Expression y1,
Expression x2,
Expression y2)
Interpolates using the cubic bezier curve defined by the given control points.
|
static Expression.Interpolator |
cubicBezier(java.lang.Number x1,
java.lang.Number y1,
java.lang.Number x2,
java.lang.Number y2)
Interpolates using the cubic bezier curve defined by the given control points.
|
static Expression |
distance(com.mapbox.geojson.GeoJson geoJson)
Retrieves the shortest distance between two geometries.
|
static Expression |
division(Expression first,
Expression second)
Returns the result of floating point division of the first input by the second.
|
static Expression |
division(java.lang.Number first,
java.lang.Number second)
Returns the result of floating point division of the first input by the second.
|
static Expression |
downcase(Expression input)
Returns the input string converted to lowercase.
|
static Expression |
downcase(java.lang.String input)
Returns the input string converted to lowercase.
|
static Expression |
e()
Returns the mathematical constant e.
|
static Expression |
eq(Expression compareOne,
boolean compareTwo)
Returns true if the input values are equal, false otherwise.
|
static Expression |
eq(Expression compareOne,
Expression compareTwo)
Returns true if the input values are equal, false otherwise.
|
static Expression |
eq(Expression compareOne,
Expression compareTwo,
Expression collator)
Returns true if the input values are equal, false otherwise.
|
static Expression |
eq(Expression compareOne,
java.lang.Number compareTwo)
Returns true if the input values are equal, false otherwise.
|
static Expression |
eq(Expression compareOne,
java.lang.String compareTwo)
Returns true if the input values are equal, false otherwise.
|
static Expression |
eq(Expression compareOne,
java.lang.String compareTwo,
Expression collator)
Returns true if the input values are equal, false otherwise.
|
boolean |
equals(java.lang.Object o)
Indicates whether some other object is "equal to" this one.
|
static Expression.Interpolator |
exponential(Expression expression)
Interpolates exponentially between the stops just less than and just greater than the input.
|
static Expression.Interpolator |
exponential(java.lang.Number base)
Interpolates exponentially between the stops just less than and just greater than the input.
|
static Expression |
floor(Expression expression)
Returns the largest integer that is less than or equal to the input.
|
static Expression |
floor(java.lang.Number number)
Returns the largest integer that is less than or equal to the input.
|
static Expression |
format(Expression.FormatEntry... formatEntries)
Returns formatted text containing annotations for use in mixed-format text-field entries.
|
static Expression.FormatEntry |
formatEntry(Expression text)
Returns a format entry that can be used in
format(FormatEntry...) to create formatted text fields. |
static Expression.FormatEntry |
formatEntry(Expression text,
Expression.FormatOption... formatOptions)
Returns a format entry that can be used in
format(FormatEntry...) to create formatted text fields. |
static Expression.FormatEntry |
formatEntry(java.lang.String text)
Returns a format entry that can be used in
format(FormatEntry...) to create formatted text fields. |
static Expression.FormatEntry |
formatEntry(java.lang.String text,
Expression.FormatOption... formatOptions)
Returns a format entry that can be used in
format(FormatEntry...) to create formatted text fields. |
static Expression |
geometryType()
Gets the feature's geometry type: Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon.
|
static Expression |
get(Expression input)
Retrieves a property value from the current feature's properties,
or from another object if a second argument is provided.
|
static Expression |
get(Expression key,
Expression object)
Retrieves a property value from another object.
|
static Expression |
get(java.lang.String input)
Retrieves a property value from the current feature's properties,
or from another object if a second argument is provided.
|
static Expression |
get(java.lang.String key,
Expression object)
Retrieves a property value from another object.
|
static Expression |
gt(Expression compareOne,
Expression compareTwo)
Returns true if the first input is strictly greater than the second, false otherwise.
|
static Expression |
gt(Expression compareOne,
Expression compareTwo,
Expression collator)
Returns true if the first input is strictly greater than the second, false otherwise.
|
static Expression |
gt(Expression compareOne,
java.lang.Number compareTwo)
Returns true if the first input is strictly greater than the second, false otherwise.
|
static Expression |
gt(Expression compareOne,
java.lang.String compareTwo)
Returns true if the first input is strictly greater than the second, false otherwise.
|
static Expression |
gt(Expression compareOne,
java.lang.String compareTwo,
Expression collator)
Returns true if the first input is strictly greater than the second, false otherwise.
|
static Expression |
gte(Expression compareOne,
Expression compareTwo)
Returns true if the first input is greater than or equal to the second, false otherwise.
|
static Expression |
gte(Expression compareOne,
Expression compareTwo,
Expression collator)
Returns true if the first input is greater than or equal to the second, false otherwise.
|
static Expression |
gte(Expression compareOne,
java.lang.Number compareTwo)
Returns true if the first input is greater than or equal to the second, false otherwise.
|
static Expression |
gte(Expression compareOne,
java.lang.String compareTwo)
Returns true if the first input is greater than or equal to the second, false otherwise.
|
static Expression |
gte(Expression compareOne,
java.lang.String compareTwo,
Expression collator)
Returns true if the first input is greater than or equal to the second, false otherwise.
|
static Expression |
has(Expression key)
Tests for the presence of an property value in the current feature's properties.
|
static Expression |
has(Expression key,
Expression object)
Tests for the presence of an property value from another object.
|
static Expression |
has(java.lang.String key)
Tests for the presence of an property value in the current feature's properties.
|
static Expression |
has(java.lang.String key,
Expression object)
Tests for the presence of an property value from another object.
|
int |
hashCode()
Returns a hash code value for the expression.
|
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.
|
static Expression |
id()
Gets the feature's id, if it has one.
|
static Expression |
image(Expression input)
Returns image expression for use in '*-pattern' and 'icon-image' layer properties.
|
static Expression |
in(Expression needle,
Expression haystack)
Retrieves whether an item exists in an array or a substring exists in a string.
|
static Expression |
in(java.lang.Number needle,
Expression haystack)
Retrieves whether an item exists in an array or a substring exists in a string.
|
static Expression |
in(java.lang.String needle,
Expression haystack)
Retrieves whether an item exists in an array or a substring exists in a string.
|
static Expression |
interpolate(Expression.Interpolator interpolation,
Expression number,
Expression... stops)
Produces continuous, smooth results by interpolating between pairs of input and output values (\"stops\").
|
static Expression |
interpolate(Expression.Interpolator interpolation,
Expression number,
Expression.Stop... stops)
Produces continuous, smooth results by interpolating between pairs of input and output values (\"stops\").
|
static Expression |
isSupportedScript(Expression expression)
Returns true if the input string is expected to render legibly.
|
static Expression |
isSupportedScript(java.lang.String string)
Returns true if the input string is expected to render legibly.
|
static Expression |
length(Expression expression)
Gets the length of an array or string.
|
static Expression |
length(java.lang.String input)
Gets the length of an array or string.
|
static Expression |
let(Expression... input)
Binds input to named variables,
which can then be referenced in the result expression using
var(String) or var(Expression) . |
static Expression.Interpolator |
linear()
interpolates linearly between the pair of stops just less than and just greater than the input.
|
static Expression |
lineProgress()
Gets the progress along a gradient line.
|
static Expression |
literal(boolean bool)
Create a literal boolean expression.
|
static Expression |
literal(java.lang.Number number)
Create a literal number expression.
|
static Expression |
literal(java.lang.Object object)
Create a literal object expression.
|
static Expression |
literal(java.lang.Object[] array)
Create a literal array expression
|
static Expression |
literal(java.lang.String string)
Create a literal string expression.
|
static Expression |
ln(Expression number)
Returns the natural logarithm of the input.
|
static Expression |
ln(java.lang.Number number)
Returns the natural logarithm of the input.
|
static Expression |
ln2()
Returns mathematical constant ln(2).
|
static Expression |
log10(Expression number)
Returns the base-ten logarithm of the input.
|
static Expression |
log10(java.lang.Number number)
Returns the base-ten logarithm of the input.
|
static Expression |
log2(Expression number)
Returns the base-two logarithm of the input.
|
static Expression |
log2(java.lang.Number number)
Returns the base-two logarithm of the input.
|
static Expression |
lt(Expression compareOne,
Expression compareTwo)
Returns true if the first input is strictly less than the second, false otherwise.
|
static Expression |
lt(Expression compareOne,
Expression compareTwo,
Expression collator)
Returns true if the first input is strictly less than the second, false otherwise.
|
static Expression |
lt(Expression compareOne,
java.lang.Number compareTwo)
Returns true if the first input is strictly less than the second, false otherwise.
|
static Expression |
lt(Expression compareOne,
java.lang.String compareTwo)
Returns true if the first input is strictly less than the second, false otherwise.
|
static Expression |
lt(Expression compareOne,
java.lang.String compareTwo,
Expression collator)
Returns true if the first input is strictly less than the second, false otherwise.
|
static Expression |
lte(Expression compareOne,
Expression compareTwo)
Returns true if the first input is less than or equal to the second, false otherwise.
|
static Expression |
lte(Expression compareOne,
Expression compareTwo,
Expression collator)
Returns true if the first input is less than or equal to the second, false otherwise.
|
static Expression |
lte(Expression compareOne,
java.lang.Number compareTwo)
Returns true if the first input is less than or equal to the second, false otherwise.
|
static Expression |
lte(Expression compareOne,
java.lang.String compareTwo)
Returns true if the first input is less than or equal to the second, false otherwise.
|
static Expression |
lte(Expression compareOne,
java.lang.String compareTwo,
Expression collator)
Returns true if the first input is less than or equal to the second, false otherwise.
|
static Expression |
match(Expression... input)
Selects the output whose label value matches the input value, or the fallback value if no match is found.
|
static Expression |
match(Expression input,
Expression defaultOutput,
Expression.Stop... stops)
Selects the output whose label value matches the input value, or the fallback value if no match is found.
|
static Expression |
max(Expression... numbers)
Returns the maximum value of the inputs.
|
static Expression |
max(java.lang.Number... numbers)
Returns the maximum value of the inputs.
|
static Expression |
min(Expression... numbers)
Returns the minimum value of the inputs.
|
static Expression |
min(java.lang.Number... numbers)
Returns the minimum value of the inputs.
|
static Expression |
mod(Expression first,
Expression second)
Returns the remainder after integer division of the first input by the second.
|
static Expression |
mod(java.lang.Number first,
java.lang.Number second)
Returns the remainder after integer division of the first input by the second.
|
static Expression |
neq(Expression compareOne,
boolean compareTwo)
Returns true if the input values are equal, false otherwise.
|
static Expression |
neq(Expression compareOne,
Expression compareTwo)
Returns true if the input values are not equal, false otherwise.
|
static Expression |
neq(Expression compareOne,
Expression compareTwo,
Expression collator)
Returns true if the input values are not equal, false otherwise.
|
static Expression |
neq(Expression compareOne,
java.lang.Number compareTwo)
Returns `true` if the input values are not equal, `false` otherwise.
|
static Expression |
neq(Expression compareOne,
java.lang.String compareTwo)
Returns `true` if the input values are not equal, `false` otherwise.
|
static Expression |
neq(Expression compareOne,
java.lang.String compareTwo,
Expression collator)
Returns true if the input values are not equal, false otherwise.
|
static Expression |
not(boolean input)
Logical negation.
|
static Expression |
not(Expression input)
Logical negation.
|
static Expression |
number(Expression... input)
Asserts that the input value is a number.
|
static Expression |
numberFormat(Expression number,
Expression.NumberFormatOption... options)
Converts the input number into a string representation using the providing formatting rules.
|
static Expression |
numberFormat(java.lang.Number number,
Expression.NumberFormatOption... options)
Converts the input number into a string representation using the providing formatting rules.
|
static Expression |
object(Expression input)
Asserts that the input value is an object.
|
static Expression |
pi()
Returns the mathematical constant pi.
|
static Expression |
pow(Expression first,
Expression second)
Returns the result of raising the first input to the power specified by the second.
|
static Expression |
pow(java.lang.Number first,
java.lang.Number second)
Returns the result of raising the first input to the power specified by the second.
|
static Expression |
product(Expression... numbers)
Returns the product of the inputs.
|
static Expression |
product(java.lang.Number... numbers)
Returns the product of the inputs.
|
static Expression |
properties()
Gets the feature properties object.
|
static Expression |
raw(java.lang.String rawExpression)
Returns a DSL equivalent of a raw expression.
|
static Expression |
resolvedLocale(Expression collator)
Returns the IETF language tag of the locale being used by the provided collator.
|
static Expression |
rgb(Expression red,
Expression green,
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.
|
static Expression |
rgb(java.lang.Number red,
java.lang.Number green,
java.lang.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.
|
static Expression |
rgba(Expression red,
Expression green,
Expression blue,
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.
|
static Expression |
rgba(java.lang.Number red,
java.lang.Number green,
java.lang.Number blue,
java.lang.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.
|
static Expression |
round(Expression expression)
Rounds the input to the nearest integer.
|
static Expression |
round(java.lang.Number number)
Rounds the input to the nearest integer.
|
static Expression |
sin(Expression number)
Returns the sine of the input.
|
static Expression |
sin(java.lang.Number number)
Returns the sine of the input.
|
static Expression |
sqrt(Expression number)
Returns the square root of the input
|
static Expression |
sqrt(java.lang.Number number)
Returns the square root of the input
|
static Expression |
step(Expression input,
Expression defaultOutput,
Expression... stops)
Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs of
input and output values (\"stops\").
|
static Expression |
step(Expression input,
Expression defaultOutput,
Expression.Stop... stops)
Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs of
input and output values (\"stops\").
|
static Expression |
step(Expression input,
java.lang.Number defaultOutput,
Expression... stops)
Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs of
input and output values (\"stops\").
|
static Expression |
step(Expression input,
java.lang.Number defaultOutput,
Expression.Stop... stops)
Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs of
input and output values (\"stops\").
|
static Expression |
step(java.lang.Number input,
Expression defaultOutput,
Expression... stops)
Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs of
input and output values (\"stops\").
|
static Expression |
step(java.lang.Number input,
Expression defaultOutput,
Expression.Stop... stops)
Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs of
input and output values (\"stops\").
|
static Expression |
step(java.lang.Number input,
java.lang.Number defaultOutput,
Expression... stops)
Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs of
input and output values (\"stops\").
|
static Expression |
step(java.lang.Number input,
java.lang.Number defaultOutput,
Expression.Stop... stops)
Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs of
input and output values (\"stops\").
|
static Expression.Stop |
stop(java.lang.Object stop,
java.lang.Object value)
Produces a stop value.
|
static Expression |
string(Expression... input)
Asserts that the input value is a string.
|
static Expression |
subtract(Expression number)
Returns the result of subtracting a number from 0.
|
static Expression |
subtract(Expression first,
Expression second)
Returns the result of subtracting the second input from the first.
|
static Expression |
subtract(java.lang.Number number)
Returns the result of subtracting a number from 0.
|
static Expression |
subtract(java.lang.Number first,
java.lang.Number second)
Returns the result of subtracting the second input from the first.
|
static Expression |
sum(Expression... numbers)
Returns the sum of the inputs.
|
static Expression |
sum(java.lang.Number... numbers)
Returns the sum of the inputs.
|
static Expression |
switchCase(Expression... input)
Selects the first output whose corresponding test condition evaluates to true.
|
static Expression |
tan(Expression number)
Returns the tangent of the input.
|
static Expression |
tan(java.lang.Number number)
Returns the tangent of the input.
|
java.lang.Object[] |
toArray()
Converts the expression to Object array representation.
|
static Expression |
toBool(Expression input)
Converts the input value to a boolean.
|
static Expression |
toColor(Expression input)
Converts the input value to a color.
|
static Expression |
toNumber(Expression input)
Converts the input value to a number, if possible.
|
static Expression |
toRgba(Expression expression)
Returns a four-element array containing the input color's red, green, blue, and alpha components, in that order.
|
java.lang.String |
toString()
Returns a string representation of the object that matches the definition set in the style specification.
|
static Expression |
toString(Expression input)
Converts the input value to a string.
|
static Expression |
typeOf(Expression input)
Returns a string describing the type of the given value.
|
static Expression |
upcase(Expression string)
Returns the input string converted to uppercase.
|
static Expression |
upcase(java.lang.String string)
Returns the input string converted to uppercase.
|
static Expression |
var(Expression expression)
References variable bound using let.
|
static Expression |
var(java.lang.String variableName)
References variable bound using let.
|
static Expression |
within(com.mapbox.geojson.Polygon polygon) |
static Expression |
zoom()
Gets the current zoom level.
|
public Expression(@NonNull java.lang.String operator, @Nullable Expression... arguments)
operator
- the expression operatorarguments
- expressions inputpublic static Expression literal(@NonNull java.lang.Number number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(literal(10.0f))
);
number
- the numberpublic static Expression literal(@NonNull java.lang.String string)
Example usage:
SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
symbolLayer.setProperties(
textField(literal("Text"))
);
string
- the stringpublic static Expression literal(boolean bool)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setProperties(
fillAntialias(literal(true))
);
bool
- the booleanpublic static Expression literal(@NonNull java.lang.Object object)
object
- the objectpublic static Expression literal(@NonNull java.lang.Object[] array)
array
- the arraypublic static Expression color(@ColorInt int color)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setProperties(
fillColor(color(Color.GREEN))
);
color
- the int colorpublic static Expression rgb(@NonNull Expression red, @NonNull Expression green, @NonNull Expression blue)
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)
)
)
);
red
- red color expressiongreen
- green color expressionblue
- blue color expressionpublic static Expression rgb(@NonNull java.lang.Number red, @NonNull java.lang.Number green, @NonNull java.lang.Number blue)
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)
)
);
red
- red color valuegreen
- green color valueblue
- blue color valuepublic static Expression rgba(@NonNull Expression red, @NonNull Expression green, @NonNull Expression blue, @NonNull Expression alpha)
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)
)
)
);
red
- red color valuegreen
- green color valueblue
- blue color valuealpha
- alpha color valuepublic static Expression rgba(@NonNull java.lang.Number red, @NonNull java.lang.Number green, @NonNull java.lang.Number blue, @NonNull java.lang.Number alpha)
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)
)
);
red
- red color valuegreen
- green color valueblue
- blue color valuealpha
- alpha color valuepublic static Expression toRgba(@NonNull Expression expression)
expression
- an expression to convert to a colorpublic static Expression eq(@NonNull Expression compareOne, @NonNull Expression compareTwo)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
eq(get("keyToValue"), get("keyToOtherValue"))
);
compareOne
- the first expressioncompareTwo
- the second expressionpublic static Expression eq(@NonNull Expression compareOne, @NonNull Expression compareTwo, @NonNull Expression collator)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
eq(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
);
compareOne
- the first expressioncompareTwo
- the second expressioncollator
- the collator expressionpublic static Expression eq(@NonNull Expression compareOne, boolean compareTwo)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
eq(get("keyToValue"), true)
);
compareOne
- the first expressioncompareTwo
- the second booleanpublic static Expression eq(@NonNull Expression compareOne, @NonNull java.lang.String compareTwo)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
eq(get("keyToValue"), "value")
);
compareOne
- the first expressioncompareTwo
- the second numberpublic static Expression eq(@NonNull Expression compareOne, @NonNull java.lang.String compareTwo, @NonNull Expression collator)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
eq(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
);
compareOne
- the first expressioncompareTwo
- the second Stringcollator
- the collator expressionpublic static Expression eq(@NonNull Expression compareOne, @NonNull java.lang.Number compareTwo)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
eq(get("keyToValue"), 2.0f)
);
compareOne
- the first expressioncompareTwo
- the second numberpublic static Expression neq(@NonNull Expression compareOne, @NonNull Expression compareTwo)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
neq(get("keyToValue"), get("keyToOtherValue"))
);
compareOne
- the first expressioncompareTwo
- the second expressionpublic static Expression neq(@NonNull Expression compareOne, @NonNull Expression compareTwo, @NonNull Expression collator)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
neq(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
);
compareOne
- the first expressioncompareTwo
- the second expressioncollator
- the collator expressionpublic static Expression neq(Expression compareOne, boolean compareTwo)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
neq(get("keyToValue"), true)
);
compareOne
- the first expressioncompareTwo
- the second booleanpublic static Expression neq(@NonNull Expression compareOne, @NonNull java.lang.String compareTwo)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
neq(get("keyToValue"), "value")
);
compareOne
- the first expressioncompareTwo
- the second stringpublic static Expression neq(@NonNull Expression compareOne, @NonNull java.lang.String compareTwo, @NonNull Expression collator)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
neq(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
);
compareOne
- the first expressioncompareTwo
- the second Stringcollator
- the collator expressionpublic static Expression neq(@NonNull Expression compareOne, @NonNull java.lang.Number compareTwo)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
neq(get("keyToValue"), 2.0f)
);
compareOne
- the first expressioncompareTwo
- the second numberpublic static Expression gt(@NonNull Expression compareOne, @NonNull Expression compareTwo)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
gt(get("keyToValue"), get("keyToOtherValue"))
);
compareOne
- the first expressioncompareTwo
- the second expressionpublic static Expression gt(@NonNull Expression compareOne, @NonNull Expression compareTwo, @NonNull Expression collator)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
gt(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
);
compareOne
- the first expressioncompareTwo
- the second expressioncollator
- the collator expressionpublic static Expression gt(@NonNull Expression compareOne, @NonNull java.lang.Number compareTwo)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
gt(get("keyToValue"), 2.0f)
);
compareOne
- the first expressioncompareTwo
- the second numberpublic static Expression gt(@NonNull Expression compareOne, @NonNull java.lang.String compareTwo)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
gt(get("keyToValue"), "value")
);
compareOne
- the first expressioncompareTwo
- the second stringpublic static Expression gt(@NonNull Expression compareOne, @NonNull java.lang.String compareTwo, @NonNull Expression collator)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
gt(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
);
compareOne
- the first expressioncompareTwo
- the second Stringcollator
- the collator expressionpublic static Expression lt(@NonNull Expression compareOne, @NonNull Expression compareTwo)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
lt(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
);
compareOne
- the first expressioncompareTwo
- the second expressionpublic static Expression lt(@NonNull Expression compareOne, @NonNull Expression compareTwo, @NonNull Expression collator)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
lt(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
);
compareOne
- the first expressioncompareTwo
- the second numbercollator
- the collator expressionpublic static Expression lt(@NonNull Expression compareOne, @NonNull java.lang.Number compareTwo)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
lt(get("keyToValue"), 2.0f)
);
compareOne
- the first expressioncompareTwo
- the second numberpublic static Expression lt(@NonNull Expression compareOne, @NonNull java.lang.String compareTwo)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
lt(get("keyToValue"), "value")
);
compareOne
- the first expressioncompareTwo
- the second stringpublic static Expression lt(@NonNull Expression compareOne, @NonNull java.lang.String compareTwo, @NonNull Expression collator)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
lt(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
);
compareOne
- the first expressioncompareTwo
- the second Stringcollator
- the collator expressionpublic static Expression gte(@NonNull Expression compareOne, @NonNull Expression compareTwo)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
gte(get("keyToValue"), get("keyToOtherValue"))
);
compareOne
- the first expressioncompareTwo
- the second expressionpublic static Expression gte(@NonNull Expression compareOne, @NonNull Expression compareTwo, @NonNull Expression collator)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
gte(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
);
compareOne
- the first expressioncompareTwo
- the second expressioncollator
- the collator expressionpublic static Expression gte(@NonNull Expression compareOne, @NonNull java.lang.Number compareTwo)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
gte(get("keyToValue"), 2.0f)
);
compareOne
- the first expressioncompareTwo
- the second numberpublic static Expression gte(@NonNull Expression compareOne, @NonNull java.lang.String compareTwo)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
neq(get("keyToValue"), "value")
);
compareOne
- the first expressioncompareTwo
- the second stringpublic static Expression gte(@NonNull Expression compareOne, @NonNull java.lang.String compareTwo, @NonNull Expression collator)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
gte(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
);
compareOne
- the first expressioncompareTwo
- the second Stringcollator
- the collator expressionpublic static Expression lte(@NonNull Expression compareOne, @NonNull Expression compareTwo)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
lte(get("keyToValue"), get("keyToOtherValue"))
);
compareOne
- the first expressioncompareTwo
- the second expressionpublic static Expression lte(@NonNull Expression compareOne, @NonNull Expression compareTwo, @NonNull Expression collator)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
lte(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
);
compareOne
- the first expressioncompareTwo
- the second expressioncollator
- the collator expressionpublic static Expression lte(@NonNull Expression compareOne, @NonNull java.lang.Number compareTwo)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
lte(get("keyToValue"), 2.0f)
);
compareOne
- the first expressioncompareTwo
- the second numberpublic static Expression lte(@NonNull Expression compareOne, @NonNull java.lang.String compareTwo)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
lte(get("keyToValue"), "value")
);
compareOne
- the first expressioncompareTwo
- the second stringpublic static Expression lte(@NonNull Expression compareOne, @NonNull java.lang.String compareTwo, @NonNull Expression collator)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
lte(get("keyToValue"), get("keyToOtherValue"), collator(true, false))
);
compareOne
- the first expressioncompareTwo
- the second Stringcollator
- the collator expressionpublic static Expression all(@NonNull Expression... input)
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"))
);
input
- expression inputpublic static Expression any(@NonNull Expression... input)
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"))
);
input
- expression inputpublic static Expression not(@NonNull Expression input)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
not(get("keyToValue"))
);
input
- expression inputpublic static Expression not(boolean input)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
not(false)
);
input
- boolean inputpublic static Expression switchCase(@NonNull @Size(min=1L) Expression... input)
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
)
)
);
input
- expression inputpublic static Expression match(@NonNull @Size(min=2L) Expression... input)
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)
)
)
);
input
- expression inputpublic static Expression match(@NonNull Expression input, @NonNull Expression defaultOutput, @NonNull Expression.Stop... stops)
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))
)
)
);
input
- expression inputpublic static Expression coalesce(@NonNull Expression... input)
Example usage:
SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
symbolLayer.setProperties(
textColor(
coalesce(
get("keyToNullValue"),
get("keyToNonNullValue")
)
)
);
input
- expression inputpublic static Expression properties()
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()))
);
public static Expression geometryType()
Example usage:
SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
symbolLayer.setProperties(
textField(concat(get("key-to-value"), literal(" "), geometryType()))
);
public static Expression id()
Example usage:
SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
symbolLayer.setProperties(
textField(id())
);
public static Expression accumulated()
Example usage:
GeoJsonOptions options = new GeoJsonOptions()
.withCluster(true)
.withClusterProperty("max", max(accumulated(), get("max")).toArray(), get("mag").toArray());
public static Expression heatmapDensity()
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))
)
);
public static Expression lineProgress()
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)))
)
);
public static Expression at(@NonNull Expression number, @NonNull Expression expression)
number
- the index expressionexpression
- the array expressionpublic static Expression at(@NonNull java.lang.Number number, @NonNull Expression expression)
number
- the index expressionexpression
- the array expressionpublic static Expression in(@NonNull Expression needle, @NonNull Expression haystack)
needle
- the item expressionhaystack
- the array or string expressionpublic static Expression in(@NonNull java.lang.Number needle, @NonNull Expression haystack)
needle
- the item expressionhaystack
- the array or string expressionpublic static Expression in(@NonNull java.lang.String needle, @NonNull Expression haystack)
needle
- the item expressionhaystack
- the array or string expressionpublic static Expression distance(@NonNull com.mapbox.geojson.GeoJson geoJson)
Currently supports `Point`, `MultiPoint`, `LineString`, `MultiLineString` geometry types.
geoJson
- the target feature geoJson.
Currently supports `Point`, `MultiPoint`, `LineString`, `MultiLineString`, `Polygon`, `MultiPolygon`
geometry typespublic static Expression within(@NonNull com.mapbox.geojson.Polygon polygon)
public static Expression get(@NonNull Expression input)
Example usage:
SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
symbolLayer.setProperties(
textField(get("key-to-feature"))
);
input
- expression inputpublic static Expression get(@NonNull java.lang.String input)
Example usage:
SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
symbolLayer.setProperties(
textField(get("key-to-feature"))
);
input
- string inputpublic static Expression get(@NonNull Expression key, @NonNull Expression object)
Example usage:
SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
symbolLayer.setProperties(
textField(get("key-to-property", get("key-to-object")))
);
key
- a property value keyobject
- an expression objectpublic static Expression get(@NonNull java.lang.String key, @NonNull Expression object)
Example usage:
SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
symbolLayer.setProperties(
textField(get("key-to-property", get("key-to-object")))
);
key
- a property value keyobject
- an expression objectpublic static Expression has(@NonNull Expression key)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
has(get("keyToValue"))
);
key
- the expression property value keypublic static Expression has(@NonNull java.lang.String key)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
has("keyToValue")
);
key
- the property value keypublic static Expression has(@NonNull Expression key, @NonNull Expression object)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
has(get("keyToValue"), get("keyToObject"))
);
key
- the expression property value keyobject
- an expression objectpublic static Expression has(@NonNull java.lang.String key, @NonNull Expression object)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setFilter(
has("keyToValue", get("keyToObject"))
);
key
- the property value keyobject
- an expression objectpublic static Expression length(@NonNull Expression expression)
expression
- an expression object or expression stringpublic static Expression length(@NonNull java.lang.String input)
input
- a stringpublic static Expression ln2()
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(product(literal(10.0f), ln2()))
);
public static Expression pi()
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(product(literal(10.0f), pi()))
);
public static Expression e()
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(product(literal(10.0f), e()))
);
public static Expression sum(@Size(min=2L) Expression... numbers)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(sum(literal(10.0f), ln2(), pi()))
);
numbers
- the numbers to calculate the sum forpublic static Expression sum(@Size(min=2L) java.lang.Number... numbers)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(sum(10.0f, 5.0f, 3.0f))
);
numbers
- the numbers to calculate the sum forpublic static Expression product(@Size(min=2L) Expression... numbers)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(product(literal(10.0f), ln2()))
);
numbers
- the numbers to calculate the product forpublic static Expression product(@Size(min=2L) java.lang.Number... numbers)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(product(10.0f, 2.0f))
);
numbers
- the numbers to calculate the product forpublic static Expression subtract(@NonNull Expression number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(subtract(pi()))
);
number
- the number subtract from 0public static Expression subtract(@NonNull java.lang.Number number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(subtract(10.0f))
);
number
- the number subtract from 0public static Expression subtract(@NonNull Expression first, @NonNull Expression second)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(subtract(literal(10.0f), pi()))
);
first
- the first numbersecond
- the second numberpublic static Expression subtract(@NonNull java.lang.Number first, @NonNull java.lang.Number second)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(subtract(10.0f, 20.0f))
);
first
- the first numbersecond
- the second numberpublic static Expression division(@NonNull Expression first, @NonNull Expression second)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(division(literal(10.0f), pi()))
);
first
- the first numbersecond
- the second numberpublic static Expression division(@NonNull java.lang.Number first, @NonNull java.lang.Number second)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(division(10.0f, 20.0f))
);
first
- the first numbersecond
- the second numberpublic static Expression mod(@NonNull Expression first, @NonNull Expression second)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(mod(literal(10.0f), pi()))
);
first
- the first numbersecond
- the second numberpublic static Expression mod(@NonNull java.lang.Number first, @NonNull java.lang.Number second)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(mod(10.0f, 10.0f))
);
first
- the first numbersecond
- the second numberpublic static Expression pow(@NonNull Expression first, @NonNull Expression second)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(pow(pi(), literal(2.0f)))
);
first
- the first numbersecond
- the second numberpublic static Expression pow(@NonNull java.lang.Number first, @NonNull java.lang.Number second)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(pow(5.0f, 2.0f))
);
first
- the first numbersecond
- the second numberpublic static Expression sqrt(@NonNull Expression number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(sqrt(pi()))
);
number
- the number to take the square root frompublic static Expression sqrt(@NonNull java.lang.Number number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(sqrt(25.0f))
);
number
- the number to take the square root frompublic static Expression log10(@NonNull Expression number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(log10(pi()))
);
number
- the number to take base-ten logarithm frompublic static Expression log10(@NonNull java.lang.Number number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(log10(10))
);
number
- the number to take base-ten logarithm frompublic static Expression ln(Expression number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(ln(pi()))
);
number
- the number to take natural logarithm frompublic static Expression ln(@NonNull java.lang.Number number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(ln(10))
);
number
- the number to take natural logarithm frompublic static Expression log2(@NonNull Expression number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(log2(pi()))
);
number
- the number to take base-two logarithm frompublic static Expression log2(@NonNull java.lang.Number number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(log2(2))
);
number
- the number to take base-two logarithm frompublic static Expression sin(@NonNull Expression number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(sin(pi()))
);
number
- the number to calculate the sine forpublic static Expression sin(@NonNull java.lang.Number number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(sin(90.0f))
);
number
- the number to calculate the sine forpublic static Expression cos(@NonNull Expression number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(cos(pi()))
);
number
- the number to calculate the cosine forpublic static Expression cos(@NonNull java.lang.Number number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(cos(0))
);
number
- the number to calculate the cosine forpublic static Expression tan(@NonNull Expression number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(tan(pi()))
);
number
- the number to calculate the tangent forpublic static Expression tan(@NonNull java.lang.Number number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(tan(45.0f))
);
number
- the number to calculate the tangent forpublic static Expression asin(@NonNull Expression number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(asin(pi()))
);
number
- the number to calculate the arcsine forpublic static Expression asin(@NonNull java.lang.Number number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(asin(90))
);
number
- the number to calculate the arcsine forpublic static Expression acos(@NonNull Expression number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(acos(pi()))
);
number
- the number to calculate the arccosine forpublic static Expression acos(@NonNull java.lang.Number number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(acos(0))
);
number
- the number to calculate the arccosine forpublic static Expression atan(@NonNull Expression number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(asin(pi()))
);
number
- the number to calculate the arctangent forpublic static Expression atan(@NonNull java.lang.Number number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(atan(90))
);
number
- the number to calculate the arctangent forpublic static Expression min(@Size(min=1L) Expression... numbers)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(min(pi(), literal(3.14f), literal(3.15f)))
);
numbers
- varargs of numbers to get the minimum frompublic static Expression min(@Size(min=1L) java.lang.Number... numbers)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(min(3.141, 3.14f, 3.15f))
);
numbers
- varargs of numbers to get the minimum frompublic static Expression max(@Size(min=1L) Expression... numbers)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(max(pi(), product(pi(), pi())))
);
numbers
- varargs of numbers to get the maximum frompublic static Expression max(@Size(min=1L) java.lang.Number... numbers)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(max(3.141, 3.14f, 3.15f))
);
numbers
- varargs of numbers to get the maximum frompublic static Expression round(Expression expression)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(round(pi()))
);
expression
- number expression to roundpublic static Expression round(@NonNull java.lang.Number number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(round(3.14159265359f))
);
number
- number to roundpublic static Expression abs(Expression expression)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(abs(subtract(pi())))
);
expression
- number expression to get absolute value frompublic static Expression abs(@NonNull java.lang.Number number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(abs(-3.14159265359f))
);
number
- number to get absolute value frompublic static Expression ceil(Expression expression)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(ceil(pi()))
);
expression
- number expression to get value frompublic static Expression ceil(@NonNull java.lang.Number number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(ceil(3.14159265359))
);
number
- number to get value frompublic static Expression floor(Expression expression)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(floor(pi()))
);
expression
- number expression to get value frompublic static Expression floor(@NonNull java.lang.Number number)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(floor(pi()))
);
number
- number to get value frompublic static Expression resolvedLocale(Expression collator)
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))))
);
collator
- the collator expressionpublic static Expression isSupportedScript(Expression expression)
Example usage:
mapboxMap.getStyle().addLayer(new SymbolLayer("layer-id", "source-id")
.withProperties(
textField(
switchCase(
isSupportedScript(get("name_property")), get("name_property"),
literal("not-compatible")
)
)
));
expression
- the expression to evaluatepublic static Expression isSupportedScript(@NonNull java.lang.String string)
Example usage:
mapboxMap.getStyle().addLayer(new SymbolLayer("layer-id", "source-id")
.withProperties(
textField(
switchCase(
isSupportedScript("ಗೌರವಾರ್ಥವಾಗಿ"), literal("ಗೌರವಾರ್ಥವಾಗಿ"),
literal("not-compatible"))
)
)
);
string
- the string to evaluatepublic static Expression upcase(@NonNull Expression string)
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")))
);
string
- the string to upcasepublic static Expression upcase(@NonNull java.lang.String string)
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"))
);
string
- string to upcasepublic static Expression downcase(@NonNull Expression input)
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")))
);
input
- expression inputpublic static Expression downcase(@NonNull java.lang.String input)
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"))
);
input
- string to downcasepublic static Expression concat(@NonNull Expression... input)
Example usage:
SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
symbolLayer.setProperties(
textField(concat(get("key-to-string-value"), literal("other string")))
);
input
- expression inputpublic static Expression concat(@NonNull java.lang.String... input)
Example usage:
SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
symbolLayer.setProperties(
textField(concat("foo", "bar"))
);
input
- expression inputpublic static Expression array(@NonNull Expression input)
input
- expression inputpublic static Expression typeOf(@NonNull Expression input)
input
- expression inputpublic static Expression string(@NonNull Expression... input)
input
- expression inputpublic static Expression number(@NonNull Expression... input)
input
- expression inputpublic static Expression numberFormat(@NonNull Expression number, @NonNull Expression.NumberFormatOption... options)
number
- number expressionoptions
- number formatting optionspublic static Expression numberFormat(@NonNull java.lang.Number number, @NonNull Expression.NumberFormatOption... options)
number
- number expressionoptions
- number formatting optionspublic static Expression bool(@NonNull Expression... input)
input
- expression inputpublic static Expression collator(boolean caseSensitive, boolean diacriticSensitive, java.util.Locale locale)
caseSensitive
- case sensitive flagdiacriticSensitive
- diacritic sensitive flaglocale
- localepublic static Expression collator(boolean caseSensitive, boolean diacriticSensitive)
caseSensitive
- case sensitive flagdiacriticSensitive
- diacritic sensitive flagpublic static Expression collator(Expression caseSensitive, Expression diacriticSensitive, Expression locale)
caseSensitive
- case sensitive flagdiacriticSensitive
- diacritic sensitive flaglocale
- localepublic static Expression collator(Expression caseSensitive, Expression diacriticSensitive)
caseSensitive
- case sensitive flagdiacriticSensitive
- diacritic sensitive flagpublic static Expression format(@NonNull Expression.FormatEntry... formatEntries)
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))
)
)
);
formatEntries
- format entriespublic static Expression.FormatEntry formatEntry(@NonNull Expression text, @Nullable Expression.FormatOption... formatOptions)
format(FormatEntry...)
to create formatted text fields.
Text is required to be of a resulting type string.
Text is required to be passed; Expression.FormatOption
s are optional and will default to the base values defined
for the symbol.
text
- displayed textformatOptions
- format optionspublic static Expression.FormatEntry formatEntry(@NonNull Expression text)
format(FormatEntry...)
to create formatted text fields.
Text is required to be of a resulting type string.
Text is required to be passed; Expression.FormatOption
s are optional and will default to the base values defined
for the symbol.
text
- displayed textpublic static Expression.FormatEntry formatEntry(@NonNull java.lang.String text, @Nullable Expression.FormatOption... formatOptions)
format(FormatEntry...)
to create formatted text fields.
Text is required to be of a resulting type string.
Text is required to be passed; Expression.FormatOption
s are optional and will default to the base values defined
for the symbol.
text
- displayed textformatOptions
- format optionspublic static Expression.FormatEntry formatEntry(@NonNull java.lang.String text)
format(FormatEntry...)
to create formatted text fields.
Text is required to be of a resulting type string.
Text is required to be passed; Expression.FormatOption
s are optional and will default to the base values defined
for the symbol.
text
- displayed textpublic static Expression image(@NonNull Expression input)
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"))
)
)
);
input
- expression inputpublic static Expression object(@NonNull Expression input)
input
- expression inputpublic static Expression toString(@NonNull Expression input)
Example usage:
SymbolLayer symbolLayer = new SymbolLayer("layer-id", "source-id");
symbolLayer.setProperties(
textField(get("key-to-number-value"))
);
input
- expression inputpublic static Expression toNumber(@NonNull Expression input)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(toNumber(get("key-to-string-value")))
);
input
- expression inputpublic static Expression toBool(@NonNull Expression input)
Example usage:
CircleLayer circleLayer = new CircleLayer("layer-id", "source-id");
circleLayer.setProperties(
circleRadius(toBool(get("key-to-value")))
);
input
- expression inputpublic static Expression toColor(@NonNull Expression input)
Example usage:
FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setProperties(
fillColor(toColor(get("keyStringValue")))
);
input
- expression inputpublic static Expression let(@Size(min=1L) Expression... input)
var(String)
or var(Expression)
.input
- expression inputpublic static Expression var(@NonNull Expression expression)
expression
- the variable naming expression that was bound with using letpublic static Expression var(@NonNull java.lang.String variableName)
variableName
- the variable naming that was bound with using letpublic static Expression zoom()
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))
)
)
);
public static Expression.Stop stop(@NonNull java.lang.Object stop, @NonNull java.lang.Object 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))
)
);
stop
- the stop inputvalue
- the stop outputpublic static Expression step(@NonNull java.lang.Number input, @NonNull Expression defaultOutput, Expression... stops)
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))
)
);
input
- the input valuedefaultOutput
- the default output expressionstops
- pair of input and output valuespublic static Expression step(@NonNull Expression input, @NonNull Expression defaultOutput, @NonNull Expression... stops)
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))
)
);
input
- the input expressiondefaultOutput
- the default output expressionstops
- pair of input and output valuespublic static Expression step(@NonNull java.lang.Number input, @NonNull Expression defaultOutput, Expression.Stop... stops)
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))
)
);
input
- the input valuedefaultOutput
- the default output expressionstops
- pair of input and output valuespublic static Expression step(@NonNull Expression input, @NonNull Expression defaultOutput, Expression.Stop... stops)
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))
)
);
input
- the input valuedefaultOutput
- the default output expressionstops
- pair of input and output valuespublic static Expression step(@NonNull java.lang.Number input, @NonNull java.lang.Number defaultOutput, Expression... stops)
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))
)
);
input
- the input valuedefaultOutput
- the default output expressionstops
- pair of input and output valuespublic static Expression step(@NonNull Expression input, @NonNull java.lang.Number defaultOutput, Expression... stops)
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))
)
);
input
- the input expressiondefaultOutput
- the default output expressionstops
- pair of input and output valuespublic static Expression step(@NonNull java.lang.Number input, @NonNull java.lang.Number defaultOutput, Expression.Stop... stops)
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))
)
);
input
- the input valuedefaultOutput
- the default output expressionstops
- pair of input and output valuespublic static Expression step(@NonNull Expression input, @NonNull java.lang.Number defaultOutput, Expression.Stop... stops)
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))
)
);
input
- the input valuedefaultOutput
- the default output expressionstops
- pair of input and output valuespublic static Expression interpolate(@NonNull Expression.Interpolator interpolation, @NonNull Expression number, @NonNull Expression... stops)
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)
)
)
)
);
interpolation
- type of interpolationnumber
- the input expressionstops
- pair of input and output valuespublic static Expression interpolate(@NonNull Expression.Interpolator interpolation, @NonNull Expression number, Expression.Stop... stops)
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))
)
)
);
interpolation
- type of interpolationnumber
- the input expressionstops
- pair of input and output valuespublic static Expression.Interpolator linear()
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))
)
)
);
public static Expression.Interpolator exponential(@NonNull java.lang.Number base)
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))
)
)
);
base
- value controlling the route at which the output increasespublic static Expression.Interpolator exponential(@NonNull Expression expression)
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))
)
)
);
expression
- base number expressionpublic static Expression.Interpolator cubicBezier(@NonNull Expression x1, @NonNull Expression y1, @NonNull Expression x2, @NonNull Expression y2)
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))
)
)
);
x1
- x value of the first point of a cubic bezier, ranges from 0 to 1y1
- y value of the first point of a cubic bezier, ranges from 0 to 1x2
- x value of the second point of a cubic bezier, ranges from 0 to 1y2
- y value fo the second point of a cubic bezier, ranges from 0 to 1public static Expression.Interpolator cubicBezier(@NonNull java.lang.Number x1, @NonNull java.lang.Number y1, @NonNull java.lang.Number x2, @NonNull java.lang.Number y2)
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))
)
)
);
x1
- x value of the first point of a cubic bezier, ranges from 0 to 1y1
- y value of the first point of a cubic bezier, ranges from 0 to 1x2
- x value of the second point of a cubic bezier, ranges from 0 to 1y2
- y value fo the second point of a cubic bezier, ranges from 0 to 1@NonNull public java.lang.Object[] toArray()
The output will later be converted to a JSON Object array.
public java.lang.String toString()
If this expression contains a coma (,) delimited literal, like 'rgba(r, g, b, a)`, it will be enclosed with double quotes (").
toString
in class java.lang.Object
public static Expression raw(@NonNull java.lang.String rawExpression)
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)"]
rawExpression
- the raw expressionpublic boolean equals(@Nullable java.lang.Object o)
equals
in class java.lang.Object
o
- the other objectpublic int hashCode()
hashCode
in class java.lang.Object