I would like to add halos on my labels on an Openlayers map.

I have tried adding the following to my code but no halos display.

labelHaloColor: "#FFFFFF",
labelHaloWidth: "2",

I got that from here:


Do I need to use a newer version of OpenLayers to get this working? I am currently using the dev version.


The ticket's status is in "Needs Discussion", they are still working on this and the only way you can use this feature would be to install the patch. However, reading the last post you can see there are still bugs in it and they are "working on it". (in quotes because it's a minor priority and you could be waiting for a while.)

Alternatively, depending on the length of the content you put in there, you might be able to use a background graphic like such:

enter image description here

strokeColor: "#00FF00",
strokeOpacity: 0.7,
strokeWidth: 3,
fillColor: "#FF5500",
fillOpacity: 0.7,
pointRadius: 12,
pointerEvents: "visiblePainted",
//Supported values include “circle”, “square”, “star”, “x”, “cross”, and “triangle”.
graphicName: "circle",
label: "${order}",
fontColor: "#000000",
fontSize: "16px",
fontFamily: "Courier New, monospace",
fontWeight: "bold",
//Valid values for horizontal alignment: “l”=left, “c”=center, “r”=right.  
//Valid values for vertical alignment: “t”=top, “m”=middle, “b”=bottom.  
//Example values: “lt”, “cm”, “rb”
labelAlign: "cm",
labelXOffset: "0",
labelYOffset: "0"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.