-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add identity function #20
Comments
👍 . This also takes the work out of having to figure out or guess at the max value to include in the highest stop (currently if the stops are |
I'm hesitant to even make the following suggestion, because it may be a bit of a slippery slope, but we may also consider something like a {
"property": "height",
"type": "exponential",
"steps": [[0, 0], [1000, 3000]]
} into {
"property": "height",
"type": "identity",
"multiplier": 3
} |
lucaswoj and I have been batting around the idea of derived values, they would address your use case and a lot more @lbud. The exact syntax is tbd, but you could do something like: {
"property": ["*", { "$ref": "height" }, 3],
"type": "identity"
} ... or convert celsius to fahrenheit. {
"property": ["+", ["*", { "$ref": "temperature" }, ["/", 9, 5], 32]],
"type": "identity"
} As more functions are introduced, the power of the concept grows. To select the the red channel of a color {
"property": ["rgba", ["red", { "$ref": "color" }], 0, 0, 0.5],
"type": "identity"
} Slippery slope archived. |
👀 |
It is often useful to define an identity property-function. For example, when styling a 3d building, users might have a feature property called
height
which maps directly to the pixel height of the building. Presently a user might define such a function like:We could make this use case more ergonomic and safe by adding an
identity
function typeThe identity function may also allow using colors in property functions, which was previously impossible
cc @andreasviglakis @scothis
The text was updated successfully, but these errors were encountered: