Skip to content
import { getCapabilities, getWFSLayerInfo } from "@arcgis/core/layers/ogc/wfsUtils.js";
Since
ArcGIS Maps SDK for JavaScript 4.20

Provides utility functions for the WFSLayer.

See also

Type definitions

GetCapabilitiesOptions

Type definition
Supertypes
AbortOptions

customParameters

Property
Type
CustomParameters | null | undefined

A list of key-value pairs of parameters to append to the url.

WFSCapabilities

Type definition

WFS service information about the available layers and operations.

See also

operations

readonly Property
Type
WFSOperations

Information about the operations needed to consume the WFS service.

featureTypes

readonly Property
Type
Array<WFSFeatureType>

An array of featureTypes (or layers) available in the WFS service.

WFSOperations

Type definition

Information about some operations of the WFS service.

See also

GetCapabilities

Property
Type
WFSOperationsGetCapabilities

DescribeFeatureType

Property
Type
WFSOperationsDescribeFeatureType

GetFeature

Property
Type
WFSOperationsGetFeature

WFSOperationsGetCapabilities

Type definition

url

Property
Type
string

The URL to the GetCapabilities endpoint.

WFSOperationsDescribeFeatureType

Type definition

url

Property
Type
string

The URL to the DescribeFeatureType endpoint.

WFSOperationsGetFeature

Type definition

url

Property
Type
string

The URL to the GetFeature endpoint.

outputFormat

Property
Type
string | null

Value of the geojson-like output format parameter (if any) to send with the GetFeature call.

supportsPagination

Property
Type
boolean

Indicates if the GetFeature request supports pagination.

WFSFeatureType

Type definition

Provides information about an individual feature type, or layer, found in the WFS service.

See also

typeName

Property
Type
${[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}:${[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}

The type name of the featureType. This will be of the format namespacePrefix:name.

name

Property
Type
string

The name of the featureType.

title

Property
Type
string

The title of the featureType.

description

Property
Type
string

The description of the featureType.

extent

Property
Type
Extent | null | undefined

The extent of the features.

namespacePrefix

Property
Type
string

The prefix of the namespace.

namespaceUri

Property
Type
string

The namespaceUri of the featureType.

defaultSpatialReference

Property
Type
number

the default spatialReference wkid used when not explicitely specified in the GetFeature call.

supportedSpatialReferences

Property
Type
number[]

An array of spatialReference wkids that are supported on the featureType.

WFSLayerInfoOptions

Type definition
Supertypes
AbortOptions

spatialReference

Property
Type
SpatialReference | undefined

The desired spatial reference for the layer. By default will use the default spatial reference of the feature type.

customParameters

Property
Type
CustomParameters | null | undefined

A list of key-value pairs of parameters to append to the url.

WFSLayerInfo

Type definition

The layer info from the WFS service.

See also

url

Property
Type
string

The URL to the WFS service.

name

Property
Type
string

The name of the layer in the WFS service to display.

namespaceUri

Property
Type
string

The namespace URI for the layer name.

fields

Property
Type
Field[]

The fields on the layer.

geometryType

Property
Type
FeatureGeometryType

The geometry type of the features in the layer.

objectIdField

Property
Type
string

The field containing the object ID.

spatialReference

Property
Type
SpatialReference

The spatial reference of the layer.

extent

Property
Type
Extent | null | undefined

The extent of the layer.

swapXY

Property
Type
boolean

Determines whether the X and Y coordinates should be swapped.

wfsCapabilities

Property
Type
WFSCapabilities

customParameters

Property
Type
CustomParameters | null | undefined

The custom parameters applied to the layer.

Functions

getCapabilities

Function

Fetches the GetCapabilities document of a WFS service which contains information about the list of layers in the service and the available operations.

Signature
getCapabilities (url: string, options?: GetCapabilitiesOptions): Promise<WFSCapabilities>
Parameters
ParameterTypeDescriptionRequired
url

The URL to the WFS endpoint.

options
Returns
Promise<WFSCapabilities>

The WFS Capabilities for the service.

Example
const capabilities = await wfsUtils.getCapabilities(url);
const layerInfo = await wfsUtils.getWFSLayerInfo(capabilities, "layer");
const layer = WFSLayer.fromWFSLayerInfo(layerInfo);
// Same as
const layer = WFSLayer({
url,
name: "layer"
});

getWFSLayerInfo

Function

Returns the WFSLayerInfo from the capabilities of the WFS service. Can be used in conjunction with getCapabilities

Signature
getWFSLayerInfo (capabilities: WFSCapabilities, name?: string | null, namespaceUri?: string | null, options?: WFSLayerInfoOptions): Promise<WFSLayerInfo>
Parameters
ParameterTypeDescriptionRequired
capabilities

The capabilities of the WFS service.

name

The type name to get information for. If not specified, the first layer of the service is chosen.

namespaceUri

The namespace URI of the type name. If not specified, the first namespace found for the name is chosen.

options

An object specifying additional options. See the object specification table below for the required properties of this object.

Returns
Promise<WFSLayerInfo>

The layer info that can be used to create a WFSLayer

Example
const capabilities = await wfsUtils.getCapabilities(url);
const layerInfo = await wfsUtils.getWFSLayerInfo(capabilities, "layer");
const layer = WFSLayer.fromWFSLayerInfo(layerInfo);
// Same as
const layer = WFSLayer({
url,
name: "layer"
});