FeatureLayer QML Type

A layer that can display features from a FeatureTable on a map. More...

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

Layer

Properties

Signals

Methods

Detailed Description

In a MVC architecture, the FeatureLayer is the view, while the FeatureTable is the model. Use the FeatureLayer to manipulate how the data displays on the map. For example, you can manipulate the opacity of the layer, turn labels on or off, and set a different Renderer through the FeatureLayer. The FeatureTable contains the data, and can be used for querying or editing the data.

FeatureLayer adopts the loadable pattern; many of its properties are initialized asynchronously. See Loadable for more information.

The feature layer has a load dependency on its featureTable from where it gets information about itself such as minimum and maximum scale, renderer, and so on.

You can initialize the FeatureLayer in two different ways:

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)

Example:

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

Map {
    BasemapTerrainWithLabels {}
    initialViewpoint: vc

    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:

// create a feature layer
FeatureLayer {
    // obtain the feature table from the geodatabase by name
    featureTable: gdb.geodatabaseFeatureTablesByTableName["Trailheads"] ?
                      gdb.geodatabaseFeatureTablesByTableName["Trailheads"] :
                      null

    // create the geodatabase
    Geodatabase {
        id: gdb
        path: dataPath + "geodatabase/LA_Trails.geodatabase"

        onErrorChanged: errorMessage = error.message;
    }

    onErrorChanged: errorMessage = error.message;
}

Note: The FeatureLayer will automatically reproject 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.

Note: You cannot create a FeatureLayer from a FeatureCollectionTable.

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

Property Documentation

definitionExpression : string

The definition expression in the syntax of a SQL WHERE clause by which to limit which features are displayed on the map.


[default] featureTable : FeatureTable

The backing dataset whose features are drawn on the map by this layer.

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


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 QML property was introduced in Esri.ArcGISRuntime 100.3.

See also TimeExtent.


[default] 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 must be set along with the serviceLayerId property. Failure to set both properties will result in the layer failing to load.

The item cannot be changed after the layer is loaded.

This QML property was introduced in Esri.ArcGISRuntime 100.3.


[default] labelDefinitions : LabelDefinitionListModel

Returns the list model of label definitions applied to the layer (read-only).


labelsEnabled : bool

Whether features will be labeled on the map.


popupDefinition : PopupDefinition

See also PopupSource.


popupEnabled : bool

See also PopupSource.


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 QML property was introduced in Esri.ArcGISRuntime 100.1.


[default] renderer : Renderer

The renderer specifying how the features should be symbolized.


renderingMode : Enums.FeatureRenderingMode

The rendering mode of the feature layer.

The default value is Enums.FeatureRenderingModeAutomatic.

This QML property was introduced in Esri.ArcGISRuntime 100.2.

See also Enums.FeatureRenderingMode.


scaleSymbols : bool

Whether the sublayer renders its symbols based on scale.

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 QML property was introduced in Esri.ArcGISRuntime 100.5.


[default] sceneProperties : LayerSceneProperties

The layer scene properties that can be used to make changes to how features are displayed in a SceneView.

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

This QML property was introduced in Esri.ArcGISRuntime 100.2.


selectFeaturesResult : FeatureQueryResult

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


selectFeaturesStatus : Enums.TaskStatus

The status for the task to select features.

See also Enums.TaskStatus.


selectedFeaturesResult : FeatureQueryResult

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


selectedFeaturesStatus : Enums.TaskStatus

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

See also Enums.TaskStatus.


serviceLayerId : string

The service layer ID being used by the feature layer.

Note: The underlying Runtime 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 QML property was introduced in Esri.ArcGISRuntime 100.3.

See also serviceLayerIdAsInt.


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 Runtime property is represented as a 64-bit integer type. See Accessing 64-bit integer properties from QML.

This QML property was introduced in Esri.ArcGISRuntime 100.3.


supportsTimeFiltering : bool

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

This QML property was introduced in 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 QML property was introduced in 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 QML property was introduced in Esri.ArcGISRuntime 100.3.

See also TimeValue.


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 QML property was introduced in Esri.ArcGISRuntime 100.3.

See also TimeValue.


Signal Documentation

definitionExpressionChanged()

Emitted when the definitionExpression property changes.


featureTableChanged()

Emitted when the featureTable property changes.


fullTimeExtentChanged()

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

This QML signal was introduced in Esri.ArcGISRuntime 100.3.


labelDefinitionsChanged()

Emitted when the labelDefinitions property changes.

This QML signal was introduced in Esri.ArcGISRuntime 100.1.


labelsEnabledChanged()

Emitted when the labelsEnabled property changes.


popupDefinitionChanged()

Emitted when the popupDefinition property changes.


popupEnabledChanged()

Emitted when the popupEnabled property changes.


refreshIntervalChanged()

Emitted when the refreshInterval property changes.

This QML signal was introduced in Esri.ArcGISRuntime 100.1.


rendererChanged()

Emitted when the renderer property changes.


renderingModeChanged()

Emitted when the renderingMode property changes.

This QML signal was introduced in Esri.ArcGISRuntime 100.2.


scaleSymbolsChanged()

Emitted when the scaleSymbols property changes.

This QML signal was introduced in Esri.ArcGISRuntime 100.5.


scenePropertiesChanged()

Emitted when the sceneProperties property changes.

This QML signal was introduced in Esri.ArcGISRuntime 100.2.


selectFeaturesStatusChanged()

Emitted when the selectFeaturesStatus property changes.


selectedFeaturesStatusChanged()

Emitted when the selectedFeaturesStatus property changes.


selectionColorChanged()

Emitted when the selectionColor property changes.


selectionWidthChanged()

Emitted when the selectionWidth property changes.


serviceLayerIdAsIntChanged()

Emitted when the serviceLayerIdAsInt property changes.

This QML signal was introduced in Esri.ArcGISRuntime 100.3.


serviceLayerIdChanged()

Emitted when the serviceLayerId property changes.

This QML signal was introduced in Esri.ArcGISRuntime 100.3.


supportsTimeFilteringChanged()

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

This QML signal was introduced in Esri.ArcGISRuntime 100.3.


timeFilteringEnabledChanged()

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

This QML signal was introduced in Esri.ArcGISRuntime 100.3.


timeIntervalChanged()

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

This QML signal was introduced in Esri.ArcGISRuntime 100.3.


timeOffsetChanged()

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

This QML signal was introduced in Esri.ArcGISRuntime 100.3.


Method Documentation

bool cancelTask(string taskId)

See also Cancelable.


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 feature table.

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


void selectFeature(Feature feature)

Selects a feature, adding it to the current selection set.


void selectFeatures(list<Feature> features)

Selects multiple features, adding them to the current selection set.


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)

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.



Feedback on this topic?