Instances of OpenLayers.Layer.Vector are used to render vector data from a variety of sources. Create a new vector layer with the OpenLayers.Layer.Vector constructor.
| OpenLayers. Layer. Vector | Instances of OpenLayers.Layer.Vector are used to render vector data from a variety of sources. |
| Constants | |
| EVENT_TYPES | {Array(String)} Supported application event types. |
| Properties | |
| isBaseLayer | {Boolean} The layer is a base layer. |
| isFixed | {Boolean} Whether the layer remains in one place while dragging the map. |
| isVector | {Boolean} Whether the layer is a vector layer. |
| features | {Array(OpenLayers.Feature.Vector)} |
| 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. |
| Constructor | |
| OpenLayers. Layer. Vector | Create a new vector layer |
| Functions | |
| destroy | Destroy this layer |
| addFeatures | Add Features to the layer. |
| removeFeatures | |
| destroyFeatures | Erase and destroy features on the layer. |
| drawFeature | Draw (or redraw) a feature on the layer. |
| getFeatureById | Given a feature id, return the feature if it exists in the features array |
| onFeatureInsert | method called after a feature is inserted. |
| preFeatureInsert | method called before a feature is inserted. |
| getDataExtent | Calculates the max extent which includes all of the features. |
{Array(String)} Supported application event types. Register a listener for a particular event with the following syntax:
layer.events.register(type, obj, listener);
Listeners will be called with a reference to an event object. The properties of this event depends on exactly what happened.
{Array(OpenLayers.Feature.Vector)}
Create a new vector layer
| name | {String} A name for the layer |
| options | {Object} Optional object with non-default properties to set on the layer. |
{OpenLayers.Layer.Vector} A new vector layer
addFeatures: function( features, options )
Add Features to the layer.
| features | {Array(OpenLayers.Feature.Vector)} |
| options | {Object} |
destroyFeatures: function( features )
Erase and destroy features on the layer.
| features | {Array(OpenLayers.Feature.Vector)} An optional array of features to destroy. If not supplied, all features on the layer will be destroyed. |
drawFeature: function( feature, style )
Draw (or redraw) a feature on the layer. If the optional style argument is included, this style will be used. If no style is included, the feature’s style will be used. If the feature doesn’t have a style, the layer’s style will be used.
| feature | {OpenLayers.Feature.Vector} |
| style | {Object} Symbolizer hash or {String} renderIntent |
getFeatureById: function( featureId )
Given a feature id, return the feature if it exists in the features array
| featureId | {String} |
{OpenLayers.Feature.Vector} A feature corresponding to the given featureId
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.
| feature | {OpenLayers.Feature.Vector} |
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.
| feature | {OpenLayers.Feature.Vector} |
Destroy this layer
destroy: function()
Add Features to the layer.
addFeatures: function( features, options )
removeFeatures: function( features )
Erase and destroy features on the layer.
destroyFeatures: function( features )
Draw (or redraw) a feature on the layer.
drawFeature: function( feature, style )
Given a feature id, return the feature if it exists in the features array
getFeatureById: function( featureId )
method called after a feature is inserted.
onFeatureInsert: function( feature )
method called before a feature is inserted.
preFeatureInsert: function( feature )
Calculates the max extent which includes all of the features.
getDataExtent: function ()