Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenLayers 3 Stroke style

I want to modify style of the method select . I'm able to change the style of this method but i'm not able to duplicate the white border of blue stroke.

Someone is able to style vector with a stroke and put a border to the stroke?

See this example, for understand what i'm talking about: http://openlayers.org/en/v3.4.0/examples/select-features.html

like image 367
FatAl Avatar asked Apr 30 '15 05:04

FatAl


1 Answers

The trick is that you have two styles. With the first style you are drawing a white line, with the second style a thinner blue line on top:

var width = 3;
var styles = [
  new ol.style.Style({
    stroke: new ol.style.Stroke({
      color: 'white',
      width: width + 2
    })
  }),
  new ol.style.Style({
    stroke: new ol.style.Stroke({
      color: 'blue',
      width: width
    })
  })
];
like image 97
tsauerwein Avatar answered Sep 17 '22 17:09

tsauerwein