-
Notifications
You must be signed in to change notification settings - Fork 38
Rationalize and simplify the taxonomy of functions #613
Comments
One point here worth reconsidering (or maybe you'd already reconsidered it enough) is the term |
I'd like to stick with "property". mapbox/vector-tile-spec#63 |
FYI, the iOS and macOS SDKs do standardize on “attribute” because “property” is already a language feature. I just couldn’t fathom MGLFeature storing properties inside a |
It seems like |
I think this proposal simplifies and clarifies the function spec. The main UI challenge here will be communicating the four function types: continuous, discrete, identity, composite to users. Onces a user understands them, everything else will be much more intuitive. Some thoughts:
|
An identity function returns the value of the selected property. In some cases (when the property values form a continuous domain/range), it can be viewed as a special case of
|
We could split out another type: zoom-driven: We've talked about allowing e.g. pitch-driven functions, so to generalize this further, we could name this type |
Not to derail this discussion, and I’m not sure how practical it would be, but I wonder if it’d be more useful to vary paint and layout properties by viewing distance (as a more generalized version of zoom level) than by pitch. That is, when the pitch is 60°, a marker close to the viewer would use a more detailed icon while a marker far from the viewer would abbreviate its label more, and this would hold true as the center coordinate changes but the zoom level and pitch stay constant. I suppose a viewing distance–driven function could coexist with a camera-driven function. |
I'm excited about this effort to simplify the function syntax! We have learned so much about the UX of functions since the initial syntax was designed. The taxonomy of functions proposed in #613 (comment) is great. By eliminating invalid combinations of functions we make the spec more robust, understandable, and pave the way for UI design in Studio. I have some thoughts about the naming of these new types. Some of the names refer to the nature of the data (
|
This definitely clarifies and simplifies the function landscape. How does this interact with the idea of bringing in arbitrary function expressions (mapbox/mapbox-gl-function#28)? Would that provide an alternative to some of the concepts in this proposal? For instance:
|
It is possible to simplify the taxonomy further by making the domain values the source of truth for the "nature" of the data (
I recognize that this taxonomy does not lend itself well to implementation in a static type system. We may need to explicitly differentiate between |
A numeric does not necessarily indicate a continuous function. Numeric values are sometimes used as enumerated constants. |
I'm purposefully leaving arbitrary function expressions out of this proposal. We have implementation experience (and are developing UI experience) for the function types in this proposal, and the proposal is guided by that experience. We don't have equivalent experience with function expressions. |
This is a moot point in practice. If the domain is a set of enumerated constants, there's no* input value for which the output value of a numeric "source-continuous" function is different than the output value of a "source-discrete" function.
* Depending our implementation, invalid domain values may result in a different output values. The behaviour in this case could be controlled by the user via the |
Earlier I said I'd prefer not to merge This produces three types:
If "zoom" or "pitch" is chosen, it's a |
It isn't moot once we introduce default values for discrete functions. #480 |
Good point. Could it make sense to have a
|
Love the proposal! This will certainly make things much easier to reason about. The only point I'm not sure about is the composite functions proposal (item 5 in the post) — turning them into nested functions where outer/inner functions can have different interpolations sounds pretty complicated (in addition to making the definitions huge). As far as I recall, @ansis considered this at some point but rejected it because there are technical difficulties in implementation. Is this right? |
We would likely design a UI like this either way so I am in favor writing it into the spec so our ui models the spec better. |
These three types correspond to three fundamental strategies in the rendering implementation:
So |
This issue was moved to mapbox/mapbox-gl-js#4154 |
The space of function types is currently difficult to grok because there are effectively two axes of function types:
It's not well documented or easy to grasp how these two axes combine, or what combinations are valid. I've tried to do so in #604, but this doesn't remove the underlying complexity from the domain model.
I believe that in order for users to use functions effectively, we need to rationalize and simplify our taxonomy.
Here's what I propose:
type
axis and property for functions, with the following values:continuous
-- a function in which stop domain values represent sample points in a continuous domaindiscrete
-- a function in which stop domain values enumerate a discrete domainidentity
-- the identity functioncomposite
-- the type formerly known as "zoom-and-property"type
property is always required and never deduced from other property values. Implementations and user interfaces can always look at this value and then decide what to do; they never have to implement a type-deduction algorithm, which would need to be synchronized between implementations and updated as new rules are introduced.property
property is optional forcontinuous
functions, and required fordiscrete
andidentity
functions (see below forcomposite
functions). If present, the function is said to be a "data-driven function". If absent, the function is said to be a "zoom-driven function".continuous
orcomposite
function supports the following properties:interpolation
-- possible values are"exponential"
(default for "interpolated" properties; allowed only for interpolated properties) and"step-after"
(default for "piecewise-constant" properties; replaces the previousinterval
function type).interpolation-base
-- renamed frombase
. Permitted only with"interpolation": "exponential"
.interpolation-color-space
-- renamed fromcolorSpace
. Permitted only only with"interpolation": "exponential"
and when the range type iscolor
.composite
functions are floating point zoom level values. Stop range values forcomposite
functions are functions, with types limited tocontinuous
anddiscrete
.type
,property
, andinterpolation-*
properties. Theproperty
value is always required.interpolation-*
properties that differ from the inner functions.Because this proposal involves numerous breaking changes, it would most likely have to involve introducing a new version of the style specification. I think that reducing the complexity of the function taxonomy would be worth a style version bump, even if we made no other breaking changes.
cc @mapbox/gl @mapbox/appbox
The text was updated successfully, but these errors were encountered: