-
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
setFilter() specify key that's within an array of objects #8963
Comments
We recommend using the newer expression syntax instead of filters. What you're trying to do can be achieved with an expression. Consider this example source that includes a property which is an array of objects:
Now in our layer's layout properties, we can define the text field like this:
This expression (reading from right to left) get the array at Hope this helps and thanks for using Mapbox! |
@ryanhamley Thanks for answering. In meantime I actually modified my properties a little bit so it looks like this:
Now:
actually returns false. Could you tell me what's wrong with this one? |
@admly The way your expression is set up, it's getting What you want in this case is the new
This is equivalent to Unfortunately, the |
@ryanhamley YES! I tried to use the in operator, but there was an error in console (saying something that arrays are not supported or sth). But yea, I used 1.5.0 release, so the new feature was not included in it. THANK YOU FOR SUPPORT!!! |
I am trying to create a code that is setting filtering based on a key extracted from a GeoJson property which is an array of objects. As I know it is not possible.
So some feature has properties:
this.map.setFilter('points2', ['==', 'someProperty[0].something', 'A']));
Will there be any support for such a filtering? Maybe there is already some workaround for this? Or maybe I am using a wrong syntax?
Cheers
The text was updated successfully, but these errors were encountered: