Publishing Spatial views as a Feature Access Service

Publishing Spatial views as a Feature Access Service

The following Blog will take you through the process of using ArcMap 10.x to publish a spatial view as a Feature Access service.

What is a database view?

Database views are database elements that store SQL query statements that act like tables.

viewViews can be used to join tables together, similar to joins in ArcMap. But because the view is stored in the database, it can be used by many users in many map documents. For example, frequently Census data is stored in a table separate from the Census geographies feature class. Using a view, all users given access will be able to create analytical maps based on Census data without having to create a join.

Views can also be used to filter attributes either for ease of use or for permissions reasons. For example, if you are storing ownership information for parcels, that data may include personal identification numbers that not all staff should have access to. A view can be used to give a user access to some but not all of the fields in a table. In this case, the user should be granted access to the view but not the table.

Spatial views are database views that contain a single spatial column. They are useful in organising your spatial data with other attribute data in a predefined way, in the same database or another database. They are also READ-ONLY, hence spatial views cannot be edited via ArcMap.

Step 1: Create spatial database views

Before attempting this step ensure that you have a working connection to a SDE geodatabase and have two feature classes or a table and feature class that can be related to one another via a primary key and foreign key.

The following example is taken from the CMGD Configuring and Managing the Multiuser Geodatabase course.

  1. In ArcCatalog, right-click your Database connection for example gisowner@Naperville connection, and choose New > View
  1. Enter a descriptive View name ideally one which includes the names of the tables being linked.
  1. Enter the View Definition this is a SQL statement that controls the output created in terms of the columns and association between the tables/feature classes.

In the example below Store_ID is the primary key of the Stores feature class and foreign key in the Store Revenue table without these keys the View cannot be created

SELECT Stores.OBJECTID, Stores.Name, Stores.Address, Stores.Shape, Store_Revenue.Revenue
FROM Stores
LEFT JOIN Store_Revenue
ON Stores.Store_ID = Store_Revenue.Store_ID

Step 2: Test database views

Now that we have created a database view, we want to test it before publishing it.

  1. Open ArcMap
  2. In the Catalog window, connect to your Database connection containing the spatial view.
  3. Note that the views have icons that look like tables with a little box. This is because ArcMap   has not yet investigated the views enough to determine what geometry type is being used.

4. Drag the View into the map

ArcMap will create a query layer based on the view to display in the map.

  1. Check the OBJECTID field as the unique identifier field, and click Finish
  1. View the attribute table for the layer

All the fields specified in the database view definition are available in the layer.

To be able to use our Spatial View on ArcGIS Online in Collector or just within a Web map we will need to publish this view as Feature Access service.

Process for adding Spatial View as Feature Access

  1. File -> Share As-> Service
  2. Choose Publish a service
  3. Click Next
  4. Must create without feature access checked (i.e. just Mapping)
  5. Choose a connection
  6. Enter a Service name
  7. Click Next
  8. Select a folder to publish the service to
  9. Click Continue
  10. Choose Capabilities and ensure Mapping is the only box checkedServiceEditor
  1. Click the Analyze button to check for any issues with the service before publishing.
  2. Click Publish
  3. From ArcCatalog->GIS Servers
  4. Locate the GIS Server and Service you have published
  5. Right-click the service and select Service Properties
  6. Choose Capabilities and check Feature Access.ServiceEditor2
  1. Click on Feature Access and ensure only Query is checked under Operations allowed.ServiceEditor3
  1. Check Service workspace to ensure registered to SDE.

You will now be able to view the features with all the associated data from the view in your Feature access service within ArcMap, online in Web maps and in Web apps like Collector.

By Nathaniel Meyer

7 thoughts on “Publishing Spatial views as a Feature Access Service

  1. Melissa

    I am curious why you can’t publish the spatial views that you are intending on using as reference data in a separate map service that you would overlay with feature service layers in the web map to be consumed by collector.

    1. Gene

      If you are using Collector for Off-Line data collection, map services are not supported. Only feature services can be taken off-line.

  2. Stella

    Is it possible to publish a spatial view to arcgis online? Even with third party tools? I want a hosted solution to this problem.

  3. Gene

    I am curious as to how to publish a view (query layer) as a feature service and be able to consume it in Operations Dashboard. Whenever I use the workflow described in this blog, or any other variations, I do not have full access to the widgets in dashboard. Only when I make a feature class am I able to apply summaries, guages, and the like in dashboard.

  4. Ravindra

    Can I perform the Editing on the Published Feature Service with Feature access & CREATE , UPDATE. and DELETE Operations allowed? Provided , I am using Spatial View as part of my Feature Service.


Got something to say?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s