1

I created a SLD file and it does not run at all inside of GeoServer. Schematically it looks all there:

<?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>FireHydrants</Name>
       <UserStyle>
        <FeatureTypeStyle>
        <Rule>
            <Name>500</Name>
          <Description>
            <Title>Fire Hydrants</Title>
          </Description>
            <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
            <ogc:PropertyIsLessThan>
              <ogc:PropertyName>flow_class</ogc:PropertyName>
              <ogc:Literal>500</ogc:Literal>
            </ogc:PropertyIsLessThan>
         </ogc:Filter>
        <PointSymbolizer>
           <Graphic>
             <Mark>
              <WellKnownName>triangle</WellKnownName>
            <sld:Fill>
              <sld:CssParameter name="fill">#00FFFF</sld:CssParameter>
            </sld:Fill>
             </Mark>
           <Size>11</Size>
            </Graphic>
        </PointSymbolizer>
       </Rule>
       <Rule>
        <Name>501-1000</Name>
        <Description>
          <Title>501 to 1000</Title>
        </Description>
           <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
             <ogc:PropertyIsGreaterThanOrEqualTo>
            <ogc:PropertyName>flow_class</ogc:PropertyName>
            <ogc:Literal>501</ogc:Literal>
              </ogc:PropertyIsGreaterThanOrEqualTo>
            <ogc:PropertyIsLessThan>
            <ogc:PropertyName>flow_class</ogc:PropertyName>
            <ogc:Literal>1000</ogc:Literal>
            </ogc:PropertyIsLessThan>
            </ogc:Filter>
        <PointSymbolizer>
            <Graphic>
               <Mark>
                <WellKnownName>triangle</WellKnownName>
                        <sld:Fill>
            <sld:CssParameter name="fill">#ffa000</sld:CssParameter>
                     </sld:Fill>
                   </Mark>
            <Size>11</Size>
            </Graphic>
        </PointSymbolizer>
    </Rule>
    <Rule>
        <Name>1001-1500</Name>
        <Description>
          <Title>1001 to 1500</Title>
        </Description>
          <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
            <ogc:PropertyIsGreaterThanOrEqualTo>
            <ogc:PropertyName>flow_class</ogc:PropertyName>
            <ogc:Literal>1001</ogc:Literal>
             </ogc:PropertyIsGreaterThanOrEqualTo>
             <ogc:PropertyIsLessThan>
            <ogc:PropertyName>flow_class</ogc:PropertyName>
            <ogc:Literal>1500</ogc:Literal>
             </ogc:PropertyIsLessThan>
            </ogc:Filter>
            <sld:MaxScaleDenominator>2134</sld:MaxScaleDenominator>
           <PointSymbolizer>
            <Graphic>
               <Mark>
                  <WellKnownName>triangle</WellKnownName>
                <sld:Fill><CssParameter name="fill">#33CC33</CssParameter>
                </sld:Fill>
                   </Mark>
                <Size>11</Size>
            </Graphic>
            </PointSymbolizer>
          </Rule>
      <Rule>
        <Name>1500</Name> 
        <Description>
            <Title>1500</Title>
        </Description>
          <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
        <ogc:PropertyIsGreaterThan>
            <ogc:PropertyName>flow_class</ogc:PropertyName>
            <ogc:Literal>1500</ogc:Literal>
        </ogc:PropertyIsGreaterThan>
        </ogc:Filter>
        <PointSymbolizer>
           <Graphic>
               <Mark>
            <WellKnownName>triangle</WellKnownName>
         <sld:Fill><sld:CssParameter name="fill">#004785</sld:CssParameter>
            </sld:Fill>
                   </Mark>
                 <Size>11</Size>
            </Graphic>
        </PointSymbolizer>
`
    </Rule>
    <Rule>
       <Name>UNKNOWN</Name>
         <Description>
        <Title>UNKNOWN</Title>
         </Description>
        <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
         <ogc:PropertyIsEqualTo>
         <ogc:PropertyName>UNKNOWN</ogc:PropertyName>
         </ogc:PropertyIsEqualTo>
           </ogc:Filter>
        <PointSymbolizer>
           <Graphic>
             <Mark>
            <WellKnownName>triangle</WellKnownName>
                  <sld:Fill><sld:CssParameter name="fill">#ffa000</sld:CssParameter>
            </sld:Fill>
              </Mark>
               <Size>11</Size>
               </Graphic>
        </PointSymbolizer>
      </Rule>

          </FeatureTypeStyle>
        </UserStyle>
     </NamedLayer>
    </StyledLayerDescriptor>

any thoughts of what I'm doing wrong?

4

There is a bad character before the last ("UNKNOWN") rule:

        </PointSymbolizer>
` <-------------------------------------------------------
    </Rule>
    <Rule>
       <Name>UNKNOWN</Name>
  • Also note that you use 'sld' as a namespace prefix, but you don't point define the associated namespace like xmlns:sld="http://www.opengis.net/sld" – nmtoken Jun 21 at 9:53
  • Okay.code looks a lot better-however i keep getting this validation error--->"line 72: cvc-complex-type.2.4.d: Invalid content was found starting with element 'ogc:PropertyIsLessThan'. No child element is expected at this point". what does this mean? thanks ! – user144979 Jun 21 at 15:10
  • It may mean an error in SLD but it can also mean that the SLD is OK but the validator is not up-to-date. The validator tends to give false negatives, Save the SLD and check with the layer preview application if it works despite the error messages. – user30184 Jun 24 at 14:52

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.