Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Add "Linear" MGLInterpolationMode #8457

Closed

Description

@ericrwolfe

MGLInterpolationMode is rather confusing, particularly since only one of the options actually deals with interpolation:

  • exponential (values interpolated)
  • interval (not interpolated)
  • categorical (not interpolated)
  • identity (not interpolated)

90% of developers are going to be using +[MGLStyleValue valueWithInterpolationMode:cameraStops:options:] and will be looking for linear interpolation as the default. Right now, I naturally reach for interval given the options, so I propose adding another linear option for clarity:

  • linear (values interpolated; alias for exponential)
  • exponential (values interpolated)
  • interval (not interpolated)
  • categorical (not interpolated)
  • identity (not interpolated)

This could be a simple alias for exponential, with the default MGLStyleFunctionOptionInterpolationBase value of 1.

/cc @boundsj @jmkiley @friedbunny

Activity

  1. added
    iOS
    on Mar 17, 2017
  2. added this to the ios-v3.6.0 milestone on Mar 17, 2017
  3. boundsj commented on May 17, 2017

    @boundsj
    Contributor

    @ericrwolfe I wanted to check in again here to see how much of a pain point this still is now that the API has existed for awhile and documentation and examples have improved.

    I think what is proposed here would lead to an API that allows for something like:

    circleStyleLayer.circleColor = MGLStyleValue<MGLColor>(
      interpolationMode: .linear,
      cameraStops: stops
    )

    as an alias for:

    // using an interpolation mode of exponential and passing no options results in linear interpolation
    circleStyleLayer.circleColor = MGLStyleValue<MGLColor>(
      interpolationMode: .exponential,
      cameraStops: stops
    )

    Implementing this API would be trivial. Updating the tests, manual docs, and generated docs would not take that much longer. However, this API would be in addition to the style spec and exist only on one platform. So, I think it is worth checking in again to see if this is really required just on iOS and macOS.

    Would it be possible to solve this problem by adding something to the relevant existing docs or add some new documentation?

    cc @friedbunny @jmkiley

  4. ericrwolfe commented on May 18, 2017

    @ericrwolfe
    ContributorAuthor

    However, this API would be in addition to the style spec and exist only on one platform. So, I think it is worth checking in again to see if this is really required just on iOS and macOS.

    @boundsj I'd be okay with revisiting this in a future API redesign if cross-platform inconsistency is a concern.

    I'm not sure I'm aware of any written issues with developers getting tripped up on this (cc @jmkiley), though I'd be interested in user testing some of the more complex APIs with developers at some point.

  5. 1ec5 commented on Jun 22, 2017

    @1ec5
    Contributor

    Taking off the v3.6.0 milestone since this isn’t going to get fixed in time. Additionally, the entire style function API will be redesigned as part of the expressions feature: #8074.

  6. removed this from the ios-v3.6.0 milestone on Jun 22, 2017
  7. 1ec5 commented on Sep 10, 2017

    @1ec5
    Contributor

    As part of the expressions implementation in mapbox/mapbox-gl-js#4777, the curve operator accepts a linear interpolation type equivalent to exponential with a base of 1. Therefore, the suggestion above will be implemented in the course of implementing #8074.

    /cc @anandthakker

  8. 1ec5 commented on Mar 27, 2018

    @1ec5
    Contributor

    Implemented in #8074 for iOS SDK v4.0.0 and macOS SDK v0.7.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureiOSruntime styling

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions