1

Is it possible to group several PointSymbolizers and rotate them all as a group?

Imagine that I have a rule such that for each point I have three small circles, the first offset along the y-axis so that it renders slightly below the point location, and the other two slightly below and to the left and right respectively. That is, the three circles appear as a horizontal line of circles below the location.

Depending on a 'heading' value, I want to rotate them as a group. Eg, given a heading of 90 degrees, I want the first circle to appear offset to the left (along x-axis this time), and the other two also to the left and up/down respectively. That is, the three circles now appear as a vertical line of circles to the left of the location.

I know I can rotate each symbolizer around itself, but I'm trying to rotate the whole group. If this is not possible, I'd have to use trigonometry to calculate the x/y offsets for each of them, plus rotate them around themselves.

Any ideas?

Below is a rule that will put a white dot at the location, and three dots below it. I would like to group these four dots and rotate them around the location (ie the white dot). Is that possible via markup?

I've managed to do it by calculating the offset values using functions ('cos', 'sin'), but it gets quite verbose and if there's a way to group markers and specify a single rotation angle, that would be neater.

    <Rule>
      <PointSymbolizer>
        <Graphic>
          <Mark>
            <WellKnownName>circle</WellKnownName>
            <Fill>
              <CssParameter name="fill">#ffffff</CssParameter>
            </Fill>
          </Mark>
          <Size>4</Size>
        </Graphic>
      </PointSymbolizer>
      <PointSymbolizer>
        <Geometry>
          <ogc:Function name="offset">
            <ogc:PropertyName>geo_pnt</ogc:PropertyName>
            <ogc:Literal>-0.000025</ogc:Literal>
            <ogc:Literal>-0.000025</ogc:Literal>
          </ogc:Function>
        </Geometry>
        <Graphic>
          <Mark>
            <WellKnownName>circle</WellKnownName>
            <Fill>
              <CssParameter name="fill">#ff0000</CssParameter>
            </Fill>
          </Mark>
          <Size>10</Size>
        </Graphic>
      </PointSymbolizer>
      <PointSymbolizer>
        <Geometry>
          <ogc:Function name="offset">
            <ogc:PropertyName>geo_pnt</ogc:PropertyName>
            <ogc:Literal>0</ogc:Literal>
            <ogc:Literal>-0.000025</ogc:Literal>
          </ogc:Function>
        </Geometry>
        <Graphic>
          <Mark>
            <WellKnownName>circle</WellKnownName>
            <Fill>
              <CssParameter name="fill">#00ff00</CssParameter>
            </Fill>
          </Mark>
          <Size>10</Size>
        </Graphic>
      </PointSymbolizer>
      <PointSymbolizer>
        <Geometry>
          <ogc:Function name="offset">
            <ogc:PropertyName>geo_pnt</ogc:PropertyName>
            <ogc:Literal>0.000025</ogc:Literal>
            <ogc:Literal>-0.000025</ogc:Literal>
          </ogc:Function>
        </Geometry>
        <Graphic>
          <Mark>
            <WellKnownName>circle</WellKnownName>
            <Fill>
              <CssParameter name="fill">#0000ff</CssParameter>
            </Fill>
          </Mark>
          <Size>10</Size>
        </Graphic>
      </PointSymbolizer>
    </Rule>
2
  • please add your SLD fragment
    – Ian Turton
    Commented Sep 29, 2016 at 8:14
  • SLD fragment added.
    – some one
    Commented Sep 30, 2016 at 1:45

1 Answer 1

1

I believe this is not possible, GeoServer does not have vendor options to rotate a group.

Even using SLD 1.1 and the new Displacement element in Graphic that would not help, as by specification "If Displacement is used in conjunction with Size and/or Rotation then the graphic symbol shall be scaled and/or rotated before it is displaced."

So your current solution is likely the only viable approach.

1
  • Thanks Andrea. I did some more reading and still couldn't find if/how to do it, so I've marked your answer as the accepted answer.
    – some one
    Commented Oct 4, 2016 at 0:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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