Search code examples
javascriptopenlayers

Openlayers text label


i was wondering if there is any way to add a text label to a open layers map.

I want to insert the name of i.e a ship next to the ships marker, and i need to be able to turn each individual text label on/off programatically.

I do see that there is a popup option, but this is far from what i want.


Solution

  • you could take a look here: http://dev.openlayers.org/releases/OpenLayers-2.13.1/examples/vector-features-with-text.html

    You basically use the StyleMap to style your text and then use an attributes object to determine your label text, etc. for each point.