Options
All
  • Public
  • Public/Protected
  • All
Menu

Store implementation for communicating with an OGC WFS server. This Store uses a Codec to convert the server response to LuciadRIA features. The standard codec assumes a server response in GeoJson format. Replace the codec if you want to support another format.

Set this Store on a FeatureModel to create a feature model which retrieves its data from a WFS server. Typically, you don't need to call the constructor yourself. Instead, use the factory methods createFromURL or createFromCapabilities to create an instance of this store. The following example demonstrates how to set up a WFSFeatureStore to retrieve WFS feature data for a given service url and feature type name:

  WFSFeatureStore.createFromURL("http://sampleservices.luciad.com/wfs", "usrivers")
      .then(function(store) {
        //Create a model for the store
        const model = new FeatureModel(store);
        //Create a layer for the model
        const layer = new FeatureLayer(model);
        //Add the model to the map
        map.layerTree.addChild(layer);
      });

The above example uses GeoJSON as default exchange format. Here's an example on how to set up the same WFSFeatureStore to decode GML-based data, using a GMLCodec:

  const storePromise = WFSFeatureStore.createFromURL("http://sampleservices.luciad.com/wfs", "usrivers", {
    codec: new GMLCodec(),
    outputFormat: "text/xml; subtype=gml/3.1.1"
  });

If you want to access the WFS server capabilities and explore the service metadata and available data sets, you have to create a WFSCapabilities instance first. You can also us this instance to create a Store afterwards:

  WFSCapabilities.fromURL("http://sampleservices.luciad.com/wfs")
      .then(function(capabilities) {
        //Create a store using the capabilities
        const store = WFSFeatureStore.createFromCapabilities(capabilities, "usrivers");
        //Create a model for the store
        const model = new FeatureModel(store);
        //Create a layer for the model
        const layer = new FeatureLayer(model);
        //Add the model to the map
        map.layerTree.addChild(layer);
      });

Supported versions

LuciadRIA supports consuming WFS services that support version 1.0, 1.1 and 2.0 of the OGC WFS specification.

Hierarchy

  • WFSFeatureStore

Implements

Overview

Constructors

constructor

Accessors

credentials

  • get credentials(): boolean
  • set credentials(value: boolean): void
  • Indicates whether or not credentials should be included with HTTP requests.

    Set this to true if the server requires credentials, like HTTP basic authentication headers or cookies. You should disable credentials if the server is configured to allow cross-origin requests from all domains (Acces-Control-Allow-Origin=*). If the server allows CORS requests from all domains, the browser will block all requests where credentials=true.

    Once set, all subsequent HTTP requests will use the newly set value.

    The default value is false.

    Returns boolean

  • Indicates whether or not credentials should be included with HTTP requests.

    Set this to true if the server requires credentials, like HTTP basic authentication headers or cookies. You should disable credentials if the server is configured to allow cross-origin requests from all domains (Acces-Control-Allow-Origin=*). If the server allows CORS requests from all domains, the browser will block all requests where credentials=true.

    Once set, all subsequent HTTP requests will use the newly set value.

    The default value is false.

    Parameters

    • value: boolean

    Returns any

requestHeaders

  • get requestHeaders(): {} | null
  • set requestHeaders(value: {} | null): void
  • Headers to send with every HTTP request.

    An object literal that represents the headers to send with every HTTP request. The property names represent HTTP header names, the property values represent the HTTP header values. This property can be set dynamically (post-construction). Once set, all subsequent HTTP requests will use the newly set headers.

    Note that when custom headers are being sent to a server on another domain, the server will have to properly respond to pre-flight CORS requests (a HTTP OPTION request sent by the browser before doing the actual request). The server has to indicate that the header can be used in the actual request, by including it in the pre-flight's Access-Control-Allow-Headers response header.

    The default value is null.

    Returns {} | null

  • Headers to send with every HTTP request.

    An object literal that represents the headers to send with every HTTP request. The property names represent HTTP header names, the property values represent the HTTP header values. This property can be set dynamically (post-construction). Once set, all subsequent HTTP requests will use the newly set headers.

    Note that when custom headers are being sent to a server on another domain, the server will have to properly respond to pre-flight CORS requests (a HTTP OPTION request sent by the browser before doing the actual request). The server has to indicate that the header can be used in the actual request, by including it in the pre-flight's Access-Control-Allow-Headers response header.

    The default value is null.

    Parameters

    • value: {} | null

    Returns any

requestParameters

  • get requestParameters(): {} | null
  • set requestParameters(value: {} | null): void
  • Custom request parameters to send along with WFS requests. The object literal can contain simple key/value pairs. Accepted values are strings, numbers and booleans. A ProgrammingError will be thrown if values of another type are used. Values must not be URL encoded.

    Assignments of other values than object literals to requestParameters will throw an Error. Clearing the parameters can be done by assigning null or an empty object literal to requestParameters. In order to trigger a refresh of the visualization on the map use layer.loadingStrategy.queryProvider.invalidate().

    since

    2021.0

    Returns {} | null

  • Custom request parameters to send along with WFS requests. The object literal can contain simple key/value pairs. Accepted values are strings, numbers and booleans. A ProgrammingError will be thrown if values of another type are used. Values must not be URL encoded.

    Assignments of other values than object literals to requestParameters will throw an Error. Clearing the parameters can be done by assigning null or an empty object literal to requestParameters. In order to trigger a refresh of the visualization on the map use layer.loadingStrategy.queryProvider.invalidate().

    since

    2021.0

    Parameters

    • value: {} | null

    Returns any

Methods

on

  • (event: string, callback: (...args: any[]) => void, context?: any): Handle
  • Parameters

    • event: string
    • callback: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any

    Returns Handle

query

  • Query the store for objects. This will make an AJAX call to the WFS server.

    Parameters

    • Optional query: WFSQueryOptions

      An object literal which contains the query-parameters

    • Optional options: QueryOptions

      Object literal containing options for the query method.

    Returns Cursor | Promise<Cursor>

    A Cursor for the result set of Feature instances or a promise for that Cursor.

spatialQuery

  • Query the store for objects within a spatial extent. This will make an AJAX call to the WFS server.

    Parameters

    • Optional bounds: Bounds

      The spatial extent to retrieve features for

    • Optional query: WFSQueryOptions

      An object literal which contains the query-parameters

    • Optional options: QueryOptions

      Object literal containing options for the query method.

    Returns Cursor | Promise<Cursor>

    A Cursor for the result set of Feature instances or a promise for that Cursor.

Static createFromCapabilities

  • Creates a new WFSFeatureStore. This is the recommended method to create a model based on information provided by WFSCapabilities.

    since

    2019.1

    Parameters

    Returns WFSFeatureStore

    a WFSFeatureStore for the given parameters.

Static createFromURL

  • Creates a new WFSFeatureStore. This is the recommended method to create a store based on a given WFS server URL and feature type name.

    since

    2019.1

    Parameters

    • url: string

      The URL of the WFS server.

    • featureTypeName: string

      The name of the WFS feature type to be loaded.

    • Optional options: WFSFeatureStoreCreateFromURLOptions

      An object literal which contains the settings for this Store

    Returns Promise<WFSFeatureStore>

    a WFSFeatureStore for the given parameters. The promise is rejected if the store creation fails.

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method