Sunday, 17 January 2016

javascript - Applying a single leaflet search control to search multiple layers?


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

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...