The <x-map-cluster-layer> component efficiently handles large numbers of markers by grouping them into clusters. As you zoom in, clusters break apart into individual points. This is the recommended approach for datasets with hundreds or thousands of points.
Pass GeoJSON Feature data to the cluster layer. Click on clusters to zoom in:
Change the cluster circle color to match your brand:
The :data prop accepts an array of GeoJSON Feature objects. Each feature must have:
[
'type' => 'Feature',
'properties' => [
'name' => 'Location Name', // Any properties you want
],
'geometry' => [
'type' => 'Point',
'coordinates' => [$lng, $lat], // [longitude, latitude]
],
]
| Prop | Type | Default | Description |
|---|---|---|---|
| :data | array | required | GeoJSON Features or coordinate array |
| :cluster-max-zoom | int | 14 | Max zoom level to cluster at |
| cluster-color | string | '#1A56DB' | Color of the cluster circle |
| popup-property | string | null | Feature property to show in popup |
| :click-zoom | bool | true | Zoom in on cluster click |