Click or drag to resize

FeatureLayer Class

A FeatureLayer displays feature data from an online ServiceFeatureTable source, or from offline sources such as GeodatabaseFeatureTable, ShapefileFeatureTable, or GeoPackageFeatureTable.
Inheritance Hierarchy

Namespace:  Esri.ArcGISRuntime.Mapping
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.7.0.0
Syntax
C#
public class FeatureLayer : Layer, 
	IPopupSource, ITimeAware

The FeatureLayer type exposes the following members.

Constructors
  NameDescription
Public methodFeatureLayer
Initializes a new instance of the FeatureLayer class.
Public methodCode exampleFeatureLayer(Uri)
Initializes a new instance of the FeatureLayer class with a ServiceFeatureTable.
Public methodCode exampleFeatureLayer(FeatureTable)
Initializes a new instance of the FeatureLayer class.
Public methodFeatureLayer(Uri, Credential)
Initializes a new instance of the FeatureLayer class with a ServiceFeatureTable.
Public methodFeatureLayer(Item, Int64)
Initializes a new instance of the FeatureLayer class from a portal item of type FeatureService.
Top
Properties
  NameDescription
Public propertyAttribution
Gets the attribution text for the layer.
(Inherited from Layer.)
Public propertyCanChangeVisibility
Gets a value indicating whether the layer content's visibility can be changed.
(Inherited from Layer.)
Public propertyCode exampleDefinitionExpression
Gets or sets the definition expression which is a where clause to filter out the features to be displayed.
Public propertyDescription
Gets the description for the layer.
(Inherited from Layer.)
Public propertyCode exampleFeatureTable
Gets the FeatureTable that contains feature.
Public propertyCode exampleFullExtent
Gets the full extent of the layer, which is the extent where all the data in the layer is contained.
(Inherited from Layer.)
Public propertyCode exampleFullTimeExtent
Gets the temporal window that encapsulates the instance's complete set of data
Public propertyCode exampleId
Gets or sets an identifier for the layer
(Inherited from Layer.)
Public propertyIsIdentifyEnabled
Gets a value indicating whether the layer supports the identify operation.
(Inherited from Layer.)
Public propertyIsPopupEnabled
Gets or sets a value indicating whether the PopupDefinition defined is enabled.
Public propertyIsTimeFilteringEnabled
Gets or sets whether the instance respects any temporal filters that are applied to it
Public propertyCode exampleIsVisible
Gets or sets a value indicating whether the layer content is visible.
(Inherited from Layer.)
Public propertyItem
Gets the ArcGIS Item
(Inherited from Layer.)
Public propertyCode exampleLabelDefinitions
Gets a modifiable collection of LabelDefinition label definitions for this feature layer.
Public propertyCode exampleLabelsEnabled
Gets or sets the LabelsEnabled which is used to enable labeling of a FeatureLayer.
Public propertyLoadError
Gets the load error of the layer, if there is one.
(Inherited from Layer.)
Public propertyCode exampleLoadStatus
Gets the load status of the layer.
(Inherited from Layer.)
Public propertyCode exampleMaxScale
Gets or sets the maximum scale where the layer is visible.
(Inherited from Layer.)
Public propertyCode exampleMinScale
Gets or sets the minimum scale where the layer is visible.
(Inherited from Layer.)
Public propertyCode exampleName
Gets or sets the name of the layer content.
(Inherited from Layer.)
Public propertyCode exampleOpacity
Gets or sets the opacity of the layer.
(Inherited from Layer.)
Public propertyPopupDefinition
Gets or sets the pop-up definition for the FeatureLayer.
Public propertyRefreshInterval
Gets the refresh interval on a FeatureLayer.
Public propertyCode exampleRenderer
Gets or sets the renderer.
Public propertyCode exampleRenderingMode
Gets or sets a value indicating which rendering mode to use
Public propertyCode exampleScaleSymbols
Gets or sets a value indicating whether the layer's symbols and labels honor the Map reference scale.
Public propertySceneProperties
Gets or sets the scene properties for the feature layer.
Public propertySelectionColor
Gets or sets the color for selected features.
Public propertySelectionWidth
Gets or sets the width of the selection highlight.
Public propertyShowInLegend
Gets or sets a value indicating whether the layer content participates in the legend.
(Inherited from Layer.)
Public propertySpatialReference
Gets the spatial reference of the layer.
(Inherited from Layer.)
Public propertyCode exampleSublayerContents
Gets the sub layer contents of a layer content.
(Inherited from Layer.)
Public propertySupportsTimeFiltering
Gets whether the instance supports filtering its data based on time
Public propertyTimeInterval
Gets a temporal value that represents the suggested temporal interval to use when sequentially stepping through the instance's data by time
Public propertyCode exampleTimeOffset
Gets or sets the amount of time by which to offset the temporal values of data points in this instance when displaying the data in a GeoView
Public propertyUnknownJson
Gets unknown data from the source JSON.
Public propertyUnsupportedJson
Gets unsupported data from the source JSON.
Top
Methods
  NameDescription
Public methodCancelLoad
Cancels an ongoing load.
(Inherited from Layer.)
Public methodCode exampleClearSelection
Clears all selected features.
Public methodCode exampleClone
Clones this instance of Layer and its members.
(Inherited from Layer.)
Public methodGetLegendInfosAsync
Returns an immutable list of LegendInfo.
(Inherited from Layer.)
Public methodCode exampleGetSelectedFeaturesAsync
Returns a list of the currently selected features.
Public methodIsVisibleAtScale
Returns the layer content's effective visibility at the specified scale.
(Inherited from Layer.)
Public methodCode exampleLoadAsync
Initiates loading of a layer
(Inherited from Layer.)
Protected methodOnPropertyChanged
Called when a property changes.
(Inherited from Layer.)
Public methodResetFeaturesVisible
Resets the layer's features visibility back to factory defaults.
Public methodCode exampleResetRenderer
Resets the renderer to the factory default.
Public methodRetryLoadAsync
Retry loading the layer.
(Inherited from Layer.)
Public methodCode exampleSelectFeature
Selects the given feature and adds it to the current list of selected features.
Public methodCode exampleSelectFeatures
Selects the features in the list and adds them to the current list of selected features.
Public methodCode exampleSelectFeaturesAsync(QueryParameters, SelectionMode)
Selects the features that match the criteria in the QueryParameters object and adds them to the current list of selected features GetSelectedFeaturesAsync.
Public methodSelectFeaturesAsync(QueryParameters, SelectionMode, CancellationToken)
Selects the features that match the criteria in the QueryParameters object and adds them to the current list of selected features GetSelectedFeaturesAsync.
Public methodSetFeaturesVisible
Sets the visibility of the given features.
Public methodSetFeatureVisible
Sets the visibility of the given feature.
Public methodUnselectFeature
Unselects the given feature and removes it from the current list of selected features.
Public methodUnselectFeatures
Unselects the features in the given list and removes them from the current list of selected features.
Top
Events
  NameDescription
Public eventFullTimeExtentChanged
Raised when the FullTimeExtent of the instance's data changes
Public eventCode exampleLoaded
Occurs when the layer is loaded.
(Inherited from Layer.)
Public eventCode exampleLoadStatusChanged
Occurs when the layer LoadStatus is changed.
(Inherited from Layer.)
Public eventPropertyChanged
Occurs when a property value changes.
(Inherited from Layer.)
Top
Remarks

The features displayed in a FeatureLayer are re-projected to match the SpatialReference, if necessary.

Examples

Android

Example Name: ServiceFeatureTableCache

Display a feature layer from a service using the **on interaction cache** feature request mode.

Code example screen shot.

C#
// Copyright 2016 Esri.
// 
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific 
// language governing permissions and limitations under the License.

using Android.App;
using Android.OS;
using Android.Widget;
using Esri.ArcGISRuntime.Data;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.UI.Controls;
using System;

namespace ArcGISRuntime.Samples.ServiceFeatureTableCache
{
    [Activity (ConfigurationChanges=Android.Content.PM.ConfigChanges.Orientation | Android.Content.PM.ConfigChanges.ScreenSize)]
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        "Service feature table (cache)",
        "Data",
        "This sample demonstrates how to use a feature service in on interaction cache mode.",
        "")]
    public class ServiceFeatureTableCache : Activity
    {
        // Hold a reference to the map view
        private MapView _myMapView;

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Title = "Feature service table (cache)";

            // Create the UI, setup the control references and execute initialization 
            CreateLayout();
            Initialize();
        }

        private void Initialize()
        {
            // Create new Map with basemap
            Map myMap = new Map(Basemap.CreateTopographic());

            // Create and set initial map area
            Envelope initialLocation = new Envelope(
                -1.30758164047166E7, 4014771.46954516, -1.30730056797177E7, 4016869.78617381,
                SpatialReferences.WebMercator);
            myMap.InitialViewpoint = new Viewpoint(initialLocation);

            // Create uri to the used feature service
            Uri serviceUri = new Uri(
               "https://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/0");

            // Create feature table for the pools feature service
            ServiceFeatureTable poolsFeatureTable = new ServiceFeatureTable(serviceUri)
            {

                // Define the request mode
                FeatureRequestMode = FeatureRequestMode.OnInteractionCache
            };

            // Create FeatureLayer that uses the created table
            FeatureLayer poolsFeatureLayer = new FeatureLayer(poolsFeatureTable);

            // Add created layer to the map
            myMap.OperationalLayers.Add(poolsFeatureLayer);

            // Assign the map to the MapView
            _myMapView.Map = myMap;
        }

        private void CreateLayout()
        {
            // Create a new vertical layout for the app
            LinearLayout layout = new LinearLayout(this) { Orientation = Orientation.Vertical };

            // Add the map view to the layout
            _myMapView = new MapView(this);
            layout.AddView(_myMapView);

            // Show the layout in the app
            SetContentView(layout);
        }
    }
}
Examples

Xamarin Forms Android

Example Name: ServiceFeatureTableCache

Display a feature layer from a service using the **on interaction cache** feature request mode.

Code example screen shot.

C#
// Copyright 2016 Esri.
// 
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific 
// language governing permissions and limitations under the License.

using Esri.ArcGISRuntime.Data;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Mapping;
using System;
using Xamarin.Forms;

namespace ArcGISRuntime.Samples.ServiceFeatureTableCache
{
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        "Service feature table (cache)",
        "Data",
        "This sample demonstrates how to use a feature service in on interaction cache mode.",
        "")]
    public partial class ServiceFeatureTableCache : ContentPage
    {
        public ServiceFeatureTableCache()
        {
            InitializeComponent ();

            // Create the UI, setup the control references and execute initialization 
            Initialize();
        }

        private void Initialize()
        {
            // Create new Map with basemap
            Map myMap = new Map(Basemap.CreateTopographic());

            // Create and set initial map area
            Envelope initialLocation = new Envelope(
                -1.30758164047166E7, 4014771.46954516, -1.30730056797177E7, 4016869.78617381,
                SpatialReferences.WebMercator);
            myMap.InitialViewpoint = new Viewpoint(initialLocation);

            // Create uri to the used feature service
            Uri serviceUri = new Uri(
               "https://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/0");

            // Create feature table for the pools feature service
            ServiceFeatureTable poolsFeatureTable = new ServiceFeatureTable(serviceUri)
            {

                // Define the request mode
                FeatureRequestMode = FeatureRequestMode.OnInteractionCache
            };

            // Create FeatureLayer that uses the created table
            FeatureLayer poolsFeatureLayer = new FeatureLayer(poolsFeatureTable);

            // Add created layer to the map
            myMap.OperationalLayers.Add(poolsFeatureLayer);

            // Assign the map to the MapView
            MyMapView.Map = myMap;
        }
    }
}
XAML
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"             
             xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
             xmlns:mapping="clr-namespace:Esri.ArcGISRuntime.Mapping;assembly=Esri.ArcGISRuntime" 
             x:Class="ArcGISRuntime.Samples.ServiceFeatureTableCache.ServiceFeatureTableCache">
  <Grid>
    <esriUI:MapView x:Name="MyMapView"/>
  </Grid>
</ContentPage>
See Also
Additional Examples
Hyperlink to ExampleDescription
AddFeaturesAdd features to a feature layer.
BrowseWfsLayersBrowse a WFS service for layers.
ChangeFeatureLayerRendererChange the appearance of a feature layer with a renderer.
ChangeTimeExtentThis sample demonstrates how to filter data in layers by applying a time extent to a MapView.
ClosestFacilityStaticFind routes from several locations to the respective closest facility.
CustomDictionaryStyleUse a custom dictionary style (.stylx) to symbolize features using a variety of attribute values.
DeleteFeaturesDelete features from an online feature service.
DisplayAnnotationDisplay annotation from a feature service URL.
DisplayDrawingStatusGet the draw status of your map view or scene view to know when all layers in the map or scene have finished drawing.
DisplayLayerViewStateView the status of the layers on the map.
DisplayWfsDisplay a layer from a WFS service, requesting only features for the current extent.
EditAndSyncFeaturesSynchronize offline edits with a feature service.
EditFeatureAttachmentsAdd, delete, and download attachments for features from a service.
FeatureLayerDefinitionExpressionLimit the features to display on the map using a definition expression.
FeatureLayerDictionaryRendererConvert features into graphics to show them with mil2525d symbols.
FeatureLayerExtrusionExtrude features based on their attributes.
FeatureLayerGeodatabaseDisplay features from a local geodatabase.
FeatureLayerGeoPackageDisplay features from a local GeoPackage.
FeatureLayerQueryFind features in a feature table which match an SQL query.
FeatureLayerRenderingModeMapRender features statically or dynamically by setting the feature layer rendering mode.
FeatureLayerRenderingModeSceneRender features in a scene statically or dynamically by setting the feature layer rendering mode.
FeatureLayerSelectionSelect features in a feature layer.
FeatureLayerShapefileOpen a shapefile stored on the device and display it as a feature layer with default symbology.
FeatureLayerTimeOffsetShow data from the same service side-by-side with a time offset. This allows for the comparison of data over time.
FeatureLayerUrlShow a feature layer on a map using the URL to the service.
FindServiceAreasForMultipleFacilitiesFind the service areas of several facilities from a feature service.
GenerateGeodatabaseGenerate a local geodatabase from an online feature service.
GenerateOfflineMapWithOverridesUse the `OfflineMapTask` with overrides to take a webmap offline. The overrides workflow allows you to adjust the settings used for taking each layer in the map offline. For a simple example of how you take a map offline, please consult the "Generate Offline Map" sample.
GeodatabaseTransactionsThis sample demonstrates how to manage edits to a local geodatabase inside of transactions.
GroupLayersGroup a collection of layers together and toggle their visibility as a group.
IdentifyLayersIdentify features in all layers in a map. MapView supports identifying features across multiple layers. Because some layer types have sublayers, the sample recursively counts results for sublayers within each layer.
ListRelatedFeaturesList features related to the selected feature.
QueryFeatureCountAndExtentZoom to features matching a query and count the features in the current visible extent.
ReadGeoPackageAdd rasters and feature tables from GeoPackages to a map.
ReadShapefileMetadataRead a shapefile and display its metadata.
RenderUniqueValuesRender features in a layer using a distinct symbol for each unique attribute value.
ServiceFeatureTableCacheDisplay a feature layer from a service using the **on interaction cache** feature request mode.
ServiceFeatureTableManualCacheDisplay a feature layer from a service using the **manual cache** feature request mode.
ServiceFeatureTableNoCacheDisplay a feature layer from a service using the **no cache** feature request mode.
ShowLabelsOnLayerDisplay custom labels on a feature layer.
StatisticalQueryQuery a table to get aggregated statistics back for a specific field.
SymbolizeShapefileDisplay a shapefile with custom symbology.
TimeBasedQueryThis sample demonstrates how to query data using a time extent. This workflow can be used to return records that are between a specified start and end date. For example, you could specify to only show records that are before September 16, 2000.
TraceUtilityNetworkDiscover connected features in a utility network using connected, subnetwork, upstream, and downstream traces.
UpdateAttributesUpdate feature attributes in an online feature service.
UpdateGeometriesUpdate a feature's location in an online feature service.
WfsXmlQueryLoad a WFS feature table using an XML query.