0

I have trouble categorize my markers by category (boolean in this case) in geoserver using CSS. I have tried a few different combinations without success.

Simply I want: if true - yellow square, if false - blue

Suggestions?

What I have tried:

* {
  mark: symbol('square'), symbol('square');
}

    [exist=true] :nth-mark(1) {
      size: 12px;
      fill: yellow;
      stroke: yellow;
    }

    [exist= false] :nth-mark(2) {
      size: 12px;
      fill: blue;
      stroke: blue;
    }

enter image description here

[exist=true] {
  mark: symbol('square');
  size: 12px;
  fill: yellow;
  stroke: yellow;
}

[exist= false] {
  mark: symbol('square');
  size: 12px;
  fill: blue;
  stroke: blue;
}

enter image description here

If I may ask in the same question. This is from doc.geoserver, what is usage, column name?

[usage='hospital'] { mark: symbol('circle'), symbol('cross'); }

1

Your CSS looks much too complex (you are drawing squares on top of squares) and not entirely correct either, try something like:

* {
  mark: symbol(square);
  mark-size: 12px;
}

:mark [NAME = 'art' ]{
  fill: yellow;
  stroke: yellow;
}
:mark [NAME = 'stock' ]{
  fill: blue;
  stroke: blue;
}

Further examples can be found in the css cookbook.

  • Thank you! Was pulling my hair out for this. Was reading up from the cookbook but I must have interpret it wrong. Thanks again! – geogrow Jul 6 '16 at 11:36

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.