Tag: Open Street Map

Marker layers in OpenLayers.

Posted by – Tuesday 2012-12-11

The most usual way of creating a markers layer in OpenLayers is by adding to the map an instance of the class OpenLayers.Layer.Markers. However, this method is no longer encouraged. As said in the OpenLayers documentation [1]:

Markers support only point geometries. They are styled only using the OpenLayers.Icon class. They do not support lines, polygons, or other complex features. Their interaction method differs significantly from vector layers.

In general, Markers are the ‘older’ way to interact with geographic data in the browser. Most new code should, where possible, use vector layers in place of marker layers.