A Web Feature Service (WFS) is an open specification for serving geographic features over the web. Unlike a Web Map Service (WMS), a WFS service returns actual features with geometry and attributes. You can connect to an Open Geospatial Consortium (OGC) WFS service in ArcGIS AllSource by creating a WFS service connection or adding a WFS item from your active portal.
Add a WFS server connection
To add a WFS server connection, complete the following steps:
- On the Insert tab, in the Project group, click the Connections button, click Server, and click New WFS Server .
The Add WFS Server Connection dialog box appears.
- Type the URL of the WFS server site you want to connect to in the Server URL text box.
The URL varies depending on the site configuration.
An example URL is: https://sampleserver6.arcgisonline.com/arcgis/services/SampleWorldCities/MapServer/WFSServer
- From the Version drop-down menu, select the WFS version you want to connect to.
The default version connects to the highest number version supported on the server.
- If the WFS service you are connecting to has additional capabilities or you want to set an ArcGIS AllSource client-specific property for the WFS server connection, add custom request parameter names and values to the Custom request parameters section.
Some examples of ArcGIS AllSource client-specific reserved keywords that are commonly used are PAGESIZE to enable client-side paging, BBOX to limit features to a specific geographic area, MAXFEATURES to set the limit for number of features displayed in the map (by default a limit of 3000 is used), and SWAPXY to swap the axis order of the layer. These keywords are applied to all layers listed in the WFS server connection. To modify the properties for individual layers, you can view or modify them on the WFS tab of the layer properties. Be aware that ArcGIS AllSource cannot validate server-specific additional parameters.
To add custom parameters, do the following:
- Click in the first cell.
- Specify the parameter name in the cell under the Parameter column.
- Specify the parameter value in the cell under the Value column.
- To add more parameters, click the Add Row button and repeat steps a through c.
To delete custom parameters, do the following:
- Select the row that contains the parameter to be deleted.
- Click Remove Row to delete the row.
- Repeat steps a and b for every parameter to be deleted.
- If applicable, authenticate the service by doing one of the following:
- If the service is secured using basic authentication, in the Authentication drop-down menu, click Server Authentication, and type the username and password. To save the user name and password to Windows Credential Manager or in the connection file, check the options under the Save Login heading.
- If the service is secured using OAuth 2.0 based authentication, in the Authentication drop-down menu, click the appropriate connection from the drop-down list. See Connect to authentication providers from ArcGIS Pro to learn how to add a connection to authentication providers if one is not available. If necessary, click Sign In to authenticate the connection with the provider.
- Click OK.
A WFS connection file (.wfs) is created and saved in the project's home folder. An item referencing this connection file is added to the project, and the connection appears in the Servers folder on the Project tab of the Catalog pane.
- Expand the WFS connection to view the layers in the WFS service, right-click a layer and click an option in the Add To New drop-down menu, or click Add To Current Map to add the WFS layer to the map.
You can also add the service to the map by dragging it onto the map or into the Contents pane.
The WFS item is added to the map. You can cancel adding the layer to the map by clicking Cancel on the progress dialog box. If the service supports paging, a default page size of 200 is used when adding the layer to the map. If the data does not display as expected when added to the map, you can modify the WFS layer properties.
WFS services allow you to add one or more layers. To select a group of layers, press Shift and click the first and last sublayer in the group you want to add. You can also select nonsequential layers by pressing Ctrl while clicking each individual layer. After selecting the layers, right-click the selected layers and choose to add them to either the current map or a new map. Adding multiple layers at once takes longer than adding one layer.
Add a WFS service from your active portal connection
WFS services can also be added to your portal. There are three sources for WFS items in your portal as follows:
- WFS services that are published to ArcGIS Server sites you have federated with your portal are added automatically as items in your portal.
- Third-party WFS services that are added as an item in your portal.
- Hosted WFS services, which are created by publishing a WFS service from a hosted feature layer.
Each of these types of WFS portal items can be added to the map using the following steps:
- In the Catalog pane, click the Portal tab.
- Browse to or search for the WFS items you want to use from the My Content, My Groups, or ArcGIS Online collections.
Hover over a portal item to see the item type.
- Right-click the item and click an option in the Add To New drop-down menu, or click Add To Current Map to add the WFS layer to the map.
You can also add the service to the map by dragging it onto the map or into the Contents pane. If the service contains multiple layers, you are prompted to choose the layer to add to the map.
The WFS item is added to the map. You can cancel adding the layer to the map by clicking Cancel on the progress dialog box. If the data does not display as expected when added to the map, you can modify the WFS layer properties.
WFS services allow you to add one or more layers. To select a group of layers, press Shift and click the first and last sublayer in the group you want to add. You can also select nonsequential layers by pressing Ctrl while clicking each individual layer. After selecting the layers, right-click the selected layers and choose to add them to either the current map or a new map. Adding multiple layers at once takes longer than adding one layer.
Use a custom request parameter
The custom request parameters form can be used to input additional capabilities that are supported by the WFS service. The input key value pair can be a custom parameter that is specific to the WFS server implementation, or you can use one of the reserved keywords implemented by the ArcGIS AllSource client.
Use a key value pair
Some WFS services may have specific key-value pairs that are used to execute a custom query on the service. The key-value pair will be appended to the WFS URL after the question mark character. For example, the WFS URL is https://sampleserver6.arcgisonline.com/arcgis/services/SampleWorldCities/MapServer/WFSServer?. If you have a custom parameter named myCustomKey, you can enter the myCustomKey value into the Parameter cell and enter the value in the Value cell. When ArcGIS AllSource makes a request to connect to the WFS service, it will append the key value pair to the WFS URL, for example, https://sampleserver6.arcgisonline.com/arcgis/services/SampleWorldCities/MapServer/WFSServer?request=GetCapabilities&service=WFS&myCustomKey=myValue.
Use a reserved keyword
The ArcGIS AllSource WFS client has reserved keywords that can be used to specify a connection property for the WFS server connection. The value you set for these parameters will apply to all layers in the WFS service. If you want to apply a reserved keyword to individual layers in the WFS service instead of per service connection, you must create multiple connections with the different parameter values or update the WFS layer properties in the map. The following table lists the custom parameter names and values you can use to set the properties of the WFS server connection file:
Keyword | Description |
---|---|
BBOX | Provide a bounding box extent to limit the extent of the features returned, for example, -122.5,37.7,-122.3,37.8. This parameter is useful when you want to limit the number of features returned in all of the WFS layers to a specific geographic area. This is only applicable for snapshot mode. |
MAXFEATURES | Set the maximum number of features returned for layers in a WFS server connection. Setting this value can avoid performance problems if the service has a large number of features. The default value is 3000. If your data is large, you can set this to a large number to see more features. If your service supports paging, you can adjust the PAGESIZE parameter to more efficiently load your data. |
OUTPUTFORMAT | Specify the format in which to request the features. WFS services can support multiple output format types, but by default, the format is GML. Only use this option if the service supports the output format specified. You can check which output formats the service supports in the GetCapabilities response.
The SWAPXY and SWAPXYFILTER properties are not applicable when the output format is GeoJSON. |
PAGESIZE | Specify the page size to use when a GetFeature request is made to load data into the map. By default, if the service supports paging, a page size value of 200 is used. A service that does not support paging may have slow performance when requesting a large number of features in one request. Use this keyword to request a specific number of features to be returned per page. For example, PAGESIZE equals 100. This keyword is only applicable for WFS 2.0 services that support startIndex and count parameters. The keyword is not applicable when using the on demand connection mode. |
STRINGLENGTH | Specify the length for text fields in the WFS layer. When a layer is opened in the map, the length of all text fields is truncated to 255 characters by default. |
SWAPXY | Swap the x,y coordinates for the display of the layer.
|
SWAPXYFILTER | Swap the x,y coordinates for spatial filter requests sent to the server.
|
Note:
With the exception of the BBOX, STRINGLENGTH, OUTPUTFORMAT, and PAGESIZE keywords, all of the keywords have a corresponding setting for the layer in the WFS layer properties. You can access the WFS layer properties by right-clicking the layer in the Contents pane and choosing Properties.
In addition to the keywords listed that can be used to specify WFS server connection properties, there are other reserved keywords that cannot be used since they have special meaning for WFS services or ArcGIS. These keywords include NAMESPACE, TYPENAME, VERSION, SERVICE, CRSNAME, REQUEST, USER, URL, PASSWORD, MODE, ANONYMOUS, HTTPTIMEOUT, CAPABILITIES_PARAMETERS, and CONNECTIONPATH.
Use the WFS to Feature Class tool
You can use the WFS to Feature Class geoprocessing tool to download data from a WFS service into a geodatabase. The tool allows you to script downloading WFS data and supports complex WFS services.
To use the tool to download data from a complex WFS service, use the following steps:
- Open the WFS to Feature Class geoprocessing tool.
You can open the tool by navigating to it in the Geoprocessing pane in the Conversion toolbox under the From WFS toolset, or you can use the search bar to search for the tool by name.
The WFS to Feature Class tool dialog box appears.
- If your WFS service is a complex service, check the Complex WFS service check box.
- Paste or type in the URL of your WFS service in the WFS Server parameter and click outside of the parameter text box..
http://gisserver.example.com/geoserver/ows?
This populates the Select Feature Type to Extract parameter drop-down menu with a list of available layers to download.
- Select a layer from the drop-down menu.
- Provide a location for the download using the Output Location parameter.
If the Complex WFS service is checked, the output will be a file geodatabase so the location must be a folder.
If the Complex WFS service is unchecked, the output will be a feature class so the location must be a geodatabase or a feature dataset in a geodatabase.
- Provide a name for the output feature class or geodatabase in the Name parameter.
- Optionally, choose to enter a value for the Max Features parameter to limit the number of features returned.
- Optionally, if Complex WFS service is checked, expose the service metadata by checking the Expose Metadata parameter, which will create and populate metadata tables in the output geodatabase.
To automate this process in a Python script, you can find code samples in the tool documentation.