Expressions / add geometry-type
operator, fix exponential interpolate
#14837
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR:
geometry-type
operator; this operator returns the current geometry type of the feature, eitherPoint
,Polygon
orLineString
; other types (multi*, collections) are resolved to one of these three (see doc)interpolate
computation when the interpolation type isexponential
; the computation is now compliant with the MapBox style spec and allows for example scaling values according to the current zoom using['exponential', 2]
. The linear interpolation is unchanged.Note: the change on the
interpolate
operator can be considered as breaking since any style using it might notice a difference in the final result. The difference can be quite significant depending on the range. Here is a visual representation of the curve before and after for an interpolation of type['exponential', 2]
, input range 5..15, output range 0..100:Before:
After:
On the other hand it is now compliant to the reference implementation so this can also be considered as fixing an erroneous behavior.