Clusters

How can retrieve the list of markers within a cluster in the TTMSFNCGoogleMaps onclusterclick event

Thanks in advance

Hi,

The AEventData.ID parameter of the OnClusterClick event contains the ID of the Cluster that was clicked. The Clusters[Index].Markers contains the list of Markers within the Cluster.

The AEventData.ID contains this string value {C6F1DC0C-077A-4F60-A58A-BBA4F3926054}
How obtain the cluster index?

(For markers exists Markers.ItemByID property)

You can manually loop the Clusters collection to find it.

procedure TForm1.TMSFNCMapsClusterClick(Sender: TObject;
  AEventData: TTMSFNCMapsEventData);
var
  I: Integer;
  ClusterIndex: Integer;
begin
  for I := 0 to m.Clusters.Count - 1 do
  begin
    if AEventData.ID = m.Clusters[I].ID then
    begin
      ClusterIndex := I;
      break;
    end;
  end;
end;

Unfortunately there is currently no Clusters.ItemByID property available. However, this is a good suggstion and we'll consider adding this in a future version.

It doesn't work: it always returns the number of total markers loadad into the map.
The markers are loaded during initialization into a single cluster (Clusters[0]) as the documentation. How can I obtain the markers for each individual cluster displayed when map is zoomed (es. 2 clusters of 2 markers, 4 cluster of 3 markers ecc.)

Please note it's currently not supported to retrieve the number of markers contained in the clicked cluster icon on the map. It is only possible to retrieve the total number of markers contained in the cluster object.
However, this is a good suggestion and we'll have to investigate if this feature is available in the API and if it can be added in a future version.

Thank you for your response. The functionality was present in the TMS VCL WebGMaps version. Are there any timelines for the implementation in the FNC version?

The functionality will be available with the next TMS FNC Maps release.
The MarkerCount value will be included in the AEventData.CustomData parameter of the OnClusterClick event.