OpenLayers. Layer. Vector

Instances of OpenLayers.Layer.Vector are used to render vector data from a variety of sources.  Create a new image layer with the OpenLayers.Layer.Vector constructor.

Inherits from

Summary
Instances of OpenLayers.Layer.Vector are used to render vector data from a variety of sources.
{Boolean} The layer is a base layer.
{Boolean} Whether the layer remains in one place while dragging the map.
{Boolean} Whether the layer is a vector layer.
{Boolean} report error message via alert() when loading of renderers fails.
{Object} Default style for the layer
{String} geometryType allows you to limit the types of geometries this layer supports.
Create a new vector layer
Destroy this layer
Add Features to the layer.
Destroy all features on the layer and empty the selected features array.
Given a feature id, return the feature if it exists in the features array
method called after a feature is inserted.
method called before a feature is inserted.

Properties

isBaseLayer

{Boolean} The layer is a base layer.  Default is true.  Set this property in the layer options

isFixed

{Boolean} Whether the layer remains in one place while dragging the map.

isVector

{Boolean} Whether the layer is a vector layer.

features

reportError

{Boolean} report error message via alert() when loading of renderers fails.

style

{Object} Default style for the layer

geometryType

{String} geometryType allows you to limit the types of geometries this layer supports.  This should be set to something like “OpenLayers.Geometry.Point” to limit types.

Constructor

OpenLayers. Layer. Vector

Create a new vector layer

Parameters

name{String} A name for the layer
options{Object} options Object with non-default properties to set on the layer.

Returns

{OpenLayers.Layer.Vector} A new vector layer

Functions

destroy

destroy: function()

Destroy this layer

addFeatures

addFeatures: function(features)

Add Features to the layer.

Parameters

features{Array(OpenLayers.Feature.Vector)}

removeFeatures

removeFeatures: function(features)

Parameters

features{Array(OpenLayers.Feature.Vector)}

destroyFeatures

destroyFeatures: function ()

Destroy all features on the layer and empty the selected features array.

getFeatureById

getFeatureById: function(featureId)

Given a feature id, return the feature if it exists in the features array

Parameters

featureId{String}

Returns

{OpenLayers.Feature.Vector} A feature corresponding to the given featureId

onFeatureInsert

onFeatureInsert: function(feature)

method called after a feature is inserted.  Does nothing by default.  Override this if you need to do something on feature updates.

Paarameters

feature{OpenLayers.Feature.Vector}

preFeatureInsert

preFeatureInsert: function(feature)

method called before a feature is inserted.  Does nothing by default.  Override this if you need to do something when features are first added to the layer, but before they are drawn, such as adjust the style.

Parameters

feature{OpenLayers.Feature.Vector}
Vector features use the OpenLayers.Geometry classes as geometry description.
destroy: function()
Destroy this layer
addFeatures: function(features)
Add Features to the layer.
removeFeatures: function(features)
destroyFeatures: function ()
Destroy all features on the layer and empty the selected features array.
getFeatureById: function(featureId)
Given a feature id, return the feature if it exists in the features array
onFeatureInsert: function(feature)
method called after a feature is inserted.
preFeatureInsert: function(feature)
method called before a feature is inserted.
Create a new vector layer