currently I am using the leaflet map and added this geocoder plugin: https://github.com/perliedman/leaflet-control-geocoder. My problem is, that everytime I search for a place, it also sets a marker at this location, but I don´t want it to. It should only zoom in and not set a marker.
Does anybody know how to disable this function or delete the set marker instantly?
The set marker looks like this
I am working in Ionic/ typescript and my code for using the geocoder is this:
leaflet.Control.geocoder().addTo(this.map);
According to GitHub, defaultMarkGeocode:false should disable the marker. When using it, I just get this error:
Cannot read property '_leaflet_id' of undefined
I also tried
var geocoder = L.Control.geocoder({
defaultMarkGeocode: false
})
.on('markgeocode', function(e) {
var bbox = e.geocode.bbox;
var poly = L.polygon([
bbox.getSouthEast(),
bbox.getNorthEast(),
bbox.getNorthWest(),
bbox.getSouthWest()
]).addTo(map);
map.fitBounds(poly.getBounds());
})
.addTo(map);
but it just tells me that the variable geocoder was never used and I get this error:
Cannot read property 'addLayer' of undefined
If you have any suggestions how to fix it and either disable or delete this marker, I would be very thankfully.
Greetings