Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.