leaflet-control-geocoder icon indicating copy to clipboard operation
leaflet-control-geocoder copied to clipboard

Disappear polygon in map

Open vanithaak opened this issue 2 years ago • 0 comments

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?

vanithaak avatar Nov 03 '22 15:11 vanithaak