Feature Layer
A layer that can visualize vector/feature data. Feature layers display feature data from an online ServiceFeatureTable source, or from offline sources such as GeodatabaseFeatureTable, ShapefileFeatureTable, or GeoPackageFeatureTable. 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 can also be used to store features associated with a utility network.
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. The geodatabase can also be a mobile geodatabase created by ArcGIS Pro. Mobile geodatabases cannot be synced and use a default renderer.
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 https://www.ogc.org/standards/geopackage. Geopackage feature tables can be edited and saved, but can't 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 WFS feature table. 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[https://www.ogc.org/standards/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.getAxisOrder() and WfsFeatureTable.getFilterAxisOrder().
OGC API Features - Backed by an OGC feature collection table. 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[https://docs.opengeospatial.org/is/17-069r3/17-069r3.html] and https://docs.opengeospatial.org/is/18-058/18-058.html.
Individual features can be queried and filtered based on spatial queries or SQL queries. Introduced at 100.3.0, string comparisons for features queried in service feature tables are case insensitive.
The features displayed in a FeatureLayer are reprojected to match the GeoModel.getSpatialReference(), if necessary. Local tables cannot be reprojected automatically.
The FeatureLayer does not expose every value defined in the web map specification. You can obtain a dictionary of these unsupported values from FeatureLayer.getUnsupportedJson(). The FeatureLayer also provides FeatureLayer.getUnknownJson() to return JSON that was not recognized in the web map specification.
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, Boolean, MutableListImpl). Once populated, all queries are made against the local table only. ServiceFeatureTable.populateFromService(QueryParameters, Boolean, MutableListImpl) 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
Constructors
Creates a new feature layer object. Any of the inherited FeatureTable types can be used as the input parameter for this constructor, including the ArcGISFeatureTable, FeatureCollectionTable, GeoPackageFeatureTable, OgcFeatureCollectionTable, ShapefileFeatureTable, and WfsFeatureTable.
Creates a new feature layer object from a feature layer or feature service portal item. If the portal item is a feature service, the FeatureLayer will be created from the first layer on the service.
Creates a new feature layer object from a feature service portal item. The FeatureLayer will fail to load if an invalid portal item is passed in, for example a feature layer portal item.
Functions
Cancels loading metadata for the Loadable object.
Clears all selected features.
Clones the FeatureLayer.
Fetches the list of legend info.
Returns a list of the currently selected features.
Returns the layer content's effective visibility at the specified scale. Returns the effective layer content visibility. This effective visibility takes care of the effective visibility of the parents at the specified scale. Will return false if an error occurs.
Resets the layer's features visibility back to factory defaults.
Resets the renderer to the factory default.
Selects the given feature and adds it to the current list of selected features.
Selects the features in the list and adds them to the current list of selected features.
Selects the features that match the criteria in the QueryParameters object and adds them to the current list of selected features.
Sets the visibility of the given features.
Sets the visibility of the given feature.
Unselects the given feature and removes it from the current list of selected features.
Unselects the features in the given list and removes them from the current list of selected features.
Properties
A SQL expression which limits the features available for query and display on the feature layer. The definition expression string that is used as the FeatureLayer.getDefinitionExpression() should follow standard SQL syntax similar to what is discussed in the document https://pro.arcgis.com/en/pro-app/latest/help/mapping/navigation/sql-reference-for-elements-used-in-query-expressions.htm.
Defines the properties that allow a layer to be floor-aware. When a layer is configured as floor-aware, it has a FloorAware.getFloorDefinition() 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.
The unique identifying string for the layer, for example specified in a map or scene. The id is used by other parts of this API to refer to a specific Layer, such as in a set of FeatureFenceParameters or a FacilityLayerDefinition. If not supplied, all layers will be assigned a unique id when created.
A flag indicating whether the PopupDefinition defined on the PopupSource is enable / disable. Will return false if an error occurs.
Whether the layer's symbols and labels honor the Map reference scale. If the Map has a positive reference scale, and the layer honors it, then symbols and labels will be drawn at their specified size when the viewing scale is the same as the reference scale, and 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 the FeatureLayer's scaleSymbols property is false, then the symbols and labels will be drawn at their fixed screen size.
The feature tiling mode in use by the feature layer. Default is FeatureTilingMode.EnabledWhenSupported. Changes how feature tiling is handled by the feature layer.