4

I'm experimenting with Geoserver. I'm styling a linestring layer with CSS in this way, which works fine:

[userid = 1]  {

stroke: #8C2300;
stroke-width: 3px;
stroke-linecap: round;
z-index: 0, 1;

}

In my data store I have an attribute 'color' with hexadecimal values. Can I use this value for stroke color, in this way:

[userid = 1]  {

stroke: [color];
stroke-width: 3px;
stroke-linecap: round;
z-index: 0, 1;

}
  • Why the z-index: 0,1 if you have no second set of symbolizers in the properties? – Andrea Aime Feb 13 '17 at 16:50
  • What error do you get with the second one? – Ian Turton Feb 13 '17 at 19:33
2

You can, I would suggest removing the brackets from the [color] with the code as below;

[userid = 1]  {

stroke: color;  
stroke-width: 3px;  
stroke-linecap: round;  
z-index: 0, 1;  

}

This tutorial provides a similar code block

  • Hi wyzar, thanks for your reply. When I do this, linestrings are styled in a default black color... I'm using sql server as datasource, and there is a string column 'color' with hexadecimal values (e.g. #661A00). – Sven Nijs Feb 13 '17 at 16:41
  • HI, have you got any solution this. – Ramesh T R Jul 3 '18 at 7:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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