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

arcpy.conversion.WFSToFeatureClass(input_WFS_server, WFS_feature_type, out_path, out_name, {is_complex}, {max_features}, {expose_metadata}, {swap_xy})
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=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 service, the output location can be a geodatabase or a feature dataset in 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

The name of the output feature class or geodatabase.

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

String
is_complex
(Optional)

Specifies whether the input_WFS_server service is a complex WFS service.

  • COMPLEXThe WFS service is a complex WFS service.
  • NOT_COMPLEXThe WFS service is not a complex 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 tables with metadata 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

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.WFSToFeatureClass_conversion(WFS_Service, WFS_FeatureType, Out_Location, Out_Name)

Licensing information

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

Related topics