I am attempting to add a single search button to look through geoJSON layers. They will look through the field "name". Unfortunately, my method of creating a layer group is not working. What am I missing? Or how do I group together geoJSON files to make this work?
var searchControl = new L.Control.Search({
layer: [syriaLayer, countryBoundary],
zoom: 7.5,
propertyName: 'Sheet_Numb',
circleLocation: false
});
Answer
Group the layers within a layerGroup
or a featureGroup
as described in the docs
layer: L.featureGroup([syriaLayer, countryBoundary]),
No comments:
Post a Comment