0

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

Amar Singh
  • 49
  • 1
  • 6
  • have a look in the geoserver log and you'll be able to see the query - I suspect the space is being trimmed off the end of your query – Ian Turton Jun 29 '15 at 17:25
  • Hi thanks for the reply. As the dataset was exposed through geoserver using a postgres view , I was able to modify the view SQL and use the trim function on the appropriate columns. I did not have a lot of time to look at this in greater detail so have not looked a the logs. Thanks for replying. – Amar Singh Jul 10 '15 at 08:13

0 Answers0