I have an leaflet map with 2 geojson file loaded locally using the leaflet ajax filter. I am trying to filter the second geojson (polyline) based on 'click' of any of the first geojson point feature. both of them had the same SiteID field I am able to get the feature ID,
layer.on("click", function(e){
pollid= feature.properties.SiteID; // ID from first layer geojson
console.log(pollid);
lyrSpider.addTo(map); // second geojson file
console.log(pollid);
});
how can I pass the (pollid) to filter the second geojson
function spiderfilter(feature) {
if (feature.properties.SiteID == pollid) return true; // problem,
}
I could not figure out the variable scope. here.