4

I can't find what is wrong. I try write an style on GeoServer.

This is not ok.:

    <FeatureTypeStyle>
                <FeatureTypeName>Odcinki</FeatureTypeName>
          <Rule>  
      <Name>Magistrala A</Name>
        <Title>&lt; 1700</Title>
  <MinScaleDenominator>1700</MinScaleDenominator>
  <MaxScaleDenominator>6771</MaxScaleDenominator>
     <ogc:Filter>**line.24**
        <ogc:PropertyIsEqualTo>
         <ogc:PropertyName>mpec_magis</ogc:PropertyName>
         <ogc:Literal>1</ogc:Literal>
        </ogc:PropertyIsEqualTo>
    </ogc:Filter>
        <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#009933</CssParameter>                   
          <CssParameter name="stroke-width">4</CssParameter>
        </Stroke>
        </LineSymbolizer>
  </Rule>
  <Rule>  <!-- thick line drawn first-->
    <MaxScaleDenominator>6771</MaxScaleDenominator>
            <ogc:Filter>**line.40**
        <ogc:PropertyIsEqualTo>
         <ogc:PropertyName>mpec_magis</ogc:PropertyName>
         <ogc:Literal>1</ogc:Literal>
        </ogc:PropertyIsEqualTo>
    </ogc:Filter>        
    <LineSymbolizer>
      <Stroke>
          <CssParameter name="stroke">#009933</CssParameter>                   
          <CssParameter name="stroke-width">2</CssParameter>
      </Stroke>
    </LineSymbolizer>
        </Rule>

I have got errors:

line 24: cvc-complex-type.2.4.a: Invalid content was found starting with element 'ogc:Filter'. One of '{"http://www.opengis.net/sld":Symbolizer}' is expected.

line 40: cvc-complex-type.2.4.a: Invalid content was found starting with element 'ogc:Filter'. One of '{"http://www.opengis.net/sld":Symbolizer}' is expected.

I don't understand what is wrong, beyond it is LineSymbolizer.

My previous wersion without ScaleDenominator is ok.:

    <FeatureTypeStyle>
 <Rule>
   <Name>Magistrala A</Name>
   <ogc:Filter>
     <ogc:PropertyIsEqualTo>
       <ogc:PropertyName>mpec_magis</ogc:PropertyName>
       <ogc:Literal>1</ogc:Literal>
     </ogc:PropertyIsEqualTo>
   </ogc:Filter>
   <LineSymbolizer>
     <Stroke>
       <CssParameter name="stroke">#009933</CssParameter>
       <CssParameter name="stroke-width">2</CssParameter>
     </Stroke>
   </LineSymbolizer>
 </Rule>

For any suggestions many thanks. I greet

1
  • Thanks your answer saved me some time. Thank you very much.
    – Bear
    Commented Nov 29, 2013 at 11:58

1 Answer 1

7

XML is ordered (at least in the SLD schema) so you must use the elements in the right order, what you should have written is:

 <ogc:Filter>**line.24**
    <ogc:PropertyIsEqualTo>
     <ogc:PropertyName>mpec_magis</ogc:PropertyName>
     <ogc:Literal>1</ogc:Literal>
    </ogc:PropertyIsEqualTo>
</ogc:Filter>
<MinScaleDenominator>1700</MinScaleDenominator>
<MaxScaleDenominator>6771</MaxScaleDenominator>
<LineSymbolizer>
1
  • I have always wondered about the order but have just used Geoserver Docs which did not make it clear, at least to me. So, it is linear down the schema. This will be my reference from now on when writing SLD. Can see where I have one issue already and just seen some interesting things in the raster section! Thanks! Commented Nov 29, 2013 at 10:14

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.