Tutorial: Setting up feature service data for offline use

Complexity: Intermediate Data Requirement: Use your own data Goal: Set up feature service data that can be used when working with maps offline.

Web-based editing allows a larger group of people to add to and improve on your data. These include field-workers, analysts in other departments of your company, or perhaps even crowdsourced volunteers who may be able to make valuable contributions to your data given a user-friendly editing interface.

In this tutorial, you'll learn how to set up your feature service data so that is can be used when working with maps offline. To do this, you'll set up a fictitious enterprise geodatabase for the purposes of managing shoreline bird sightings.

This tutorial will demonstrate how to do the following:

  1. Set up an enterprise geodatabase using a database platform such as PostgreSQL, SQL Server, or Oracle.
  2. Author a map document that supports web editing. This involves designing the map document to be compliant with the feature service. The feature service allows users to add and edit bird sightings in your enterprise geodatabase.
  3. Prepare your enterprise geodatabase for publishing to ArcGIS Server. This involves setting up the data to support the feature service sync capability, connecting to ArcGIS Server, and registering your database with the server.
  4. Publish your map document as a map service with the Feature Access and sync capability enabled. This creates a feature service endpoint through which client applications can edit the bird sightings in your map while offline.

Before beginning this tutorial

If you've just installed ArcGIS Server, consider reading the following before you begin this tutorial:

Set up an enterprise geodatabase

Feature services can be published using data from an enterprise geodatabase. That's because enterprise geodatabases are designed to be edited simultaneously by multiple users, which is the situation you'll encounter in this tutorial. Enterprise geodatabases support a variety of database platforms, such as PostgreSQL, SQL Server, and Oracle.

For the purposes of this tutorial, you'll need to set up an empty enterprise geodatabase to store the features you create and edit. If you've already installed a supported database platform and have an empty geodatabase set up, skip ahead to the next section. If you don't, you'll need to create a new enterprise geodatabase by installing an appropriate database platform on your machine. Before doing so, make sure that your operating system and license level of ArcGIS Server and ArcGIS for Desktop support the database platform you want to install. For more information on system requirements, see the ArcGIS System Requirements. For more information on licensing requirements, see the ArcGIS 10.3 for Server functionality matrix or contact your Esri representative.

The following topics describe the installation process for each database platform. They also include links to ancillary topics that describe how to create a new enterprise geodatabase and properly configure it for use within your organization. Once you have installed the appropriate database platform and created a new geodatabase, move on to the next section in this tutorial.

Create a new database user

Once you've created an empty enterprise geodatabase, you'll need to create a new database user to manage your edits. To do this, you'll need to first connect to your geodatabase as the database administrator, create a new database user, then reconnect to the database as the new user.

Connect to the database and create a new user

Steps:
  1. In ArcCatalog or the Catalog window in ArcMap, expand the Database Connections folder Database Connection and double-click Add Database Connection Add Database Connection.

    The Database Connection dialog box opens.

  2. From the Database Platform drop-down list, choose the type of database with which you want to connect.
  3. Enter the appropriate database properties and authentication credentials to connect to the database. If you need help, see Database connections in ArcGIS for Desktop to learn how to enter the correct information to connect to your database.

    You must connect as a database administrator to create a user.

  4. Click OK. The connection to your database appears in the Database Connections node Database Connection.
  5. Right-click your new database connection and choose Administration > Add User. This launches the Create Database User geoprocessing tool.
  6. On the Create Database User dialog box, enter a new database user name and database user password, for example, User: editor, Password: tutorial.
  7. Click OK.

    The new user is created in the database, and has been granted the privileges necessary to create tables and feature classes.

Reconnect to the database as the new user

Steps:
  1. Remaining in ArcCatalog or the Catalog window in ArcMap, expand the Database Connections Database Connection folder and double-click Add Database Connection Add Database Connection.
  2. On the Database Connection dialog box, enter the authentication credentials for the user you created in the previous section.
  3. Click OK.

    You are now connected to the database as the new user.

  4. In the Database Connections folder Database Connection, delete the first connection you established to your database. This will help eliminate confusion when specifying your database connection file later in the tutorial.

Author a map document to support feature services and web editing

After you've set up your enterprise geodatabase, you can begin the work of authoring a map document to support the feature service you'll use for web editing.

In this section of the tutorial, you will do the following:

To get started, follow the steps in the sections below.

Create an attribute domain

To enforce data integrity when editing, you'll configure an attribute domain to limit the sightings added to your database to a few specific bird types.

Steps:
  1. Start ArcMap, open a new empty map document, then save the map document. The map document does not have to be saved in a location that is visible to the ArcGIS Server account.
  2. In the Catalog window, expand the Database Connections folder Database Connection.
  3. Right-click your database connection and choose Properties Properties.
  4. On the Database Properties dialog box, click the Domains tab.
  5. In the Domain Name field, click the first cell and type Type.
  6. In the Description column next to the domain name, click the first cell and type Bird Type.
  7. In the Domain Properties section, click the cell next to Field Type and choose Long Integer.
  8. Click the cell next to Domain Type and choose Coded Values.
  9. In the Coded Values section, click the first cell under Code and type 0.
  10. In the Description column next to the code, click the first cell and type Alcid/Pelagic.
  11. Enter the remaining bird types in the Coded Values section from the list below:

    Code

    Description

    1

    Diving Bird

    2

    Gull/Tern

    3

    Raptor

    4

    Shorebird

    5

    Wading Bird

    6

    Waterfowl

    7

    Unknown

  12. Specifying the domain for the shoreline bird sightings database

  13. Click OK.

Create a feature class

In this section of the tutorial, you'll create a point feature class that will represent the various types of birds in your bird sightings geodatabase. This includes defining the spatial reference of the feature class and assigning your domain to a new field in the feature class table. To get started, follow these steps:

Steps:
  1. In the Catalog window, right-click your database connection and choose New > Feature Class.
  2. On the New Feature Class dialog box, type shoreline_birdsightings in the Name field.
  3. From the Type drop-down list, choose Point Features. Click Next.
  4. In the coordinate system search box, type web mercator (auxiliary sphere) and click Search Search.
  5. In the results list, choose WGS 1984 Web Mercator (auxiliary sphere). This is the same coordinate system used by ArcGIS Online and will allow you to seamlessly overlay your feature service with ArcGIS basemap services. Click Next.
  6. In the XY Tolerance panel, accept the defaults and click Next.
  7. In the Configuration Keyword panel, accept the defaults and click Next.
  8. In the Field Properties panel, in the Field Name column, click the cell below SHAPE and type TYPE.
  9. In the Data Type column, click the cell below Geometry and choose Long Integer.
  10. Edit the properties of the field by clicking the cell to the right of Domain and choosing Type. This specifies that the field will only accept the values defined in the Type domain you created earlier in the tutorial.
  11. In the Field Name column, click the cell below the TYPE field and type COMMENTS.
  12. Specify the data type of the COMMENTS field to be Text.
  13. Click Finish.

Your feature class is created and added to the table of contents automatically.

Create feature attachments

In this section, you'll add feature attachments to your feature class. An attachment is a media file, such as an image, PDF, or video, that can be associated with a feature when it is created or edited. For example, when a user adds a shoreline bird sighting to the database, they can attach a photograph of the bird for additional context. When the feature is clicked, the attachment is displayed.

Steps:
  1. In the Catalog window, expand the connection to your enterprise geodatabase.
  2. Right-click the shoreline_birdsightings feature class and choose Manage > Create Attachments.

ArcMap adds a new table to contain the attached files and a relationship class to manage the link between the features and their attachments.

Define layer renderer and symbology

In this section, you'll define a layer renderer and symbology for the various bird types in your database. The way you symbolize your features is important, since features are displayed on the web using the symbology defined in the map document.

Steps:
  1. In the ArcMap table of contents, click List by Drawing Order List By Drawing Order.
  2. Right-click the shoreline_birdsightings feature class and click Properties Properties.
  3. On the Layer Properties dialog box, click the Symbology tab.
  4. On the Show dialog box, click Categories > Unique values. This specifies that you will use a unique value renderer for all the features in your database.
  5. In the Value Field drop-down list, choose type.
  6. Click Add All Values. Each bird type is added to the list.
  7. Uncheck the check box next to the <all other values> symbol.
  8. Double-click the symbol next to the Alcid/Pelagic bird type.
  9. On the Symbol Selector dialog box, type alcid in the search field and click Search Search.
  10. Select the Alcid/Pelagic Bird symbol and increase its size to 25.
  11. Click OK. The symbol is applied to the Alcid/Pelagic bird type.
  12. Based on the following criteria, use the symbol search to specify the symbology for the remaining bird types:
  13. Bird type

    Search criteria

    Symbol

    Size

    Diving Bird

    diving bird

    Diving Bird

    25

    Gull/Tern

    tern

    Gull/Tern

    25

    Raptor

    raptor

    Raptor

    25

    Shorebird

    shorebird

    Shorebird

    25

    Wading Bird

    wading bird

    Wading Bird

    25

    Waterfowl

    waterfowl

    Waterfowl

    25

    Unknown

    question mark (In the results list, choose the ESRI_Optimized style.)

    Unknown

    25

  14. When you're finished specifying the symbology, click OK on the Layer Properties dialog box. The symbology is displayed in the ArcMap table of contents.

Add a basemap for context

For context, you'll add a basemap to your map document from ArcGIS Online.

Steps:
  1. From the main menu in ArcMap, click File > Add Data > Add Basemap.
  2. Choose Light Gray Canvas as the basemap and click Add. The basemap is added to your map display.
  3. Zoom in to an area of interest, for example, a familiar coast or shoreline, and save your map document.

Add features to your map

Now that you've symbolized your features appropriately and added a basemap for context, you'll set up the proper editing environment and add features to your map.

Steps:
  1. In ArcMap, display the Editor toolbar by choosing Customize > Toolbars > Editor from the main menu.
  2. On the Editor toolbar, click Editor > Options.
  3. On the Editing Options dialog box, click the Versioning tab.
  4. Since the data in your geodatabase is nonversioned, uncheck Edit a version of the database with the ability to undo and redo. Disabling this option allows you to edit data that is nonversioned.
  5. Click OK.
  6. On the Editor toolbar, click Editor > Start Editing. A default feature editing template is created based on the symbology of the editable layers in your map document. You'll use this feature template in the next step to add features to your map.
  7. On the Editor toolbar, click Create Features Create Features.
  8. In the Create Features window, select a bird type and add it to the map.
  9. On the Editor toolbar, click Attributes Attributes.
  10. In the Attributes window, add a comment and attachment to the feature you created. You can search the web for a picture of the bird you chose, save it as an image, then add it as an attachment.
  11. Adding a bird sighting to the ArcMap display

  12. In the table of contents, right-click the shoreline_birdsightings feature class and choose Open Attribute Table.
  13. In the Table window, verify that your feature and comments are included in the table. Close the table when you are finished.
  14. Repeat steps 7 through 12 to add another bird sighting to your map.
  15. On the Editor toolbar, click Editor > Stop Editing. When prompted to save your edits, click Yes.
  16. Save your map document.

Prepare your enterprise geodatabase for publishing

Now that you've created and edited your map document, you're ready to prepare your data for publishing. To do so, you'll need to do the following:

Add Global IDs

Global IDs need to be added to your data to use your feature service locally in a client application. This allows the edits made to your database to be uniquely identified.

Steps:
  1. Right-click the shoreline_birdsightings feature class and choose Manage > Add Global IDs.
  2. In the Confirm Add Global IDs dialog box, click Yes.

Enable archiving

Since the data in your database is nonversioned, you'll need to enable archiving for your feature service to be used locally by client applications. Archiving records changes made to the data, which allows the local data to be synced back to the feature service.

Steps:
  1. In the Catalog window, expand your database connection.
  2. Right-click the shoreline_birdsightings feature class and choose Manage > Enable Archiving.

Remove the basemap layer

Steps:
  1. In the ArcMap table of contents, right-click the basemap and choose Remove.
  2. Save your map document.

Connect to ArcGIS Server

Steps:
  1. In the Catalog window in ArcMap, expand the GIS Servers node.
  2. Double-click Add ArcGIS Server Add ArcGIS Server.
  3. Choose Publish GIS services and click Next.
  4. For Server URL, type the URL of the ArcGIS Server site you want to connect to. The default is http://gisserver.domain.com:6080/arcgis. If you or your server administrator installed ArcGIS Web Adaptor, the URL will vary depending on the Web Adaptor configuration. See Components of ArcGIS URLs for additional URL examples.
  5. In the Server Type drop-down list, make sure ArcGIS Server is selected.
  6. For the purposes of this tutorial, accept the default staging folder location.
  7. If your server administrator has enabled security for your site, enter your user name and password. Click Finish.

A publisher connection to ArcGIS Server is created in the GIS Servers node.

Register your database with ArcGIS Server

Since your map document references data residing in an enterprise geodatabase, you'll need to register the enterprise geodatabase with ArcGIS Server. Registration provides ArcGIS Server knowledge about the location of your enterprise geodatabase and the data referenced by your map document. This helps you validate that you're ready to publish.

Steps:
  1. In the Catalog window, right-click your publisher connection to ArcGIS Server and select Server Properties.
  2. On the ArcGIS Server Properties dialog box, next to the Registered Databases panel, click Add Add.
  3. On the Register Database dialog box, enter a unique name for the registered database. Names can be alphanumeric and contain spaces, for example, Shoreline Bird Sightings GDB.
  4. Next to the Publisher database connection section, click Import.
  5. On the Browse for a Database Connection dialog box, click the Look in drop-down list and choose Database Connections.
  6. Select the connection to your database and click Select.
  7. In the Server database connection section of the Register Database dialog box, make sure the check box next to Same as publisher database connection is enabled. This specifies that both ArcMap users and web users accessing the feature service can view and manipulate the data in the bird sightings geodatabase simultaneously. For more information, see About registering your data with the server.
  8. Same as publisher database connection option checked

  9. Click OK. Your enterprise geodatabase is registered with the server and appears on the Registered Databases dialog box.
  10. Click OK to close the ArcGIS Server Properties dialog box.

Publish a map service with feature access enabled

Now that you've done the work of preparing your database, you can publish your map document with the Feature Access capability enabled. This creates a feature service endpoint to your map service through which clients, such as a web application, can access and edit the features in your map.

As part of this step, you'll also enable the Sync capability. This will allow the data in your feature service to be used offline in client applications.

Steps:
  1. From the main menu in ArcMap, choose File > Share As > Service.
  2. In the Share as Service window, choose Publish a service. Click Next.
  3. In the Publish a Service dialog box, choose the publisher connection to ArcGIS Server you set up earlier in the tutorial.
  4. By default, the name of the map document dictates the service name. Instead of using the default, type Shoreline_BirdSightings. Click Next.
  5. By default, services are published to the root folder (root) of ArcGIS Server. Accept the default location and click Continue.

    The Service Editor dialog box is displayed. Use Service Editor to choose what users can do with your feature service and take fine-grained control of how the server will expose your feature service.

  6. Click the Capabilities tab.
  7. By default, mapping and KML are enabled. Choose Feature Access. Enabling this option creates an associated feature service with your map service that allows clients to perform feature editing over the web.
  8. In the left pane of the Service Editor, click Feature Access.
  9. In the Feature Access dialog box, enable the Sync capability.
  10. In the left pane of the Service Editor dialog box, click Item Description and enter the following summary and tags for your service:

    • Summary: The Shoreline Bird Sightings feature service allows users to add common shoreline bird sightings to a map, attach photographs to sightings, and input comments.
    • Tags: shoreline, bird, sighting

  11. Click Publish Publish.

Your feature service is published to ArcGIS Server. When the publishing process completes, you are ready to consume your shoreline bird sightings feature service in client applications. You can also use a client application to create a local copy of your features for offline use.

Leverage the sync capability

NoteNote:

ArcGIS clients and developer SDKs will progressively add support for the sync capability in feature services. The first clients to support working with maps while offline are the 10.2.2 versions of Collector for ArcGIS and ArcGIS Runtime SDKs.

If you use ArcMap to edit feature services that are part of an offline editing workflow, be sure to keep the ArcMap editing option to Automatically save changes after each edit enabled. If you disable this option, synchronization from any other client will be blocked until you close your edit session.

9/1/2015