Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 988
Christer Avatar asked Jan 01 '26 20:01

Christer


1 Answers

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.

like image 119
swatkins Avatar answered Jan 03 '26 11:01

swatkins



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!