Tutorial: Publishing a WFS service
In this topic
- Before beginning this tutorial
- Deciding between a geodata service or a map service
- Publishing a WFS service to ArcGIS Server
- Consuming the WFS service
- Using the Data Interoperability extension to connect to a WFS service
This tutorial shows how to publish a Web Feature Service (WFS) service to ArcGIS Server using ArcMap. WFS is a specification published by the Open Geospatial Consortium, Inc. (OGC) for serving geographic features on the Internet. When a map service or geodata service is published with WFS capabilities, the data can be accessed by OGC-compliant WFS clients, including the ArcGIS Data Interoperability extension for Desktop in ArcGIS for Desktop. These WFS clients can also see the latest changes made to the data. If you're new to WFS services and want to learn more about them before attempting this tutorial, see WFS services.
Before beginning this tutorial
If you've just installed ArcGIS Server, you need to complete some preparatory steps before you can connect to the server and publish services:
- For details on how to configure your ArcGIS Server site, see the Getting started after install section of this help system.
- To learn how to make the data referenced by your GIS resource available to the server, see the topic Making your data accessible to ArcGIS Server.
Deciding between a geodata service or a map service
With WFS services, you have the option of publishing a geodata service or a map service. There are a few differences to be aware of when selecting the type of service you're going to create. The following sections summarize the functionality available with map and geodata services to help you identify which type of service best suits your requirements.
Geodata service
A WFS geodata service allows you to access a workgroup, enterprise, or file geodatabase through the Internet or any OGC-compliant WFS client. When creating a WFS service from a geodata service, it's important to keep in mind that all the feature classes in the geodatabase will be exposed in the service.
Geodata services are useful in situations where you need to access geodatabases in remote locations; for example, a company may want to set up enterprise geodatabases to manage data in its Los Angeles and New York offices. Once created, each office can publish its enterprise geodatabase on the Internet using a geodata service.
Map service
A WFS map service represents a map document that you've made available to others through the Internet or any OGC-compliant WFS client. Map services with WFS functionality give you a lot of control over the data that's published through the service. The following are common reasons why you might set up a map service:
- Unlike a geodata service, a single map service can include data from a variety of sources including data from multiple geodatabases as well as shapefiles.
- You can select which feature classes are exposed through a map service.
- You can rename the feature classes in the map document so that the service does not expose the actual names in the data source.
There are also some limitations associated with WFS map services. Consider the following when publishing a WFS service from a map document:
- The map document is a specification of the layers that will be available in your WFS service. Symbology, query definitions, and field aliases defined at the layer level will not transfer to the WFS service, because the purpose of the service is to expose the features in the data. To expose the visual properties of your map through OGC specifications, use a WMS service.
- Two or more layers in the map cannot reference the same feature class.
- Two or more layers in the map cannot have the same name.
- Since WFS only works with features, any raster layers in the map will be excluded from the service.
- Nonspatial tables are not exposed.
- If you want the WFS service to support transactions for editing (WFS-T), the source data for all the layers in the map must come from the same workspace, for example, the same enterprise geodatabase.
Publishing a WFS service to ArcGIS Server
To get started publishing a WFS service, follow these steps:
- Follow the directions in the following table based on the service type you want to publish to the server:
Option Description To publish a WFS map service...
...open your map document in ArcMap, choose File > Share As > Service > Publish service, and click Next.
To publish a WFS geodata service...
...browse to the workgroup, enterprise, or file geodatabase in ArcCatalog or the Catalog window, right-click it, and choose Share as Geodata Service.
- In the Share as Service window, choose Publish a service, and click Next.
The Publish a Servicedialog box appears.
- In the Publish a Service dialog box, click Connect to ArcGIS Server to create a new connection to the server.
The Add ArcGIS Server window appears.
- In the Add ArcGIS Server window, choose Publish GIS Services, and click Next.
- For the Server URL, type the URL of the ArcGIS Server site you want to connect to. For example, http://gisserver.domain.com:6080/arcgis.
- From the Server Type drop-down list, choose ArcGIS Server.
- During the publishing process, a service definition file is created and temporarily stored locally on disk. When the publishing process completes, the service definition is uploaded to the server and the local file is deleted. For the purposes of this tutorial, accept the default staging folder and continue.
- If your server administrator has enabled security for your site, enter your User Name and Password, and click Finish.
- Optionally, in the Publish a Service window, type a new name for the service. The name cannot be more than 120 characters long and can contain only alphanumeric characters and underscores. Click Next.
- By default, services are published to the root folder (root) of ArcGIS Server. Services can be organized into subfolders under the root folder. Choose the folder where you want to publish the service, or create a new folder to contain the service. Click Continue.
- The Service Editor displays. You'll use the Service Editor to choose what users can do with your WFS service and take fine-grained control of how the server will expose your service. Click the Capabilities tab.
- By default, mapping and KML are enabled. Select WFS.
- In the left pane of the Service Editor, click WFS. Use this panel to choose how to configure the properties of your WFS service. By providing WFS service properties, clients can gain a better understanding of the service publisher.
- The URL field displays the URL clients use to access the WFS service. The URL will be formatted as follows: http://gisserver.domain.com:6080/arcgis/services/folder/service/MapServer/WFSServer.
Tip:
Copy and save the WFS service URL. You'll need it to perform additional steps in this tutorial.
- If you want to publish a WFS service with system-generated capabilities files, use the default Enter service properties below option. The Name, Title, and OnlineResource fields are automatically populated and should not be modified. Optionally, you can populate additional properties using the fields in the list. For more information, see Available WFS service properties.
- If you want to configure a WFS service to use external capabilities files, select Use external capabilities files. To use this option, you must have already created a WFS capabilities file. For more information, see Using external capabilities files with WFS services.
- The URL field displays the URL clients use to access the WFS service. The URL will be formatted as follows: http://gisserver.domain.com:6080/arcgis/services/folder/service/MapServer/WFSServer.
- Click Analyze .This examines your map document or geodatabase to see if it can be published to the server.
Tip:
To give yourself more viewing area when configuring your WFS service, click the Collapse button at the top of the Service Editor.
- Fix any Errors in the Prepare window; this must be done before you can publish. Optionally, you can fix the warnings and informational messages to further improve the performance and appearance of your WFS service. For more information about resolving these issues, see Analyzing your GIS resource.
Note:
You can register folders and geodatabases with your ArcGIS Server site, ensuring that the server can recognize and use your data. If you proceed with the following steps, any data referenced by your GIS resource originating from an unregistered folder or geodatabase will be copied to the server when you publish. This is a precautionary measure to ensure that the server can access all the data used by the service. For full instructions on registering a folder or geodatabase with your ArcGIS Server site, see Registering your data with ArcGIS Server using ArcGIS for Desktop.
- Optionally, in the Service Editor, click Preview . This can give you an idea of how your WFS service will look when viewed on the web. See Previewing your map for more information.
- Once you've fixed the errors in your map document or geodatabase, click Publish .
Consuming the WFS service
Once you've published a WFS service, it can be used in any client that supports WFS 1.0.0 or 1.1.0 and the Simple Features profile of GML, including web browsers. A web browser is one of the simplest clients of a WFS service. You can request information through HTTP, and the responses or exceptions are returned through the browser.
Follow these steps to access WFS services through a web browser:
- Open a web browser.
- Perform the GetCapabilities, DescribeFeatureType, and GetFeature requests as indicated in the following sections.
GetCapabilities
This request will return all feature types and functionality available through the service in GML format. To use the GetCapabilities operation, copy and paste the WFS service URL into the address bar and add ?request=getcapabilities to the end of the URL.
URL example: http://gisserver.domain.com:6080/arcgis/services/wfs_services/enterprise_wfs/GeoDataServer/WFSServer?request=GetCapabilities
The following graphic is an example of functionality returned by the GetCapabilities operation:
GetCapabilities also returns a list of all available feature classes and tables:
DescribeFeatureType
This request describes the field information about one or more features in the WFS service. This includes the field names, field types, allowed minimum and maximum field values, and any other constraints set on a field of the feature classes or tables.
To use the DescribeFeatureType operation, copy and paste the WFS URL into the address bar and add ?SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&VERSION=1.1.0 to the end of the URL. This will return all the field information about each of the feature types and tables available in the feature service.
URL Example: http://gisserver.domain.com:6080/arcgis/services/wfs_services/enterprise_wfs/GeoDataServer/WFSServer?SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&VERSION=1.1.0
Adding filters
You can also specify a single feature class or table for which you want the field information by appending the following request to the end of the URL with the name of the feature type or table: ?SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&TypeName=<enter feature type here>&VERSION=1.1.0.
For more information about the different filters available with WFS services, see Communicating with a WFS service in a web browser.
In the following example, the DescribeFeatureType request is used to identify the field information for the feature type called cities:
URL example: http://gisserver.domain.com:6080/arcgis/services/wfs_services/enterprise_wfs/GeoDataServer/WFSServer?SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&TypeName=cities&VERSION=1.1.0
GetFeature
This request returns information about specific feature types available through the WFS service.
To use the GetFeature operation in a web browser, copy and paste the WFS URL into the address bar and add ?request=getFeature&typename=<enter feature type here> to the end of the URL. This will return all the attribute and geometry information about each feature or row in the feature type.
URL example: http://gisserver.domain.com:6080/arcgis/services/wfs_services/enterprise_wfs/GeoDataServer/WFSServer?request=getfeature&typename=cities
Adding filters
You can also add filters in the request to refine the results that are returned. For example, you can request all the cities that are within a specified coordinate range. In the following example, two cities are located within a specified coordinate range. For more information about the different filters available with WFS services, see Communicating with a WFS service in a web browser.
URL example: http://gisserver.domain.com:6080/arcgis/services/wfs_services/enterprise_wfs/GeoDataServer/WFSServer?request=getfeature&typename=cities&BBOX=46.90,-76.21,42.12,-72.88
Using the Data Interoperability extension to connect to a WFS service
The ArcGIS Data Interoperability extension for Desktop allows you to read and write data in data formats other than ArcGIS. You can use the Interoperability Connection tool in ArcCatalog or the Catalog window in ArcGIS for Desktop to connect directly to external Esri data formats, including WFS services. Once the connection is made, the data source will appear under the Interoperability Connection entry in the Catalog tree. A connection is just like any other dataset in that you can add it to the table of contents or use it in geoprocessing tools.