Wednesday 26 April 2017

Rotation in GeoServer SLD


I am using the style editor in GeoServer to make some symbols for an OpenLayers based Web GIS solution. But I face a challenge when trying to rotate some symbols. I have a Point Layer that needs to be rotated based on the values in a field named "ROTATION".


This is fairly simple and I created the following SLD that do this:



enter image description here


But unfortunately the values in the rotation field is not providing the correct rotation (it might be radians or something)... so I get the following result in my Web GIS (it is the small black lines):


enter image description here


I wish the black lines to be perpendicular to the red and blue lines. I have calculated that I will get the right rotation using the formula: (360 - "ROTATION" + 90) / 360


At least it works when I calculate a new field on the feature class using MSSQL (where the layer is currently stored). Unfortunately I can't do the trick in MSSQL as the data are currently in production. So my question is - how do I get this formula to work on the field ROTATION in the SLD editor.


I am using GeoServer 2.10.


I have so far read that I might need something with "ogc:Literal"Formula"/ogc:Literal", but what should I write exactly.



Answer



Something like this should work, using the math operators - please note it is untested:






450
ROTATION

360


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...