-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
map.setFilter() bug with 'within' expression within 'all' expression #9605
Comments
Hi @zmiao , would you happen to know what can cause this off the top of your head? |
@dpdiliberto @arindam1993 I am trying to debug this issue, but for both pages I got access errors for the isochone API: Failed to load resource: the server responded with a status of 401 (Unauthorized). Can you help me checking this? |
by the way, @dpdiliberto you mentioned I see the second one did not use |
I think I know what is going wrong, the problem is that the combination of |
I am facing a similar problem as well. My data points contain 3 properties - timestamp (d), id (i) and name (n). The following filter does not work: When I combine one more filter expression for property 'i', the filter works for the first 3 expressions out of the 4 expressions below: @zmiao can you look into this as well? |
@octopusabhiraj there is a pr open for this issue. Please verify if it fixes your issue. |
@zmiao thanks for the quick fix, works in my case. 👍 |
@zmiao I'm still seeing the same results on my end with the following filter expression: Is there anything I should update in my expression to get this to work as expected? |
@dpdiliberto, I tried locally it works for me. I think the probable reason is you are still using the old gl-js version:
|
I created an example by going off this example to test setting a filter based on 1) features within a certain polygon using the
within
expression, as well as 2) features that met certain data conditions using thein
expression.My example works with the
within
expression orin
expression individually, but not when they are both within anall
expression. Here is my filter expression that does not work:map.setFilter('population', ['all', ['in', 'Hispanic', ['get', 'ethnicity']], ['within', feature]]);
I was able to get this to work with the following workaround:
map.setPaintProperty('population', 'circle-opacity' , ['to-number', ['all', ['within', feature], ['==', ['get', 'ethnicity'], 'Hispanic']]]);
Is this a bug or expected behavior?
mapbox-gl-js version: 1.9.0
browser: Chrome Version 80.0.3987.163
Steps to Trigger Behavior
map.setFilter('population', ['all', ['in', 'Hispanic', ['get', 'ethnicity']], ['within', feature]]);
does not work2.
map.setFilter('population', ['within', feature]);
andmap.setFilter('population', ['in', 'Hispanic', ['get', 'ethnicity']]);
work individuallymap.setPaintProperty('population', 'circle-opacity' , ['to-number', ['all', ['within', feature], ['==', ['get', 'ethnicity'], 'Hispanic']]]);
Link to Demonstration
https://jsbin.com/yoqunojelu/edit?html,output
Expected Behavior
Being able to filter for both conditions: 1) being within a polygon and 2) certain data conditions
Actual Behavior
It is not possible to filter for both when using the
within
expression.The text was updated successfully, but these errors were encountered: