[GIS] Geoserver SLD using PropertyIsEqualTo And PropertyIsLike

geoserversldsql server

I have two SLD rules one using PropertyIsEqualTo and another using PropertyIsLike

Using PropertyIsEqualTo

<Rule>
          <Name>Vendor FirstVendor</Name>
          <Title>FristVendor</Title>
          <ogc:Filter>
            <ogc:PropertyIsEqualTo>
            <ogc:PropertyName>Vendor</ogc:PropertyName>
            <ogc:Literal>firstVendor</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>
          <PointSymbolizer>
            <Graphic>
              <Mark>
                <WellKnownName>circle</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#0033CC</CssParameter>
                </Fill>
              </Mark>
              <Size>8</Size>
            </Graphic>
          </PointSymbolizer>              
     </Rule>

Using PropertyIsLike

<ogc:Filter>
            <ogc:PropertyIsLike  wildCard="*" singleChar="." escape="!">
            <ogc:PropertyName>Vendor</ogc:PropertyName>
            <ogc:Literal>firstVendor*</ogc:Literal>
            </ogc:PropertyIsLike>
</ogc:Filter>

The SLD using Like works fine where as using equal does not work at all.I have seen the string in database well there is not leading or trailing spaces.

Geoserver is taking space at the end of literal. That was the issue. I added space to PropertyName eg Vendor_

Best Answer

Try adding matchCase="true" like this:

<ogc:PropertyIsEqualTo matchCase="true">
    <ogc:PropertyName>Vendor</ogc:PropertyName>
    <ogc:Literal>firstVendor</ogc:Literal>
</ogc:PropertyIsEqualTo>

I know it doesn't really make sense, but comparing yours to mine, that's the only difference i see.