1

I try create SLD style in QGIS and export to GeoServer. And I have trouble with VendorOption name="placement">lastPoint<

Yes, I readed GeoServer import SLD style from QGIS issue on 'se:Stroke' this question and come at the end of the Symbolizer VendorOption but it isn't work.

sld look like:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1.0" xmlns:se="http://www.opengis.net/se" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd">
  <NamedLayer>
    <se:Name>bridges</se:Name>
    <UserStyle>
      <se:Name>bridges</se:Name>
      <se:FeatureTypeStyle>
        <se:Rule>
          <se:Name>Single symbol</se:Name>
          <se:LineSymbolizer>
            <se:Stroke>
              <se:SvgParameter name="stroke">#000000</se:SvgParameter>
              <se:SvgParameter name="stroke-width">4</se:SvgParameter>
              <se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter>
              <se:SvgParameter name="stroke-linecap">square</se:SvgParameter>
            </se:Stroke>
          </se:LineSymbolizer>
          <se:LineSymbolizer>
            <se:Stroke>
              <se:GraphicStroke>
                <se:Graphic>
                  <se:Mark>
                    <se:WellKnownName>arrowhead</se:WellKnownName>
                    <se:Fill>
                      <se:SvgParameter name="fill">#ff0000</se:SvgParameter>
                    </se:Fill>
                    <se:Stroke>
                      <se:SvgParameter name="stroke">#232323</se:SvgParameter>
                      <se:SvgParameter name="stroke-width">2</se:SvgParameter>
                    </se:Stroke>
                  </se:Mark>
                  <se:Size>11</se:Size>
                  <se:Rotation>
                    <ogc:Literal>180</ogc:Literal>
                  </se:Rotation>
                </se:Graphic>
              </se:GraphicStroke>
            </se:Stroke>
            <se:VendorOption name="placement">lastPoint</se:VendorOption>
          </se:LineSymbolizer>
          <se:LineSymbolizer>
            <se:Stroke>
              <se:GraphicStroke>
                <se:Graphic>
                  <se:Mark>
                    <se:WellKnownName>arrowhead</se:WellKnownName>
                    <se:Fill>
                      <se:SvgParameter name="fill">#ff0000</se:SvgParameter>
                    </se:Fill>
                    <se:Stroke>
                      <se:SvgParameter name="stroke">#232323</se:SvgParameter>
                      <se:SvgParameter name="stroke-width">2</se:SvgParameter>
                    </se:Stroke>
                  </se:Mark>
                  <se:Size>11</se:Size>
                </se:Graphic>
              </se:GraphicStroke>
            </se:Stroke>
            <se:VendorOption name="placement">firstPoint</se:VendorOption>
          </se:LineSymbolizer>
          <se:LineSymbolizer>
            <se:Stroke>
              <se:SvgParameter name="stroke">#ffffff</se:SvgParameter>
              <se:SvgParameter name="stroke-width">2</se:SvgParameter>
              <se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter>
              <se:SvgParameter name="stroke-linecap">square</se:SvgParameter>
            </se:Stroke>
          </se:LineSymbolizer>
        </se:Rule>
      </se:FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

Desired result on pic

enter image description here

but I have this

enter image description here

1
  • 1
    Just to clarify - is the issue that the entire dataset doesn't display? Or is the actual issue that you want the symbology to be exactly the same?
    – nr_aus
    Commented Mar 2, 2021 at 13:12

2 Answers 2

1

The whole point of VendorOption is to warn you that it is something a vendor has added to the standard and that it probably won't work if you move to a different vendor (i.e. from QGis to GeoServer).

If you want to add a symbol to the beginning and end of the line in GeoServer then you need to use a function to transform your line into a point (Start_Point and End_Point) along with the related functions to give you the correct angle as described in this answer.

0

ok thanks i do it

<?xml version="1.0" encoding="ISO-8859-1"?> <StyledLayerDescriptor version="1.0.0" 
    xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" 
    xmlns="http://www.opengis.net/sld" 
    xmlns:ogc="http://www.opengis.net/ogc" 
    xmlns:xlink="http://www.w3.org/1999/xlink" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NamedLayer>
    <Name>bridge</Name>
    <UserStyle>
        <Title>bridge</Title>
        <FeatureTypeStyle>
            <Rule>
                <Name>bridge</Name>
                <LineSymbolizer>
                    <Stroke>
                        <CssParameter name="stroke">#000000</CssParameter>
                        <CssParameter name="stroke-width">2</CssParameter>
                    </Stroke>
                </LineSymbolizer>
                <PointSymbolizer>
                    <Geometry>
                        <ogc:Function name="endPoint">
                            <ogc:PropertyName>geom</ogc:PropertyName>
                        </ogc:Function>
                    </Geometry>
                    <Graphic>
                          <Mark>
                            <WellKnownName>arrowhead</WellKnownName>
                            <Fill>
                            </Fill>
                            <Stroke>
                              <CssParameter name="stroke">#000000</CssParameter>
                              <CssParameter name="stroke-width">2</CssParameter>
                            </Stroke>
                          </Mark>
                          <Size>20</Size>
                        <Rotation>
         <ogc:Add> 
          <ogc:Function name="startAngle"> 
            <ogc:PropertyName>geom</ogc:PropertyName> 
          </ogc:Function> 
          <ogc:Literal>180.0</ogc:Literal> 
        </ogc:Add> 
                            </Rotation>
                    </Graphic>
                </PointSymbolizer>
                <PointSymbolizer>
                    <Geometry>
                        <ogc:Function name="startPoint">
                            <ogc:PropertyName>geom</ogc:PropertyName>
                        </ogc:Function>
                    </Geometry>
                    <Graphic>
                          <Mark>
                            <WellKnownName>arrowhead</WellKnownName>
                            <Fill>
                            </Fill>
                            <Stroke>
                              <CssParameter name="stroke">#000000</CssParameter>
                              <CssParameter name="stroke-width">2</CssParameter>
                            </Stroke>
                          </Mark>
                          <Size>20</Size>
                        <Rotation>
                                                           <ogc:Function name="endAngle">
                                <ogc:PropertyName>geom</ogc:PropertyName>
                            </ogc:Function>
                        </Rotation>
                    </Graphic>
                </PointSymbolizer>
      <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#000000</CssParameter>
          <CssParameter name="stroke-width">4</CssParameter>
          <CssParameter name="stroke-linejoin">bevel</CssParameter>
          <CssParameter name="stroke-linecap">square</CssParameter>
        </Stroke>
      </LineSymbolizer>
          </Rule>
        </FeatureTypeStyle>
    </UserStyle>
</NamedLayer>

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.