- All Implemented Interfaces:
RemoteResource
,Loadable
,PopupSource
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
-
Property Summary
Properties inherited from class com.esri.arcgisruntime.data.FeatureTable
loadError, loadStatus
-
Constructor Summary
ConstructorDescriptionWfsFeatureTable
(WfsLayerInfo wfsLayerInfo) Creates a WFS feature table from WFS layer information.WfsFeatureTable
(String url, String tableName) Creates a WFS feature table from the URL of a WFS Service and a table name. -
Method Summary
Modifier and TypeMethodDescriptionGets the axis order, which defines how coordinates are interpreted (x,y or y,x).Gets theCredential
that is set on the network-enabled resource.Gets the mode defining when features are requested from the service.Gets the filter axis order, which determines how coordinates are ordered when sent to the server as part of spatial queries.Gets the metadata describing the WFS layer, such as name and description.Gets the preferred spatial reference of the WFS feature table.Gets theRequestConfiguration
used to modify the parameters of network requests made by thisRemoteResource
.getUri()
Gets the URL used to create the WFS feature table.populateFromServiceAsync
(QueryParameters query, boolean clearCache, Iterable<String> outFields) Populates the WFS feature table using the query parameters.populateFromServiceAsync
(String xmlRequest, boolean clearCache) Populates the table using an XML query.void
setAxisOrder
(OgcAxisOrder axisOrder) Sets the axis order, which defines how coordinates are interpreted (x,y or y,x).void
setCredential
(Credential credential) Sets aCredential
to be used by the network-enabled resource in the event of an authentication challenge.void
setFeatureRequestMode
(ServiceFeatureTable.FeatureRequestMode featureRequestMode) Sets the mode defining when features are requested from the service.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.void
setPreferredSpatialReference
(SpatialReference spatialReference) Sets the preferred spatial reference for the WFS feature table.void
setRequestConfiguration
(RequestConfiguration requestConfiguration) Sets theRequestConfiguration
used to modify the parameters of network requests made by thisRemoteResource
.Methods inherited from class com.esri.arcgisruntime.data.FeatureTable
addDoneLoadingListener, addFeatureAsync, addFeaturesAsync, addLoadStatusChangedListener, canAdd, cancelLoad, canDelete, canEditGeometry, canUpdate, createFeature, createFeature, deleteFeatureAsync, deleteFeaturesAsync, getDisplayName, getExtent, getField, getFields, getGeometryType, getLayer, getLoadError, getLoadStatus, getPopupDefinition, getSpatialReference, getTableName, getTotalFeatureCount, hasGeometry, hasM, hasZ, isEditable, isPopupEnabled, loadAsync, loadErrorProperty, loadStatusProperty, queryExtentAsync, queryFeatureCountAsync, queryFeaturesAsync, queryStatisticsAsync, removeDoneLoadingListener, removeLoadStatusChangedListener, retryLoadAsync, setDisplayName, setPopupDefinition, setPopupEnabled, updateFeatureAsync, updateFeaturesAsync
-
Constructor Details
-
WfsFeatureTable
Creates a WFS feature table from the URL of a WFS Service and a table name.- Parameters:
url
- the URL of a WFS servicetableName
- 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
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
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 usingpopulateFromServiceAsync(QueryParameters, boolean, Iterable)
.By default this value is
ServiceFeatureTable.FeatureRequestMode.ON_INTERACTION_CACHE
.- Returns:
- the feature request mode
- Since:
- 100.5.0
-
setFeatureRequestMode
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 usingpopulateFromServiceAsync(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
Gets the metadata describing the WFS layer, such as name and description.- Returns:
- a WfsLayerInfo object
- Since:
- 100.5.0
-
getPreferredSpatialReference
Gets the preferred spatial reference of the WFS feature table.- Returns:
- the preferred spatial reference of this WfsFeatureTable
- Since:
- 100.5.0
-
setPreferredSpatialReference
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
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 toOgcAxisOrder.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 topopulateFromServiceAsync(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
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 toOgcAxisOrder.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 topopulateFromServiceAsync(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
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 andOgcAxisOrder.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
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 andOgcAxisOrder.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
Gets the URL used to create the WFS feature table.- Specified by:
getUri
in interfaceRemoteResource
- 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
. TheQueryParameters.getWhereClause()
only works when the table is backed by a service powered by a GeoServer. Spatial queries (those that specify geometries) must use theQueryParameters.SpatialRelationship.INTERSECTS
spatial relationship.You must ensure that the
setFeatureRequestMode(ServiceFeatureTable.FeatureRequestMode)
is set toServiceFeatureTable.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 serviceclearCache
- if true, the existing table data is cleared before it is populated with the query resultoutFields
- 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. Callingget()
on the returned future may throw an ExecutionException with its cause set toIOException
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 toServiceFeatureTable.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 aliasesclearCache
- 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. Callingget()
on the returned future may throw an ExecutionException with its cause set toIOException
if a network request fails. - Throws:
IllegalArgumentException
- if xmlRequest is null or empty- Since:
- 100.5.0
-
getCredential
Description copied from interface:RemoteResource
Gets theCredential
that is set on the network-enabled resource.Only applicable if the resource is secured.
- Specified by:
getCredential
in interfaceRemoteResource
- Returns:
- the Credential, or null if there is none
-
setCredential
Description copied from interface:RemoteResource
Sets aCredential
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 interfaceRemoteResource
- Parameters:
credential
- the Credential to be used for authentication
-
getRequestConfiguration
Description copied from interface:RemoteResource
Gets theRequestConfiguration
used to modify the parameters of network requests made by thisRemoteResource
.- Specified by:
getRequestConfiguration
in interfaceRemoteResource
- Returns:
- the
RequestConfiguration
used to modify network requests
-
setRequestConfiguration
Description copied from interface:RemoteResource
Sets theRequestConfiguration
used to modify the parameters of network requests made by thisRemoteResource
. If not set, the globalRequestConfiguration
will be used (seeRequestConfiguration.getGlobalRequestConfiguration()
).- Specified by:
setRequestConfiguration
in interfaceRemoteResource
- Parameters:
requestConfiguration
- the RequestConfiguration used to modify network requests
-