FeatureLayer class final
A layer that can visualize feature data.
Feature layers can display Feature data from a range of online feature
table 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 feature table 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 theWFSFeatureTable.axisOrder
andWFSFeatureTable.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
FeatureLayer.unsupportedJSON
. The FeatureLayer also provides
FeatureLayer.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 (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.
Constructors
- FeatureLayer.withFeatureLayerItem(Item item)
-
Creates a new feature layer object from a feature layer or feature service
portal item.
factory
- FeatureLayer.withFeatureTable(FeatureTable featureTable)
-
Creates a new feature layer from a given FeatureTable.
factory
- FeatureLayer.withItem({required Item featureServiceItem, required int layerId})
-
Creates a new feature layer object from a feature service portal item.
factory
Properties
- attribution → String
-
The attribution text for the layer.
no setterinherited
- canChangeVisibility → bool
-
A flag indicating whether the layer content's visibility can be changed.
no setterinherited
- definitionExpression ↔ String
-
A SQL expression which limits the features available for query and display
on the feature layer.
getter/setter pair
- description ↔ String
-
The description for the layer.
getter/setter pairinherited
- displayFilterDefinition ↔ DisplayFilterDefinition?
-
Defines how features are filtered from the display.
getter/setter pair
- featureReduction ↔ FeatureReduction?
-
Defines properties for dynamically aggregating and summarizing groups of
features as the map scale or visible extent changes.
getter/setter pair
- featureTable → FeatureTable?
-
The feature table whose features are drawn on the map by this layer.
no setter
- fullExtent → Envelope?
-
The full extent of this layer, which is the extent where all layer data is
contained.
no setterinherited
- fullTimeExtent → TimeExtent?
-
The full time extent of the layer.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- id ↔ String
-
The unique identifying string for the layer, as specified in a map or
scene.
getter/setter pairinherited
- isIdentifyEnabled → bool
-
True if the layer supports identify, false otherwise.
no setterinherited
- isTimeFilteringEnabled ↔ bool
-
True if the layer filters data based on its
GeoViewController.timeExtent, false otherwise.
getter/setter pairoverride
- isVisible ↔ bool
-
The layer content's visibility.
getter/setter pairinherited
- item → Item?
-
The item the layer has been created from.
no setterinherited
- labelsEnabled ↔ bool
-
True if features in the layer are labelled, otherwise false.
getter/setter pair
- loadError → ArcGISException?
-
The load error.
no setterinherited
- loadStatus → LoadStatus
-
The load status.
no setterinherited
- maxScale ↔ double
-
The maximum scale for the layer.
getter/setter pairinherited
- minScale ↔ double
-
The minimum scale for the layer.
getter/setter pairinherited
- name ↔ String
-
The layer content's name.
getter/setter pairinherited
-
onFullTimeExtentChanged
→ Stream<
TimeExtent?> -
Sets the callback invoked when the full time extent of the object has
changed.
no setteroverride
-
onLoadStatusChanged
→ Stream<
LoadStatus> -
A stream that reports changes to the
LoadStatus
.no setterinherited -
onSubLayerContentChanged
→ Stream<
List< LayerContent> > -
Callback invoked when the sublayer content of the layer content have
changed.
no setterinherited
-
onVisibilityChanged
→ Stream<
bool> -
Callback invoked when the visibility of the layer changes.
no setterinherited
- opacity ↔ double
-
The opacity for the layer.
getter/setter pairinherited
- refreshInterval ↔ int
-
The objects refresh interval.
getter/setter pair
- renderer ↔ Renderer?
-
The renderer specifies how the features are symbolized.
getter/setter pair
- renderingMode ↔ FeatureRenderingMode
-
The mode defines how the feature layer is rendered.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scaleSymbols ↔ bool
-
True if the layer's symbols and labels honor the map's reference scale,
otherwise false.
getter/setter pair
- showInLegend ↔ bool
-
A flag indicating whether the layer content participates in the legend.
getter/setter pairinherited
- spatialReference → SpatialReference?
-
The spatial reference of the layer.
no setterinherited
-
subLayerContents
→ List<
LayerContent> -
The sub layer contents of a layer content.
no setterinherited
- supportsTimeFiltering → bool
-
True if the layer supports filtering data based on its time values, false
otherwise.
no setteroverride
- tilingMode ↔ FeatureTilingMode
-
The mode defines whether feature tiling is used to retrieve the features
from the feature service.
getter/setter pair
- timeInterval → TimeValue?
-
The suggested time slider step size for this time aware layer.
no setteroverride
- timeOffset ↔ TimeValue?
-
The amount of time by which the temporal values of this layer's data
points are offset when displaying it in a GeoViewController.
getter/setter pairoverride
Methods
-
cancelLoad(
) → void -
Cancels loading metadata for the object.
inherited
-
clearSelection(
) → void - Clears all selected features.
-
clone(
) → Layer -
Clones this instance of the layer and its members.
inherited
-
fetchLegendInfos(
) → Future< List< LegendInfo> > -
Fetches the list of legend info.
inherited
-
fetchLegendInfosCancelable(
) → CancelableOperation< List< LegendInfo> > -
Cancelable version of fetchLegendInfos. See that method for more
information.
inherited
-
getSelectedFeatures(
) → Future< FeatureQueryResult> - Returns a collection of the currently selected features.
-
getSelectedFeaturesCancelable(
) → CancelableOperation< FeatureQueryResult> - Cancelable version of getSelectedFeatures. See that method for more information.
-
isVisibleAtScale(
double scale) → bool -
Returns the layer content's effective visibility at the specified scale.
inherited
-
load(
) → Future< void> -
Loads the metadata for the object asynchronously.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resetFeaturesVisible(
) → void - Reset the visibility of all features back to their original state.
-
resetRenderer(
) → void - Reset the renderer back to the original renderer provided by the FeatureTable.
-
retryLoad(
) → Future< void> -
Loads or retries loading metadata for the object asynchronously.
inherited
-
selectFeature(
{required Feature feature}) → void - Selects the given feature and adds it to the current collection of selected features.
-
selectFeatures(
{required List< Feature> features}) → void - Selects the given features and adds them to the current collection of selected features.
-
selectFeaturesWithQuery(
{required QueryParameters parameters, required SelectionMode mode}) → Future< FeatureQueryResult> - Selects the features that match the criteria in the QueryParameters object and adds them to the current collection of selected features.
-
selectFeaturesWithQueryCancelable(
{required QueryParameters parameters, required SelectionMode mode}) → CancelableOperation< FeatureQueryResult> - Cancelable version of selectFeaturesWithQuery. See that method for more information.
-
setFeaturesVisible(
{required List< Feature> features, required bool visible}) → void - Sets the visibility of the given features.
-
setFeatureVisible(
{required Feature feature, required bool visible}) → void - Sets the visibility of the given feature.
-
toString(
) → String -
A string representation of this object.
inherited
-
unselectFeature(
{required Feature feature}) → void - Unselects the given feature and removes it from the current collection of selected features.
-
unselectFeatures(
{required List< Feature> features}) → void - Unselects the given features and removes them from the current collection of selected features.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited