OptionaldataData conditions are used to filter features based on what property values the feature has. If the condition's filter passes, the input is used. If all conditions fail, the fallback is used.
ex.
"color": {
"dataCondition": {
"conditions": [
{
"filter": { "key": "country", "comparator": "==", "value": "US" },
"input": "#007bfe"
}
],
"fallback": "#23374d"
}
}
ex.
When using a cluster source you can access its sum:
"color": {
"dataCondition": {
"conditions": [
{
"filter": { "key": "__sum", "comparator": ">", "value": 750 },
"input": "#f28cb1"
},
{
"filter": { "key": "__sum", "comparator": ">", "value": 100 },
"input": "#f1f075"
}
],
"fallback": "#51bbd6"
}
}
OptionaldataData Range is used to group features based on a range of values and apply specific design attributes for those groups. If the feature's value falls within the range, the fallback is used.
ex.
"weight": {
"dataRange": {
"key": "mag",
"ease": "expo",
"base": 1.5,
"ranges": [
{ "stop": 0, "input": 0 },
{ "stop": 8, "input": 1 }
]
}
}
ex.
If the layer type is a LAYOUT, you are limited to using the step ease function.
"opacity": {
"dataRange": {
"key": "age",
"ease": "step",
"ranges": [
{ "stop": 0, "input": 0 },
{ "stop": 50, "input": 1 }
]
}
}
OptionalfallbackUsed in conjunction with one of the other types ("inputValue" | "dataCondition" | "dataRange" | "inputRange" | "featureState"). You will never directly call this at the top level but as an internal fallback for the other types.
OptionalfeatureFeature State is still under construction and incomplete
OptionalinputInput Range is used to group features based on a range of values based upon a type provided and apply specific design attributes for those groups.
If the feature's value falls within the range, the fallback is used.
The types you can use are:
zoomlonlatanglepitchex.
"radius": {
"inputRange": {
"type": "zoom",
"ease": "expo",
"base": 1.5,
"ranges": [
{ "stop": 0, "input": 3 },
{ "stop": 8, "input": 30 }
]
}
}
ex.
If the layer type is a LAYOUT, you are limited to using the step ease function.
"opacity": {
"inputRange": {
"type": "zoom",
"ease": "step",
"ranges": [
{ "stop": 0, "input": 1 },
{ "stop": 5, "input": 0 }
]
}
}
OptionalinputInput values directly access properties data from the feature.
Lets say you have a feature with the following properties:
const properties = {
class: {
type: 'color-scheme',
subclass: 'deep'
}
}
You can utilize/access the type property with the following:
{
"color": {
"inputValue": {
"key": {
"nestedKey": ["class", "type"],
},
"fallback": "blue"
}
}
}
to get a better understanding of the nestedKey: (this is a contrived example)
Lets say you have a feature with the following properties:
const properties = {
a: {
b: {
c: '#fff'
}
}
}
You can utilize/access the type property with the following:
{
"color": {
"inputValue": {
"key": {
"nestedKey": ["a", "b", "c"],
},
"fallback": "blue"
}
}
}
Property
An extremely maleable input that allows you to style input data as either the value itself or something that mutates on user input changes, data input changes, feature state like hovering, etc.
ex.
ex.
ex.
Your list of options are:
inputValue: [See InputValue] access value in feature propertiesdataCondition: [See DataCondition] filter based on feature property conditionsdataRange: [See DataRange] filter based on feature property rangesinputRange: [See InputRange] filter based on map conditions like "zoom", "lon", "lat", "angle", or "pitch"featureState: [See FeatureState] filter based on feature statefallback: if all else fails, use this value. A value ofTitself or pull from feature properties using Property