0

Using GeoServer CSS extension

 mark-rotation:  [env('rot',2)];

ends in

    <sld:Rotation>
        <ogc:Function name="env">
            <ogc:Literal>rot</ogc:Literal>
            <ogc:Literal>2</ogc:Literal>
         </ogc:Function>
     </sld:Rotation>

How should my style look like to add a property name to rotation:

 <sld:Rotation>
    <ogc:Add>               
    <ogc:PropertyName>mystyle</ogc:PropertyName>
       <ogc:Function name="env">
          <ogc:Literal>rot</ogc:Literal>
          <ogc:Literal>2</ogc:Literal>
       </ogc:Function>
    </ogc:Add>
  </sld:Rotation>

I have tried

 mark-rotation:  [env('rot',2),mystyle];
 mark-rotation:  [mystyle],[env('rot',2)];
  • what are you trying to achieve? Your SLD makes no sense (and will not parse) – Ian Turton Jul 18 '15 at 14:09
  • I have not written the sld but try to translate it into css. (edited the sld as I forgot the closing add.) You say it makes no sense. Wouldn´t the SLD rotate the point by use of PropertyName or variable "rot" or default value 2? – t Book Jul 18 '15 at 15:00
  • How about mark-rotation: [env('rot',2)+mystyle]; – Ian Turton Jul 18 '15 at 15:01
  • Yes ! that did it. If you post it as answer I can accept it. One more question. Do I read the filter correctly: "Wouldn´t the SLD rotate the point by use of PropertyName or variable "rot" or default value 2?" thanks a lot! – t Book Jul 18 '15 at 15:11
1

To produce a rotation of ( the rot variable or 2 ) plus the value of the property mystyle you should use:

mark-rotation: [env('rot',2)+mystyle]; 

To generate SLD that uses rot, followed by mystyle, or 2 you should use something like (and I haven't tested this). If it doesn't work you can check the syntax page:

mystyle is null {
  mark-rotation:  [env('rot',2)]
}
mystyle is not null {  
  mark-rotation: [mystyle];
}

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.