;

FeatureLayer Class

  • FeatureLayer
  • class Esri::ArcGISRuntime::FeatureLayer

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

    This class was introduced in Esri::ArcGISRuntime 100.0.

    Public Functions

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

    Reimplemented Public Functions

    virtual Esri::ArcGISRuntime::LayerFloorDefinition *floorDefinition() const override
    virtual Esri::ArcGISRuntime::TimeExtent fullTimeExtent() const override
    virtual bool isPopupEnabled() const override
    virtual bool isSupportsTimeFiltering() const override
    virtual bool isTimeFilteringEnabled() const override
    virtual Esri::ArcGISRuntime::PopupDefinition *popupDefinition() const override
    virtual void setFloorDefinition(Esri::ArcGISRuntime::LayerFloorDefinition *floorDefinition) override
    virtual void setPopupDefinition(Esri::ArcGISRuntime::PopupDefinition *popupDefinition) override
    virtual void setPopupEnabled(bool popupEnabled) override
    virtual void setTimeFilteringEnabled(bool timeFilteringEnabled) override
    virtual void setTimeOffset(const Esri::ArcGISRuntime::TimeValue &timeOffset) override
    virtual Esri::ArcGISRuntime::TimeValue timeInterval() const override
    virtual Esri::ArcGISRuntime::TimeValue timeOffset() const override

    Signals

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

    Detailed Description

    Feature layers display data from feature services or supported local data sources, including shapefiles, GeoPackages, and geodatabases. 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.

    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.

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

    • Feature service - backed by a feature service table. 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 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 the 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. Uses a feature layer to show the contents of shapefiles (.shp).
    • Geopackage - backed by a geopackage feature table. 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 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.
    • OGC API Features - Backed by an OGC feature collection table. You can populate the table using Runtime query parameters. A OCG feature collection table only supports manual cache feature request mode. Runtime supports OGC API - Features - Part 1 and OGC API - Features - Part 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 WfsFeatureTable::axisOrder and WfsFeatureTable::filterAxisOrder properties.

    Individual features can be queried and filtered based on spatial queries or SQL queries. Introduced at Esri::ArcGISRuntime 100.3, string comparisons for features queried in service feature tables are case insensitive.

    The features displayed in a FeatureLayer are reprojected to match the Map::spatialReference, if necessary. Local tables cannot be reprojected 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 by Runtime. Feature layers also provide a unknownJson property to return JSON that was not recognized.

    Performance characteristics

    Because 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 usage 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 ServiceFeatureTable::populateFromService(QueryParameters, bool, QStringList). Once populated, all queries are made against the local table only. ServiceFeatureTable::populateFromService(QueryParameters, bool, QStringList) 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.

    See also Layer, https://developers.arcgis.com/qt/latest/cpp/sample-code/feature-layer-geodatabase/, https://developers.arcgis.com/qt/latest/cpp/sample-code/feature-layer-query/, https://developers.arcgis.com/qt/latest/cpp/sample-code/feature-layer-shapefile/, https://developers.arcgis.com/qt/latest/cpp/sample-code/feature-layer-feature-service/, and https://developers.arcgis.com/qt/latest/cpp/sample-code/service-feature-table-manual-cache/.

    Member Function Documentation

    FeatureLayer::FeatureLayer(Esri::ArcGISRuntime::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(Esri::ArcGISRuntime::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.

    [signal] void FeatureLayer::fullTimeExtentChanged()

    Signal emitted when the fullTimeExtent changes.

    See also TimeAware.

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

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

    [override virtual] 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().

    Esri::ArcGISRuntime::FeatureTable *FeatureLayer::featureTable() const

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

    [override virtual] Esri::ArcGISRuntime::LayerFloorDefinition *FeatureLayer::floorDefinition() const

    Returns 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 nullptr (default value) the specific layer does not support floor filtering.

    This function was introduced in Esri::ArcGISRuntime 100.12.

    See also setFloorDefinition().

    [override virtual] Esri::ArcGISRuntime::TimeExtent FeatureLayer::fullTimeExtent() const

    Reimplements: TimeAware::fullTimeExtent() const.

    Returns the full time extent of the layer.

    This function was introduced in Esri::ArcGISRuntime 100.3.

    bool FeatureLayer::isLabelsEnabled() const

    Returns true if features will be labeled on the map.

    [override virtual] bool FeatureLayer::isPopupEnabled() const

    Reimplements: PopupSource::isPopupEnabled() const.

    Returns whether the Popup is enabled on the 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.

    [override virtual] bool FeatureLayer::isSupportsTimeFiltering() const

    Reimplements: TimeAware::isSupportsTimeFiltering() const.

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

    This function was introduced in Esri::ArcGISRuntime 100.3.

    [override virtual] bool FeatureLayer::isTimeFilteringEnabled() const

    Reimplements: TimeAware::isTimeFilteringEnabled() const.

    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.

    Esri::ArcGISRuntime::LabelDefinitionListModel *FeatureLayer::labelDefinitions() const

    Returns the list model of label definitions in the layer.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [override virtual] Esri::ArcGISRuntime::PopupDefinition *FeatureLayer::popupDefinition() const

    Reimplements: PopupSource::popupDefinition() const.

    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().

    Esri::ArcGISRuntime::Renderer *FeatureLayer::renderer() const

    Returns the renderer specifying how the features should be symbolized.

    See also setRenderer().

    Esri::ArcGISRuntime::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.

    Esri::ArcGISRuntime::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(Esri::ArcGISRuntime::Feature *feature)

    Adds the feature to the current selection set.

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

    Adds multiple features to the current selection set.

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

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

    Esri::ArcGISRuntime::TaskWatcher FeatureLayer::selectedFeatures()

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

    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.

    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.

    See also definitionExpression().

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

    Sets a feature to be visible or invisible.

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

    Sets multiple features to be visible or invisible.

    [override virtual] void FeatureLayer::setFloorDefinition(Esri::ArcGISRuntime::LayerFloorDefinition *floorDefinition)

    Sets the floorDefinition to floorDefinition.

    See also floorDefinition.

    void FeatureLayer::setLabelsEnabled(bool enabled)

    Sets whether labels are enabled on features in layer.

    See also isLabelsEnabled().

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

    Reimplements: PopupSource::setPopupDefinition(Esri::ArcGISRuntime::PopupDefinition *popupDefinition).

    Sets the popup definition to popupDefinition.

    See also popupDefinition() and PopupSource.

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

    Reimplements: PopupSource::setPopupEnabled(bool popupEnabled).

    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(Esri::ArcGISRuntime::Renderer *renderer)

    Sets the renderer specifying how the features should be symbolized.

    See also renderer().

    void FeatureLayer::setRenderingMode(Esri::ArcGISRuntime::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 Esri::ArcGISRuntime::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().

    void FeatureLayer::setTilingMode(Esri::ArcGISRuntime::FeatureTilingMode tilingMode)

    Sets the tilingMode to tilingMode.

    This function was introduced in Esri::ArcGISRuntime 100.10.

    See also tilingMode.

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

    Reimplements: TimeAware::setTimeFilteringEnabled(bool timeFilteringEnabled).

    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().

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

    Reimplements: TimeAware::setTimeOffset(const Esri::ArcGISRuntime::TimeValue &timeOffset).

    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().

    Esri::ArcGISRuntime::FeatureTilingMode FeatureLayer::tilingMode() const

    Returns the feature tiling mode in-use by the feature layer. Default is FeatureTilingMode::EnabledWhenSupported.

    Changes how feature tiling is handled by the feature layer.

    This function was introduced in Esri::ArcGISRuntime 100.10.

    See also setTilingMode() and FeatureTilingMode.

    [override virtual] Esri::ArcGISRuntime::TimeValue FeatureLayer::timeInterval() const

    Reimplements: TimeAware::timeInterval() const.

    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.

    [override virtual] Esri::ArcGISRuntime::TimeValue FeatureLayer::timeOffset() const

    Reimplements: TimeAware::timeOffset() const.

    Returns the applied time offset.

    This function was introduced in Esri::ArcGISRuntime 100.3.

    See also setTimeOffset().

    QJsonObject FeatureLayer::unknownJson() const

    Returns unknown JSON data from the source JSON.

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

    This function was introduced in Esri::ArcGISRuntime 100.7.

    void FeatureLayer::unselectFeature(Esri::ArcGISRuntime::Feature *feature)

    Unselects and removes a feature from the current selection.

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

    Unselects and removes features from the current selection.

    QJsonObject FeatureLayer::unsupportedJson() const

    Returns the unsupported JSON data from the source JSON.

    Unsupported JSON data consists of values that are supported by web maps, but are not exposed through the ArcGIS Runtime API.

    This function was introduced in Esri::ArcGISRuntime 100.7.

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