I trying to maximize the search for the leaflet control search. So, I have a layerGroup "grupocartas" and I want to use different attributes to maximize the search. Let´s say that I have the attribute "title" only in scale10000 layer and I have the attribute "number" only in scale300000 layer. I wonder if it is possible to add more than one attribute to the propertyName to achieve my goal or if someone could help to figure out another way to do that. Find bellow my leaflet control search code:
var grupocartas = L.layerGroup([scale10000,scale300000]);
var controlSearch = new L.Control.Search({
position:'topleft', // where do you want the search bar?
propertyName: 'title',
circleLocation: false,
layer: grupocartas, // name of the layer
initial: false,
zoom: 11, // set zoom to found location when searched
marker: false,
textPlaceholder: 'search...' // placeholder while nothing is searched
});
map.addControl(controlSearch); // add it to the map
controlSearch.on('search:collapsed', function(e) {
map.setView([-12, -60], 4);
})
I am looking for something like this propertyName: '[title,number]', so the search will occur in both GeoJson attributes.
Aucun commentaire:
Enregistrer un commentaire