Skip to content
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

Regression in color property styling between 0.32.x and 0.33.x #4496

Closed
benjamintd opened this issue Mar 25, 2017 · 4 comments
Closed

Regression in color property styling between 0.32.x and 0.33.x #4496

benjamintd opened this issue Mar 25, 2017 · 4 comments

Comments

@benjamintd
Copy link

benjamintd commented Mar 25, 2017

mapbox-gl-js version: 0.34.0

Steps to Trigger Behavior

  1. Valid styling (identical to the Mapbox Studio rendering) with 0.32.0 in this example
  2. The same style with 0.34.0 (and 0.33 too) renders black features instead of the properly styled features for some, but not all the layers.

Expected Behavior

The rendering should match the result seen on Studio.

Actual Behavior

Some of the layers with property function coloring are rendered in black (#000000) instead of the desired function.

For those layers, other property styling works as intended (e.g. radius).

Some other layers of similar type are rendered correctly. Trying to turn compositing on or off did not have any effect.

The only example I have of this bug is the link posted above. Sorry if the data is messy!

v0.33 - v0.34
screen shot 2017-03-25 at 1 20 18 am
v0.25 - v0.32
screen shot 2017-03-25 at 1 20 01 am

@ashleyclough
Copy link

ashleyclough commented Mar 25, 2017

The same happened to a couple of my styles where I was using a function colour value for no data.

There was a new feature in v33.0: 'Add ability to specify default property value for undefined or invalid property values used in property functions. #4175'

Before v33:
"type": 'categorical',
"stops": [
['', 'hsl(0,0%,80%)'], << this rendered everything black in later versions
['Medical Care', 'hsl(212,70%,60%)'],
['Education', 'hsl(31,72%,69%)']
]

After v33:
"type": 'categorical',
'default': 'hsl(0,0%,80%)',
"stops": [
['Medical Care', 'hsl(212,70%,60%)'],
['Education', 'hsl(31,72%,69%)']
]

@jfirebaugh
Copy link
Contributor

Reduced test case:

{
  "version": 8,
  "center": [-109, 33],
  "zoom": 4,
  "sources": {
    "composite": {
      "url": "mapbox://benjamintd.dlb6j0j3",
      "type": "vector"
    }
  },
  "layers": [
    {
      "id": "sup-pts",
      "type": "circle",
      "source": "composite",
      "source-layer": "supptfeaturesgeojson",
      "paint": {
        "circle-color": {
          "property": "promo",
          "stops": [
            [
              0,
              "hsl(0, 56%, 30%)"
            ],
            [
              10,
              "hsl(38, 87%, 43%)"
            ],
            [
              19,
              "hsl(59, 68%, 91%)"
            ]
          ]
        }
      }
    }
  ]
}

It's not a categorical function, so at first glance #4175 isn't related.

@jfirebaugh
Copy link
Contributor

The promo property has string-typed values in the data, so it is affected by #4175, which made exponential functions strict about domain types, for consistency with filters and categorical functions (#4205). A property value such as "16" will no longer interpolate between the 10 and 19 stops; instead it will use the function "default" value or the style property default (black).

Can you change the data source to use numeric values for this property?

@benjamintd
Copy link
Author

Thanks @jfirebaugh for looking into this! I could not figure out why one of my layers worked and not the other. I will convert my properties to numerical values.

When Studio updates to 0.34+ it will make it easier to spot those issues.

I'm closing since this is the expected behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants