I am using a L.control.search to search for points in GeoJSON file and create a layer with the points I´m seaching according to a features.properties.value, and dispay them on a map.
The var that creates de layer with the points is:
var lights= L.geoJson(data, {
filter: function(feature, layer) {
return (feature.properties.type === "Lights");
},
pointToLayer: function(feature,latlng) {
return new L.CircleMarker(latlng, {radius: 3,
fillOpacity: 1,
color: 'black',
fillColor: '#E0E0E0',
weight: 1,})
},
onEachFeature: setPopup
}
); // end geojson layer all lights
lights.addTo(map);
Than I add a layer group and pass it to L.control.search to be able to search using feature.properties.maclora
var allLayers = L.layerGroup([lights]);
L.control.search({
layer: allLayers,
initial: false,
propertyName: 'maclora',
zoom: 20,
buildTip: function(text, val) {
var type = val.layer.feature.properties.maclora;
return '<a href="#" class="' + type + '">' + text + '<b>' + type + '</b></a>';
}
}).addTo(map);
But when I try to use another L.Control that searches for addresses the L.control.search disapears:
I´m using https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.js to create another control and search for streets names and add a marker to it.
var geocoder = L.Control.geocoder({
defaultMarkGeocode: true
})
.addTo(map);
How can I create something similar to a L.Control.Cluster() and add the controls to it?
L.control.searchcoming from? Please edit your question and add that info.