WFS To Feature Class (Conversion)

Summary

Imports a feature type from a Web Feature Service (WFS) to a feature class in a geodatabase.

Usage

  • Download features from a simple or complex WFS service.

  • After setting the URL for the WFS server, all feature types published from the server will be listed. Examples can include WFS feature types for schools, roads, and parcels. One of these is then selected and an output location and name are specified.

  • By default, all features from the WFS source are added to the feature class. The extent environment setting can be used to limit the features to only those that intersect a user-defined extent. You can also specify an output configuration keyword using the geodatabase settings section of the environment settings.

Parameters

LabelExplanationData Type
WFS Server

The URL of the source WFS service (for example, http://sampleserver6.arcgisonline.com/arcgis/services/SampleWorldCities/MapServer/WFSServer?). If the input is a complex WFS service (Complex WFS service is checked), this can also be the path to the .xml file.

String
Select Feature Type to Extract

The name of the WFS layer to extract from the input WFS service.

String
Output Location

The location of the output feature class or geodatabase.

If the input is a simple WFS, the output location can be a geodatabase or a feature dataset in a geodatabase. If the output location is a feature dataset, the coordinates will be converted from the source coordinate system to the coordinate system of the feature dataset.

If the input is a complex WFS service, the output location must be a folder.

Workspace; Feature Dataset; Folder
Name

The name of the output feature class or geodatabase.

If the input is a simple WFS service, the name will be used to create a feature class in the output location. If the feature class name already exists in the geodatabase, the name will be automatically incremented. By default, the feature type name is used.

If the input is a complex WFS service, the name will be used to create a geodatabase in the output location.

String
Complex WFS service
(Optional)

Specifies whether the WFS Server parameter value is a complex WFS service.

  • Checked—The WFS service is a complex WFS service.
  • Not checked—The WFS service is not a complex WFS. This is the default.

Boolean
Max Features
(Optional)

The maximum number of features that can be returned. The default is 1000.

Long
Expose Metadata
(Optional)

Specifies whether metadata tables will be created from the service. This is only applicable for complex WFS services.

  • Checked—Metadata tables will be created in the output geodatabase.
  • Not checked—Metadata tables will not be created in the output geodatabase. This is the default.

Boolean
Swap XY Axis Order
(Optional)

Specifies whether the x,y axis order of the output feature class will be swapped. Some WFS services may have the order of the x,y coordinates swapped on the server side, causing the feature class to display incorrectly.

  • Checked—The x,y axis order will be swapped.
  • Not checked—The x,y axis order will not be swapped. This is the default.

Boolean
Page Size
(Optional)

The page size that will be used when downloading features from the WFS service. The default is 100.

Some servers limit the number of features that can be requested at a time or server performance may be slow when requesting a large number of features in a single request. Use this parameter to request a smaller number of features in multiple pages to avoid server timeouts or maximum feature limits.

This parameter is only applicable for simple WFS 2.0 services that support startIndex and count WFS parameters. It will be ignored for older versions of WFS (1.1.0, 1.0.0).

Long

Derived Output

LabelExplanationData Type
Output Feature Class

The output feature class when converting a simple WFS service.

Feature Class
Output Workspace

The output file geodatabase when converting a complex WFS service.

Workspace

arcpy.conversion.WFSToFeatureClass(input_WFS_server, WFS_feature_type, out_path, out_name, {is_complex}, {max_features}, {expose_metadata}, {swap_xy}, {page_size})
NameExplanationData Type
input_WFS_server

The URL of the source WFS service (for example, http://sampleserver6.arcgisonline.com/arcgis/services/SampleWorldCities/MapServer/WFSServer?). If the input is a complex WFS service (is_complex = "COMPLEX"), this can also be the path to the .xml file.

String
WFS_feature_type

The name of the WFS layer to extract from the input WFS service.

String
out_path

The location of the output feature class or geodatabase.

If the input is a simple WFS, the output location can be a geodatabase or a feature dataset in a geodatabase. If the output location is a feature dataset, the coordinates will be converted from the source coordinate system to the coordinate system of the feature dataset.

If the input is a complex WFS service, the output location must be a folder.

Workspace; Feature Dataset; Folder
out_name

The name of the output feature class or geodatabase.

If the input is a simple WFS service, the name will be used to create a feature class in the output location. If the feature class name already exists in the geodatabase, the name will be automatically incremented. By default, the feature type name is used.

If the input is a complex WFS service, the name will be used to create a geodatabase in the output location.

String
is_complex
(Optional)

Specifies whether the input_WFS_server parameter value is a complex WFS service.

  • COMPLEXThe WFS service is a complex WFS service.
  • NOT_COMPLEXThe WFS service is not a complex WFS service. This is the default.
Boolean
max_features
(Optional)

The maximum number of features that can be returned. The default is 1000.

Long
expose_metadata
(Optional)

Specifies whether metadata tables will be created from the service. This is only applicable for complex WFS services.

  • EXPOSE_METADATAMetadata tables will be created in the output geodatabase.
  • DO_NOT_EXPOSEMetadata tables will not be created in the output geodatabase. This is the default.
Boolean
swap_xy
(Optional)

Specifies whether the x,y axis order of the output feature class will be swapped. Some WFS services may have the order of the x,y coordinates swapped on the server side, causing the feature class to display incorrectly.

  • SWAP_XYThe x,y axis order will be swapped.
  • DO_NOT_SWAP_XYThe x,y axis order will not be swapped. This is the default.
Boolean
page_size
(Optional)

The page size that will be used when downloading features from the WFS service. The default is 100.

Some servers limit the number of features that can be requested at a time or server performance may be slow when requesting a large number of features in a single request. Use this parameter to request a smaller number of features in multiple pages to avoid server timeouts or maximum feature limits.

This parameter is only applicable for simple WFS 2.0 services that support startIndex and count WFS parameters. It will be ignored for older versions of WFS (1.1.0, 1.0.0).

Long

Derived Output

NameExplanationData Type
out_feature_class

The output feature class when converting a simple WFS service.

Feature Class
out_gdb

The output file geodatabase when converting a complex WFS service.

Workspace

Code sample

WFSToFeatureClass example 1 (stand-alone script)

The following script demonstrates how to execute the WFSToFeatureClass function in a stand-alone script.


# Name: WFSToFeatureClass_example1.py
# Description: Create a feature class from a WFS service

# Import arcpy module
import arcpy

# Set local variables
WFS_Service = "http://sampleserver6.arcgisonline.com/arcgis/services/SampleWorldCities/MapServer/WFSServer?request=GetCapabilities&service=WFS"
WFS_FeatureType = "cities"
Out_Location = "C:/Data/Default.gdb"
Out_Name = "SampleWorldCities"

# Execute the WFSToFeatureClass tool
arcpy.conversion.WFSToFeatureClass(WFS_Service, WFS_FeatureType, Out_Location, Out_Name)

Related topics