ArcGIS Feature Layer

An ArcGIS Feature Layer displays features from a layer of an ArcGIS Server Feature Service or an ArcGIS Server Map Service. You can perform queries and selections on features, and work with feature attachments. When using an ArcGIS Server Feature Service, you can also edit features and their attachments. The feature layer honors defintion queries, scale dependencies, and other properties configured on the service layer.

Feature Services, like Map Services, are based on map documents (*.mxd and *.msd files). A map document contains references to GIS datasets. These datasets contain the features that need to displayed in the map. Features are real world entities such as buildings, pipes, and parcels. Features are organized into layers in a map document. For example, the map document of a national park may contain separate layers for hiking trails, picnic areas and campgrounds. Map documents can be published to ArcGIS Server to create Map and Feature services.

ArcGIS Server Map and Feature services are accessible on the web as SOAP and REST web services. You can find the URL of these web services using the ArcGIS Server Services Directory.

The feature layer retrieves features from the service layer, holds them in memory on the device, and then draws them onto the map using the device's graphics capabilities. This is different from a dynamic layer or a tiled layer which rely on the service to render features into images which are then displayed on the map. Whenever you navigate the map, dynamic and tiled layers fetch new map images to display, but the feature layer may already have all the features it needs to display, or it may fetch some more features. In some cases, a feature layer can be more efficient than a dynamic or tiled layer because it does not have to make frequent round trips to the server.

The feature layer inherits its drawing capabilities from the graphics layer. Thus, in a way, they both provide the same functionality for displaying features. However, one key difference is that the graphics layer requires you to provide the graphics that need to be displayed, whereas the feature layer automatically retrieves them from the service layer. Thus, you should never directly add or remove any graphics from the feature layer like you do with the graphics layer.

Another difference is that the graphics layer requires you to provide either a renderer or the symbols needed for displaying the graphics, whereas the feature layer inherits its symbology from the service layer when the service is hosted on an ArcGIS Server 10 or above. If the service is from an older server, you will need to assign a renderer for the feature layer to symbolize the features.

To instantiate a feature layer you need to provide a URL to a layer in a Map Service of Feature Service REST endpoint. This URL is usually of the form http:<server:port>/<instance>/rest/services/<service>/MapServer/<layerid> or http:<server:port>/<instance>/rest/services/<service>/FeatureServer/<layerid>. You also need to specify a mode while creating the feature layer. The mode decides how the layer will retrieve features from the service layer.

Instantiate a feature layer with REST URL and mode:

String URL = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer/0";
ArcGISFeatureLayer fLayer = new ArcGISFeatureLayer(URL, MODE.ONDEMAND);

Feature Service Modes

Feature Layers can operate under 3 modes. The default mode is SNAPSHOT mode which you can change when instantiating the layer.

1/24/2013