new ol.Feature(opt_geometryOrProperties)
| Name | Type | Description | 
|---|---|---|
geometryOrProperties | 
            
            
            
            ol.geom.Geometry | Object.<string, *>= | 
                
                 You may pass a Geometry object directly, or an object literal
    containing properties.  If you pass an object literal, you may
    include a Geometry associated with a   | 
        
Fires:
- 
            
changeexperimental - Triggered when the revision counter is increased. - 
            
change:geometry(ol.ObjectEvent) - 
            
change:id(ol.ObjectEvent) - 
            
change:style(ol.ObjectEvent) - 
            
propertychange(ol.ObjectEvent) - Triggered when a property is changed. 
Extends
Observable Properties
| Name | Type | Settable | ol.ObjectEvent type | Description | 
|---|---|---|---|---|
geometry | 
      ol.geom.Geometry | undefined | yes | change:geometry | 
      The default geometry for the feature.  | 
    
id | 
      number | string | undefined | yes | change:id | 
      Id.  | 
    
style | 
      ol.style.Style | Array.<ol.style.Style> | ol.FeatureStyleFunction | yes | change:style | 
      The feature style.  | 
    
Methods
- 
    
changed() inherited experimental
src/ol/observable.js, line 57 - 
    
    
Increases the revision counter and dispatches a 'change' event.
 - 
    
clone(){ol.Feature}
src/ol/feature.js, line 121 - 
    
    
Clone this feature. If the original feature has a geometry it is also cloned. The feature id is not set in the clone.
Returns:
The clone.
 - 
    
dispatchEvent(event) inherited experimental
src/ol/observable.js, line 81 - 
    
    
Dispatches an event and calls all listeners listening for events of this type. The event parameter can either be a string or an Object with a
typeproperty.Name Type Description eventObject | ol.events.Event | string Event object.
 - 
    
get(key){*} inherited
src/ol/object.js, line 148 - 
    
    
Gets a value.
Name Type Description keystring Key name.
Returns:
Value.
 - 
    
getGeometry(){ol.geom.Geometry|undefined}
src/ol/feature.js, line 144 - 
    
    
Get the feature's default geometry. A feature may have any number of named geometries. The "default" geometry (the one that is rendered by default) is set when calling
ol.Feature#setGeometry.Returns:
The default geometry for the feature.
 - 
    
getGeometryName(){string}
src/ol/feature.js, line 170 - 
    
    
Get the name of the feature's default geometry. By default, the default geometry is named
geometry.Returns:
Get the property name associated with the default geometry for this feature.
 - 
    
getId(){number|string|undefined}
src/ol/feature.js, line 158 - 
    
    
Get the feature identifier. This is a stable identifier for the feature and is either set when reading data from a remote source or set explicitly by calling
ol.Feature#setId.Returns:
Id.
 - 
    
getKeys(){Array.<string>} inherited
src/ol/object.js, line 162 - 
    
    
Get a list of object property names.
Returns:
List of property names.
 - 
    
getProperties(){Object.<string, *>} inherited
src/ol/object.js, line 172 - 
    
    
Get an object of all property names and values.
Returns:
Object.
 - 
    
getRevision(){number} inherited experimental
src/ol/observable.js, line 90 - 
    
    
Get the version number for this object. Each time the object is modified, its version number will be incremented.
Returns:
Revision.
 - 
    
getStyle(){ol.style.Style|Array.<ol.style.Style>|ol.FeatureStyleFunction}
src/ol/feature.js, line 183 - 
    
    
Get the feature's style. This return for this method depends on what was provided to the
ol.Feature#setStylemethod.Returns:
The feature style.
 - 
    
getStyleFunction(){ol.FeatureStyleFunction|undefined}
src/ol/feature.js, line 194 - 
    
    
Get the feature's style function.
Returns:
Return a function representing the current style of this feature.
 - 
    
on(type, listener, opt_this){ol.events.Key|Array.<ol.events.Key>} inherited
src/ol/observable.js, line 105 - 
    
    
Listen for a certain type of event.
Name Type Description typestring | Array.<string> The event type or array of event types.
listenerfunction The listener function.
thisObject The object to use as
thisinlistener.Returns:
Unique key for the listener. If called with an array of event types as the first argument, the return will be an array of keys.
 - 
    
once(type, listener, opt_this){ol.events.Key|Array.<ol.events.Key>} inherited
src/ol/observable.js, line 130 - 
    
    
Listen once for a certain type of event.
Name Type Description typestring | Array.<string> The event type or array of event types.
listenerfunction The listener function.
thisObject The object to use as
thisinlistener.Returns:
Unique key for the listener. If called with an array of event types as the first argument, the return will be an array of keys.
 - 
    
set(key, value, opt_silent) inherited
src/ol/object.js, line 197 - 
    
    
Sets a value.
Name Type Description keystring Key name.
value* Value.
silentboolean Update without triggering an event.
 - 
    
setGeometry(geometry)
src/ol/feature.js, line 231 - 
    
    
Set the default geometry for the feature. This will update the property with the name returned by
ol.Feature#getGeometryName.Name Type Description geometryol.geom.Geometry | undefined The new geometry.
 - 
    
setGeometryName(name)
src/ol/feature.js, line 275 - 
    
    
Set the property name to be used when getting the feature's default geometry. When calling
ol.Feature#getGeometry, the value of the property with this name will be returned.Name Type Description namestring The property name of the default geometry.
 - 
    
setId(id)
src/ol/feature.js, line 262 - 
    
    
Set the feature id. The feature id is considered stable and may be used when requesting features or comparing identifiers returned from a remote source. The feature id can be used with the
ol.source.Vector#getFeatureByIdmethod.Name Type Description idnumber | string | undefined The feature id.
 - 
    
setProperties(values, opt_silent) inherited
src/ol/object.js, line 217 - 
    
    
Sets a collection of key-value pairs. Note that this changes any existing properties and adds new ones (it does not remove any existing properties).
Name Type Description valuesObject.<string, *> Values.
silentboolean Update without triggering an event.
 - 
    
setStyle(style)
src/ol/feature.js, line 245 - 
    
    
Set the style for the feature. This can be a single style object, an array of styles, or a function that takes a resolution and returns an array of styles. If it is
nullthe feature has no style (anullstyle).Name Type Description styleol.style.Style | Array.<ol.style.Style> | ol.FeatureStyleFunction Style for this feature.
 - 
    
un(type, listener, opt_this) inherited
src/ol/observable.js, line 153 - 
    
    
Unlisten for a certain type of event.
Name Type Description typestring | Array.<string> The event type or array of event types.
listenerfunction The listener function.
thisObject The object which was used as
thisby thelistener. - 
    
unByKey(key) inherited
src/ol/observable.js, line 174 - 
    
    
Removes an event listener using the key returned by
on()oronce(). Note that using theol.Observable.unByKeystatic function is to be preferred.Name Type Description keyol.events.Key | Array.<ol.events.Key> The key returned by
on()oronce()(or an array of keys). - 
    
unset(key, opt_silent) inherited
src/ol/object.js, line 231 - 
    
    
Unsets a property.
Name Type Description keystring Key name.
silentboolean Unset without triggering an event.
 
 OpenLayers 3