Skip To Content ArcGIS for Developers Sign In Dashboard

FeatureLayer Class

(Esri::ArcGISRuntime::FeatureLayer)

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

Header: #include <FeatureLayer>
Since: Esri::ArcGISRuntime 100.0
Inherits: Layer, PopupSource, and TimeAware

Public Functions

FeatureLayer(FeatureTable *featureTable, QObject *parent = nullptr)
FeatureLayer(Item *item, qint64 serviceLayerId, QObject *parent = nullptr)
~FeatureLayer()
void clearSelection()
QString definitionExpression() const
FeatureTable *featureTable() const
bool isLabelsEnabled() const
bool isScaleSymbols() const
LabelDefinitionListModel *labelDefinitions() const
quint64 refreshInterval() const
Renderer *renderer() const
FeatureRenderingMode renderingMode() const
void resetFeaturesVisible()
void resetRenderer()
LayerSceneProperties sceneProperties() const
void selectFeature(Feature *feature)
void selectFeatures(const QList<Feature *> &features)
TaskWatcher selectFeatures(const QueryParameters &parameters, SelectionMode mode)
TaskWatcher selectedFeatures()
qint64 serviceLayerId() const
void setDefinitionExpression(const QString &expression)
void setFeatureVisible(Feature *feature, bool visible)
void setFeaturesVisible(const QList<Feature *> &features, bool visible)
void setLabelsEnabled(bool enabled)
void setRefreshInterval(quint64 milliseconds)
void setRenderer(Renderer *renderer)
void setRenderingMode(FeatureRenderingMode renderingMode)
void setScaleSymbols(bool scaleSymbols)
void setSceneProperties(const LayerSceneProperties &sceneProperties)
void unselectFeature(Feature *feature)
void unselectFeatures(const QList<Feature *> &features)

Reimplemented Public Functions

virtual TimeExtent fullTimeExtent() const
virtual bool isPopupEnabled() const
virtual bool isSupportsTimeFiltering() const
virtual bool isTimeFilteringEnabled() const
virtual PopupDefinition *popupDefinition() const
virtual void setPopupDefinition(PopupDefinition *popupDefinition)
virtual void setPopupEnabled(bool popupEnabled)
virtual void setTimeFilteringEnabled(bool timeFilteringEnabled)
virtual void setTimeOffset(const TimeValue &timeOffset)
virtual TimeValue timeInterval() const
virtual TimeValue timeOffset() const

Signals

void fullTimeExtentChanged()
void selectFeaturesCompleted(QUuid taskId, Esri::ArcGISRuntime::FeatureQueryResult *featureQueryResult)
void selectedFeaturesCompleted(QUuid taskId, Esri::ArcGISRuntime::FeatureQueryResult *featureQueryResult)

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 1 public variable inherited from QObject
  • 10 static public members inherited from QObject
  • 9 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

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

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.

Feature layer 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.

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:

// create the feature table
m_featureTable = new ServiceFeatureTable(QUrl("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Energy/Geology/FeatureServer/9"), this);

// create the feature layer using the feature table
m_featureLayer = new FeatureLayer(m_featureTable, this);

// add the feature layer to the map
m_map->operationalLayers()->append(m_featureLayer);

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

// access the feature table by name
GeodatabaseFeatureTable* featureTable = m_geodatabase->geodatabaseFeatureTable("Trailheads");

// create a feature layer from the feature table
FeatureLayer* featureLayer = new FeatureLayer(featureTable, this);

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.

See also PopupSource.

Member Function Documentation

FeatureLayer::FeatureLayer(FeatureTable *featureTable, QObject *parent = nullptr)

Initialize the layer with the given featureTable and optional parent.

The feature table is the backing dataset whose features need to be drawn on the map by this layer.

Note: You cannot create a FeatureLayer from a FeatureCollectionTable.

FeatureLayer::FeatureLayer(Item *item, qint64 serviceLayerId, QObject *parent = nullptr)

Initialize the layer with the given item, serviceLayerId, and optional parent.

This function was introduced in Esri::ArcGISRuntime 100.3.

FeatureLayer::~FeatureLayer()

Destructor.

void FeatureLayer::clearSelection()

Clears selection on all features.

QString FeatureLayer::definitionExpression() const

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

See also setDefinitionExpression().

FeatureTable *FeatureLayer::featureTable() const

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

[virtual] TimeExtent FeatureLayer::fullTimeExtent() const

Reimplemented from TimeAware::fullTimeExtent().

Returns the full time extent of the layer.

This function was introduced in Esri::ArcGISRuntime 100.3.

[signal] void FeatureLayer::fullTimeExtentChanged()

Signal emitted when the fullTimeExtent changes.

See also TimeAware.

bool FeatureLayer::isLabelsEnabled() const

Returns true if features will be labeled on the map.

[virtual] bool FeatureLayer::isPopupEnabled() const

Reimplemented from PopupSource::isPopupEnabled().

See PopupSource.

bool FeatureLayer::isScaleSymbols() const

Returns 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 function was introduced in Esri::ArcGISRuntime 100.5.

[virtual] bool FeatureLayer::isSupportsTimeFiltering() const

Reimplemented from TimeAware::isSupportsTimeFiltering().

Returns whether the layer supports filtering its contents by time values.

This function was introduced in Esri::ArcGISRuntime 100.3.

[virtual] bool FeatureLayer::isTimeFilteringEnabled() const

Reimplemented from TimeAware::isTimeFilteringEnabled().

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

This function was introduced in Esri::ArcGISRuntime 100.3.

LabelDefinitionListModel *FeatureLayer::labelDefinitions() const

Returns the list model of label definitions in the layer.

This function was introduced in Esri::ArcGISRuntime 100.1.

[virtual] PopupDefinition *FeatureLayer::popupDefinition() const

Reimplemented from PopupSource::popupDefinition().

See PopupSource.

See also setPopupDefinition().

quint64 FeatureLayer::refreshInterval() const

Returns 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.

This function was introduced in Esri::ArcGISRuntime 100.1.

See also setRefreshInterval().

Renderer *FeatureLayer::renderer() const

Returns the renderer specifying how the features should be symbolized.

See also setRenderer().

FeatureRenderingMode FeatureLayer::renderingMode() const

Gets the rendering mode of the feature layer.

The default value is FeatureRenderingMode::Automatic.

This function was introduced in Esri::ArcGISRuntime 100.2.

See also setRenderingMode().

void FeatureLayer::resetFeaturesVisible()

Resets all features back to visible state.

void FeatureLayer::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.

LayerSceneProperties FeatureLayer::sceneProperties() const

Gets 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 function was introduced in Esri::ArcGISRuntime 100.2.

See also setSceneProperties().

void FeatureLayer::selectFeature(Feature *feature)

Adds the feature to the current selection set.

void FeatureLayer::selectFeatures(const QList<Feature *> &features)

Adds multiple features to the current selection set.

TaskWatcher FeatureLayer::selectFeatures(const QueryParameters &parameters, SelectionMode mode)

Selects features, asynchronously, based on query parameters and selection mode and returns a TaskWatcher for the asynchronous operation.

[signal] void FeatureLayer::selectFeaturesCompleted(QUuid taskId, Esri::ArcGISRuntime::FeatureQueryResult *featureQueryResult)

Signal emitted when a selection of features from a query operation has completed.

  • taskId - The task ID for the asynchronous operation.
  • featureQueryResult - A feature query result containing an iterator pointing to the selected features from the query.

The returned FeatureQueryResult object has the FeatureLayer as its parent.

See also Returned QObjects Parenting.

TaskWatcher FeatureLayer::selectedFeatures()

Launches a task to retrieve a collection of selected features, and returns a TaskWatcher for the asynchronous task.

[signal] void FeatureLayer::selectedFeaturesCompleted(QUuid taskId, Esri::ArcGISRuntime::FeatureQueryResult *featureQueryResult)

Signal emitted when the current selected features have been determined.

  • taskId - The task ID for the asynchronous operation.
  • featureQueryResult - A feature query result containing an iterator pointing to the selected features.

The returned FeatureQueryResult object has the FeatureLayer as its parent.

See also Returned QObjects Parenting.

qint64 FeatureLayer::serviceLayerId() const

Returns the service layer ID in the feature service that this layer was created from.

This function was introduced in Esri::ArcGISRuntime 100.3.

void FeatureLayer::setDefinitionExpression(const QString &expression)

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

See also definitionExpression().

void FeatureLayer::setFeatureVisible(Feature *feature, bool visible)

Sets a feature to be visible or invisible.

void FeatureLayer::setFeaturesVisible(const QList<Feature *> &features, bool visible)

Sets multiple features to be visible or invisible.

void FeatureLayer::setLabelsEnabled(bool enabled)

Sets whether labels are enabled on features in layer.

See also isLabelsEnabled().

[virtual] void FeatureLayer::setPopupDefinition(PopupDefinition *popupDefinition)

Reimplemented from PopupSource::setPopupDefinition().

Sets the popup definition to popupDefinition.

See also popupDefinition() and PopupSource.

[virtual] void FeatureLayer::setPopupEnabled(bool popupEnabled)

Reimplemented from PopupSource::setPopupEnabled().

Sets whether the PopupSource is enabled to popupEnabled.

See also isPopupEnabled() and PopupSource.

void FeatureLayer::setRefreshInterval(quint64 milliseconds)

Sets the refresh interval used by the layer to milliseconds.

Layers request features from the service each time this interval elapses

A value of 0 means to never refresh.

This function was introduced in Esri::ArcGISRuntime 100.1.

See also refreshInterval().

void FeatureLayer::setRenderer(Renderer *renderer)

Sets the renderer specifying how the features should be symbolized.

See also renderer().

void FeatureLayer::setRenderingMode(FeatureRenderingMode renderingMode)

Sets the rendering mode of the feature layer to renderingMode.

This function was introduced in Esri::ArcGISRuntime 100.2.

See also renderingMode().

void FeatureLayer::setScaleSymbols(bool scaleSymbols)

Sets whether the sublayer renders its symbols based on scale to scaleSymbols.

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 function was introduced in Esri::ArcGISRuntime 100.5.

See also isScaleSymbols().

void FeatureLayer::setSceneProperties(const LayerSceneProperties &sceneProperties)

Sets layer scene properties to sceneProperties, which can be used to make changes to how features are displayed in a SceneView.

This function was introduced in Esri::ArcGISRuntime 100.2.

See also sceneProperties().

[virtual] void FeatureLayer::setTimeFilteringEnabled(bool timeFilteringEnabled)

Reimplemented from TimeAware::setTimeFilteringEnabled().

Sets whether the layer uses the time range defined on the geo view to timeFilteringEnabled.

This function was introduced in Esri::ArcGISRuntime 100.3.

See also isTimeFilteringEnabled().

[virtual] void FeatureLayer::setTimeOffset(const TimeValue &timeOffset)

Reimplemented from TimeAware::setTimeOffset().

Sets the time offset of the layer to timeOffset.

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

This function was introduced in Esri::ArcGISRuntime 100.3.

See also timeOffset().

[virtual] TimeValue FeatureLayer::timeInterval() const

Reimplemented from TimeAware::timeInterval().

Returns a time interval that represents the suggested step size for use when manipulating the time extent.

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

This function was introduced in Esri::ArcGISRuntime 100.3.

[virtual] TimeValue FeatureLayer::timeOffset() const

Reimplemented from TimeAware::timeOffset().

Returns the applied time offset.

This function was introduced in Esri::ArcGISRuntime 100.3.

See also setTimeOffset().

void FeatureLayer::unselectFeature(Feature *feature)

Unselects and removes a feature from the current selection.

void FeatureLayer::unselectFeatures(const QList<Feature *> &features)

Unselects and removes features from the current selection.


Feedback on this topic?