1

I would like to symbolize a line with a point graphic at each end AND offset the graphics slightly along the line in order to look something like the following:

enter image description here

The offset is intended to allow the viewer to be able to recognize that all four lines (in this example) have an end (or start) point at this intersection. If the circle isn't offset, then it will just look like one single circle.

Below is the pointSymbolizer portions of my SLD. Is there a way to offset the point graphic a few pixels along the line? The only thing I can think of is to create a graphic PNG myself with a few transparent pixels on the left and then use end/startAngle to rotate it appropriately. However, I really hope there is a more efficient solution using some SLD magic.

<PointSymbolizer>
    <Geometry>
        <ogc:Function name="startPoint">
            <ogc:PropertyName>Shape</ogc:PropertyName>
        </ogc:Function>
    </Geometry>
    <Graphic>
        <Mark>
            <WellKnownName>circle</WellKnownName>
            <Fill>
                <CssParameter name="fill">#E60000</CssParameter>
            </Fill>
          <Stroke>
              <CssParameter name="stroke">#FFFFFF</CssParameter>
              <CssParameter name="stroke-width">1.5</CssParameter>
          </Stroke>
        </Mark>
        <Opacity>1</Opacity>
        <Size>9</Size>
    </Graphic>
</PointSymbolizer>
<PointSymbolizer>
    <Geometry>
        <ogc:Function name="endPoint">
            <ogc:PropertyName>Shape</ogc:PropertyName>
        </ogc:Function>
    </Geometry>
    <Graphic>
        <Mark>
            <WellKnownName>circle</WellKnownName>
            <Fill>
                <CssParameter name="fill">#E60000</CssParameter>
            </Fill>
          <Stroke>
              <CssParameter name="stroke">#FFFFFF</CssParameter>
              <CssParameter name="stroke-width">1.5</CssParameter>
          </Stroke>
        </Mark>
        <Opacity>1</Opacity>
        <Size>9</Size>
    </Graphic>
</PointSymbolizer>
1
  • @Ian Turton, that solution may work, but it seemed more resource intensive than just creating a png with empty space on the left and then orienting it based on the startAngle/endAngle. For now, I have decided to go that route, and it is working perfectly. Thanks!
    – CarteTon
    Apr 9, 2021 at 14:16

1 Answer 1

2

You can get the angle of the line at the start (end) of the line using the startAngle function and probably create an offset in pixels using some trigonometry. But it would probably be easier to create a custom function to do it (and donate it to the project to help others in the future).

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.