Skip to main content
Table of Contents

TTMSFNCGoogleMaps.Clusters Property

Provides marker clusters displayed on the map.

API unit family: TMSFNCGoogleMaps Declaring type: TTMSFNCGoogleMaps Inherited from: TTMSFNCCustomGoogleMaps Type: TTMSFNCGoogleMapsClusters

Syntax

FMX.TMSFNCGoogleMaps.hppPascalC++
property Clusters: TTMSFNCGoogleMapsClusters;
__property TTMSFNCGoogleMapsClusters* Clusters = {read=FClusters, write=SetClusters};

Usage examples

Configure MarkerClusterer-backed Google Maps clusters

Adds a cluster and assigns markers for MarkerClusterer rendering.

Configure MarkerClusterer-backed Google Maps clustersPascalC++
procedure TForm1.ConfigureGoogleMapsClusters;
var
  LCluster: TTMSFNCGoogleMapsCluster;
  LMarker: TTMSFNCGoogleMapsMarker;
begin
  TMSFNCGoogleMaps1.Markers.Clear;
  TMSFNCGoogleMaps1.Clusters.Clear;

  LCluster := TMSFNCGoogleMaps1.Clusters.Add;
  LCluster.Title := 'Regional offices';
  LCluster.MinimumNumberOfMarkers := 2;
  LCluster.MaxZoom := 12;
  LCluster.ZoomOnClick := True;
  LCluster.ImagePath := 'images/google-cluster.png';

  LMarker := TMSFNCGoogleMaps1.Markers.Add;
  LMarker.Coordinate.Latitude := 48.8566;
  LMarker.Coordinate.Longitude := 2.3522;
  LMarker.Title := 'Paris office';
  LMarker.Cluster := LCluster;
  LCluster.Markers.Add(LMarker);

  LMarker := TMSFNCGoogleMaps1.Markers.Add;
  LMarker.Coordinate.Latitude := 50.8503;
  LMarker.Coordinate.Longitude := 4.3517;
  LMarker.Title := 'Brussels office';
  LMarker.Cluster := LCluster;
  LCluster.Markers.Add(LMarker);
end;
void __fastcall TForm1::ConfigureGoogleMapsClusters()
{
  TMSFNCGoogleMaps1->Markers->Clear();
  TMSFNCGoogleMaps1->Clusters->Clear();

  TTMSFNCGoogleMapsCluster *LCluster = TMSFNCGoogleMaps1->Clusters->Add();
  LCluster->Title = "Regional offices";
  LCluster->MinimumNumberOfMarkers = 2;
  LCluster->MaxZoom = 12;
  LCluster->ZoomOnClick = true;
  LCluster->ImagePath = "images/google-cluster.png";

  TTMSFNCGoogleMapsMarker *LMarker = TMSFNCGoogleMaps1->Markers->Add();
  LMarker->Coordinate->Latitude = 48.8566;
  LMarker->Coordinate->Longitude = 2.3522;
  LMarker->Title = "Paris office";
  LMarker->Cluster = LCluster;
  LCluster->Markers->Add(LMarker);

  LMarker = TMSFNCGoogleMaps1->Markers->Add();
  LMarker->Coordinate->Latitude = 50.8503;
  LMarker->Coordinate->Longitude = 4.3517;
  LMarker->Title = "Brussels office";
  LMarker->Cluster = LCluster;
  LCluster->Markers->Add(LMarker);
}

Read the related guide