Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's "an array of ol.style.Style" good for?

Tags:

openlayers-3

A style of an ol.layer.Vector can be set as ol.style.Style, a style function or an array of ol.style.Style. What's the array for and what does it do -- compared to just passing an ol.style.Style object?

I cannot find any information on this, neither in the official API docs nor in the tutorials.

like image 481
nachtigall Avatar asked Sep 06 '25 03:09

nachtigall


1 Answers

If you look at the draw features example, when drawing lines, they are displayed in blue with a white border/outline.

These is achieved by styling the line twice, first with a large white line, then a thin blue line above.

There are 2 styles for the same geometry. It can’t be done with a single ol.style.Style, so to achieve this you need to pass an array of 2 styles: see the source for this.

like image 55
tonio Avatar answered Sep 07 '25 21:09

tonio