Tutorial: Creating a Web editing application
With ArcGIS Server, you can create Web applications for editing data without writing any code. You create these applications in ArcGIS Server Manager. This example shows how to create a Web editing application in Manager.
Creating the application is actually the final step of a larger workflow. The first step is to make your data available through an ArcSDE geodatabase. This example uses a database server (ArcSDE for SQL Server Express) because it works with the free Microsoft SQL Server Express database and is available with the Workgroup level of ArcGIS Server. Once you have your data available through ArcSDE, you need to create a map from the data and symbolize it appropriately. You'll publish this map document to ArcGIS Server so that it will be available to users of your Web application. As a final step, you'll create and configure the Web application with the Editing task. This document explains each part of the workflow.
Making the data available through ArcSDE
There's no specific data that you need for this tutorial. It's recommended that you use a subset of your own data that includes some point, line, and polygon layers. By using your own data for this test application, you'll be well prepared to create your production application.
Installing ArcSDE
Creating a Web editing application in Manager requires that your data be available in an ArcSDE geodatabase. That's because ArcSDE geodatabases are designed to be edited simultaneously by multiple users, which is the situation you'll encounter through a Web application.
If your data is in ArcSDE already, you can skip the rest of this section. If your data is in some other format, you need to move it to ArcSDE. An easy way to set up a small deployment is to use the ArcSDE included with ArcGIS Server Workgroup, which uses the Microsoft SQL Server Express database.
The first thing you need to do, if you haven't already, is install ArcSDE for SQL Server Express. The ArcSDE CD or DVD comes with ArcGIS Server and contains an Install Guide that can help you through the installation and postinstallation.
Note: If you want to work through this tutorial and you have ArcGIS Server Enterprise, chances are your data is in ArcSDE already. If not, you need to install ArcSDE Enterprise and move your data into it before continuing with this tutorial. The steps below are for the Workgroup level of ArcGIS Server and will not work with ArcGIS Server Enterprise. You can find information about administering Enterprise geodatabases in the ArcGIS Desktop Help book Administering geodatabases licensed through ArcGIS Server Enterprise.
Creating the geodatabase
Once you've installed ArcSDE for SQL Server Express, follow these steps to create a geodatabase:
- Start ArcCatalog and find the Database Servers node. A database server is a machine containing a SQL Server Express database and ArcSDE for SQL Server Express. This is where you'll add and manage your geodatabase.
-
Double-click Add Database Server and enter the SQL Server Express instance to which you want to connect. In most cases, this will take the form of <database server name>\sqlexpress. You'll see the server appear in the list.
Tip: If you have any difficulties connecting to the database server, see Troubleshooting database servers.
- The ArcGIS Server Object Container (SOC) account needs permission to read data from the database server. Right-click the database server you just added and click Permissions.
- Click Add User and add the SOC account.
- Now you can add a new geodatabase. In the list of Database Servers, right-click your server and click New Geodatabase.
- Type a Name for your geodatabase, then set a Location and Initial Size. Don't worry about setting the initial size too low; the geodatabase will grow as it needs to until it reaches SQL Server Express's 4 GB limit.
- You've already given the SOC account permissions to use the database server, but now you need to define the permissions the SOC account will have for this specific geodatabase. Right-click your new geodatabase and click Administration > Permissions.
-
Click the SOC account, give it Read/Write permissions, then click OK.
Tip: If you don't see the SOC account in the list, make sure you completed steps 3 and 4.
- Use ArcCatalog to copy and paste any existing feature classes that you want to add to your new geodatabase.
A note about attribute domains and subtypes
To enhance the user experience of the Editor task and to prevent data entry errors, configure your datasets to use subtypes and attribute domains where appropriate. These provide ways of categorizing your data and ensuring that appropriate values are entered when the data is edited. In some cases, the Editor task can detect and use the subtypes and domains. For example, if you have a domain limiting the color of a fire hydrant to red, yellow, or blue, you will see a drop-down list in the Editor task allowing only the selection of one of those three colors.
The picture below shows part of an Editor task in which a roads feature class has been configured to use a domain. The user can now classify the road using a drop-down list.
Remember, if you want these drop-down lists to be available in the Editor task, you'll need to prepare your geodatabase by creating domains and subtypes. This might happen long before you publish the service or create the Web application.
Authoring the map
The map you use in your Web editing application can contain both editable and noneditable layers. Follow these steps to create the map:
- Start ArcMap and open a new empty map.
- Add all the layers you want to see in the map. You should include at least one layer from an ArcSDE geodatabase. Only layers from ArcSDE geodatabases will be editable through the Editor task.
-
Set up the symbology and layer order that you need.
Tip: If you set a layer's symbology based on unique values, the different symbols will appear in the Editor task as individual buttons. This can help a user quickly pick the type of feature he or she would like to create. For example, the image below shows what the Editor task looks like when the Buildings layer of the map has a unique value renderer applied. The renderer was based on a building type field. The task exposes buttons for creating each type of building. Clicking the green button allows the user to create a residential building.
- Save the map document.
Publishing the map service
Once your map document is complete, you can publish it as a map service. When you publish a map service, you make it available on your ArcGIS Server so that many users can access it at once.
Choosing pooled or nonpooled
You can choose to make a service available in either pooled or nonpooled modes. When you use a pooled service, you share instances of the service with many other users while you work through your edit session. In contrast, when you use a nonpooled service, an instance of the service is dedicated to you throughout your entire edit session. With nonpooled services, if someone else needs to use the service at the same time as you, another instance of the service must be created at the expense of server resources.
You can use both pooled and nonpooled services for editing over the Web. When you edit with pooled services, each edit is saved immediately. This means that the data cannot be versioned and you cannot undo your edits. However, using pooled services, you can accommodate many more concurrent editors than you can with nonpooled services.
Setting the required permissions
Before publishing your services, be sure to read and follow the guidelines presented in Preparing resources for publishing as services. These will help you ensure that the server has permissions to read and access all the data for your map. Specifically, the SOC account needs to have read permissions to your map document and any data in the map document. It also needs to have write permissions to any data that you will be editing.
Publishing the service
Follow these steps to publish a map service that you can use for editing:
-
Log in to ArcGIS Server Manager and click Publish a map, globe, or other GIS resource as a service.
Tip: There are two wizards in Manager that you can use to publish services. This link takes you to the Publish GIS Resource wizard, which is the simplest way to create a service. It asks you the minimum amount of information needed to create a service.
The other way to create services is through the Add New Service wizard. This wizard is the completely manual way of publishing a service; it prompts you for all the service parameters.
- On the first page of the wizard, you're prompted for the resource that you want to publish. This is the map document you just created. If it's in a shared directory, you can browse to the map document. If it's not in a shared location, carefully type the path of the map document.
- Give your service a Name. Optionally, if you have your services grouped in folders, choose the folder where you want to publish the service. Click Next to move to the second page of the wizard.
- Notice that the Mapping capability is enabled by default. The other available capabilities will vary depending on what types of layers are in your map. For this example, you can accept the default and click Next.
- The final page of the wizard explains that the service will be created and gives its URL. Click Finish to publish the service and close the wizard.
Important: This wizard creates a pooled service by default. If you need to do versioned editing or you require the undo/redo capability, you need to change this to nonpooled. In Manager, click the Services tab, find your service, then click the Edit (pencil) icon. Click the Pooling tab and change the service to be Not Pooled. Click Save.
Creating the Web application
Once you have a running map service, you can create the Web editing application. You'll do this using the Manager wizard interface for creating a Web mapping application. Some of the most important things you'll do in this wizard are selecting the map for the application to display (telling it to use a local connection) and configuring the Editor task.
These are the steps for creating the Web application:
- Click the Applications tab in Manager and click Create Web Application. A wizard appears that helps you create the application.
- Type a Name for your application. This name will appear in the application's URL. Optionally, type a description for use within Manager and click Next.
- The next page helps you choose the services you want to display in your map. You need to add the map service you just published that contains your editable layers, so click Add Layer.
-
Examine the list of servers in the Available Services dialog box. Does your server name appear, followed by the words ArcGIS Server Local? If not, you need to click Add GIS Server, choose to add an ArcGIS Server Local connection, then type the name of your server and click Add.
Remember: An ArcGIS Server local connection is required for editing. Your Web application will still be available through the Internet, but the application itself needs to make a local connection to the GIS server for the editing to occur.
- Once you've successfully added your server, you'll see a list of available services that you can add to your map. Click the map service that you just published and click Add.
- Once you see a message that the layer has been added successfully, click Close to close the dialog box and click Next to move to the next page of the wizard.
-
On this panel, you can choose the tasks you want in your application. You want to include the Editor task, so click Add Task. In the Available Task Items list, click Editor and click OK.
-
With the Editor task still selected, click Configure. You can use the resulting dialog box, the task configurator, to do the following things:
-
Choose the layers and versions you can edit
You may not want to expose all the layers in your map for editing. Similarly, you may want your users to only edit specific versions. On the General tab, you can check and uncheck the editable layers and versions.
-
Choose the types of edits users can make
On the Settings tab of the configurator, you can choose whether or not users will be able to add features, edit attributes, or edit features. For example, you may want users to be able to add new features, with the assurance that they will not modify any existing features in the database.
-
Set the selection rules
To edit a feature, you first need to select it. The configurator gives several options for how users make selections and how many features they can select at once. You can set these options here, or you can choose if these options are exposed through the task so that each user can set it up in his or her preferred way.
-
Set the snapping rules
When editing a feature, you may want to share boundaries or vertices with existing features. Snapping is a way to ensure that if you place a feature close enough to an existing vertex or boundary, your feature will share that vertex or boundary. Snapping is important for maintaining data quality; it can help you avoid topological problems like overshoots and sliver polygons.
On the Settings tab of the configurator, you can set snapping rules, such as which features can be snapped to and how close you need to click for snapping to occur (this distance is known as the snapping tolerance).
-
Set conflict resolution rules
What happens when two people edit the same features, then save their edits? On the Advanced tab of the configurator, you can set rules for the way the database will handle these situations. See the topic Editor task for a discussion of different conflict resolution options.
If you're editing a pooled service, you won't be able to set any of the conflict resolution options; this is because in the nonversioned editing environment, the edits are saved immediately. If two people edit the same feature, the last edit to be made is the one that will remain in the database.
Tip: If you see a message that your map does not contain editable layers, check to make sure that you gave the SOC account Read/Write permissions to the geodatabase, as described previously in this document. Your map must contain at least one layer from a geodatabase before you can edit.
-
Choose the layers and versions you can edit
- When you've configured the Editor task the way you want it, click OK to close the dialog box and click Next to move to the next page of the wizard. Read the information about local connections and, if necessary, change the account that will be used to make the local connection.
- You've completed the essential parts of configuring the Editor task, so you can click Next to advance through the remaining pages of the wizard. These give you the opportunity to customize the look of your application. When you're ready to create the application, click Finish.
Using the Web editing application
As you view your new Web application, you'll see a list of tasks across the top of the map. You can open the Editor task from this task bar. The Editor task runs inside its own floating panel, which you can move around the screen.
The application has built-in help that you can access by clicking the Help link in the upper right corner. The help has an Editing data section that explains each tool on the Editor task dialog box. This help was created in HTML so that you can customize it if needed.
Editing in a Web application has a slightly different feel from editing in ArcMap. When using the Editor task, you'll often need to point and click in situations where you may be accustomed to clicking and dragging in ArcMap. Also, when snapping, the pointer does not automatically jump to the snap point on the screen, but the snapping will occur if you place the point within the snapping threshold.
It may be helpful to prepare a practice application that your editors can use to familiarize themselves with the Web editing environment. This is especially recommended if your editors will be working with nonversioned data, where undo/redo is not available.