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
A table of features that typically represents real-world objects from an OGC Web Feature Service (WFS) dataset.

You can create WFS feature table using the URL of an OGC Web Feature Service and a specified layer name. Alternatively, you may connect to a WfsService, obtain its metadata from WfsService.getServiceInfo(), and discover its available layers using WfsServiceInfo.getLayerInfos(). You can then create a WfsFeatureTable from an individual layer using WfsFeatureTable(WfsLayerInfo).

When you have created a WFS Feature table, features are not automatically requested. Instead, you must set the WFS Feature table request mode to ServiceFeatureTable.FeatureRequestMode.MANUAL_CACHE and then populate the table using populateFromServiceAsync(QueryParameters, boolean, Iterable), for example.

You can visualize features from a WFS feature table using a FeatureLayer but the table does not support editing. See the OGC Web Feature Service standard for more information.

Since:
100.5.0
  • Constructor Details

    • WfsFeatureTable

      public WfsFeatureTable(String url, String tableName)
      Creates a WFS feature table from the URL of a WFS Service and a table name.
      Parameters:
      url - the URL of a WFS service
      tableName - the name of the layer (feature type) from the WFS 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 from WFS layer information.
      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.

      You must set the feature request mode to ServiceFeatureTable.FeatureRequestMode.MANUAL_CACHE before attempting to populate the table using populateFromServiceAsync(QueryParameters, boolean, Iterable).

      By default this value is ServiceFeatureTable.FeatureRequestMode.ON_INTERACTION_CACHE.

      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.

      You must set the feature request mode to ServiceFeatureTable.FeatureRequestMode.MANUAL_CACHE before attempting to populate the table using populateFromServiceAsync(QueryParameters, boolean, Iterable).

      By default this value is ServiceFeatureTable.FeatureRequestMode.ON_INTERACTION_CACHE.

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

      public WfsLayerInfo getLayerInfo()
      Gets the metadata describing the WFS layer, such as name and description.
      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 service does not provide a preferred spatial reference, or you have not set it explicitly, then the table will fail to load. The preferred spatial reference cannot be changed once the table is loaded.

      Set the preferred spatial reference to match the map or scene's spatial reference to avoid the automatic reprojection of features.

      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 (x,y or y,x).

      Some WFS services return coordinates in (x,y) order, while others use (y,x) order. Setting this property to OgcAxisOrder.SWAP results in all coordinates in geometries being swapped from what was sent by the server. Setting to OgcAxisOrder.NO_SWAP will cause coordinates to be interpreted as-is. The axis order can be changed on an already-loaded feature table, but the change will only affect future calls to populateFromServiceAsync(QueryParameters, boolean, Iterable). Features that are already in the table will not be modified/swapped.

      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 (x,y or y,x).

      Some WFS services return coordinates in (x,y) order, while others use (y,x) order. Setting this property to OgcAxisOrder.SWAP results in all coordinates in geometries being swapped from what was sent by the server. Setting to OgcAxisOrder.NO_SWAP will cause coordinates to be interpreted as-is. The axis order can be changed on an already-loaded feature table, but the change will only affect future calls to populateFromServiceAsync(QueryParameters, boolean, Iterable). Features that are already in the table will not be modified/swapped.

      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 filter axis order, which determines how coordinates are ordered when sent to the server as part of spatial queries.

      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 and OgcAxisOrder.NO_SWAP to use (x,y) order.

      The default value is OgcAxisOrder.AUTO. This indicates that the axis order will be based on the OGC standard specification, version, and spatial reference.

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

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

      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 and OgcAxisOrder.NO_SWAP to use (x,y) order.

      The default value is OgcAxisOrder.AUTO. This indicates that the axis order will be based on the OGC standard specification, version, and spatial reference.

      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)
      Populates the WFS feature table using the query parameters.

      Use the default (empty) QueryParameters to get all features from the service. If you specify a null or an empty collection for outfields, then the default set of outfields are used.

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

      You must ensure that the setFeatureRequestMode(ServiceFeatureTable.FeatureRequestMode) is set to ServiceFeatureTable.FeatureRequestMode.MANUAL_CACHE before attempting to populate the table.

      Parameters:
      query - the query to execute or default (empty) QueryParameters to get all features from the service
      clearCache - if true, the existing table data is cleared before it is populated with the query result
      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)
      Populates the table using an XML query.

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

      You must ensure that the setFeatureRequestMode(ServiceFeatureTable.FeatureRequestMode) is set to ServiceFeatureTable.FeatureRequestMode.MANUAL_CACHE before attempting to populate 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