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

Return "in" operator to filter expressions #7077

Closed
rouen-sk opened this issue Aug 3, 2018 · 1 comment
Closed

Return "in" operator to filter expressions #7077

rouen-sk opened this issue Aug 3, 2018 · 1 comment

Comments

@rouen-sk
Copy link

rouen-sk commented Aug 3, 2018

In the old deprecated filter syntax, there is very useful operator in, which can be easily used to test property value against number of possible values. It does not work with expressions, so I guess my only option is to use combination or any and == (and possibly number).
So this clear statement:
[ "in", "country", "BGR", "BIH", "GBR", "ROU", "SVN" ]
become this:
[ "any",["==", ["get", "country"], "BGR"], ["==", ["get", "country"], "BIH"], ["==", ["get", "country"], "GBR"], ["==", ["get", "country"], "ROU"], ["==", ["get", "country"], "SVN"]]
(or even worse with numbers).
Is there any good reason not to have in operator in expressions syntax? I believe it can maybe even provide better performance (since JS have functions to test for elements in arrays)

@anandthakker
Copy link
Contributor

Duplicate of #4698

@anandthakker anandthakker marked this as a duplicate of #4698 Aug 3, 2018
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