Markers and ID

I am adding markers to a map.

Th ID number start at zero and increments. so If I add 12 markers, the id range is 0-11.

If I then clear the markers and add new markers, The ID of the next set starts at 12.

I was assuming that IdMarker in events would match Marker.Id, but this doesn't seem to be the case.

Can you help?

Dave Craggs

I'm trying to locate the Marker in event OnMarkerClick.

But I'm getting a strange situation where markers disappear on being clicked when I access WebGMaps1.Markers in this event.

Hmm - doesn't appear to be the event.

When it happens the markers seem to be different.

If you see the two markers are slightly different. Click on the left one and it disappears.

They have both been added using the same code.


I have not been able to reproduce these issues.
Can you please provide a ready to run sample project by email ( that demonstrates the issue so I can further investigate this?

I deleted the component and re added it to the form.

After re linking the events, the problem no longer happens.


What about the original question regarding ID?


Can you please make sure the markers are removed from both the Markers collection and the map?
For example, when using the ClearMapMarkers call, the markers are only removed from the map but not from the Markers collection.

If the problem persists, please provide a ready to run sample project that demonstrates the issue by email (

I'm confused (easily done!).

I'm clearing the markers using WebGMaps1.Markers.Clear;

I can't find a ClearMapMarkers function, and there is no reference ion the documentation.

The manual has a lot of "DeleteAll*" methods.
This is probably what you are looking for:

function DeleteAllMapMarker: Boolean;

The DeleteAllMapMarker method was indeed what I wanted to refer to.
Sorry for the confusion.