ServiceFeatureTable

A table of features that typically represent real-world objects created from an ArcGIS feature service. An instance of this class represents the dataset of an individual layer or table in an ArcGIS map or feature service. The map or feature service may be hosted in the cloud on ArcGIS Online, or on-premises on an ArcGIS Server. To access these services you may need to provide authentication in your application.

You can construct a ServiceFeatureTable directly from the feature service using its URI or PortalItem. Alternatively, you can obtain a ServiceFeatureTable from a FeatureLayer or a FeatureTable that is part of an ArcGISMap or ArcGISScene. You can also obtain a ServiceFeatureTable directly from its service geodatabase using ServiceGeodatabase.getTable(Long).

The ServiceFeatureTable adopts the loadable pattern so many of its properties are initialized asynchronously after connecting to the service. For more information, see Loadable.

Display

If the ServiceFeatureTable.hasGeometry is true, you can display the features in an ArcGISMap or ArcGISScene. To do this create a FeatureLayer from the feature table and add it to the map or scene's collection of operational layers (GeoModel.operationalLayers). Spatial features are requested in the SpatialReference that matches the ArcGISMap or ArcGISScene and are displayed using the Symbol information defined by the map or feature service.

Query

You can query the data in the ServiceFeatureTable based on SQL expressions and/or spatial relationships. Use the QueryParameters object to define your spatial or attribute query and pass it to the ServiceFeatureTable.queryFeatures(QueryParameters, QueryFeatureFields) method. If the service feature table is related to any other tables that are part of the map or scene, use the ServiceFeatureTable.queryRelatedFeatures(ArcGISFeature, RelatedQueryParameters, QueryFeatureFields) method to query the related tables. For more information, see RelatedQueryParameters.

Edit

A ServiceFeatureTable can have editable attribute fields, feature templates(FeatureTemplate), feature types (FeatureType), and editing capabilities defined in ArcGISFeatureLayerInfo.capabilities. You can create, delete, and update data in the local cache depending upon whether the service allows those operations, who owns the data, and what ownership-based access control policies are in place. Permission to edit the data is managed by the author of the feature service. Explore ServiceFeatureTable.isEditable, ServiceFeatureTable.canAdd(), ServiceFeatureTable.canUpdate(Feature), and ServiceFeatureTable.canDelete(Feature) for information on what is permitted. If the service supports attachments (ServiceFeatureTable.hasAttachments), you can also view and potentially edit the attachments. If you want to apply your edits to the feature service, you must call the ServiceGeodatabase.applyEdits() method on the ServiceFeatureTable.serviceGeodatabase. This will ensure that the table and any tables involved in geodatabase behavior are updated. Areas that have geodatabase behavior include: * Composite relationships * Annotation feature layers * Utility network association deletion semantics * Attribute rules

Contingent Values

The ServiceFeatureTable supports querying and editing contingent values. See ServiceFeatureTable.getContingentValuesOrNull(ArcGISFeature, String) for more information.

Offline

If you wish to adopt an offline workflow, you can take areas of a ServiceFeatureTable offline using the GeodatabaseSyncTask. If you wish to take an ArcGISMap offline use the OfflineMapTask. See Build offline applications[https://developers.arcgis.com/documentation/mapping-apis-and-services/offline/] for more information.

Feature Request Mode

The FeatureRequestMode determines whether ServiceFeatureTable features are cached locally (for quicker access by map and scene layers) and whether queries are performed on the local cache or on the server. Consider which of these 3 modes is appropriate for your application:

  • FeatureRequestMode.OnInteractionCache - User interactions (pan or zoom) with the MapView or SceneView request features from the server and cache them locally for the duration of the session. Subsequent interactions with the MapView or SceneView will refresh this local cache. Queries are executed on the local cache or (if requested features are not resident in the cache) on the server. If the network connection is lost then the application can still operate with the local cache. This is the default mode.

  • FeatureRequestMode.OnInteractionNoCache - Your application will display or query features directly from the server. They are not cached locally. This mode ensures that you are working against the latest data, but it has a high network bandwidth since it goes to the server for all interactions (pans, zooms, selects, or queries).

  • FeatureRequestMode.ManualCache - Your application must explicitly call ServiceFeatureTable.populateFromService(QueryParameters, Boolean, MutableListImpl) to query the feature service and cache the resulting features in the ServiceFeatureTable. All queries are made against this local cache. You must adopt this mode for tables that contain non-spatial records (see ServiceFeatureTable.hasGeometry).

Since

200.1.0

Constructors

Link copied to clipboard
constructor(portalItem: PortalItem)

Creates a new service feature table object from an ArcGIS feature service or feature layer portal item. If the portal item is a feature service, the ServiceFeatureTable will be created from the first layer on the service. If the portal item is a feature layer, the ServiceFeatureTable will be created from the feature layer.

constructor(portalItem: PortalItem, layerId: Long)

Creates a new service feature table object from a feature service portal item.

constructor(table: ServiceFeatureTable, relationshipInfo: RelationshipInfo)

Creates a new service feature table object from the specified table and relationship information.

constructor(uri: String)

Creates a new service feature table object from a given URI.

Properties

Link copied to clipboard

The factor used to calculate a buffered extent around the current visible area when requesting features from a service. New features are requested from the service if the visible area of the MapView exceeds the buffered extent. A change in the visible area can result from any user interaction with the MapView, such as a pan or zoom action. The buffer factor is applied when the FeatureRequestMode is in either FeatureRequestMode.OnInteractionCache or FeatureRequestMode.OnInteractionNoCache.

Link copied to clipboard

An expression (SQL where clause) to filter features queried in this table. The definition expression string uses the SQL-92 where clause syntax (https://en.wikipedia.org/wiki/SQL-92). 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. For more information, see the ArcGIS Blog article "Querying Feature Services Date-Time Queries".

Link copied to clipboard

Defines when features and non-spatial records are requested from the feature service. The default mode is FeatureRequestMode.OnInteractionCache.

Link copied to clipboard

The service geodatabase version name. This property is populated if the ServiceFeatureTable is provided by a layer or a table in a web map or if the ServiceFeatureTable is created using ServiceGeodatabase.getTable(Long).

Link copied to clipboard

The Item that defines the service feature table.

Link copied to clipboard

The service geodatabase this service feature table is part of. This property is populated if the ServiceFeatureTable is provided by a layer or a table in a web map or if the ServiceFeatureTable is created using ServiceGeodatabase.getTable(Long).

Link copied to clipboard
val uri: String?

The URI of the service feature table.

Inherited properties

Link copied to clipboard
open override var apiKey: ApiKey?

An API key is a unique key used to authorize access to specific services and resources in ArcGIS Online. It is also used to monitor access to those services.

Link copied to clipboard

The table's contingent values definition. The contingent values definition must be loaded after the table has loaded. If the list of field groups is empty after loading, then no contingent values are defined for this table.

Link copied to clipboard

The table's default subtype code.

Link copied to clipboard

A user-friendly name that can be displayed in the UI (for example, in a Table of Contents). If the table is displayed with a FeatureLayer, the FeatureTable.displayName is used as the FeatureLayer.name.

Link copied to clipboard

A list of editable fields.

Link copied to clipboard

The geographic extent of features within the table. This is calculated differently for specific types and modes of feature tables:

Link copied to clipboard

The table's feature subtypes.

Link copied to clipboard

A list of the feature templates on this table.

Link copied to clipboard

The feature types for this table.

Link copied to clipboard
open val fields: List<Field>

The collection of Field objects representing the fields of the feature table.

Link copied to clipboard

The type of geometry of the features stored in this table. If FeatureTable.hasGeometry is false, then the geometry type is GeometryType.Unknown.

Link copied to clipboard

The global id field name.

Link copied to clipboard

True if the features in this table have attachments, false otherwise.

Link copied to clipboard

True if the feature table supports geographic features, false otherwise.

Link copied to clipboard

True if the feature table supports geometries with M values, false otherwise.

Link copied to clipboard

True if the feature table supports geometries with Z values, false otherwise.

Link copied to clipboard

True if this feature table is editable, false otherwise. Underlying file permissions (for subclasses such as ShapefileFeatureTable and GeodatabaseFeatureTable) can be changed while the feature table is open. In these cases the value of this property may not be accurate.

Link copied to clipboard
open override var isPopupEnabled: Boolean

A flag indicating whether the PopupDefinition defined on the PopupSource is enable / disable. Will return false if an error occurs.

Link copied to clipboard
val layer: Layer?

The layer that displays this table, if any. The Layer type depends on how the feature table is created. For example, a Layer will be an AnnotationLayer if the FeatureTable is created from a table that supports annotation. See Layer for more information about the supported layer types.

Link copied to clipboard

The service information related to the feature layer. Explore the editing capabilities of this feature table with ArcGISFeatureLayerInfo.capabilities or the editor tracked fields with ArcGISFeatureLayerInfo.editFieldsInfo.

Link copied to clipboard
open override val loadStatus: StateFlow<LoadStatus>

The load status.

Link copied to clipboard

The number of features in the table. If all the features are stored in the local table, for example with a GeodatabaseFeatureTable or a ShapefileFeatureTable, then the FeatureTable.numberOfFeatures will return the full number of features.

Link copied to clipboard

The object id field name.

Link copied to clipboard
open override var popupDefinition: PopupDefinition?

The pop-up definition. The PopupDefinition associated with the popup source. A null if an error occurs or if the popup source is not associated with a pop-up definition.

Link copied to clipboard

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

Link copied to clipboard

The spatial reference of the table. A spatial reference defines how the coordinates of a feature's Geometry correspond to locations in the real world. For more information, see the SpatialReference class or the Spatial references[https://developers.arcgis.com/documentation/spatial-references/] documentation.

Link copied to clipboard

The table's subtype field.

Link copied to clipboard

The name of the table in the source dataset.

Link copied to clipboard

The type id field name.

Link copied to clipboard

Unknown data from the source JSON. Unknown JSON is a dictionary of values not defined in the ArcGIS specification used to create this object but found in the source JSON. If the object is written back to JSON, any unknown JSON data is not persisted. The ArcGIS specification may be for a web map, web scene, REST API, and so on.

Link copied to clipboard

Unsupported data from the source JSON. Unsupported JSON is a dictionary of values defined in the ArcGIS specification used to create this object but not currently used in this API. If the object is written back to JSON, any unsupported JSON data is persisted. The ArcGIS specification may be from a web map, web scene, REST API, and so on.

Link copied to clipboard

True if the table is using advanced symbology, false otherwise.

Link copied to clipboard

The username of the feature table. The username is used for ownership-based access control (OBAC) and editor tracking purposes.

Functions

Link copied to clipboard

Uploads any changes to the local table to the feature service. ServiceFeatureTable.applyEdits() is meant to be used for single table workflows or tables without geodatabase behavior (see below). If an edit on this table can cause an edit to another table due to geodatabase behavior, it is highly recommended to use ServiceGeodatabase.applyEdits() instead to prevent data inconsistency, so that dependent edits are all applied or none are (if an error occurs).

Link copied to clipboard
fun clearCache(keepLocalEdits: Boolean)

Clears cached data.

Link copied to clipboard

Loads all attributes and geometries for features that have not been loaded and fetches attributes and geometries for previously loaded features. Features returned from ServiceFeatureTable.queryFeatures(QueryParameters, QueryFeatureFields) or ServiceFeatureTable.queryRelatedFeatures(ArcGISFeature, RelatedQueryParameters, QueryFeatureFields) may be in the minimally loaded state (minimum attributes required for rendering and no m-values). To load all attributes, pass an Iterable of the features to this method.

Link copied to clipboard
suspend fun populateFromService(parameters: QueryParameters, clearCache: Boolean, outFields: Iterable<String>): Result<FeatureQueryResult>

Queries the feature service and places the resulting features in the local table, which is cached for the duration of the session. The ServiceFeatureTable must have its ServiceFeatureTable.featureRequestMode set to FeatureRequestMode.ManualCache. This method is useful for non-geographic data. It's also helpful when you want to avoid accessing the service for a feature whose geometry is in the current extent of the map or scene.

Link copied to clipboard
suspend fun queryFeatures(parameters: QueryParameters, queryFeatureFields: QueryFeatureFields): Result<FeatureQueryResult>

Queries features from this table's cache and/or from the feature service used to create this table. If the request mode of the table is FeatureRequestMode.ManualCache, then the query is always performed on the local table.

Link copied to clipboard

Queries for related features in this service feature table using the provided parameters and query feature fields. See ServiceFeatureTable.queryFeatures(QueryParameters, QueryFeatureFields) for more details.

Link copied to clipboard
suspend fun undoLocalEdits(): Result<Unit>

Undoes all of the local edits since the last server acknowledgment. ServiceFeatureTable.undoLocalEdits() is meant to be used for single table workflows or tables without geodatabase behavior (see below). If the service which the table belongs to has geodatabase behavior (see below), it is highly recommended to use ServiceGeodatabase.undoLocalEdits(). Undoing edits in one table can cause data inconsistencies between the local cache and the service if ServiceFeatureTable.undoLocalEdits() is used.

Inherited functions

Link copied to clipboard
suspend fun addFeature(feature: Feature): Result<Unit>

Adds a feature to the table. Adding a feature that contains a Geometry causes the geometry to become simplified. This may change a single part geometry to a multipart geometry, or round off X, Y, Z, and M coordinate values that are above the resolution set by the SpatialReference.

Link copied to clipboard
suspend fun addFeatures(features: Iterable<Feature>): Result<Unit>

Adds a collection of features to the table.

Link copied to clipboard

Determines whether you can add new features to the table. Although this method may state that the table allows new features to be added, the application may not be licensed to permit this. For example, a user cannot add features to a secured feature table if the application is licensed at the Lite level (LicenseLevel.Lite).

Link copied to clipboard
open override fun cancelLoad()

Cancels loading metadata for the Loadable object.

Link copied to clipboard
fun canDelete(feature: Feature): Boolean

Determines whether you can delete the feature from the table. Although this method may state that the table allows the feature to be deleted, the application may not be licensed to permit this. For example, a user cannot delete features from a secured feature table if the application is licensed at the Lite level (LicenseLevel.Lite).

Link copied to clipboard

Determines whether you can edit the geometry field in a table. Although this method may state that the table allows geometry fields to be edited, the application may not be licensed to permit this. For example, a user cannot update geometry in a secured feature table if the application is licensed at the Lite level (LicenseLevel.Lite).

Link copied to clipboard
fun canUpdate(feature: Feature): Boolean

Determines whether you can update the feature in the table. Although this method may state that the table allows the feature to be updated, the application may not be licensed to permit this. For example, a user cannot update features in a secured feature table if the application is licensed at the Lite level (LicenseLevel.Lite).

Link copied to clipboard
fun createFeature(featureSubtype: FeatureSubtype, geometry: Geometry? = null): ArcGISFeature

Creates a new feature based on the provided feature subtype and geometry.

fun createFeature(featureTemplate: FeatureTemplate, geometry: Geometry? = null): ArcGISFeature

Creates a new feature based on the provided feature template and geometry.

fun createFeature(featureType: FeatureType, geometry: Geometry? = null): ArcGISFeature

Creates a new feature based on the provided feature type and geometry.

Creates a new empty feature. The new feature is only available in memory at this point. Execute FeatureTable.addFeature(Feature) to commit the new Feature to the table.

fun createFeature(attributes: Map<String, Any?>, geometry: Geometry?): Feature

Creates a new feature with the provided attribute values and, optionally, geometry. The new feature is only available in memory at this point. Execute FeatureTable.addFeature(Feature) to commit the new Feature to the table.

Link copied to clipboard
suspend fun deleteFeature(feature: Feature): Result<Unit>

Deletes a feature from the table. Deleting a feature from a GeodatabaseFeatureTable in a stand-alone mobile geodatabase created with ArcGIS Pro is not supported when the table participates in a controller dataset, such as a utility network or parcel fabric. Use FeatureTable.canDelete(Feature) to determine if this operation is allowed.

Link copied to clipboard
suspend fun deleteFeatures(features: Iterable<Feature>): Result<Unit>

Deletes a collection of features from the table.

Link copied to clipboard

Returns the features added since the last sync. For mobile geodatabases created by ArcGIS Pro, this method returns no features because there is no concept of syncing.

Link copied to clipboard

Returns the number of features added since the last sync. For mobile geodatabases created by ArcGIS Pro, this method returns 0 because there is no concept of syncing.

Link copied to clipboard

Returns possible values for the specified field, in the context of defined contingencies. This method iterates over all the field groups that the input field participates in. For each, it looks at the input feature's field values for the other fields participating in that field group. Contingencies that are satisfied by the other fields are identified, and their values for the input field are aggregated. These are returned in a ContingentValuesResult, which contains a dictionary of field group names to an array of ContingentValue objects accessed via ContingentValuesResult.byFieldGroup, specifying possible values for the input field that will satisfy a contingency in that field group. If the feature participates in multiple field groups and there are values that will satisfy all groups, they will be returned by ContingentValuesResult.allGroups.

Link copied to clipboard

Returns the features deleted since the last sync. For mobile geodatabases created by ArcGIS Pro, this method returns no features because there is no concept of syncing.

Link copied to clipboard

Returns the number of features deleted since the last sync. For mobile geodatabases created by ArcGIS Pro, this method returns 0 because there is no concept of syncing.

Link copied to clipboard

Searches for the feature template with the given name.

Link copied to clipboard

Searches for the feature type with the given name.

Link copied to clipboard
fun getField(fieldName: String): Field?

Retrieves the field with the given fieldName.

Link copied to clipboard

Returns all the features that were added, updated or deleted since the last sync. Returns a result object containing a feature edit iterator. For mobile geodatabase created by ArcGIS Pro, the iterator in the result object is empty because there is no concept of syncing.

Link copied to clipboard

Returns the number of features that were added, updated or deleted since the last sync. For mobile geodatabases created by ArcGIS Pro, this method returns a count of 0 because there is no concept of syncing.

Link copied to clipboard

Returns a list of all related tables that have been added to the map. Only returns tables that have been added to the map that this table is associated with.

Link copied to clipboard

Returns the features updated since the last sync. For mobile geodatabases created by ArcGIS Pro, this method returns no features because there is no concept of syncing.

Link copied to clipboard

Returns the number of features updated since the last sync. For mobile geodatabases created by ArcGIS Pro, this method returns 0 because there is no concept of syncing.

Link copied to clipboard

Checks whether the feature table has local edits. For ServiceFeatureTable, local edits are edits that have not yet been applied to the feature service. For GeodatabaseFeatureTable, local edits are edits that have been made since the last acknowledged upload. For mobile geodatabases created by ArcGIS Pro, this method returns false because there is no concept of uploading or applying edits. For mobile geodatabases, use GeodatabaseFeatureTable.hasLocalEditsSince(Instant).

Link copied to clipboard
open suspend override fun load(): Result<Unit>

Loads the metadata for the object.

Link copied to clipboard
suspend fun queryExtent(queryParameters: QueryParameters): Result<Envelope>

Determines the minimum bounding envelope that contains features satisfying the provided query parameters. If no features meet the query criteria, an empty envelope is returned.

Link copied to clipboard
suspend fun queryFeatureCount(queryParameters: QueryParameters): Result<Long>

Determines the count of features that satisfy the provided query parameters.

Link copied to clipboard

Submits a query against the table.

Link copied to clipboard
suspend fun queryRelatedFeatureCount(feature: ArcGISFeature, parameters: RelatedQueryParameters? = null): Result<Long>

Performs a query that returns the number of related features to supplied feature based on the parameters.

Link copied to clipboard

Queries for related features of a given feature in a specific relationship. The origin and all destination tables must be associated with the same map, either as a feature source for a layer or added to the map via its table collection. Otherwise, the query will return no results.

Link copied to clipboard
suspend fun queryStatistics(statisticsQueryParameters: StatisticsQueryParameters): Result<StatisticsQueryResult>

Calculates values for the requested statistics. Statistics query parameters may also define fields on which results are grouped or sorted.

Link copied to clipboard
open suspend override fun retryLoad(): Result<Unit>

Loads or retries loading metadata for the object.

Link copied to clipboard

Returns list of tables related by the given relationship info. Only returns tables that have been added to the map. If there are multiple instances of the related table on the map, all such instances will be returned.

Link copied to clipboard
suspend fun updateFeature(feature: Feature): Result<Unit>

Updates a feature in the table. If you update a feature that contains a Geometry, the geometry becomes simplified. This may change a single part geometry to a multipart geometry, or round X, Y, Z, and M coordinate values that are above the resolution set by the SpatialReference.

Link copied to clipboard
suspend fun updateFeatures(features: Iterable<Feature>): Result<Unit>

Updates a collection of features in the table.

Link copied to clipboard

Returns an array of contingency constraint violations based on the input feature. An empty array indicates that all contingencies associated with the feature are valid.

Link copied to clipboard

Validates constraints for a given feature participating in a relationship. The following are considered violations: