1

I've found several examples for how to draw a simple arrow (on one line end). Also, I've found few that explain how it should work to put one on the other end of a line. Unfortunately I don't have any success with that.

The code looks as follows:

        <Rule>
          <Title>line with arrow on both endings</Title>
          <LineSymbolizer>
            <Stroke>
              <CssParameter name="stroke">#E60000</CssParameter>
              <CssParameter name="stroke-width">1</CssParameter>
            </Stroke>
          </LineSymbolizer>
          <PointSymbolizer>
            <Geometry>
              <ogc:Function name="startPoint">
                <ogc:PropertyName>the_geom</ogc:PropertyName>
              </ogc:Function>
            </Geometry>
            <Graphic>
              <Mark>
                <WellKnownName>shape://oarrow</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#E60000</CssParameter>
                  <CssParameter name="fill-opacity">1.0</CssParameter>
                </Fill>
              </Mark>
              <Size>30</Size>
              <Rotation>
                <ogc:Add>
                  <ogc:Function name="startAngle">
                    <ogc:PropertyName>the_geom</ogc:PropertyName>
                  </ogc:Function>
                  <ogc:Literal>180.0</ogc:Literal> 
                </ogc:Add>
              </Rotation>
            </Graphic>
          </PointSymbolizer>
          <PointSymbolizer>
            <Geometry>
              <ogc:Function name="endPoint">
                <ogc:PropertyName>the_geom</ogc:PropertyName>
              </ogc:Function>
            </Geometry>
            <Graphic>
              <Mark>
                <WellKnownName>shape://oarrow</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#00E600</CssParameter>
                  <CssParameter name="fill-opacity">1.0</CssParameter>
                </Fill>
              </Mark>
              <Size>30</Size>
              <Rotation>
                <ogc:Add>
                  <ogc:Function name="endAngle">
                    <ogc:PropertyName>GWAI_GEOM</ogc:PropertyName>
                  </ogc:Function>
                  <ogc:Literal>0.0</ogc:Literal> 
                </ogc:Add>
              </Rotation>
            </Graphic>
          </PointSymbolizer>
        </Rule>

What I get is this:

Two lines with start and end arrow both on the same end and end arrow not turned at all

Two lines with start- and end-arrow both on the same line end and end-arrow not turned at all. What is the error I have in my code?

GeoServer Version: 2.13.2

/EDIT: When removing the "Rotation" bit from endPoint Graphic, the result looks the same.

0

2 Answers 2

0

I've just tested your SLD in GeoServer 2.15.1 and it seems to work fine on the sf:streams layer.

The only thing I can think of that might cause your issue is duplicate lines running in opposite directions, could that be the issue?

enter image description here

4
  • After upgrading to 2.15.1 the issue persists. I don't know how to use/access sf:streams though (or how to test with it). It's not a matter of duplicate lines. With lines more at a vertical angle, it becomes more obvious that the green arrow points straight to the right (instead of in the angle of the line end as the red arrow correctly does). Commented Aug 16, 2019 at 7:58
  • when you install GeoServer there are a number of default data sets sf:streams is one of them.
    – Ian Turton
    Commented Aug 16, 2019 at 8:07
  • Found the streams example (somebody had removed it previously) and could try with it: and indeed there it works. Still not with my other layer. Commented Aug 16, 2019 at 8:08
  • then your data set is somehow the issue, not the SLD
    – Ian Turton
    Commented Aug 16, 2019 at 8:08
0

Ian Turton's answer (especially his last comment) opened the path to the right direction. When testing with the sf:streams layer I realized at some point that the layers' type icons of my and the streams layer look different. My layer showed what turned out to be a MULTIPOLIGON whereas the stream layer showed a MULTILINESTRING. So after changing my data source's type to MULTILINESTRING the whole thing worked fine with my layer as well.

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.