GeoServer WFS PropertyIsEqualTo not matching trailing whitespace

581 views Asked by At

I currently have a dataset in a postgis database that contains trailing whitespaces for certain columns e.g. TOWNSHIP.

When a WFS request is made through geoserver's WFS functionality, no data is returned (see below)

<?xml version="1.0"?>
<wfs:GetFeature maxFeatures="10" startIndex="0" service="WFS" version="1.1.0" outputFormat="json" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
  <wfs:Query typeName="<layer>">
    <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
      <ogc:And>
        <PropertyIsEqualTo>
          <PropertyName>TOWNSHIP</PropertyName>
          <Literal>Town </Literal>
        </PropertyIsEqualTo>
      </ogc:And>
    </ogc:Filter>
    <SortBy xmlns:ogc="http://www.opengis.net/ogc">
      <SortProperty>
        <PropertyName>NUM</PropertyName>
        <SortOrder>ASC</SortOrder>
      </SortProperty>
    </SortBy>
  </wfs:Query>
</wfs:GetFeature>

In the above GetFeature request, the WFS is trying to match by TOWNSHIP where the value is 'Town '. There are records in the database with the value 'Town '.

I could use the PropertyIsLike filter but that would match extra records.

Could someone please let me know if you have come across this issue and how to resolve it?

Thanks Amar

0

There are 0 answers