If I load a JSON file I essentially get to do functions for each feature :
var highlight = {
'color': '#149c14',
'weight': 4,
'opacity': 1
};
` $.getJSON("/data/geojson/gen.json", function(data){
var genlayer = L.geoJson(data,{
style:function(feature){
return {color:"red"};
},
onEachFeature:function(feature, layer){
layer.on('click', function(e){
//do functions to selected feature
selectedFeature = e.target;
layer.setStyle(highlight);
});
}
});
roads.addLayer(genLayer);
});`
I'm trying to figure out a way though how to focus on the selected feature by additionally and temporarily hiding other features that are not selected at the moment.
How can I approach this problem in leaflet?