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

'evaluateIdentityFunction' ignores valid string input if the propertySpec type is 'enum' #4999

Closed
ChrisLoer opened this issue Jul 20, 2017 · 1 comment

Comments

@ChrisLoer
Copy link
Contributor

If you create an identity function that points at a string feature property, and the values of that property match the enum values declared in the style spec, the value should be used. Instead, the value gets ignored because of the perceived type difference.

Nicki and I ran into this when she tried to use an identity function to test a text-anchor DDS property. She says that we are intending to use identity functions on enums in core styles.

I haven't worked through enough of this code to see what exactly needs to change, but hopefully it's a straightforward fix.

/cc @nickidlugash @anandthakker

@ChrisLoer ChrisLoer changed the title evaluateIdentityFunction ignores valid string input if the propertySpec type is enum 'evaluateIdentityFunction' ignores valid string input if the propertySpec type is 'enum' Jul 20, 2017
@anandthakker
Copy link
Contributor

Hm, yeah @ChrisLoer -- looks like we aren't appropriately handling enum values in style functions. Strings that match one of an enum's values should be returned (not happening due to https://github.com/mapbox/mapbox-gl-js/blob/master/src/style-spec/function/index.js#L215, as you said). Also, I think if a categorical or interval function evaluates to a string not matching the enum, we should return undefined.

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

2 participants