Skip To Content

WFS To Feature Class

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 are 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.

Syntax

WFSToFeatureClass(input_WFS_server, WFS_feature_type, out_path, out_name, {is_complex}, {max_features}, {expose_metadata})
ParameterExplanationData 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=True), 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

If the input is a simple WFS service, the output location can be a geodatabase or a feature dataset within a geodatabase. If the output location is a feature dataset, the coordinates are 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

If the input is a simple WFS service, the name is used to create a feature class within 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 is used to create a geodatabase in the output location.

String
is_complex
(Optional)

Specify if the input_WFS_server service is a complex WFS service.

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

Specify the maximum number of features that can be returned. This parameter is only applicable for complex WFS services. The default is 1000.

Long
expose_metadata
(Optional)

Specifies whether to create tables with metadata from the service. This is only applicable for complex WFS services.

  • TRUECreate metadata tables in the output geodatabase.
  • FALSEDo not create metadata tables in the output geodatabase. This is the default.
Boolean

Derived Output

NameExplanationData Type
out_feature_class

When converting a simple WFS service, this will be the output feature class.

Feature Class
out_gdb

When converting a complex WFS service, this will be the output file geodatabase.

Workspace

Code sample

WFSToFeatureClass example 1 (stand-alone script)

The following script demonstrates how to execute the WFSToFeatureClass tool 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.WFSToFeatureClass_conversion(WFS_Service, WFS_FeatureType, Out_Location, Out_Name)

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics