Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to make a halo around the line of one pixel? For example, line (vector) hase blue color and its frame (one pixel) the black color. Thanks!

share|improve this question
up vote 5 down vote accepted

Use strokeWidth : 1 and strokeColor: '#000000' on the vector's style

Actually, after testing what I said, turns out it's not that simple.

Looks like lines don't use the fill property at all and instead only use stroke.

So the only way I was able to do it was by cloning the feature and modifying the style. So you have 2 features.

Here's the DEMO Demo LINK UPDATE

enter image description here

share|improve this answer
In demo i see 2 lines: black and white, without halo. I have an idea: draw two times the same line, only the second line will be slightly thicker than the first and will have a different color. – dedoki Jul 20 '12 at 21:15
For fixing proposed example use the same geometry definition for both lines. – drnextgis Jul 21 '12 at 16:47
Sorry, I put in the wrong DEMO link. Just updated it which should reflect what both of you (dedoki and drnextgis) are saying. – CaptDragon Jul 23 '12 at 12:44
In terms of web map cartography, this has generally been the route used by the most popular engines. I remember using this technique when styling maps in Tilemill which uses Carto. – Michael Markieta Jul 23 '12 at 15:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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