leaflet-control-geocoder
leaflet-control-geocoder copied to clipboard
Disappear polygon in map
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);
I used this as mentioned in README file, but I'd like to make the polygon disappear after few seconds. I used setTImeout function here function(e) {
and I get an error that it's not able to read e.geocode.bbox
.
How can I achieve this?