What is a feature layer?

Feature layers are a special type of graphics layer that allow you to display features in a layer hosted by an ArcGIS for Server map service, an ArcGIS for Server feature service, or in a table served by the Spatial Data Service. Like graphics layers, feature layers contain and display graphic features, which consist of geometry and attributes. In addition, feature layers can also provide solutions in the following areas:

The following table highlights feature layer sources supported in this application programming interface (API):

Feature layer source

Description

ArcGIS for Server map service

Dynamic (non-cached) ArcGIS for Server map services can contain feature layers. Each layer is represented by an explicit URL that references the map service name and layer ID assigned by the map service. The URL is usually retrieved using ArcGIS Services Directory.

For example:

http://serverapps.esri.com/ArcGIS/rest/services/California/MapServer/8

The California map service contains a layer with county features assigned the unique id 8.

ArcGIS for Server feature service

ArcGIS for Server feature services reference individual feature layers. Each layer is represented by an explicit URL that references the feature service name and layer ID assigned by the service. The URL is usually retrieved using ArcGIS Services Directory.

For example:

http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSFields/FeatureServer/0

This sample service represents oil and gas fields in the State of Kansas. The Petroleum feature service contains a feature layer with current Kansas field production features assigned the unique ID 0.

ArcGIS for Server feature services support editing when the feature layer is hosted in an ArcSDE geodatabase. Use a feature service to take advantage of symbols and feature templates from the service's source map document.

Spatial Data Service

A spatial data service includes a REST-ful Web service termed the Spatial Data Service. It provides access to tables in databases hosted by a database instance, such as SQL Server. A table can be spatially enabled, which means it has a column that contains geometry.

For example:

http://serverapps.esri.com/SDS/databases/Demo/dbo.USStates_Geographic.

The Demo database contains a spatially-enabled table dbo.USStates_Geographic.

Editing and time awareness are not supported with Spatial Data Service layers at this time.

Feature layers have several properties that enable functionality that is not available with graphics layers. The following table highlights some of the key members included with FeatureLayer:

FeatureLayer member

Description

Url property

Address of a layer in an ArcGIS for Server map service or table hosted by a Spatial Data Service spatial data service (see the previous table for examples). Feature layers are automatically populated with features from the source.

Where property

Query that defines which features in the specified layer are displayed. If not specified, all features will be retrieved ("1=1").

Mode property

Defines the technique for retrieving features from a service.

  • Snapshot mode retrieves all the features from the layer immediately after the layer is added to the map. This eliminates any need to return to the server for information, but can become cumbersome if the layer contains many features. The client app may become overwhelmed by the number of features it needs to draw, or the service may reach its limit of how many features it can return at once (the default is 500 for ArcGIS Server 9.3.1, 1000 for ArcGIS Server 10, and 1000 for Spatial Data Service). Use snapshot mode only with smaller datasets or when dealing with temporal data.
  • On Demand mode retrieves features as they are needed, requesting only the features within your current view extent. On demand mode requires more round trips between the client and server and should not be used for showing temporal animations. However, it protects you from retrieving more features than you need.
  • Selection Only mode does not initially request any features. Features are added only when a selection is made. This mode is useful when you cannot or do not want to bring all features into the client, but you want to highlight one or more features for a certain reason. In most cases, this mode is used in conjunction with a dynamic map service layer to display the location of selected features.

OnDemandCacheSize property

Defines the number of features outside the current map extent to store in client-side cache when Mode = OnDemand. If a feature has been retrieved and resides in cache, it will not be requested again unless it's removed from the cache (number of features in the cache is surpassed). The cache is not maintained across sessions.

FeatureSymbol property

References a single symbol to use when rendering individual graphics in the layer.

SelectionColor property

Defines a color or visual brush to display selected graphic features in a feature layer. Note, each graphic feature maintains a Selected property. And the SelectedGraphics and SelectionCount properties (implemented on GraphicsLayer) return information on selected graphics.

TimeExtent property

References the time instance or range represented within the feature layer. This property is defined by an ArcGIS for Server map or feature service and is read-only.

DisableClientCaching property

By default, a feature layer uses browser caching to improve performance. If the data underlying your feature layer changes (that is, the table hosted by Spatial Data Service's spatial data service is being updated with new content) and you want to see the changes immediately, set this property to true.

Update method

This method re-queries the data underlying your feature layer. If the layer or table contents have changed on the server, you can call this method to see changes in the feature layer on the client. Note, you may need to disable client caching.

1/27/2015