Click or drag to resize

FeatureLayer Class

A layer that can visualize vector/feature data.
Inheritance Hierarchy

Namespace:  Esri.ArcGISRuntime.Mapping
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.11.0
Syntax
[ContentPropertyAttribute("FeatureTable")]
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 propertyIsVisible
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 propertyScaleSymbols
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 Obsolete.
Gets or sets the color for selected features.
Public propertySelectionWidth Obsolete.
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 propertyTilingMode
Gets or sets the feature tiling mode in use by the feature layer. Default is EnabledWhenSupported.
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 eventLoaded
Occurs when the layer is loaded.
(Inherited from Layer.)
Public eventLoadStatusChanged
Occurs when the layer LoadStatus is changed.
(Inherited from Layer.)
Public eventPropertyChanged
Occurs when a property value changes.
(Inherited from Layer.)
Top
Remarks

Feature layers displays feature data from the online sources: ServiceFeatureTable, OgcFeatureCollectionTable, and WfsFeatureTable and from the offline sources: GeodatabaseFeatureTable,ShapefileFeatureTable, and GeoPackageFeatureTable. Feature layers can be used to display, select, and query features in a layer. If the underlying feature service or table supports editing, you can use it with a feature layer as a basis for editing geometry, attributes, and attachments. Feature layers are used to store features associated with a utility network.

To display features in a FeatureCollectionTable, use FeatureCollectionLayer instead.

Features are retrieved as needed by the app. Features can be downloaded from a sync-enabled feature service when the device is connected and cached locally for use when the device is offline. Edits can then be synchronized back to the service.

Functional characteristics

The following are sources that can be rendered using a feature layer.

Feature service - Backed by a service feature table; feature data from the service is cached locally in the table. New features are retrieved automatically when you navigate the map. The local table cache is discarded when the layer is disposed. If sync is enabled, features can be created, edited, and pushed to the server.

Geodatabase — Backed by a geodatabase feature table; The geodatabase can be a replica of a feature service, which allows synchronizing with a feature service, or taking the content of a feature service offline. Use a geodatabase sync task to synchronize the geodatabase with the service.

Shapefile — Backed by a shapefile feature table; use a feature layer to show the contents of shapefiles(.shp).

Geopackage — Backed by a geopackage feature table; use a feature layer to render the tables in a GeoPackage (.gpkg). A GeoPackage is a data source that conforms to the OGC GeoPackage specification. Geopackage feature tables can be edited and saved, but can't support sync, because there is no backing feature service. ArcGIS Runtime supports GeoPackage versions 1.0, 1.1, and 1.2.

Web Feature Service (WFS)—Backed by a WFS feature table. You can populate the table using Runtime query parameters or raw XML-encoded GetFeature queries. A WFS feature table only supports manual cache feature request mode. Runtime supports OGC WFS versions 2.0.0 and 2.0.2.

WFS server implementations are inconsistent in how they expect coordinates to be formatted. Some return and expect coordinates in (x, y) order, while others expect(y, x). Runtime guesses the correct order by default. This behavior can be configured with the AxisOrder and FilterAxisOrder properties.

Individual features can be queried and filtered based on spatial queries or SQL queries. Starting with release 100.3.0, ArcGIS Runtime uses case-insensitive string comparison when querying a ShapefileFeatureTable.`

The features displayed in a FeatureLayer are re-projected to match the SpatialReference, if necessary. Local tables cannot be re-projected automatically.

Feature layers expose a UnsupportedJson property that, for feature layers based on a feature service, returns a dictionary of values known to the supported web map specification but not explicitly exposed through the Runtime API. This allows you to access information that was saved with the layer but not used b Runtime. Feature layers also provide a UnknownJson property to return JSON that was not recognized.

Performance characteristics

As full feature information is cached locally in a geodatabase, shapefile, or GeoPackage, and features are drawn natively, this layer type offers excellent display performance when zooming and panning the map within the extent of cached features. Querying features is also efficient, enabling app functions such as real-time updates of query results in a map.

The local cache must be initially created, which can be resource-intensive for the server. The initial download to the device may require extensive network usage and subsequent local device storage. App memory increases with the number and complexity of the features cached. Network usage can be eliminated by provisioning the cache directly to the device in advance.

Feature tables backed by a service define three feature request modes. The table's feature request mode controls how and when features are requested from the service.

On interaction cache — Features are requested automatically for the visible map or scene extent. As the user pans and zooms, features are cached locally. If the user returns to an area where features have already been loaded, the table won't need to download those features again.

Manual cache — Features must be manually populated using a call to the PopulateFromServiceAsync(QueryParameters, Boolean, IEnumerableString) method. Once populated, all queries are made against the local table only. This method can be called again to retrieve more features from the service.

On interaction, no cache—Features are requested automatically for the visible map extent. As the user pans and zooms, features outside the visible extent are not cached and must be downloaded again each time.

Sample Code:

Examples

WPF

Example Name: ChangeTimeExtent

Filter data in layers by applying a time extent to a MapView.

Code example screen shot.

C#
// Copyright 2018 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;
using Esri.ArcGISRuntime.Mapping;
using System;
using System.Windows;

namespace ArcGISRuntime.WPF.Samples.ChangeTimeExtent
{
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        name: "Change time extent",
        category: "MapView",
        description: "Filter data in layers by applying a time extent to a MapView.",
        instructions: "Switch between the available options and observe how the data is filtered.",
        tags: new[] { "data", "filter", "time", "time frame", "time span" })]
    public partial class ChangeTimeExtent
    {
        // Hold two map service URIs, one for use with an ArcGISMapImageLayer, the other for use with a FeatureLayer.
        private readonly Uri _mapServerUri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Hurricanes/MapServer");
        private readonly Uri _featureLayerUri = new Uri("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Earthquakes_Since1970/MapServer/0");

        public ChangeTimeExtent()
        {
            InitializeComponent();

            Initialize();
        }

        private void Initialize()
        {
            // Create new Map with basemap and initial location.
            Map map = new Map(BasemapStyle.ArcGISTopographic);

            // Assign the map to the MapView.
            MyMapView.Map = map;

            // Load the layers from the corresponding URIs.
            ArcGISMapImageLayer imageryLayer = new ArcGISMapImageLayer(_mapServerUri);
            FeatureLayer pointLayer = new FeatureLayer(_featureLayerUri);

            // Add the layers to the map.
            MyMapView.Map.OperationalLayers.Add(imageryLayer);
            MyMapView.Map.OperationalLayers.Add(pointLayer);
        }

        private void twoThousand_Click(object sender, RoutedEventArgs e)
        {
            // Hard-coded start value: January 1st, 2000.
            DateTime start = new DateTime(2000, 1, 1);

            // Hard-coded end value: December 31st, 2000.
            DateTime end = new DateTime(2000, 12, 31);

            // Set the time extent on the map with the hard-coded values.
            MyMapView.TimeExtent = new TimeExtent(start, end);
        }

        private void twoThousandFive_Click(object sender, RoutedEventArgs e)
        {
            // Hard-coded start value: January 1st, 2005.
            DateTime start = new DateTime(2005, 1, 1);

            // Hard-coded end value: December 31st, 2005.
            DateTime end = new DateTime(2005, 12, 31);

            // Set the time extent on the map with the hard-coded values.
            MyMapView.TimeExtent = new TimeExtent(start, end);
        }
    }
}
XAML
<UserControl
    x:Class="ArcGISRuntime.WPF.Samples.ChangeTimeExtent.ChangeTimeExtent"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
    <Grid>
        <esri:MapView x:Name="MyMapView" />
        <Border Style="{StaticResource BorderStyle}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Label Content="Tap a year to filter the data."
                       Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
                       HorizontalAlignment="Center"
                       FontWeight="SemiBold" />
                <Button Content="2000"
                        Grid.Row="1" Grid.Column="0"
                        Margin="0,5,5,0"
                        Click="twoThousand_Click" />
                <Button Content="2005"
                        Grid.Row="1" Grid.Column="1"
                        Margin="5,5,0,0"
                        Click="twoThousandFive_Click" />
            </Grid>
        </Border>
    </Grid>
</UserControl>
See Also
Additional Examples
Hyperlink to ExampleDescription
AddFeaturesAdd features to a feature layer.
BrowseWfsLayersBrowse a WFS service for layers and add them to the map.
ChangeFeatureLayerRendererChange the appearance of a feature layer with a renderer.
ChangeTimeExtentFilter 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.
DisplayLayerViewStateDetermine if a layer is currently being viewed.
DisplayUtilityAssociationsCreate graphics for utility associations in a utility network.
DisplayWfsDisplay a layer from a WFS service, requesting only features for the current extent.
EditAndSyncFeaturesSynchronize offline edits with a feature service.
EditBranchVersioningCreate, query and edit a specific server version using service geodatabase.
EditFeatureAttachmentsAdd, delete, and download attachments for features from a service.
EditFeatureLinkedAnnotationEdit feature attributes which are linked to annotation through an expression.
FeatureLayerDefinitionExpressionLimit the features displayed on a map with 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.
FeatureLayerTimeOffsetDisplay a time-enabled feature layer with a time offset.
FeatureLayerUrlShow features from an online feature service.
FindServiceAreasForMultipleFacilitiesFind the service areas of several facilities from a feature service.
GenerateGeodatabaseGenerate a local geodatabase from an online feature service.
GenerateOfflineMapWithOverridesTake a web map offline with additional options for each layer.
GeodatabaseTransactionsUse transactions to manage how changes are committed to a geodatabase.
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.
LocalServerFeatureLayerStart a local feature service and display its features in a map.
PerformValveIsolationTraceRun a filtered trace to locate operable features that will isolate an area from the flow of network resources.
QueryFeatureCountAndExtentZoom to features matching a query and count the features in the current visible extent.
ReadGeoPackageAdd rasters and feature tables from a GeoPackage 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.
ShowPopupShow predefined popups from a web map.
StatisticalQueryQuery a table to get aggregated statistics back for a specific field.
SymbolizeShapefileDisplay a shapefile with custom symbology.
TimeBasedQueryQuery data using a time extent.
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.