How do I delete created markers in the map?

I'm using the map component to create several markers programmatically using the CreateMarker method

Now I would like to initialize the map again and remove all the previously created markers... How can I do this? It seems to be a method like DeleteMarker is missing?


Does this help ?

1 Like

thank you...

it sems to be, I have to first add all the markers to the Maps.Features property...
later then I can
to remove all the markers

sometimes I had to wait a few seconds until the map reinitialized...


EDIT: here are the example blocks of my test project

map.aia (2.9 KB)

@SteveJG (Maps expert!) may be along with a different solution....

What you do to delete created Markers depends on how your data is structured.
You can delete the Markers or make them not visible or only make some visible and others not visible.

Not necessarily. Make a ListOfMarkers as you create the the design time Marker (add items to list). When you no longer want the Markers displayed, iterate thru the List and delete the items from ListOfMarkers components .

Is this more efficient? I don't know.

Yep. You are dealing with OpenStreetMap tiles. Adding Markers and Features depend on OSMs server. Several seconds does seem a bit long. How many Markers are you deleting @Taifun ? I am aware of one developer who posts around 7000 Markers; if I recall, his updates (and deletes them) in a few seconds including display time. I am guessing it may take longer to update all Features then it takes to update/remove Markers.

There is no deleteMarker method; probably because the component Markers are autogenerated. You could of course work with design time Markers instead of run time Markers and delete (make invisible very easily).

-- Steve

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.