# How to add pins using the MapPinLayer?

This approach is better suited for **large data sets** where clustering may be required:

* Add a `MapPinLayer` component to the MapRenderer's GameObject. If clustering is enabled, check this setting on the layer and attach a prefab that has a ClusterMapPin component.

![Map Pin Layer Script](https://1227696974-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LoMjAI1irMPA8c0ezFQ%2Fuploads%2Fgit-blob-c7a529dfa6893070f6bf48a5f88cb52794478496%2FMapPinLayerWithClustering.png?alt=media)

* In a script, get a reference to the `MapPinLayer` and add `MapPin` instances to the the layer's `MapPins` collection.

```csharp
foreach (var mapPinLocation in _maoPinLocations)
{
    var mapPin = Instantiate(_mapPinPrefab);
    mapPin.Location = mapPinLocation;
    _mapPinLayer.MapPins.Add(mapPin);
}​

```

###
