Skip to content
Advertisement

leaflet js map not updating marker and circle point when i search some another city dont know what is problem in code? See picture

when I search city in search bar than another city it show marker and circle on both location previous city and current city like so. if u see picture it will tell you what i am saying. help me to imporve the code.

See problem

JavaScript

Advertisement

Answer

You would need to clear the previous layer from the map instance. You can try creating a layer group and add the layer to/remove it from that (DOCS):

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement