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

Name Type Description
options

Options.

Name Type Description
features Array.<ol.Feature> | ol.Collection.<ol.Feature> | undefined experimental

Features.

map ol.Map | undefined experimental

Map.

style ol.style.Style | Array.<ol.style.Style> | ol.style.StyleFunction | undefined experimental

Feature style.

Methods

addFeature(feature) experimental

Name Type Description
feature ol.Feature

Feature.

Returns:
Features collection.

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.style.StyleFunction|undefined} experimental

Get the style function.

Returns:
Style function.

removeFeature(feature) experimental

Name Type Description
feature ol.Feature

Feature.

setFeatures(features) experimental

Name Type Description
features ol.Collection.<ol.Feature>

Features collection.

setMap(map) experimental

Name Type Description
map ol.Map

Map.

setStyle(style) experimental

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.style.StyleFunction

Overlay style.