Summary
Imports a feature type from a web feature service (WFS) to a feature class in a geodatabase.
Usage
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 feature class name are specified. The output location can be the root level of a geodatabase or a feature dataset within a geodatabase.
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 just those that intersect a user-defined extent. You can also specify an output config keyword and output spatial grids using the geodatabase settings section of the environment settings.
Syntax
arcpy.conversion.WFSToFeatureClass(input_WFS_server, WFS_feature_type, out_path, {out_name})
Parameter | Explanation | Data Type |
input_WFS_server | The URL of the source WFS service. | String |
WFS_feature_type | The name of the feature type to extract from the input WFS service. | String |
out_path | The output location can be the root level of 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. | Workspace; Feature Dataset |
out_name (Optional) | The name of the feature class to create within the output location. If the feature class name already exists in the geodatabase, the name will be auto-incremented. By default, the feature type name is used. | String |
Derived Output
Name | Explanation | Data Type |
out_feature_class | The output feature class. | Feature Class |
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)
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes