# Class: FeatureOverlay

## ol.FeatureOverlay

A mechanism for changing the style of a small number of features on a temporary basis, for example highlighting. This is necessary with the Canvas renderer, where, unlike in SVG, features cannot be individually referenced. See examples/vector-layers for an example: create a FeatureOverlay with a different style, copy the feature(s) you want rendered in this different style into it, and then remove them again when you're finished.

#### new ol.FeatureOverlay(opt_options) experimental

src/ol/featureoverlay.js, line 30

  Name | Type | Description
  --- | --- | ---
  `options` | optional Options.
  Name | Type | Description
  --- | --- | ---
  `features` | Array.<ol.Feature> | ol.Collection | undefined | optional Features.
  `map` | ol.Map | undefined | optional Map.
  `style` | ol.style.Style | Array.<ol.style.Style> | ol.feature.StyleFunction | undefined | optional Feature style.

### Methods

#### addFeature(feature) experimental

src/ol/featureoverlay.js, line 99

  Name | Type | Description
  --- | --- | ---
  `feature` | ol.Feature | Feature.

#### getFeatures(){ol.Collection} experimental

src/ol/featureoverlay.js, line 139

  ##### Returns:

  Features collection.

#### getStyle(){ol.style.Style|Array.<ol.style.Style>|ol.feature.StyleFunction} experimental

src/ol/featureoverlay.js, line 313

  Get the style for features. This returns whatever was passed to the `style` option at construction or to the `setStyle` method.

  ##### Returns:

  Overlay style.

#### getStyleFunction(){ol.feature.StyleFunction|undefined} experimental

src/ol/featureoverlay.js, line 323

  Get the style function.

  ##### Returns:

  Style function.

#### removeFeature(feature) experimental

src/ol/featureoverlay.js, line 222

  Name | Type | Description
  --- | --- | ---
  `feature` | ol.Feature | Feature.

#### setFeatures(features) experimental

src/ol/featureoverlay.js, line 241

  Name | Type | Description
  --- | --- | ---
  `features` | ol.Collection | Features collection.

#### setMap(map) experimental

src/ol/featureoverlay.js, line 275

  Name | Type | Description
  --- | --- | ---
  `map` | ol.Map | Map.

#### setStyle(style) experimental

src/ol/featureoverlay.js, line 299

  Set the style for features. This can be a single style object, an array of styles, or a function that takes a feature and resolution and returns an array of styles.

  Name | Type | Description
  --- | --- | ---
  `style` | ol.style.Style | Array.<ol.style.Style> | ol.feature.StyleFunction | Overlay style.