You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 10, 2018. It is now read-only.
How would it be possible to filter or apply style functions based on the results of an external function? That is to say a function that derives it's result from data not contained in the mvt source?
For example, I have mvt tiles returning census grid coverage for an area. There are lots and lots of polygons (thousands and thousands.) I would like to be able to filter and/or style these based on the results of a computation (in my case, the results out a routing function that measures census units that are accessible within a certain travel time.) The computation returns an array of ids that are reachable. I would like to filter, or change color or change opacity of the already displayed mvt layer based on the presence of a unit's id in my computed array.
Using the filter syntax, the only way I see to do this is ["in", id_field, id1, id2, id3..., idn]. The two negatives I see there are that a) this needs to be constructed, which will create a massive filter (with several hundreds of ids potentially reachable, and b) the filter is defined on layer definition. I might run this computation many times, and would would want the filter to update with each run, as the array will have changed.
Using data-driven styles, I can access properties in the mvt layer (id being one of them,) but the available functions are based on static classification of those values, not derived values base on a property. So I can do stops or categories based on this value, but not, say, compare this value to my array of ids, and determine style based on the results.
Are any of these options possible? How would I approach this? The examples that show ui-derived filtering are based on small groups, and using map.setLayoutProperty() on individual layers, which will obviously not work with mvt and thousands of census units...
Thanks for the input!
The text was updated successfully, but these errors were encountered:
How would it be possible to filter or apply style functions based on the results of an external function? That is to say a function that derives it's result from data not contained in the mvt source?
For example, I have mvt tiles returning census grid coverage for an area. There are lots and lots of polygons (thousands and thousands.) I would like to be able to filter and/or style these based on the results of a computation (in my case, the results out a routing function that measures census units that are accessible within a certain travel time.) The computation returns an array of ids that are reachable. I would like to filter, or change color or change opacity of the already displayed mvt layer based on the presence of a unit's id in my computed array.
Using the filter syntax, the only way I see to do this is
["in", id_field, id1, id2, id3..., idn]
. The two negatives I see there are that a) this needs to be constructed, which will create a massive filter (with several hundreds of ids potentially reachable, and b) the filter is defined on layer definition. I might run this computation many times, and would would want the filter to update with each run, as the array will have changed.Using data-driven styles, I can access properties in the mvt layer (id being one of them,) but the available functions are based on static classification of those values, not derived values base on a property. So I can do stops or categories based on this value, but not, say, compare this value to my array of ids, and determine style based on the results.
Are any of these options possible? How would I approach this? The examples that show ui-derived filtering are based on small groups, and using
map.setLayoutProperty()
on individual layers, which will obviously not work with mvt and thousands of census units...Thanks for the input!
The text was updated successfully, but these errors were encountered: