Skip to content

SLD: se:Rotation is applied counterclockwise #7662

Open

Description

@maxcollombin

A triangle mark with <se:Rotation>90</se:Rotation> is drawn pointing left. SE 1.1.0 defines Rotation as clockwise, so it should point right..
The SLD reader copies the value into the style ANGLE, which is counterclockwise, while the SLD writer converts it since #7591 (360 - angle).

Activity

  1. geographika commented on Oct 7, 2026

    @geographika
    Member

    @maxcollombin to be clear, you are highlighting an existing bug in the SLD reader, which has likely always been there?
    #7591 should have fixed the same bug in the SLD writer - or is there an issue with the changes in this PR?

  2. maxcollombin commented on Oct 8, 2026

    @maxcollombin
    Author

    Yes, it's the reader, and it's old: 6.4 already does psStyle->angle = atof(...) with no conversion, and main still does (msSLDParseOgcExpression, MS_STYLE_BINDING_ANGLE). SE 1.1.0 §11.3.2 defines Rotation as clockwise, while STYLE ANGLE is counterclockwise.

    #7591 looks right to me, 360 - angle is what the writer needs. Only its comment has the directions swapped.

    Since #7591 the writer converts but the reader doesn't, so an SLD from GetStyles read back into MapServer now turns the other way. The reader probably needs the same 360 - value, including when Rotation is an ogc:PropertyName (currently bound as [attr] as is).

    Labels have the same mismatch on both sides: PointPlacement/Rotation is clockwise in SE (§11.4.2) but LABEL ANGLE is counterclockwise, and neither the reader (MS_LABEL_BINDING_ANGLE) nor the writer converts it. The writer also skips negative angles (angle > 0).

  3. akshat-lakhera commented on Oct 25, 2026

    @akshat-lakhera
    Contributor

    I'd like to take this one, unless you're already working on it @maxcollombin. My plan is to apply the same 360 - value conversion in the SLD reader for se:Rotation on point symbols and labels in mapogcsld.cpp, so it matches the writer since #7591, and to sort out the ogc:PropertyName case, where a plain subtraction on the parsed value doesn't work. I'll update the msautotest expected output along with it.

    cc @geographika @jmckenna

  4. jratike80 commented on Oct 25, 2026

    @jratike80

    I have nothing to add really, just telling that "SE 1.1.0" means "Symbology Encoding Implementation Specification", OGC 05-077r4 https://docs.ogc.org/is/05-077r4/05-077r4.pdf and this is what it says about "rotation":

    The Rotation element gives the rotation of a graphic in the clockwise direction about its
    center point in decimal degrees, encoded as a floating-point number. Negative values
    mean counter-clockwise rotation. The default value is 0.0 (no rotation). Note that there is
    no connection between source geometry types and rotations; the point used for plotting
    has no inherent direction. Also, the point within the graphic about which it is rotated is
    format dependent. If a format does not include an inherent rotation point, then the point
    of rotation should be the centroid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions