Class SortingWFSClient

java.lang.Object
org.geotools.data.ows.AbstractOpenWebService<org.geotools.data.wfs.internal.WFSGetCapabilities, QName>
org.geotools.data.wfs.internal.WFSClient
org.tailormap.api.geotools.wfs.SortingWFSClient

public class SortingWFSClient extends org.geotools.data.wfs.internal.WFSClient
WFSClient that lets a WFS 2.0.0 server sort, when the capabilities have the ImplementsSorting constraint. GeoTools 35.2 only lets a WFS 1.1.0 server sort.

When the client can't sort, ContentFeatureSource sorts each page of features in memory after getting it from the server with STARTINDEX and COUNT. Each page is sorted on its own, which gives a wrong order across pages, and it fails when a feature has an attribute that isn't Serializable, such as an Instant for a date. That also happens without a sort order, because ContentFeatureSource adds NATURAL_ORDER when paging.

For WFS 2.0.0 the StrictWFS_2_0_Strategy GeoTools picks is replaced with SortingWFS_2_0_Strategy, which sends the sort order to the server. The client then always says it can sort, so GeoTools never sorts in memory: in memory sorting is wrong with paging, and paging is always used for the attribute list. Instead:

  • Natural order (also the one ContentFeatureSource adds when paging) is not sent, so the server uses its own order. WFS 2.0 (ISO 19142) 7.9.2.5.4.4 requires that order to be the same across executions of the same query, so it is stable across pages.
  • Sorting on an attribute when the capabilities don't have the ImplementsSorting constraint is an error, see SortingWFS_2_0_Strategy.

Other strategies, such as ArcGisStrategy_2_0, are left to GeoTools: no sorting on the server, and each page sorted in memory.

This can be removed when GeoTools supports sorting for WFS 2.0.0 itself.

  • Field Summary

    Fields inherited from class org.geotools.data.wfs.internal.WFSClient

    config

    Fields inherited from class org.geotools.data.ows.AbstractOpenWebService

    capabilities, headers, hints, info, resourceInfo, serverURL, specification, specs
  • Constructor Summary

    Constructors
    Constructor
    Description
    SortingWFSClient(URL capabilitiesURL, org.geotools.http.HTTPClient httpClient, org.geotools.data.wfs.internal.WFSConfig config)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     

    Methods inherited from class org.geotools.data.wfs.internal.WFSClient

    canCount, canFilter, canLimit, canOffset, canRetype, createDescribeFeatureTypeRequest, createDescribeStoredQueriesRequest, createGetFeatureRequest, createInfo, createInfo, createListStoredQueriesRequest, createTransaction, getAxisOrderFilter, getBounds, getCapabilities, getCapabilitiesURL, getConfig, getDefaultCRS, getDescribeFeatureTypeGetURL, getInfo, getRemoteTypeNames, getStrategy, internalIssueRequest, issueComplexRequest, issueRequest, issueRequest, issueRequest, issueRequest, issueRequest, issueTransaction, isUseProvidedFIDSupported, setupSpecifications, splitFilters, supportsStoredQueries, supportsTransaction

    Methods inherited from class org.geotools.data.ows.AbstractOpenWebService

    getHints, getHTTPClient, getInfo, negotiateVersion, setHints, setHttpClient, setLoggingLevel

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SortingWFSClient

      public SortingWFSClient(URL capabilitiesURL, org.geotools.http.HTTPClient httpClient, org.geotools.data.wfs.internal.WFSConfig config) throws IOException, org.geotools.ows.ServiceException
      Throws:
      IOException
      org.geotools.ows.ServiceException
  • Method Details

    • canSort

      public boolean canSort()
      Overrides:
      canSort in class org.geotools.data.wfs.internal.WFSClient