0

I'm wortking with GeoServer Version 2.20.4 and I have uploaded an SLD file generated with QGIS 3.22.9-Białowieża. When validating the code, however, I get the following error

java.lang.RuntimeException: Parsing failed for Filter: java.lang.RuntimeException: Unable 
to find function PropertyName

This is my SLD code

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" version="1.1.0" 
xsi:schemaLocation="http://www.opengis.net/sld 
http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" 
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema- 
instance" xmlns:se="http://www.opengis.net/se" xmlns:ogc="http://www.opengis.net/ogc">
<NamedLayer>
<se:Name>atlas_nuevo</se:Name>
<UserStyle>
  <se:Name>atlas_nuevo</se:Name>
  <se:FeatureTypeStyle>
    <se:Rule>
      <se:Name>atlas_sacre_sacin_noctua</se:Name>
      <se:Description>
        <se:Title>atlas_sacre_sacin_noctua</se:Title>
      </se:Description>
      <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
        <ogc:PropertyName>atlas_sacre_sacin_noctua</ogc:PropertyName>
      </ogc:Filter>
      <se:PolygonSymbolizer>
        <se:Fill>
          <se:SvgParameter name="fill">#b506a9</se:SvgParameter>
        </se:Fill>
        <se:Stroke>
          <se:SvgParameter name="stroke">#232323</se:SvgParameter>
          <se:SvgParameter name="stroke-width">0.5</se:SvgParameter>
          <se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter>
        </se:Stroke>
      </se:PolygonSymbolizer>
    </se:Rule>
    <se:Rule>
      <se:Name>atlas_sacre_sacin</se:Name>
      <se:Description>
        <se:Title>atlas_sacre_sacin</se:Title>
      </se:Description>
      <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
        <ogc:And>
          <ogc:PropertyName>atlas_sacre_sacin</ogc:PropertyName>
          <ogc:PropertyIsEqualTo>
            <ogc:PropertyName>atlas_sacre_sacin_noctua</ogc:PropertyName>
            <ogc:Literal>0</ogc:Literal>
          </ogc:PropertyIsEqualTo>
        </ogc:And>
      </ogc:Filter>
      <se:PolygonSymbolizer>
        <se:Fill>
          <se:SvgParameter name="fill">#3241c8</se:SvgParameter>
        </se:Fill>
        <se:Stroke>
          <se:SvgParameter name="stroke">#232323</se:SvgParameter>
          <se:SvgParameter name="stroke-width">0.5</se:SvgParameter>
          <se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter>
        </se:Stroke>
      </se:PolygonSymbolizer>
    </se:Rule>
    <se:Rule>
      <se:Name>atlas_sacre</se:Name>
      <se:Description>
        <se:Title>atlas_sacre</se:Title>
      </se:Description>
      <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
        <ogc:And>
          <ogc:And>
            <ogc:PropertyName>atlas_sacre</ogc:PropertyName>
            <ogc:Or>
              <ogc:PropertyIsEqualTo>
                <ogc:PropertyName>atlas_sacre_sacin</ogc:PropertyName>
                <ogc:Literal>0</ogc:Literal>
              </ogc:PropertyIsEqualTo>
              <ogc:PropertyIsNull>
                <ogc:PropertyName>atlas_sacre_sacin</ogc:PropertyName>
              </ogc:PropertyIsNull>
            </ogc:Or>
          </ogc:And>
          <ogc:Or>
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>atlas_sacre_sacin_noctua</ogc:PropertyName>
              <ogc:Literal>0</ogc:Literal>
            </ogc:PropertyIsEqualTo>
            <ogc:PropertyIsNull>
              <ogc:PropertyName>atlas_sacre_sacin_noctua</ogc:PropertyName>
            </ogc:PropertyIsNull>
          </ogc:Or>
        </ogc:And>
      </ogc:Filter>
      <se:PolygonSymbolizer>
        <se:Fill>
          <se:SvgParameter name="fill">#9bd7ff</se:SvgParameter>
        </se:Fill>
        <se:Stroke>
          <se:SvgParameter name="stroke">#232323</se:SvgParameter>
          <se:SvgParameter name="stroke-width">0.5</se:SvgParameter>
          <se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter>
        </se:Stroke>
      </se:PolygonSymbolizer>
    </se:Rule>
    <se:Rule>
      <se:Name>alternativas</se:Name>
      <se:Description>
        <se:Title>alternativas</se:Title>
      </se:Description>
      <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
        <ogc:PropertyIsEqualTo>
          <ogc:PropertyName>atlas_sacre</ogc:PropertyName>
          <ogc:Literal>0</ogc:Literal>
        </ogc:PropertyIsEqualTo>
      </ogc:Filter>
      <se:PolygonSymbolizer>
        <se:Fill>
          <se:SvgParameter name="fill">#cbffc1</se:SvgParameter>
        </se:Fill>
        <se:Stroke>
          <se:SvgParameter name="stroke">#232323</se:SvgParameter>
          <se:SvgParameter name="stroke-width">0.5</se:SvgParameter>
          <se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter>
        </se:Stroke>
      </se:PolygonSymbolizer>
    </se:Rule>
    <se:Rule>
      <se:Name>selección_sacre</se:Name>
      <se:Description>
        <se:Title>selección_sacre</se:Title>
      </se:Description>
      <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
        <ogc:PropertyName>selecc_sacre</ogc:PropertyName>
      </ogc:Filter>
      <se:PolygonSymbolizer>
        <se:Fill>
          <se:GraphicFill>
            <se:Graphic>
              <se:Mark>
                <se:WellKnownName>horline</se:WellKnownName>
                <se:Stroke>
                  <se:SvgParameter name="stroke">#ff8d01</se:SvgParameter>
                  <se:SvgParameter name="stroke-width">1</se:SvgParameter>
                </se:Stroke>
              </se:Mark>
              <se:Size>13</se:Size>
              <se:Rotation>
                <ogc:Literal>45</ogc:Literal>
              </se:Rotation>
            </se:Graphic>
          </se:GraphicFill>
        </se:Fill>
      </se:PolygonSymbolizer>
    </se:Rule>
    <se:Rule>
      <se:Name>sacre_profesional</se:Name>
      <se:Description>
        <se:Title>sacre_profesional</se:Title>
      </se:Description>
      <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
        <ogc:PropertyIsEqualTo>
          <ogc:PropertyName>Profesionales sacre</ogc:PropertyName>
          <ogc:Literal>X</ogc:Literal>
        </ogc:PropertyIsEqualTo>
      </ogc:Filter>
      <se:PointSymbolizer>
        <se:Graphic>
          <se:Mark>
            <se:WellKnownName>circle</se:WellKnownName>
            <se:Fill>
              <se:SvgParameter name="fill">#ff0000</se:SvgParameter>
              <se:SvgParameter name="fill-opacity">0</se:SvgParameter>
            </se:Fill>
            <se:Stroke>
              <se:SvgParameter name="stroke">#ff0101</se:SvgParameter>
              <se:SvgParameter name="stroke-width">1</se:SvgParameter>
            </se:Stroke>
          </se:Mark>
          <se:Size>29</se:Size>
        </se:Graphic>
      </se:PointSymbolizer>
    </se:Rule>
    <se:Rule>
      <se:TextSymbolizer>
        <se:Label>
          <ogc:PropertyName>utm_nueva</ogc:PropertyName>
        </se:Label>
        <se:Font>
          <se:SvgParameter name="font-family">MS Shell Dlg 2</se:SvgParameter>
          <se:SvgParameter name="font-size">13</se:SvgParameter>
          <se:SvgParameter name="font-weight">bold</se:SvgParameter>
        </se:Font>
        <se:LabelPlacement>
          <se:PointPlacement>
            <se:AnchorPoint>
              <se:AnchorPointX>0</se:AnchorPointX>
              <se:AnchorPointY>0.5</se:AnchorPointY>
            </se:AnchorPoint>
          </se:PointPlacement>
        </se:LabelPlacement>
        <se:Halo>
          <se:Radius>1</se:Radius>
          <se:Fill>
            <se:SvgParameter name="fill">#fafafa</se:SvgParameter>
          </se:Fill>
        </se:Halo>
        <se:Fill>
          <se:SvgParameter name="fill">#323232</se:SvgParameter>
        </se:Fill>
        <se:VendorOption name="maxDisplacement">1</se:VendorOption>
      </se:TextSymbolizer>
    </se:Rule>
  </se:FeatureTypeStyle>
</UserStyle>

Following the suggestions given in this thread SLD parsing fail on GeoServer, I have included (not understanding what I was doing, I confess), I included a PropertyIsEqualTo tag whithin the first filter, which returns

java.lang.RuntimeException: Parsing failed for PropertyIsEqualTo: 
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1

How should it be fixed?

2 Answers 2

1
  <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
    <ogc:PropertyName>atlas_sacre_sacin_noctua</ogc:PropertyName>
  </ogc:Filter>

is not a valid filter so the error is correct.

2
  • OK. Any suggestions to fix it?
    – jpinilla
    Mar 14, 2023 at 10:26
  • 3
    The QGIS style exporter must be fixed. You might want to open a bug report at the QGIS project. As a possible alternative, try out the GeoCat Bridge plugin, it also exports styles, but with a different generator, you might be more successful (or not, up to you to find out). Mar 14, 2023 at 11:40
1

If you just want to hand-fix it, there is a good chance this may work:

 <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
    <ogc:PropertyName>atlas_sacre_sacin_noctua</ogc:PropertyName>
    <ogc:Literal>True</ogc:Literal>
  </ogc:Filter>

My guess here is that atlas_sacre_sacin_noctua is a boolean property, and QGIS cannot tell the difference between a boolean expression and a filter (they are two different things in SLD).

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.