- All Implemented Interfaces:
Loadable,PopupSource
- Direct Known Subclasses:
ArcGISFeatureTable,FeatureCollectionTable,GeoPackageFeatureTable,OgcFeatureCollectionTable,ShapefileFeatureTable,WfsFeatureTable
This is the base class for a number of different feature tables, such as ServiceFeatureTable,
FeatureCollectionTable, and GeoPackageFeatureTable.
The records in a feature table must all have geometry (shape and location) or have no geometry (just attribute
values). If the records have geometry (hasGeometry() is true), you can display the features
by creating a FeatureLayer from the feature table and adding the feature layer
to the ArcGISMap or ArcGISScene's
collection of operational layers (GeoModel.getOperationalLayers()).
FeatureTable provides methods for spatial and attribute querying (for example,
queryFeaturesAsync(QueryParameters)), and methods to add, update, and delete features (such
as addFeatureAsync(Feature), updateFeatureAsync(Feature), and
deleteFeatureAsync(Feature)).
- Since:
- 100.0.0
-
Property Summary
PropertiesTypePropertyDescriptionThe load error.The load status. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDoneLoadingListener(Runnable listener) Adds a listener to the loadable resource that is invoked when loading has completed.addFeatureAsync(Feature feature) Adds a feature to the table.addFeaturesAsync(Iterable<Feature> features) Adds features to the table.voidAdds aLoadStatusChangedListenerto the loadable resource that is invoked whenever the load status changes.booleancanAdd()Determines whether you can add new features to the table.voidCancels loading metadata for the object.booleanDetermines whether you can delete the feature from the table.booleanDetermines whether you can edit the geometry field in a table.booleanDetermines whether you can update the feature in the table.Creates a new empty feature.createFeature(Map<String, Object> attributes, Geometry geometry) Creates a new feature with the provided attribute values and, optionally, geometry.deleteFeatureAsync(Feature feature) Deletes a feature from the table.deleteFeaturesAsync(Iterable<Feature> features) Deletes features from this feature table.Gets a user-friendly name that can be displayed in the UI (for example, in a Table of Contents).Gets the geographic extent of features within the table.Gets a field by its name.Gets the collection ofFieldobjects representing the fields of the feature table.Gets the type of geometry of the features stored in this table.getLayer()Gets the layer that displays this table, if any.Gets the value of theloadErrorproperty.Gets the value of theloadStatusproperty.Gets the PopupDefinition for this feature table.Gets the spatial reference of the table.Gets the name of the table in the source dataset.longGets the total number of features in this FeatureTable.booleanTrue if the feature table supports geographic features, false otherwise.booleanhasM()True if the feature table supports geometries with M values, false otherwise.booleanhasZ()True if the feature table supports geometries with Z values, false otherwise.booleanIndicates if this FeatureTable is editable.booleanGets a flag indicating whether the PopupDefinition returned fromgetPopupDefinition()is enabled or disabled.voidLoads the metadata of the loadable resource asynchronously.The load error.The load status.queryExtentAsync(QueryParameters queryParameters) Asynchronously queries the minimum bounding envelope that contains features satisfying the provided queryParameters.queryFeatureCountAsync(QueryParameters queryParameters) Asynchronously queries the number of features that satisfy the provided query parameters.queryFeaturesAsync(QueryParameters queryParameters) Asynchronously queries features in this FeatureTable.queryStatisticsAsync(StatisticsQueryParameters statisticsQueryParameters) Performs an asynchronous query to calculate statistics for the fields defined in the statistics query parameter, which may also define fields on which results are grouped or sorted.booleanremoveDoneLoadingListener(Runnable listener) Removes a done loading listener from the loadable resource.booleanRemoves aLoadStatusChangedListenerfrom the loadable resource.voidLoads or retries loading metadata for the object asynchronously.voidsetDisplayName(String displayName) Sets a user-friendly name that can be displayed in the UI (for example, in a Table of Contents).voidsetPopupDefinition(PopupDefinition popupDefinition) Sets the PopupDefinition for this feature table, overriding the previous one.voidsetPopupEnabled(boolean enabled) Sets a flag indicating whether the PopupDefinition returned fromgetPopupDefinition()is enabled or disabled.updateFeatureAsync(Feature feature) Updates a feature in the table.updateFeaturesAsync(Iterable<Feature> features) Updates the geometry and/or attributes of features.
-
Property Details
-
loadStatus
- Specified by:
loadStatusPropertyin interfaceLoadable- See Also:
-
loadError
- Specified by:
loadErrorPropertyin interfaceLoadable- See Also:
-
-
Method Details
-
getExtent
Gets the geographic extent of features within the table.This is calculated differently for specific types and modes of feature tables.
ServiceFeatureTable. If the feature request mode isServiceFeatureTable.FeatureRequestMode.MANUAL_CACHEthe service feature table will return the extent of the features which have been cached. All other modes will return the extent of the layer/table defined by the service (fromArcGISFeatureLayerInfo.getExtent()). This can be used to determine the extent within which data can be edited.GeodatabaseFeatureTable. This returns the extent of the features which have been cached. This extent can grow as features are added or edited, but not shrink.
- Returns:
- the extent
- Since:
- 100.0.0
- See Also:
-
getField
Gets a field by its name. Field names can be viewed in this FeatureTable's service definition's HTML pages. This method is case-sensitive.- Parameters:
fieldName- the field name- Returns:
- the field
- Throws:
IllegalArgumentException- if the input fieldName is null- Since:
- 100.0.0
-
getFields
Gets the collection ofFieldobjects representing the fields of the feature table.- Returns:
- an unmodifiable list of
Fieldobjects representing the fields of the feature table - Since:
- 100.0.0
-
getGeometryType
Gets the type of geometry of the features stored in this table. Tables can only have a single type of Geometry, and it must be eitherGeometryType.POINT,GeometryType.MULTIPOINT,GeometryType.POLYLINEorGeometryType.POLYGON.If
hasGeometry()is false, then the geometry type isGeometryType.UNKNOWN.- Returns:
- the geometry type, or
GeometryType.UNKNOWNif the table is not loaded - Since:
- 100.0.0
-
getLayer
Gets the layer that displays this table, if any.The
Layertype depends on how the feature table is created. For example, aLayerwill be anAnnotationLayerif the FeatureTable is created from a table that supports annotation. SeeLayerfor more information about the supported layer types.The layer will be null if the feature table does not contain spatial features (where
hasGeometry()is false).- Returns:
- the layer that displays this table, if any, or null if none
- Since:
- 100.7.0
-
getSpatialReference
Gets the spatial reference of the table.A spatial reference defines how the coordinates of a feature's
Geometrycorrespond to locations in the real world. For more information, see theSpatialReferenceclass or the Spatial references documentation.- Returns:
- the spatial reference of the table, or null if none
- Since:
- 100.0.0
-
getTableName
Gets the name of the table in the source dataset.- Returns:
- the name of the table in the source dataset
- Since:
- 100.0.0
-
hasGeometry
public boolean hasGeometry()True if the feature table supports geographic features, false otherwise. If it doesn't, then it's a non-spatial table and can't be bound to a feature layer to draw on a map.- Returns:
- true if the feature table supports geographic features, false otherwise
- Since:
- 100.0.0
-
isEditable
public boolean isEditable()Indicates if this FeatureTable is editable.Underlying file permissions (for subclasses such as
ShapefileFeatureTableandGeodatabaseFeatureTable) can be changed while the feature table is open. In these cases the value of this property may not be accurate.- Returns:
- true if this feature table is editable, false otherwise
- Since:
- 100.0.0
- See Also:
-
getTotalFeatureCount
public long getTotalFeatureCount()Gets the total number of features in this FeatureTable.If all the features are stored in the local table, for example with a
GeodatabaseFeatureTableor aShapefileFeatureTable, thengetTotalFeatureCount()will return the full number of features.If the table is created from a service, for example,
ServiceFeatureTableorWfsFeatureTable, thegetTotalFeatureCount()will only return the number of features in the local table cache. You need to populate the local table cache to return a value forgetTotalFeatureCount(). Do this by rendering the features in anArcGISMaporArcGISScenewith aFeatureLayer, or by querying the feature table. Consider the feature table'sServiceFeatureTable.FeatureRequestModein both cases. SeeServiceFeatureTableorWfsFeatureTablefor more information. If you want to return the full number of features in the service, executequeryFeatureCountAsync(QueryParameters)and pass "1=1" to theQueryParameters.getWhereClause().- Returns:
- the number of features in the table
- Since:
- 100.0.0
-
getPopupDefinition
Gets the PopupDefinition for this feature table.- Specified by:
getPopupDefinitionin interfacePopupSource- Returns:
- the popup definition, or null if one is not defined and one has not been set
- Since:
- 100.1.0
- See Also:
-
isPopupEnabled
public boolean isPopupEnabled()Gets a flag indicating whether the PopupDefinition returned fromgetPopupDefinition()is enabled or disabled.- Specified by:
isPopupEnabledin interfacePopupSource- Returns:
- a flag indicating whether the PopupDefinition is enabled or disabled
- Since:
- 100.1.0
- See Also:
-
setPopupDefinition
Sets the PopupDefinition for this feature table, overriding the previous one. If this table is attached to a layer then the popup definition on the layer will also be overridden.- Specified by:
setPopupDefinitionin interfacePopupSource- Parameters:
popupDefinition- the PopupDefinition to set- Since:
- 100.1.0
- See Also:
-
setPopupEnabled
public void setPopupEnabled(boolean enabled) Sets a flag indicating whether the PopupDefinition returned fromgetPopupDefinition()is enabled or disabled.- Specified by:
setPopupEnabledin interfacePopupSource- Parameters:
enabled- true to enable the PopupDefinition, otherwise false- Since:
- 100.1.0
- See Also:
-
queryFeaturesAsync
Asynchronously queries features in this FeatureTable.- Parameters:
queryParameters- the query parameters- Returns:
- a ListenableFuture representing the feature query result and indicating if the result
java.util.concurrent.Future.isDone(); also allows cancellation. Callingget()on the returned future may throw an ExecutionException with its cause set toIOExceptionif a network request fails - Throws:
IllegalArgumentException- if queryParameters is null- Since:
- 100.0.0
-
canAdd
public boolean canAdd()Determines whether you can add new features to the table.For
ArcGISFeatureTables this takes the table's edit capabilities (for attachments and geometry) into account as well as ownership based access control based on the tables metadata from its layer infoArcGISFeatureLayerInfo.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).- Returns:
- true if you can add features to the table, false otherwise
- Since:
- 100.0.0
- See Also:
-
canEditGeometry
public boolean canEditGeometry()Determines whether you can edit the geometry field in a table.For
ArcGISFeatureTables this is based on the tables metadata fromArcGISFeatureLayerInfo.isAllowGeometryUpdates().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).- Returns:
- true if you can edit the geometry field, false if you can't edit the geometry field or an error occurred
- Since:
- 100.0.0
- See Also:
-
canDelete
Determines whether you can delete the feature from the table.For
ArcGISFeatureTables this takes the table's edit capabilities (for attachments and geometry) into account as well as ownership based access control based on the tables metadata from its layer infoArcGISFeatureLayerInfo.If owner based access control is being used, this method will also take account of the current user. Deletion will be allowed if one of the following is true:
- allowOthersToDelete is true
- allowOthersToDelete is false but the current user matches the user who created the feature
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).- Parameters:
feature- the feature to check- Returns:
- true if the feature can be deleted, false if the feature can't be deleted or an error occurred
- Throws:
IllegalArgumentException- if feature is null- Since:
- 100.0.0
-
canUpdate
Determines whether you can update the feature in the table. This validates that attributes of the feature are of the corresponding type based on the field type, seeField.Type.For
ArcGISFeatureTables this takes the table's edit capabilities (for attachments and geometry) into account as well as ownership based access control based on the tables metadata from its layer infoArcGISFeatureLayerInfo.If owner based access control is being used, this method will also take account of the current user. Updates will be allowed if one of the following is true:
- allowOthersToUpdate is true
- allowOthersToUpdate is false but the current user matches the user who created the feature
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).- Parameters:
feature- the feature to check- Returns:
- true if feature can be updated; false otherwise
- Throws:
IllegalArgumentException- if feature is null- Since:
- 100.0.0
-
addFeatureAsync
Adds a feature to the table.Adding a feature that contains a
Geometrycauses 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 theSpatialReference.Adding a feature to a
GeodatabaseFeatureTablein 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. UsecanAdd()to determine if this operation is allowed.- Parameters:
feature- the feature- Returns:
- a
ListenableFuturethat has no return value - Throws:
IllegalArgumentException- if feature is null- Since:
- 100.0.0
- See Also:
-
addFeaturesAsync
Adds features to the table.- Parameters:
features- the features to be added- Returns:
- a ListenableFuture for tracking when the asynchronous operation is done. The get() method on this
ListenableFuturemay throw an ExecutionException if the operation fails. - Throws:
IllegalArgumentException- if features is null- Since:
- 100.0.0
-
updateFeatureAsync
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 theSpatialReference.Updating a feature from a
GeodatabaseFeatureTablein 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. UsecanUpdate(Feature)to determine if this operation is allowed.- Parameters:
feature- the feature- Returns:
- a
ListenableFuturethat has no return value - Throws:
IllegalArgumentException- if feature is null- Since:
- 100.0.0
- See Also:
-
updateFeaturesAsync
Updates the geometry and/or attributes of features. Features to update are identified by their unique feature ID in the given list.All values in the feature passed in will be persisted, including null values.
- Parameters:
features- the features to be updated- Returns:
- a ListenableFuture for tracking when the asynchronous operation is done. The get() method on this
ListenableFuturemay throw an ExecutionException if the operation fails. - Throws:
IllegalArgumentException- if features is null- Since:
- 100.0.0
-
deleteFeatureAsync
Deletes a feature from the table.Deleting a feature from a
GeodatabaseFeatureTablein 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. UsecanDelete(Feature)to determine if this operation is allowed.- Parameters:
feature- the feature- Returns:
- a
ListenableFuturethat has no return value - Throws:
IllegalArgumentException- if feature is null- Since:
- 100.0.0
- See Also:
-
deleteFeaturesAsync
Deletes features from this feature table. Features to delete are identified by their unique feature ID in the given list.- Parameters:
features- the features to be deleted- Returns:
- a ListenableFuture for tracking when the asynchronous operation is done. The get() method on this
ListenableFuturemay throw an ExecutionException if the operation fails. - Throws:
IllegalArgumentException- if features is null- Since:
- 100.0.0
-
createFeature
Creates a new empty feature.The new feature is only available in memory at this point. Execute
addFeatureAsync(Feature)to commit the newFeatureto the table.- Returns:
- a
Feature - Since:
- 100.0.0
-
createFeature
Creates a new feature with the provided attribute values and, optionally, geometry.The new feature is only available in memory at this point. Execute
addFeatureAsync(Feature)to commit the newFeatureto the table.- Parameters:
attributes- attributes for the featuregeometry- geometry of the feature, may be null- Returns:
- a
Feature - Since:
- 100.0.0
-
queryStatisticsAsync
public ListenableFuture<StatisticsQueryResult> queryStatisticsAsync(StatisticsQueryParameters statisticsQueryParameters) Performs an asynchronous query to calculate statistics for the fields defined in the statistics query parameter, which may also define fields on which results are grouped or sorted.The statistic result can be obtained by calling the get() method on the
ListenableFuture, which may throw an exception if the operation failed, was cancelled or interrupted.- Parameters:
statisticsQueryParameters- defines the statistics type, fields, and features to be used for the query- Returns:
- A task that represents the asynchronous query statistics operation. It is a ListenableFuture for tracking when the asynchronous operation is done and getting a StatisticsQueryResult as a result.
- Throws:
IllegalArgumentException- if statisticsQueryParameters is null- Since:
- 100.2.0
-
queryFeatureCountAsync
Asynchronously queries the number of features that satisfy the provided query parameters.The query result can be obtained by calling the get() method on the
ListenableFuture, which may throw an exception if the operation failed, was cancelled or interrupted.- Parameters:
queryParameters- the query parameters- Returns:
- A task that represents the asynchronous query of feature count. It is a ListenableFuture for tracking when the asynchronous operation is done and getting a Long value.
- Throws:
IllegalArgumentException- if queryParameters is null- Since:
- 100.2.0
-
queryExtentAsync
Asynchronously queries the minimum bounding envelope that contains features satisfying the provided queryParameters. If no features meet the query criteria, an empty envelope is returned.The query result can be obtained by calling the get() method on the
ListenableFuture, which may throw an exception if the operation failed, was cancelled or interrupted.- Parameters:
queryParameters- the query queryParameters- Returns:
- A task that represents the asynchronous query of feature extent. It is a ListenableFuture for tracking when the asynchronous operation is done and getting an Envelope.
- Throws:
IllegalArgumentException- if queryParameters is null- Since:
- 100.2.0
-
hasZ
public boolean hasZ()True if the feature table supports geometries with Z values, false otherwise.- Returns:
- true if the feature table supports geometries with Z values, false otherwise
- Since:
- 100.2.0
-
hasM
public boolean hasM()True if the feature table supports geometries with M values, false otherwise.- Returns:
- true if the feature table supports geometries with M values, false otherwise
- Since:
- 100.2.0
-
setDisplayName
Sets 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, thegetDisplayName()is used as theLayer.getName().- Parameters:
displayName- a user-friendly name that can be displayed in the UI (for example, in a Table of Contents)- Since:
- 100.3.0
-
getDisplayName
Gets 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 display name is used as theLayer.getName().The default value is
getTableName().- Returns:
- a user-friendly name that can be displayed in the UI (for example, in a Table of Contents)
- Since:
- 100.3.0
-
getLoadError
Gets the value of theloadErrorproperty.- Specified by:
getLoadErrorin interfaceLoadable- Property description:
- Returns:
- the value of the
loadErrorproperty - See Also:
-
getLoadStatus
Gets the value of theloadStatusproperty.- Specified by:
getLoadStatusin interfaceLoadable- Property description:
- Returns:
- the value of the
loadStatusproperty - See Also:
-
loadAsync
public void loadAsync()Description copied from interface:LoadableLoads the metadata of the loadable resource asynchronously.The load status changes from
LoadStatus.NOT_LOADEDtoLoadStatus.LOADING. A listener can be added viaLoadable.addDoneLoadingListener(java.lang.Runnable)that is invoked upon completion of the asynchronous load operation.If the load operation completes successfully, the load status will be
LoadStatus.LOADED, which means the resource has loaded its metadata.If the load operation failed, the load status will be
LoadStatus.FAILED_TO_LOADand the error can be retrieved by callingLoadable.getLoadError().This method can be called concurrently and repeatedly, but only one attempt is ever made to perform the load operation. If a load operation is already in progress (
LoadStatus.LOADINGstate) whenloadAsyncis called, it simply piggy-backs on the outstanding operation and the done loading listener added to the loadable resource is enqueued to be invoked when that operation completes. If the operation has already completed (LoadStatus.LOADEDorLoadStatus.FAILED_TO_LOADstate) whenloadAsyncis called, the done loading listener is immediately invoked when added to the loadable resource.If a loadable resource has failed to load, calling
loadAsyncon it subsequently will not change its state. The done loading listener will be invoked immediately when added to the loadable resource. In order to retry loading the resource,Loadable.retryLoadAsync()needs to be used.A load operation that is in progress (
LoadStatus.LOADINGstate) can be cancelled by callingLoadable.cancelLoad(). -
retryLoadAsync
public void retryLoadAsync()Description copied from interface:LoadableLoads or retries loading metadata for the object asynchronously.Will retry loading the metadata if the object's load status is
LoadStatus.FAILED_TO_LOAD. Will load the object if it is not loaded. Will not retry to load the object if the object is loaded.For more details on the load process see
Loadable.loadAsync().- Specified by:
retryLoadAsyncin interfaceLoadable
-
cancelLoad
public void cancelLoad()Description copied from interface:LoadableCancels loading metadata for the object.Cancels loading the metadata if the object is loading, and always invokes the done loading listener.
A load operation that is in progress (
LoadStatus.LOADINGstate) can be cancelled by calling this method and the resource will transition fromLoadStatus.LOADINGtoLoadStatus.FAILED_TO_LOADstate. If the load operation was successfully cancelled, a CancellationException will be returned fromLoadable.getLoadError().Cancellation should be used carefully because all enqueued done loading listeners for that resource instance will get invoked with an error stating that the operation was cancelled. Thus, one component in the application can cancel the load operation initiated by other components.
This method does nothing if the resource is not in
LoadStatus.LOADINGstate.- Specified by:
cancelLoadin interfaceLoadable
-
addDoneLoadingListener
Description copied from interface:LoadableAdds a listener to the loadable resource that is invoked when loading has completed.The listener may be added at any point, whether the loadable resource has already completed loading or not.
- For resources that are not loaded when the listener is added (LoadStatus is NOT_LOADED or LOADING): When the resource completes loading, the listener will be invoked on the UI thread if it is added from the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.
- For resources that are already loaded when the listener is added (LoadStatus is LOADED or FAILED_TO_LOAD): The listener will be called immediately, on the current thread.
Alternatively, to be notified when there is any change in the load status, add a listener to the
Loadable.loadStatusProperty()instead.- Specified by:
addDoneLoadingListenerin interfaceLoadable- Parameters:
listener- a Runnable that is invoked upon completion of the load operation
-
removeDoneLoadingListener
Description copied from interface:LoadableRemoves a done loading listener from the loadable resource.- Specified by:
removeDoneLoadingListenerin interfaceLoadable- Parameters:
listener- the listener to be removed- Returns:
- true if the listener was removed, otherwise false
-
addLoadStatusChangedListener
Description copied from interface:LoadableAdds aLoadStatusChangedListenerto the loadable resource that is invoked whenever the load status changes.Adding this listener on the UI thread will cause it to be invoked on the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.
The listener will not be called if added to a loadable resource that has already completed loading. To be notified when a loadable resource has completed loading, including if the resource is already loaded when the listener is added, use the
Loadable.addDoneLoadingListener(Runnable)method.- Specified by:
addLoadStatusChangedListenerin interfaceLoadable- Parameters:
listener- theLoadStatusChangedListenerto be added
-
removeLoadStatusChangedListener
Description copied from interface:LoadableRemoves aLoadStatusChangedListenerfrom the loadable resource.- Specified by:
removeLoadStatusChangedListenerin interfaceLoadable- Parameters:
listener- theLoadStatusChangedListenerto be removed- Returns:
- true if the listener was removed, otherwise false
-
loadStatusProperty
Description copied from interface:LoadableThe load status.- Specified by:
loadStatusPropertyin interfaceLoadable- Returns:
- the
loadStatusproperty - See Also:
-
loadErrorProperty
Description copied from interface:LoadableThe load error.- Specified by:
loadErrorPropertyin interfaceLoadable- Returns:
- the
loadErrorproperty - See Also:
-