-
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
Categorical functions became non-strict #4174
Comments
From @jfirebaugh on January 27, 2017 0:0 The current categorical function implementation in gl-native (in mapbox/mapbox-gl-native#7372) is also strict. |
From @kronick on January 27, 2017 23:0 @jfirebaugh Ah good catch. Would it be a good solution to use a more purpose-built hash map implementation (i.e. https://www.npmjs.com/package/hashmap) if performance is comparable? That package looks like it will keep type information in tact: https://www.npmjs.com/package/hashmap#no-stringification If that sounds like a good approach to you, I can try it out. |
From @jfirebaugh on January 28, 2017 0:30 That kind of approach was my first thought as well, but I think we can get away with a simpler solution given that all stop domain values are required to be the same type (something which is checked by the validator): record |
From @kronick on January 28, 2017 1:11 Ok, so if I understand: categorical functions need to (1) be strict about matching, and (2) the style spec forbids mixed types in a categorical function.
|
From @jfirebaugh on January 28, 2017 1:31 (2) is enforced here. It's true that it's possible to use
Returning the value of the first stop is fine for now. I was working on #582 / #480 when I noticed this strictness issue, and my planned solution for #582 / #480 is to add support for a |
From @jfirebaugh on January 26, 2017 23:58
Prior to mapbox/mapbox-gl-function#32, categorical functions were strict about types: a stop such as
["1", 1]
would not match a numeric property value1
, and vice versa. But now that stop domain values are used as object keys, everything is coerced to a string, and there's no distinction between strings and numbers.For comparison, filters are strict about types, and functions should probably be consistent with that.
cc @kronick
Copied from original issue: mapbox/mapbox-gl-style-spec#669
The text was updated successfully, but these errors were encountered: