Bordered Polyline
#15750
-
Is it possible to give a polyline a different color for the border of it? |
Beta Was this translation helpful? Give feedback.
Answered by
ahocevar
Apr 16, 2024
Replies: 2 comments 2 replies
-
Yes! Just create two styles: a thicker one for the border, and on top a thinner one for the stroke. |
Beta Was this translation helpful? Give feedback.
1 reply
-
No need to create another feature. Just return an array of styles instead of a single style from your style function, or configure the layer's style with a static array of two styles. Change your code to the following, and you're all set: const layer = new VectorLayer({
source: new VectorSource({
features: [new Feature(lineString)],
}),
style: [borderStyle, style]
}) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
karussell
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No need to create another feature. Just return an array of styles instead of a single style from your style function, or configure the layer's style with a static array of two styles.
Change your code to the following, and you're all set: