predicate1 || predicate2
`NSNotPredicateType` | `NOT predicate`Attribute | Type | Meaning |
---|---|---|
cluster |
Bool | True if the feature is a point cluster. If the attribute is false (or not present) then the feature should not be considered a cluster. |
cluster_id |
Number | Identifier for the point cluster. |
point_count |
Number | The number of point features in a given cluster. |
Variable | Type | Meaning |
---|---|---|
$featureIdentifier |
Any GeoJSON data type |
A value that uniquely identifies the feature in the containing source.
This variable corresponds to the
NSExpression.featureIdentifierVariableExpression property.
|
$geometryType |
String |
The type of geometry represented by the feature. A feature’s type is one
of the following strings:
NSExpression.geometryTypeVariableExpression property.
|
$heatmapDensity |
Number |
The
kernel density estimation
of a screen point in a heatmap layer; in other words, a relative measure
of how many data points are crowded around a particular pixel. This
variable can only be used with the heatmapColor property.
This variable corresponds to the
NSExpression.heatmapDensityVariableExpression property.
|
$zoomLevel |
Number |
The current zoom level. In style layout and paint properties, this
variable may only appear as the target of a top-level interpolation or
step expression. This variable corresponds to the
NSExpression.zoomLevelVariableExpression property.
|
$lineProgress |
Number |
A number that indicates the relative distance along a line at a given
point along the line. This variable evaluates to 0 at the beginning of the
line and 1 at the end of the line. It can only be used with the
`MGLLineStyleLayer.lineGradient` property. It corresponds to the
NSExpression.lineProgressVariableExpression property.
|
mgl_does:have:
mgl_does:have:(SELF, '🧀🍔')
or mgl_does:have:(%@, '🧀🍔')
mgl_interpolate:withCurveType:parameters:stops:
mgl_interpolate:withCurveType:parameters:stops:(x, 'linear', nil, %@)
mgl_step:from:stops:
mgl_step:from:stops:(x, 11, %@)
mgl_join:
mgl_join({'Old', 'MacDonald'})
mgl_acos:
mgl_acos(1)
mgl_asin:
mgl_asin(0)
mgl_atan:
mgl_atan(20)
mgl_cos:
mgl_cos(0)
mgl_log2:
mgl_log2(1024)
mgl_round:
mgl_round(1.5)
mgl_sin:
mgl_sin(0)
mgl_tan:
mgl_tan(0)
mgl_coalesce:
mgl_coalesce({x, y, z})
mgl_attributed:
mgl_attributed({x, y, z})
MGL_LET:
MGL_LET('age', uppercase('old'), 'name', uppercase('MacDonald'), mgl_join({$age, $name}))
NSExpression
values, followed by an NSExpression
that may contain references to those variables.
MGL_MATCH:
MGL_MATCH(x, 0, 'zero match', 1, 'one match', 2, 'two match', 'default')
MGL_IF:
MGL_IF(1 = 2, YES, 2 = 2, YES, NO)
NSPredicate
conditionals and resulting expressions,
followed by a default expression.
MGL_FUNCTION:
MGL_FUNCTION('typeof', mystery)
boolValue
FUNCTION(1, 'boolValue')
NSExpression
that evaluates to a number or string.
FALSE
when then input is an
empty string, 0, FALSE
, NIL
, or NaN
,
otherwise TRUE
.
### `mgl_has:`
mgl_has:
FUNCTION($featureAttributes, 'mgl_has:', '🧀🍔')
NSExpression
that evaluates to an NSDictionary
or the evaluated object (SELF
).
NSExpression
that evaluates to an NSString
representing the key to look up in the dictionary or the feature attribute to
look up in the evaluated object (see MGLFeature.attributes
).
true
if the dictionary has a value for the key or if the evaluated
object has a value for the feature attribute.
This function corresponds to the
[`has`](https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-has)
operator in the Mapbox Style Specification. See also the
[`mgl_does:have:`](#code-mgl_does-have-code) function, which is used on its own
without the `FUNCTION()` operator. You can also check whether an object has an
attribute by comparing the key path to `NIL`, for example `cheeseburger != NIL`
or `burger.cheese != NIL`
### `mgl_expressionWithContext:`
mgl_expressionWithContext:
FUNCTION($ios + $macos, 'mgl_expressionWithContext:', %@)
with
a dictionary containing ios
and macos
keys
NSExpression
that may contain references to the variables
defined in the context dictionary.
NSDictionary
with NSString
s as keys and
NSExpression
s as values. Each key is a variable name and each
value is the variable’s value within the target expression.
mgl_interpolateWithCurveType:parameters:stops:
FUNCTION($zoomLevel, 'mgl_interpolateWithCurveType:parameters:stops:', 'linear', NIL, %@)
with a dictionary containing zoom levels or other constant values as keys
NSExpression
that evaluates to a number and contains a
variable or key path expression.
linear
, exponential
, or cubic-bezier
.
The second argument is an expression providing parameters for the curve:
linear
, the argument is NIL
.exponential
, the argument is an
expression that evaluates to a number, specifying the base of the
exponential interpolation.
cubic-bezier
, the argument is an
array or aggregate expression containing four expressions, each
evaluating to a number. The four numbers are control points for the
cubic Bézier curve.
NSDictionary
object representing the
interpolation’s stops, with numeric zoom levels as keys and expressions as
values.
mgl_numberWithFallbackValues:
,
doubleValue
,
floatValue
, or
decimalValue
FUNCTION(ele, 'mgl_numberWithFallbackValues:', 0)
NSExpression
that evaluates to a Boolean value, number, or
string.
NSExpression
s, each evaluating to a Boolean value
or string.
NIL
or FALSE
, the result is 0.
* If the target is true, the result is 1.
* If the target is a string, it is converted to a number as specified by the
“[ToNumber Applied to the String Type](https://tc39.github.io/ecma262/#sec-tonumber-applied-to-the-string-type)”
algorithm of the ECMAScript Language Specification.
* If multiple values are provided, each one is evaluated in order until the
first successful conversion is obtained.
This function corresponds to the
[`to-number`](https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-types-to-number)
operator in the Mapbox Style Specification. You can also cast a value to a
number by passing the value and the string `NSNumber` into the `CAST()`
operator.
### `mgl_stepWithMinimum:stops:`
mgl_stepWithMinimum:stops:
FUNCTION($zoomLevel, 'mgl_stepWithMinimum:stops:', 0, %@)
with
a dictionary with zoom levels or other constant values as keys
NSExpression
that evaluates to a number and contains a
variable or key path expression.
NSDictionary
object representing the
interpolation’s stops, with numeric zoom levels as keys and expressions as
values.
stringByAppendingString:
FUNCTION('Old', 'stringByAppendingString:', 'MacDonald')
NSExpression
that evaluates to a string.NSExpression
s, each evaluating to a string.stringValue
FUNCTION(ele, 'stringValue')
NSExpression
that evaluates to a Boolean value, number, or
string.
NIL
, the result is the empty string.
* If the target is a Boolean value, the result is the string `true` or `false`.
* If the target is a number, it is converted to a string as specified by the
“[NumberToString](https://tc39.github.io/ecma262/#sec-tostring-applied-to-the-number-type)”
algorithm of the ECMAScript Language Specification.
* If the target 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 target is converted to a string in the format specified by the
[`JSON.stringify()`](https://tc39.github.io/ecma262/#sec-json.stringify)
function of the ECMAScript Language Specification.
This function corresponds to the
[`to-string`](https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-types-to-string)
operator in the Mapbox Style Specification. You can also cast a value to a
string by passing the value and the string `NSString` into the `CAST()`
operator.