Leaflet.PixiOverlay
Leaflet.PixiOverlay copied to clipboard
Example for adding markers dynamically
Hello there. Is there an example in the docs on how to add or remove markers dynamically after the map and layers have been rendered? For instance, after a specified interval, I'd like to check a datasource for any changes. If a new element is added in the source, I'd like to add that as a marker to the map. Same for the inverse.
I tried looking in the docs, googling and examples but couldn't find anything. Any tips?
Hi @hokiepokedad2, did you succeed? I'm in the same case I don't understand how to remove the old markers.
@hokiepokedad2
- create sprinte var marker = new PIXI.Sprite(markerTexture);
- add to Container pixiContainer.addChild(marker);
- to remove/hide, just set sprinte to visible=false, or visible=true opposite
- don't forget to call renderer.render(pixiContainer);