I am trying to implement a function that will filter multiple GeoJSON layers in Leaflet based on the contents of a text box on the same page.
For instance, a user may write 4 5 7 10 in the textbox - after pressing a 'submit' button, I now want to update the map to include features that have an ID GeoJSON attribute of 4, 5, 7, or 10.
I need to apply this filter across multiple layers as ID's 4, 5, 7, or 10 could exist across multiple layers. As such the function needs to be generic in that it will look at any layer, check if any of the ID's match and pick them up, regardless of the layer name or the geojson variable used to create the layer.
From what i can tell in the documentation the only way to apply filters is to reconstruct the GeoJSON layer from scratch whilst using 'filter:myfilter'. Is there a way to avoid this? Ideally a way that avoids having to remove layers from the map etc.