---
metadata:
  - name: generator
    content: Diplodoc Platform v5.39.1
alternate:
  - https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md
  - https://yandex.com.tr/dev/jsapi-v2-1/doc/ru/v2-1/ref/reference/GeoObjectCollection.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com.tr/dev/jsapi-v2-1/doc/en/llms.txt

# GeoObjectCollection

Extends [IGeoObject](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md), [IGeoObjectCollection](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObjectCollection.md).

Collection of geo objects. Allows you to group geo objects for adding them to the map, setting options, etc. Collections are geo objects too.

[Constructor](#constructor-summary) | [Fields](#properties-summary) | [Events](#events-summary) | [Methods](#methods-summary)

## Constructor {#constructor-summary}

```javascript
GeoObjectCollection([feature[, options]])
```

Creates a collection of geo objects.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`feature`](#param-feature) | — | Type: Object

Collection description. For all purposes, corresponds to the geo object description. See [GeoObject](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObject.md) object. ||
|| [`feature.children`](#param-feature.children) | — | Type: [IGeoObject](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md)[]

Array of child geoobjects. ||
|| [`feature.geometry`](#param-feature.geometry) | — | Type: [IGeometry](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeometry.md)\|Object

Geometry of a collection. ||
|| [`feature.properties`](#param-feature.properties) | — | Type: [IDataManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDataManager.md)\|Object

Collection data. ||
|| [`options`](#param-options) | — | Type: Object

Collection options. You can set all the options described in the [GeoObject](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObject.md) object. Option values will be applied both to the collection itself and to its child objects, if these options are not set for them. ||
|#


**Example:**

```javascript
// Creating a collection of geo objects and setting options.
var myGeoObjects = new ymaps.GeoObjectCollection({}, {
    preset: "islands#redCircleIcon",
    strokeWidth: 4,
    geodesic: true
});

// Adding placemarks and a polyline to the collection.
myGeoObjects.add(new ymaps.Placemark([13.38, 52.51]));
myGeoObjects.add(new ymaps.Placemark([30.30, 50.27]));
myGeoObjects.add(new ymaps.Polyline([[13.38, 52.51], [30.30, 50.27]]));

// Adding the collection to the map.
myMap.geoObjects.add(myGeoObjects);
// Setting the map center and scale so that the whole collection is visible.
myMap.setBounds(myGeoObjects.getBounds());
```

## Fields {#properties-summary}

#|
|| **Name** | **Type** | **Description** ||
|| [events](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#events) | [IEventManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventManager.md)| Event manager.

Inherited from [IDomEventEmitter](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#events). ||
|| [geometry](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md#geometry) | [IGeometry](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeometry.md)\|null| Geo object geometry.

Inherited from [IGeoObject](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md#geometry). ||
|| [options](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ICustomizable.md#options) | [IOptionManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md)| Options manager.

Inherited from [ICustomizable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ICustomizable.md#options). ||
|| [properties](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md#properties) | [IDataManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDataManager.md)| Geo object data.

Inherited from [IGeoObject](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md#properties). ||
|| [state](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md#state) | [IDataManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDataManager.md)| State of the geo object.

Inherited from [IGeoObject](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md#state). ||
|#

## Events {#events-summary}

#|
|| **Name** | **Description** ||
|| [add](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObjectCollection.md#event-add)| A child geo object has been added (inserted). Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- index: Integer - Index of the added geo object.
- child: [IGeoObject](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md) - Reference to the added geo object.

Inherited from [IGeoObjectCollection](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObjectCollection.md#event-add). ||
|| [boundschange](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md#event-boundschange)| Change to coordinates of the geographical area that includes the collection and all its child geo objects. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. ||
|| [click](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-click)| Single left-click on the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the [MapEvent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/MapEvent.md) class. More information is available in [domEvent.manager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/domEvent.manager.md).

Inherited from [IDomEventEmitter](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-click). ||
|| [contextmenu](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-contextmenu)| Calls the element's context menu. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the [MapEvent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/MapEvent.md) class. More information is available in [domEvent.manager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/domEvent.manager.md).

Inherited from [IDomEventEmitter](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-contextmenu). ||
|| [dblclick](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-dblclick)| Double left-click on the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the [MapEvent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/MapEvent.md) class. More information is available in [domEvent.manager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/domEvent.manager.md).

Inherited from [IDomEventEmitter](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-dblclick). ||
|| [geometrychange](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md#event-geometrychange)| Change to the geo object geometry. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- originalEvent: [IEvent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEvent.md) - Original event of the geometry.

Inherited from [IGeoObject](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md#event-geometrychange). ||
|| [mapchange](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IParentOnMap.md#event-mapchange)| Map reference changed. Data fields: 
- oldMap - Old map.
- newMap - New map.

Inherited from [IParentOnMap](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IParentOnMap.md#event-mapchange). ||
|| [mousedown](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-mousedown)| Pressing the mouse button over the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the [MapEvent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/MapEvent.md) class. More information is available in [domEvent.manager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/domEvent.manager.md).

Inherited from [IDomEventEmitter](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-mousedown). ||
|| [mouseenter](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-mouseenter)| Pointing the cursor at the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the [MapEvent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/MapEvent.md) class. More information is available in [domEvent.manager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/domEvent.manager.md).

Inherited from [IDomEventEmitter](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-mouseenter). ||
|| [mouseleave](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-mouseleave)| Moving the cursor off of the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the [MapEvent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/MapEvent.md) class. More information is available in [domEvent.manager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/domEvent.manager.md).

Inherited from [IDomEventEmitter](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-mouseleave). ||
|| [mousemove](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-mousemove)| Moving the cursor over the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the [MapEvent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/MapEvent.md) class. More information is available in [domEvent.manager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/domEvent.manager.md).

Inherited from [IDomEventEmitter](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-mousemove). ||
|| [mouseup](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-mouseup)| Letting go of the mouse button over an object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the [MapEvent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/MapEvent.md) class. More information is available in [domEvent.manager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/domEvent.manager.md).

Inherited from [IDomEventEmitter](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-mouseup). ||
|| [multitouchend](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-multitouchend)| End of multitouch. This event is only available on devices that support multitouch. Returns an implementation of the IMultiTouchEvent interface.

Inherited from [IDomEventEmitter](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-multitouchend). ||
|| [multitouchmove](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-multitouchmove)| Repeating event during multitouch. This event is only available on devices that support multitouch. Returns an implementation of the IMultiTouchEvent interface with information about touches. Defines the touches property, which contains a list of touches. Every touch is described by an object that contains the following fields: 
- clientX - X coordinate of the touch relative to the viewable area of the browser.
- clientY - Y coordinate of the touch relative to the viewable area of the browser.
- pageX - X coordinate of the touch relative to the beginning of the document.
- pageY - Y coordinate of the touch relative to the beginning of the document.

Inherited from [IDomEventEmitter](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-multitouchmove). ||
|| [multitouchstart](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-multitouchstart)| Start of multitouch. This event is only available on devices that support multitouch. Returns an implementation of the IMultiTouchEvent interface with information about touches. Defines the touches property, which contains a list of touches. Every touch is described by an object that contains the following fields: 
- clientX - X coordinate of the touch relative to the viewable area of the browser.
- clientY - Y coordinate of the touch relative to the viewable area of the browser.
- pageX - X coordinate of the touch relative to the beginning of the document.
- pageY - Y coordinate of the touch relative to the beginning of the document.

Inherited from [IDomEventEmitter](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-multitouchstart). ||
|| [optionschange](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ICustomizable.md#event-optionschange)| Change to the object options.

Inherited from [ICustomizable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ICustomizable.md#event-optionschange). ||
|| [overlaychange](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md#event-overlaychange)| Change to the geo object overlay. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- overlay: [IOverlay](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOverlay.md)\|null - Reference to the overlay.
- oldOverlay: [IOverlay](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOverlay.md)\|null - Previous overlay of the geo object.

Inherited from [IGeoObject](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md#event-overlaychange). ||
|| [parentchange](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IChild.md#event-parentchange)| The parent object reference changed.

Data fields:

- oldParent - Old parent.
- newParent - New parent.

Inherited from [IChild](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IChild.md#event-parentchange). ||
|| [pixelboundschange](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md#event-pixelboundschange)| Change to pixel coordinates of the area that includes the collection and all its child geo objects. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. ||
|| [propertieschange](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md#event-propertieschange)| Change to the geo object data. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- originalEvent: [IEvent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEvent.md) - Original event of the data manager.

Inherited from [IGeoObject](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md#event-propertieschange). ||
|| [remove](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObjectCollection.md#event-remove)| A child geo object has been removed. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- index: Integer - Index of the deleted geo object.
- child: [IGeoObject](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md) - Reference to the deleted geo object.

Inherited from [IGeoObjectCollection](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObjectCollection.md#event-remove). ||
|| [set](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObjectCollection.md#event-set)| A new child geo object has been added to the collection. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. Names of fields that are available via the [Event.get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md#get) method: 
- index: Integer - Index of the geo object.
- child: [IGeoObject](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md) - Reference to the new geo object.
- prevChild: [IGeoObject](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md) - Reference to the previous value for this index.

Inherited from [IGeoObjectCollection](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObjectCollection.md#event-set). ||
|| [wheel](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-wheel)| Mouse wheel scrolling. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the [MapEvent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/MapEvent.md) class. More information is available in [domEvent.manager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/domEvent.manager.md).

Inherited from [IDomEventEmitter](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IDomEventEmitter.md#event-wheel). ||
|#

## Methods {#methods-summary}

#|
|| **Name** | **Returns** | **Description** ||
|| [add](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md#add)([child](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md#add-param-child)) | [GeoObjectCollection](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md)
| Adds a geo object to the collection. ||
|| [each](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md#each)([callback](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md#each-param-callback)[, [context](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md#each-param-context)]) | | Iterates through all the items in the collection and calls a handler function for each of them. ||
|| [get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObjectCollection.md#get)([index](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObjectCollection.md#get-param-index)) | [IGeoObject](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md)
| Returns a child geo object with the specified index.

Inherited from [IGeoObjectCollection](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObjectCollection.md#get). ||
|| [getBounds](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md#getBounds)() | Number[][]\|null
| Returns geographical coordinates of the area that covers the collection and all its child geo objects. ||
|| [getIterator](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md#getIterator)() | [IIterator](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IIterator.md)
| Returns iterator for the collection. ||
|| [getLength](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md#getLength)() | Integer
| Returns the number of geo objects in the collection. ||
|| [getMap](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IParentOnMap.md#getMap)() | [Map](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Map.md)
| Returns reference to the map.

Inherited from [IParentOnMap](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IParentOnMap.md#getMap). ||
|| [getOverlay](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md#getOverlay)() | [vow.Promise](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/vow.Promise.md)
| Returns the promise object, which is confirmed by the overlay object at the time it is actually created, or is rejected with an appropriate error message.

Inherited from [IGeoObject](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md#getOverlay). ||
|| [getOverlaySync](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md#getOverlaySync)() | [IOverlay](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOverlay.md)\|null
| The method provides synchronous access to the overlay.

Inherited from [IGeoObject](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md#getOverlaySync). ||
|| [getParent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IChildOnMap.md#getParent)() | [IParentOnMap](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IParentOnMap.md)\|null
| Returns link to the parent object, or null if the parent element was not set.

Inherited from [IChildOnMap](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IChildOnMap.md#getParent). ||
|| [getPixelBounds](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md#getPixelBounds)() | Number[][]\|null
| Returns global pixel coordinates of the area that spans the collection and all its child geo objects. ||
|| [indexOf](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObjectCollection.md#indexOf)([object](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObjectCollection.md#indexOf-param-object)) | Integer
| Returns index of the child geo object. If the geo object cannot be found in the collection, -1 is returned.

Inherited from [IGeoObjectCollection](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObjectCollection.md#indexOf). ||
|| [remove](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md#remove)([child](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md#remove-param-child)) | [GeoObjectCollection](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md)
| Removes a geo object from the collection. ||
|| [removeAll](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md#removeAll)() | [GeoObjectCollection](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md)
| Removes all the geo objects from the collection. ||
|| [set](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md#set)([index](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md#set-param-index), [child](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md#set-param-child)) | [GeoObjectCollection](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md)
| Adds a new child geo object to the collection. ||
|| [setParent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IChildOnMap.md#setParent)([parent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IChildOnMap.md#setParent-param-parent)) | [IChildOnMap](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IChildOnMap.md)
| Sets the parent object. If the null value is passed, the manager element will only be deleted from the current parent object.

Inherited from [IChildOnMap](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IChildOnMap.md#setParent). ||
|| [splice](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md#splice)([index](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md#splice-param-index), [number](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md#splice-param-number)) | [GeoObjectCollection](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md)
| Removes geo objects from the collection. If necessary, puts other objects in their place. Objects that will be added in place of the deleted ones are passed as additional parameters (after the "number" parameter). ||
|| [toArray](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoObjectCollection.md#toArray)() | [IGeoObject](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md)[]
| Returns an array containing all the collection's geo objects at the time of the method call. ||
|#

## Events details {#event_detail}

### boundschange {#boundschange}

Change to coordinates of the geographical area that includes the collection and all its child geo objects. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class.

### pixelboundschange {#pixelboundschange}

Change to pixel coordinates of the area that includes the collection and all its child geo objects. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class.

## Methods details {#method_detail}

### add {#add}

```javascript
{GeoObjectCollection} add(child)
```

Adds a geo object to the collection.

**Returns** a reference to the collection.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`child`](#add-param-child)[*](*star) | — | Type: [IGeoObject](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md)

Child object. ||
|#

\* Mandatory parameter/option.

### each {#each}

```javascript
{} each(callback[, context])
```

Iterates through all the items in the collection and calls a handler function for each of them.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`callback`](#each-param-callback)[*](*star) | — | Type: Function

Handler function. ||
|| [`context`](#each-param-context) | — | Type: Object

Context for the function. ||
|#

\* Mandatory parameter/option.

### getBounds {#getBounds}

```javascript
{Number[][]|null} getBounds()
```

**Returns** geographical coordinates of the area that covers the collection and all its child geo objects.

**Example:**

```javascript
// Setting the map center and zoom so that the entire collection is displayed.
myMap.setBounds(myCollection.getBounds());
```

### getIterator {#getIterator}

```javascript
{IIterator} getIterator()
```

**Returns** iterator for the collection.

**Example:**

```javascript
// Searching the collection for a geo object with the "Polyline" geometry.
var iterator = myGroup.getIterator(),
    object;
while ((object = iterator.getNext()) != iterator.STOP_ITERATION) {
    if (object.geometry.getType() == "LineString") {
        break;
    }
}
```

### getLength {#getLength}

```javascript
{Integer} getLength()
```

**Returns** the number of geo objects in the collection.

### getPixelBounds {#getPixelBounds}

```javascript
{Number[][]|null} getPixelBounds()
```

**Returns** global pixel coordinates of the area that spans the collection and all its child geo objects.

### remove {#remove}

```javascript
{GeoObjectCollection} remove(child)
```

Removes a geo object from the collection.

**Returns** a reference to the collection.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`child`](#remove-param-child)[*](*star) | — | Type: [IGeoObject](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md)

Child object. ||
|#

\* Mandatory parameter/option.

### removeAll {#removeAll}

```javascript
{GeoObjectCollection} removeAll()
```

Removes all the geo objects from the collection.

**Returns** a reference to the collection.

### set {#set}

```javascript
{GeoObjectCollection} set(index, child)
```

Adds a new child geo object to the collection.

**Returns** self-reference.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`index`](#set-param-index)[*](*star) | — | Type: Integer

Index. ||
|| [`child`](#set-param-child)[*](*star) | — | Type: [IGeoObject](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IGeoObject.md)

Child object. ||
|#

\* Mandatory parameter/option.

### splice {#splice}

```javascript
{GeoObjectCollection} splice(index, number)
```

Removes geo objects from the collection. If necessary, puts other objects in their place. Objects that will be added in place of the deleted ones are passed as additional parameters (after the "number" parameter).

**Returns** collection of deleted geo objects.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`index`](#splice-param-index)[*](*star) | — | Type: Integer

Index of the geo object to start deletion from. ||
|| [`number`](#splice-param-number)[*](*star) | — | Type: Integer

The number of geo objects to be deleted. ||
|#

\* Mandatory parameter/option.

**Example:**

```javascript
// Removes the second object.
myGeoObjects.splice(1, 1);
// Puts a new "obj" object in the second position.
myGeoObjects.splice(1, 0, obj);
// Replaces the second object with the new "obj" object.
myGeoObjects.splice(1, 1, obj);
```

### toArray {#toArray}

```javascript
{IGeoObject[]} toArray()
```

**Returns** an array containing all the collection's geo objects at the time of the method call.

[*star]: Mandatory parameter/option.