-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Rationalize and simplify the taxonomy of functions #4154
Comments
From @davidtheclark on December 2, 2016 0:33 One point here worth reconsidering (or maybe you'd already reconsidered it enough) is the term |
From @jfirebaugh on December 2, 2016 0:54 I'd like to stick with "property". mapbox/vector-tile-spec#63 |
From @1ec5 on December 2, 2016 9:56
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 |
From @kkaefer on December 2, 2016 11:18 It seems like |
From @samanpwbb on December 2, 2016 15:56 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:
|
From @jfirebaugh on December 2, 2016 18:14 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
|
From @jfirebaugh on December 2, 2016 18:21 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 |
From @1ec5 on December 2, 2016 18:52
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 mapbox/mapbox-gl-style-spec#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 (
|
From @anandthakker on December 2, 2016 19:12 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 |
From @jfirebaugh on December 2, 2016 19:27
A numeric does not necessarily indicate a continuous function. Numeric values are sometimes used as enumerated constants. |
From @jfirebaugh on December 2, 2016 19:31 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 |
From @jfirebaugh on December 2, 2016 19:57 Earlier I said I'd prefer not to merge This produces three types:
If "zoom" or "pitch" is chosen, it's a |
From @jfirebaugh on December 2, 2016 19:58
It isn't moot once we introduce default values for discrete functions. mapbox/mapbox-gl-style-spec#480 |
Good point. Could it make sense to have a
|
From @mourner on December 2, 2016 21:42 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? |
From @samanpwbb on December 5, 2016 16:10
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. |
From @jfirebaugh on December 6, 2016 1:3
These three types correspond to three fundamental strategies in the rendering implementation:
So |
A belated update: Android SDK v5.0.0, iOS SDK v3.5.0, and macOS SDK v0.3.0 all shipped with a runtime styling API that conforms to the taxonomy proposed in #4154 (comment). (These SDKs support the same existing style JSON syntax as GL JS for the time being.) The remaining work is to modify the style specification (and thus the style JSON file format and GL JS’s runtime styling API) to conform to this taxonomy as well. |
Addressed by #4777 |
From @jfirebaugh on December 1, 2016 23:18
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
Copied from original issue: mapbox/mapbox-gl-style-spec#613
The text was updated successfully, but these errors were encountered: