Class WfsFeatureTable

java.lang.Object
com.esri.arcgisruntime.data.FeatureTable
com.esri.arcgisruntime.ogc.wfs.WfsFeatureTable
All Implemented Interfaces:
RemoteResource, Loadable, PopupSource

public final class WfsFeatureTable extends FeatureTable implements RemoteResource
Represents a table in a Web Feature Service.
Since:
100.5.0
  • Constructor Details

    • WfsFeatureTable

      public WfsFeatureTable(String url, String tableName)
      Creates a WFS feature table with the given URL and table name.
      Parameters:
      url - the URL to the WFS service to connect to
      tableName - the name of the layer (feature type) from the service
      Throws:
      IllegalArgumentException - if url or tableName are null or empty
      Since:
      100.5.0
    • WfsFeatureTable

      public WfsFeatureTable(WfsLayerInfo wfsLayerInfo)
      Creates a WFS feature table with the given WfsLayerInfo object.
      Parameters:
      wfsLayerInfo - a WfsLayerInfo object
      Throws:
      IllegalArgumentException - if wfsLayerInfo is null
      Since:
      100.5.0
  • Method Details

    • getFeatureRequestMode

      public ServiceFeatureTable.FeatureRequestMode getFeatureRequestMode()
      Gets the mode defining when features are requested from the service.

      Currently, WFS feature table only supports ServiceFeatureTable.FeatureRequestMode.MANUAL_CACHE but defaults to ServiceFeatureTable.FeatureRequestMode.ON_INTERACTION_CACHE. Use setFeatureRequestMode(ServiceFeatureTable.FeatureRequestMode) to set the feature request mode to manual before attempting to populate the table.

      Returns:
      the feature request mode
      Since:
      100.5.0
    • setFeatureRequestMode

      public void setFeatureRequestMode(ServiceFeatureTable.FeatureRequestMode featureRequestMode)
      Sets the mode defining when features are requested from the service.

      Currently, WFS feature table only supports ServiceFeatureTable.FeatureRequestMode.MANUAL_CACHE but defaults to ServiceFeatureTable.FeatureRequestMode.ON_INTERACTION_CACHE. Set the feature request mode to manual before attempting to populate the table.

      Parameters:
      featureRequestMode - the feature request mode
      Throws:
      IllegalArgumentException - if featureRequestMode is null
      Since:
      100.5.0
      See Also:
    • getLayerInfo

      public WfsLayerInfo getLayerInfo()
      Gets the WFS layer metadata.
      Returns:
      a WfsLayerInfo object
      Since:
      100.5.0
    • getPreferredSpatialReference

      public SpatialReference getPreferredSpatialReference()
      Gets the preferred spatial reference of the WFS feature table.
      Returns:
      the preferred spatial reference of this WfsFeatureTable
      Since:
      100.5.0
    • setPreferredSpatialReference

      public void setPreferredSpatialReference(SpatialReference spatialReference)
      Sets the preferred spatial reference for the WFS feature table.

      If the preferred spatial reference isn't available from the service, the table will fail to load. Specify a preferred spatial reference that matches the map or scene's spatial reference to avoid automatic reprojection. The preferred spatial reference cannot be changed on a loaded table.

      Parameters:
      spatialReference - the preferred spatial reference
      Throws:
      IllegalArgumentException - if spatialReference is null
      Since:
      100.5.0
      See Also:
    • getAxisOrder

      public OgcAxisOrder getAxisOrder()
      Gets the axis order, which defines how coordinates are interpreted.

      Some WFS services return coordinates in (X,Y) order, while others use (Y,X). Setting this property to OgcAxisOrder.SWAP results in all coordinates in geometries being swapped from what was sent by the server. The axis order can be changed on a loaded table, but that change will only affect future calls to populateFromServiceAsync(QueryParameters, boolean, Iterable). Features that are already in the table will not be modified. The default value is OgcAxisOrder.AUTO. In this mode, the results are optimized using heuristics from popular WFS Servers.

      Returns:
      the axis order type
      Since:
      100.5.0
    • setAxisOrder

      public void setAxisOrder(OgcAxisOrder axisOrder)
      Sets the axis order, which defines how coordinates are interpreted.

      Some WFS services return coordinates in (X,Y) order, while others use (Y,X). Setting this property to OgcAxisOrder.SWAP results in all coordinates in geometries being swapped from what was sent by the server. The axis order can be changed on a loaded table, but that change will only affect future calls to populateFromServiceAsync(QueryParameters, boolean, Iterable). Features that are already in the table will not be modified. The default value is OgcAxisOrder.AUTO. In this mode, the results are optimized using heuristics from popular WFS Servers.

      Parameters:
      axisOrder - the axis order to use for this service
      Throws:
      IllegalArgumentException - if axisOrder is null
      Since:
      100.5.0
      See Also:
    • getFilterAxisOrder

      public OgcAxisOrder getFilterAxisOrder()
      Gets the axis order of the filter, which determines how coordinates are ordered when sent to the server as part of spatial queries (those that specify a geometry).

      Some WFS services expect coordinates to be sent in (x,y) order, while others use (y,x). Use OgcAxisOrder.SWAP to send coordinates in (y,x) order. Use OgcAxisOrder.NO_SWAP to send coordinates in (x,y) order. Defaults to OgcAxisOrder.AUTO.

      Returns:
      the axis order of the filter
      Since:
      100.5.0
    • setFilterAxisOrder

      public void setFilterAxisOrder(OgcAxisOrder filterAxisOrder)
      Sets the axis order of the filter, which determines how coordinates are ordered when sent to the server as part of spatial queries (those that specify a geometry).

      Some WFS services expect coordinates to be sent in (x,y) order, while others use (y,x). Use OgcAxisOrder.SWAP to send coordinates in (y,x) order. Use OgcAxisOrder.NO_SWAP to send coordinates in (x,y) order. Defaults to OgcAxisOrder.AUTO

      Parameters:
      filterAxisOrder - the filter axis order to use for this service
      Throws:
      IllegalArgumentException - if filterAxisOrder is null
      Since:
      100.5.0
      See Also:
    • getUri

      public String getUri()
      Gets the URL used to create the WFS feature table.
      Specified by:
      getUri in interface RemoteResource
      Returns:
      the service url of the WFS feature table
      Since:
      100.5.0
    • populateFromServiceAsync

      public ListenableFuture<FeatureQueryResult> populateFromServiceAsync(QueryParameters query, boolean clearCache, Iterable<String> outFields)
      Executes an asynchronous method that populates the table with the results of a query. The table must be in ServiceFeatureTable.FeatureRequestMode.MANUAL_CACHE mode.

      WFS is only compatible with a subset of possible queries defined by QueryParameters. The where clause only works when the table is backed by a service powered by GeoServer. Spatial queries (those that specify geometries) must use the Intersects spatial relationship.

      Parameters:
      query - the query to execute or default (empty) QueryParameters to get all features from the service
      clearCache - true if this table should be cleared when this method is called, false if the result of the query should be appended to this table
      outFields - the names of the fields to be populated or null/empty for the default set of fields
      Returns:
      a ListenableFuture that represents the result of the query; the results will replace or be appended to this table. The ListenableFuture indicates if the query isDone(); also allows cancellation. Calling get() on the returned future may throw an ExecutionException with its cause set to IOException if a network request fails.
      Throws:
      IllegalArgumentException - if query is null
      Since:
      100.5.0
    • populateFromServiceAsync

      public ListenableFuture<FeatureQueryResult> populateFromServiceAsync(String xmlRequest, boolean clearCache)
      Executes an asynchronous method that populates the table with the results of the XML query. The table must be in ServiceFeatureTable.FeatureRequestMode.MANUAL_CACHE mode.

      The XML query must be made against the same feature type represented by the WFS feature table. The schema of the query result must match or be a subset of the schema of the table.

      Parameters:
      xmlRequest - an XML string representing the complete GetFeature request including but not limited to filters, joins, and aliases
      clearCache - if true, clears existing table data before populating with the query result; if false, the result of the query should be appended to this table
      Returns:
      a ListenableFuture that represents the result of the query; the results will replace or be appended to this table. The ListenableFuture indicates if the query isDone(); also allows cancellation. Calling get() on the returned future may throw an ExecutionException with its cause set to IOException if a network request fails.
      Throws:
      IllegalArgumentException - if xmlRequest is null or empty
      Since:
      100.5.0
    • getCredential

      public Credential getCredential()
      Description copied from interface: RemoteResource
      Gets the Credential that is set on the network-enabled resource.

      Only applicable if the resource is secured.

      Specified by:
      getCredential in interface RemoteResource
      Returns:
      the Credential, or null if there is none
    • setCredential

      public void setCredential(Credential credential)
      Description copied from interface: RemoteResource
      Sets a Credential to be used by the network-enabled resource in the event of an authentication challenge. The default credential is null.

      Only applicable if the resource is secured.

      Specified by:
      setCredential in interface RemoteResource
      Parameters:
      credential - the Credential to be used for authentication
    • getRequestConfiguration

      public RequestConfiguration getRequestConfiguration()
      Description copied from interface: RemoteResource
      Gets the RequestConfiguration used to modify the parameters of network requests made by this RemoteResource.
      Specified by:
      getRequestConfiguration in interface RemoteResource
      Returns:
      the RequestConfiguration used to modify network requests
    • setRequestConfiguration

      public void setRequestConfiguration(RequestConfiguration requestConfiguration)
      Description copied from interface: RemoteResource
      Sets the RequestConfiguration used to modify the parameters of network requests made by this RemoteResource. If not set, the global RequestConfiguration will be used (see RequestConfiguration.getGlobalRequestConfiguration()).
      Specified by:
      setRequestConfiguration in interface RemoteResource
      Parameters:
      requestConfiguration - the RequestConfiguration used to modify network requests