FeatureLayer QML Type

  • Esri.ArcGISRuntime
  • FeatureLayer
  • A layer that can visualize vector/feature data. More...

    Import Statement: import Esri.ArcGISRuntime
    Since: Esri.ArcGISRuntime 100.0
    Inherits:

    Layer

    Inherited By:

    SubtypeFeatureLayer

    Properties

    Signals

    Methods

    Detailed Description

    Feature layers can display Feature data from online sources such as ServiceFeatureTable, WfsFeatureTable or OgcFeatureCollectionTable source, and offline sources such as GeodatabaseFeatureTable, ShapefileFeatureTable, or GeoPackageFeatureTable. You can construct a feature layer object using these sources or you can obtain it directly from a map or scene's collection of GeoModel::operationalLayers.

    Feature layers can also be used to store features associated with a utility network. To display features in a FeatureCollectionTable, use FeatureCollectionLayer instead.

    Feature layers can be used to display, select, and query features in a layer. Individual features can be queried and filtered based on spatial queries or SQL queries. String comparisons for features queried in service feature tables are case insensitive.

    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.

    The features in a feature layer 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 sources can be rendered using a feature layer:

    • Feature service - backed by a ServiceFeatureTable. The 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 synchronized back to the server.
    • Geodatabase - backed by a GeodatabaseFeatureTable. The geodatabase can be a replica of a feature service, which allows synchronizing with the feature service, or taking the content of a feature service offline. Use GeodatabaseSyncTask to synchronize the geodatabase with the service. The geodatabase can also be a mobile geodatabase created by ArcGIS Pro. These geodatabases cannot be synced and use a default renderer.
    • Shapefile - backed by a ShapefileFeatureTable. Use a feature layer to show the contents of a shapefile (.shp).
    • Geopackage - backed by a GeoPackageFeatureTable. This uses 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 do not support sync, because there is no backing feature service. This API supports GeoPackage versions 1.0, 1.1, and 1.2.
    • Web Feature Service (WFS) - backed by a WfsFeatureTable. You can populate the table using QueryParameters or raw XML-encoded GetFeature queries. A WFS feature table only supports the manual cache feature request mode. This API 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). This API anticipates the order but you can configure it with the WfsFeatureTable::axisOrder and WfsFeatureTable::filterAxisOrder.
    • OGC API Features - Backed by an OgcFeatureCollectionTable. You can populate the table using QueryParameters. An OCG feature collection table only supports the manual cache feature request mode. This API supports OGC API - Features - Part 1 and OGC API - Features - Part 2.

    The features displayed in a FeatureLayer are automatically projected to match the map or scene's GeoModel::spatialReference, if necessary. Local tables cannot be projected automatically.

    FeatureLayer does not expose every value defined in the web map or web scene specification. You can obtain a dictionary of unsupported values from unsupportedJson. The FeatureLayer also provides unknownJson to return JSON that is not recognized in the web map or web scene specification.

    Performance characteristics

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

    Initially, a local cache must be created. The initial download to the device may require extensive network usage and subsequent local device storage. App memory usage increases with the number and complexity of the features cached. You can eliminate the network usage by provisioning the cache directly to the device in advance.

    If the feature layer's FeatureTable is backed by a service it has three feature request modes (Enums.FeatureRequestMode) that control 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 are manually populated using a call to ServiceFeatureTable::populateFromService(). Once populated, all queries are made against the local table only. ServiceFeatureTable::populateFromService() 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.

    Calling load() on the feature layer initiates loading of its featureTable also.

    Example:

    Display a feature service on a map using a FeatureLayer and ServiceFeatureTable:

    Map {
        Basemap {
            initStyle: Enums.BasemapStyleArcGISTerrain
        }
    
        FeatureLayer {
            ServiceFeatureTable {
                url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Energy/Geology/FeatureServer/9"
            }
        }
    }

    To display features from a mobile geodatabase, create the Geodatabase, obtain a GeodatabaseFeatureTable, and set the table to the FeatureLayer:

    // Display a feature layer with a Geodatabase
    FeatureLayer {
        id: gdbFeatureLayer
        visible: false
    
        featureTable: geodatabase.geodatabaseFeatureTablesByTableName["Trailheads"] ?? null
        Geodatabase {
            id: geodatabase
            path: dataPath + "geodatabase/LA_Trails.geodatabase"
        }
    }

    Note: The FeatureLayer will automatically re-project on-the-fly. For example, a FeatureLayer that is in WKID 4326 could be added to a Map that is in WKID 3857, and the FeatureLayer would project on-the-fly to WKID 3857. This is the case for a FeatureLayer using either a ServiceFeatureTable or a GeodatabaseFeatureTable.

    This QML type supports the following default properties. A default property may be declared inside another declared object without being assigned explicitly to a property.

    TypeDefault Property
    FeatureTablefeatureTable
    Rendererrenderer
    LabelDefinitionlabelDefinitions (since Esri.ArcGISRuntime 100.1) (appends to model)
    LayerScenePropertiessceneProperties (since Esri.ArcGISRuntime 100.2)
    ArcGISItemitem (since Esri.ArcGISRuntime 100.3)

    Note: You cannot create a FeatureLayer from a FeatureCollectionTable.

    For samples, see:

    See also Cancelable, LayerContent, Loadable, PopupSource, and TimeAware.

    Property Documentation

    definitionExpression : string

    A SQL expression that limits the features available for query and display on the feature layer.

    The definition expression string should follow standard SQL syntax as detailed in the SQL reference for query expressions used in ArcGIS document.

    The definition expression string uses the SQL-92 WHERE clause syntax. Be sure to escape special characters in the expression string as required for your platform. The DATE keyword expects the date format yyyy-mm-dd and the TIMESTAMP keyword expects the time stamp format yyyy-mm-dd hh:mm:ss. See the ArcGIS Blog article Querying Feature Services Date-Time Queries for more information.


    [since Esri.ArcGISRuntime 100.13] displayFilterDefinition : DisplayFilterDefinition

    Defines how features are filtered from the display.

    Use this property to reduce the number of features displayed in the map or scene view. The filter aims to improve data visualization and optimize rendering performance. It only affects the display of features so all features are still available for query methods such as selectFeaturesWithQuery(QueryParameters, Enums.SelectionMode).

    This property was introduced in Esri.ArcGISRuntime 100.13.

    See also ManualDisplayFilterDefinition and ScaleDisplayFilterDefinition.


    [read-only, since Esri.ArcGISRuntime 200.2] featureReduction : FeatureReduction

    Defines properties for dynamically aggregating and summarizing groups of features as the map scale changes (read-only).

    A null value indicates the layer does not use feature reduction. FeatureReduction is only supported for point feature layers in dynamic rendering mode (Enums.FeatureRenderingModeDynamic).

    This property was introduced in Esri.ArcGISRuntime 200.2.


    [default] featureTable : FeatureTable

    The feature table whose features are drawn on the map by this layer.

    This property cannot be set after the layer has started loading.

    Any of the inherited FeatureTable types can be used as the input parameter for this constructor except FeatureCollectionTable.

    Note: You cannot create a FeatureLayer from a FeatureCollectionTable.


    [since Esri.ArcGISRuntime 100.12] floorDefinition : LayerFloorDefinition

    Defines the properties that allow a layer to be floor-aware.

    When a layer is configured as floor-aware, it has a floorDefinition property that defines properties that allow a layer to be floor-aware. When it is null (default value) the specific layer does not support floor filtering.

    This property was introduced in Esri.ArcGISRuntime 100.12.


    [read-only, since Esri.ArcGISRuntime 100.3] fullTimeExtent : TimeExtent

    Returns the full time extent of the time aware layer (read-only).

    Note: This property is only available after the time aware layer is loaded.

    This property was introduced in Esri.ArcGISRuntime 100.3.

    See also TimeExtent.


    [default, since Esri.ArcGISRuntime 100.3] item : ArcGISItem

    The item being used by the feature layer.

    The Item represents a feature layer on ArcGIS Online or an ArcGIS Enterprise portal.

    This property can be set along with the serviceLayerId property. The FeatureLayer will fail to load if an invalid portal item is passed in, for example a feature layer portal item.

    The item cannot be changed after the layer is loaded.

    This property was introduced in Esri.ArcGISRuntime 100.3.


    [default] labelDefinitions : LabelDefinitionListModel

    Returns the collection of LabelDefinition objects that define how labels are displayed (read-only).


    labelsEnabled : bool

    Returns true if features in the layer are labelled, otherwise false.


    popupDefinition : PopupDefinition

    See also PopupSource.


    popupEnabled : bool

    See also PopupSource.


    [since Esri.ArcGISRuntime 100.1] refreshInterval : int

    The refresh interval used by the layer in milliseconds.

    Layers request features from the service each time this interval elapses.

    A value of 0 means to never refresh.

    Note: The value is treated as unsigned and cannot be negative.

    This property was introduced in Esri.ArcGISRuntime 100.1.


    [default] renderer : Renderer

    The renderer specifying how the features should be symbolized.


    [since Esri.ArcGISRuntime 100.2] renderingMode : Enums.FeatureRenderingMode

    The mode defines how the feature layer is rendered.

    Enums.FeatureRenderingModeStatic mode is better suited for displaying large datasets (in terms of the number of vertices) and for complex symbology because it does not update the layer's display while pan/zoom operations are in progress.

    Enums.FeatureRenderingModeDynamic mode is better suited for small datasets that update frequently or for better interactive experiences when the layer's display is updated continuously while pan/zoom operations are in progress.

    The default value is Enums.FeatureRenderingModeAutomatic.

    This property was introduced in Esri.ArcGISRuntime 100.2.

    See also Enums.FeatureRenderingMode.


    [since Esri.ArcGISRuntime 100.5] scaleSymbols : bool

    Returns true if the layer's symbols and labels honor the map's reference scale, otherwise false.

    If the map has a positive reference scale, and the layer honors it, then symbols and labels are drawn at their specified size when the viewing scale is the same as the reference scale. They will grow or shrink as the view zooms in or out, to keep the symbol a fixed size on the map. If the map has no reference scale, the reference scale is zero, or this feature layer's scaleSymbols property is false, then the symbols and labels will be drawn at their fixed screen size.

    A value of false means the symbols stay the same size in screen units regardless of the map scale.

    The default value is false.

    This property was introduced in Esri.ArcGISRuntime 100.5.


    [default, since Esri.ArcGISRuntime 100.2] sceneProperties : LayerSceneProperties

    Properties that are applied when the layer is rendered in a 3D scene using a SceneView object.

    These settings will have no effect if the layer is displayed in a MapView.

    This property was introduced in Esri.ArcGISRuntime 100.2.


    [read-only] selectFeaturesResult : FeatureQueryResult

    A collection of selected features, the result of the last successful select features task.


    [read-only] selectFeaturesStatus : Enums.TaskStatus

    The status for the task to select features.

    See also Enums.TaskStatus.


    [read-only] selectedFeaturesResult : FeatureQueryResult

    A collection of selected features, the result of the last successful get selected features task.


    [read-only] selectedFeaturesStatus : Enums.TaskStatus

    The status for the task to retrieve the collection of selected features.

    See also Enums.TaskStatus.


    [since Esri.ArcGISRuntime 100.3] serviceLayerId : string

    The service layer ID being used by the feature layer.

    Note: The underlying property is represented as a 64-bit integer type. See Accessing 64-bit integer properties from QML.

    This property must be set along with the item property. Failure to set both properties will result in the layer failing to load.

    The service layer ID cannot be changed after the layer is loaded.

    This property was introduced in Esri.ArcGISRuntime 100.3.

    See also serviceLayerIdAsInt.


    [since Esri.ArcGISRuntime 100.3] serviceLayerIdAsInt : double

    The same as serviceLayerId but represented as an integer type.

    The service layer ID cannot be changed after the layer is loaded.

    Note: The underlying property is represented as a 64-bit integer type. See Accessing 64-bit integer properties from QML.

    This property was introduced in Esri.ArcGISRuntime 100.3.


    [read-only, since Esri.ArcGISRuntime 100.3] supportsTimeFiltering : bool

    Returns whether the time aware layer supports filtering its contents by time values (read-only).

    This property was introduced in Esri.ArcGISRuntime 100.3.


    [since Esri.ArcGISRuntime 100.10] tilingMode : Enums.FeatureTilingMode

    The mode defines whether feature tiling is used to retrieve the features from the feature service.

    The default tiling mode is Enums.FeatureTilingModeEnabledWhenSupported.

    This property was introduced in Esri.ArcGISRuntime 100.10.


    [since Esri.ArcGISRuntime 100.3] timeFilteringEnabled : bool

    Returns whether the time aware layer participates in filtering based on the time extent of its geo view.

    This property was introduced in Esri.ArcGISRuntime 100.3.


    [read-only, since Esri.ArcGISRuntime 100.3] timeInterval : TimeValue

    Returns a time interval that represents the suggested step size for use when manipulating the time extent (read-only).

    This information can be used to set the step size for a time slider control.

    Note: This property is only available after the time aware layer is loaded.

    This property was introduced in Esri.ArcGISRuntime 100.3.

    See also TimeValue.


    [since Esri.ArcGISRuntime 100.3] timeOffset : TimeValue

    The time offset of the time aware layer.

    The time offset is subtracted from the time extent set on the time aware layer's geo view. This can be used to overlay data from different periods of time for comparison.

    Note: This property is only available after the layer is loaded.

    This property was introduced in Esri.ArcGISRuntime 100.3.

    See also TimeValue.


    [read-only, since Esri.ArcGISRuntime 100.7] unknownJson : jsobject

    Returns unknown JSON data from the source JSON. (read-only).

    Unknown JSON data consists of values that are in the source JSON but not parsed by this API.

    Unknown JSON is a jsobject of values not defined in the ArcGIS specification used to create this object but found in the source JSON. If the object is written back to JSON, any unknown JSON data is not persisted. The ArcGIS specification may be for a web map, web scene, REST API, and so on.

    This property was introduced in Esri.ArcGISRuntime 100.7.


    [read-only, since Esri.ArcGISRuntime 100.7] unsupportedJson : jsobject

    Returns unsupported JSON data from the source JSON. (read-only).

    Unsupported JSON is a jsobject of values defined in the ArcGIS specification used to create this object but not currently used in this API. If the object is written back to JSON, any unsupported JSON data is persisted. The ArcGIS specification may be from a web map, web scene, REST API, and so on.

    This property was introduced in Esri.ArcGISRuntime 100.7.


    Signal Documentation

    definitionExpressionChanged()

    Emitted when the definitionExpression property changes.

    Note: The corresponding handler is onDefinitionExpressionChanged.


    [since Esri.ArcGISRuntime 100.13] displayFilterDefinitionChanged()

    Emitted when the displayFilterDefinition property changes.

    Note: The corresponding handler is onDisplayFilterDefinitionChanged.

    This signal was introduced in Esri.ArcGISRuntime 100.13.


    featureTableChanged()

    Emitted when the featureTable property changes.

    Note: The corresponding handler is onFeatureTableChanged.


    [since Esri.ArcGISRuntime 100.3] fullTimeExtentChanged()

    Emitted when the fullTimeExtent property of the time aware layer changes.

    Note: The corresponding handler is onFullTimeExtentChanged.

    This signal was introduced in Esri.ArcGISRuntime 100.3.


    labelsEnabledChanged()

    Emitted when the labelsEnabled property changes.

    Note: The corresponding handler is onLabelsEnabledChanged.


    popupDefinitionChanged()

    Emitted when the popupDefinition property changes.

    Note: The corresponding handler is onPopupDefinitionChanged.


    popupEnabledChanged()

    Emitted when the popupEnabled property changes.

    Note: The corresponding handler is onPopupEnabledChanged.


    [since Esri.ArcGISRuntime 100.1] refreshIntervalChanged()

    Emitted when the refreshInterval property changes.

    Note: The corresponding handler is onRefreshIntervalChanged.

    This signal was introduced in Esri.ArcGISRuntime 100.1.


    rendererChanged()

    Emitted when the renderer property changes.

    Note: The corresponding handler is onRendererChanged.


    [since Esri.ArcGISRuntime 100.2] renderingModeChanged()

    Emitted when the renderingMode property changes.

    Note: The corresponding handler is onRenderingModeChanged.

    This signal was introduced in Esri.ArcGISRuntime 100.2.


    [since Esri.ArcGISRuntime 100.5] scaleSymbolsChanged()

    Emitted when the scaleSymbols property changes.

    Note: The corresponding handler is onScaleSymbolsChanged.

    This signal was introduced in Esri.ArcGISRuntime 100.5.


    [since Esri.ArcGISRuntime 100.2] scenePropertiesChanged()

    Emitted when the sceneProperties property changes.

    Note: The corresponding handler is onScenePropertiesChanged.

    This signal was introduced in Esri.ArcGISRuntime 100.2.


    selectFeaturesStatusChanged()

    Emitted when the selectFeaturesStatus property changes.

    Note: The corresponding handler is onSelectFeaturesStatusChanged.


    selectedFeaturesStatusChanged()

    Emitted when the selectedFeaturesStatus property changes.

    Note: The corresponding handler is onSelectedFeaturesStatusChanged.


    [since Esri.ArcGISRuntime 100.3] serviceLayerIdAsIntChanged()

    Emitted when the serviceLayerIdAsInt property changes.

    Note: The corresponding handler is onServiceLayerIdAsIntChanged.

    This signal was introduced in Esri.ArcGISRuntime 100.3.


    [since Esri.ArcGISRuntime 100.3] serviceLayerIdChanged()

    Emitted when the serviceLayerId property changes.

    Note: The corresponding handler is onServiceLayerIdChanged.

    This signal was introduced in Esri.ArcGISRuntime 100.3.


    [since Esri.ArcGISRuntime 100.3] supportsTimeFilteringChanged()

    Emitted when the supportsTimeFiltering property of the time aware layer changes.

    Note: The corresponding handler is onSupportsTimeFilteringChanged.

    This signal was introduced in Esri.ArcGISRuntime 100.3.


    [since Esri.ArcGISRuntime 100.10] tilingModeChanged()

    Emitted when the tilingMode property changes.

    Note: The corresponding handler is onTilingModeChanged.

    This signal was introduced in Esri.ArcGISRuntime 100.10.


    [since Esri.ArcGISRuntime 100.3] timeFilteringEnabledChanged()

    Emitted when the timeFilteringEnabled property of the time aware layer changes.

    Note: The corresponding handler is onTimeFilteringEnabledChanged.

    This signal was introduced in Esri.ArcGISRuntime 100.3.


    [since Esri.ArcGISRuntime 100.3] timeIntervalChanged()

    Emitted when the timeInterval property of the time aware layer changes.

    Note: The corresponding handler is onTimeIntervalChanged.

    This signal was introduced in Esri.ArcGISRuntime 100.3.


    [since Esri.ArcGISRuntime 100.3] timeOffsetChanged()

    Emitted when the timeOffset property of the time aware layer changes.

    Note: The corresponding handler is onTimeOffsetChanged.

    This signal was introduced in Esri.ArcGISRuntime 100.3.


    Method Documentation

    void clearSelection()

    Clears selection on all features.


    void resetFeaturesVisible()

    Resets all features back to visible state.


    void resetRenderer()

    Resets the renderer back to the original renderer provided by the FeatureTable.

    This is useful if you change the renderer and then want to revert back to the original renderer.


    void selectFeature(Feature feature)

    Selects the given feature and adds it to the current collection of selected features.

    • feature - The feature.

    Selected features are rendered according to the GeoView::selectionProperties.


    void selectFeatures(list<Feature> features)

    Selects the given features and adds them to the current collection of selected features.

    • features - A collection of features to be selected. Contents of the list are copied.

    Use the selectedFeaturesResult: to retrieve all of the selected features.


    void selectFeaturesWithQuery(QueryParameters parameters, SelectionMode mode)

    Queries for features and selects them, adding them to the current selection set.

    This method uses an asynchronous task that cannot be started if it is already running from a previous call to selectFeaturesWithQuery. You should check that the selectFeaturesStatus property is not Enums.TaskStatusInProgress before calling this method.

    After the task starts, you may use the signal selectFeaturesStatusChanged to monitor task status.

    Returns a task ID that can be used to cancel the selectFeaturesWithQuery task.

    See also Enums.TaskStatus and Cancelable.


    void selectedFeatures()

    Retrieves a list of selected features.

    This method uses an asynchronous task that cannot be started if it is already running from a previous call to selectedFeatures. You should check that the selectedFeaturesStatus property is not Enums.TaskStatusInProgress before calling this method.

    After the task starts, you may use the signal selectedFeaturesStatusChanged to monitor task status.

    Returns a task ID that can be used to cancel the selectedFeatures task.

    See also Cancelable.


    void setFeatureVisible(Feature feature, bool visible)

    Sets a feature to be visible or invisible.


    void setFeaturesVisible(list<Feature> features, bool visible)

    Sets multiple features to be visible or invisible.


    void unselectFeature(Feature feature)

    Unselects a feature, removing it from the current selection set.


    void unselectFeatures(list<Feature> features)

    Unselects multiple features, removing them from the current selection set.


    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.