Class WfsFeatureTable

    • Constructor Detail

      • 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 Detail

      • 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:
        SpatialReference
      • 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 will result 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. AxisOrder can be changed on an already-loaded table, but that change will only affect future calls to populateFromServiceAsync(String, boolean) or populateFromServiceAsync(QueryParameters, boolean, Iterable). Features that are already in the table will not be modified. Defaults to OgcAxisOrder.AUTO. In this mode, Runtime will make its best guess using heuristics that are optimized for good results with the most 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 will result 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. Defaults to OgcAxisOrder.AUTO. In this mode, Runtime will make its best guess using heuristics that are optimized for good results with the most 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:
        OgcAxisOrder
      • 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:
        OgcAxisOrder
      • 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