Geodatabase Class

  • Geodatabase
  • class Esri::ArcGISRuntime::Geodatabase

    A mobile geodatabase containing geographic data and non-spatial tables. More...

    Header: #include <Geodatabase.h>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: Esri::ArcGISRuntime::Object and Esri::ArcGISRuntime::Loadable

    Public Functions

    Geodatabase(const QString &path, QObject *parent = nullptr)
    virtual ~Geodatabase() override
    void beginTransaction()
    void close()
    void commitTransaction()
    QFuture<Esri::ArcGISRuntime::Domain> createDomainAsync(Esri::ArcGISRuntime::DomainDescription *domainDescription)
    QFuture<Esri::ArcGISRuntime::GeodatabaseFeatureTable *> createTableAsync(Esri::ArcGISRuntime::TableDescription *tableDescription, QObject *parent = nullptr)
    QFuture<void> deleteDomainAsync(const QString &domainName)
    QFuture<void> deleteTableAsync(const QString &tableName)
    QList<Esri::ArcGISRuntime::Domain> domains() const
    Esri::ArcGISRuntime::Geometry generateGeodatabaseGeometry() const
    Esri::ArcGISRuntime::GeodatabaseFeatureTable *geodatabaseAnnotationTable(const QString &tableName) const
    Esri::ArcGISRuntime::GeodatabaseFeatureTable *geodatabaseAnnotationTable(qint64 serviceLayerId) const
    QList<Esri::ArcGISRuntime::GeodatabaseFeatureTable *> geodatabaseAnnotationTables() const
    Esri::ArcGISRuntime::GeodatabaseFeatureTable *geodatabaseDimensionTable(qint64 serviceLayerId) const
    Esri::ArcGISRuntime::GeodatabaseFeatureTable *geodatabaseDimensionTable(const QString &tableName) const
    QList<Esri::ArcGISRuntime::GeodatabaseFeatureTable *> geodatabaseDimensionTables() const
    Esri::ArcGISRuntime::GeodatabaseFeatureTable *geodatabaseFeatureTable(const QString &tableName) const
    Esri::ArcGISRuntime::GeodatabaseFeatureTable *geodatabaseFeatureTable(qint64 serviceLayerId) const
    QList<Esri::ArcGISRuntime::GeodatabaseFeatureTable *> geodatabaseFeatureTables() const
    bool hasLocalEdits() const
    bool isInTransaction() const
    bool isSyncEnabled() const
    qint64 minServerGeneration() const
    QString path() const
    void rollbackTransaction()
    QUrl serviceUrl() const
    QUuid syncId() const
    Esri::ArcGISRuntime::SyncModel syncModel() const
    Esri::ArcGISRuntime::UtilityNetwork *utilityNetwork(const QString &utilityNetworkName) const
    QList<Esri::ArcGISRuntime::UtilityNetwork *> utilityNetworks() const

    Reimplemented Public Functions

    virtual void cancelLoad() override
    virtual void load() override
    virtual Esri::ArcGISRuntime::Error loadError() const override
    virtual Esri::ArcGISRuntime::LoadStatus loadStatus() const override
    virtual void retryLoad() override

    Signals

    void doneLoading(const Esri::ArcGISRuntime::Error &loadError)
    void loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus)
    void transactionStatusChanged(bool isInTransaction)

    Static Public Members

    QFuture<Esri::ArcGISRuntime::Geodatabase *> createAsync(const QString &path, QObject *parent)

    Detailed Description

    Geodatabase is used to open and access the contents of a mobile geodatabase (.geodatabase file) that can contain geographic features, non-spatial tabular data, and data such as attachments, utility networks, field domain definitions, contingent values, and relationships between layers/tables.

    Geodatabases can contain one or more geodatabase feature tables. You can create a layer from a GeodatabaseFeatureTable tables, as follows:

    You can generate a mobile geodatabase file from an ArcGIS feature service and downloaded it to a device using offline workflows offered by the GeodatabaseSyncTask and the OfflineMapTask. Apps can then operate offline to view and edit the features in these geodatabases. If the geodatabases are enabled for synchronization with the original feature service, edits can be synchronized when connectivity is restored.

    Mobile geodatabase files can also be created with ArcGIS Pro. These geodatabases can be used offline but they do not support synchronization with the original feature service. See Build offline applications for more information.

    Member Function Documentation

    [explicit] Geodatabase::Geodatabase(const QString &path, QObject *parent = nullptr)

    Creates a geodatabase object with the given path.

    • path - Path to geodatabase (including .geodatabase file extension).
    • parent - The optional parent QObject.

    If the specified path points to a stand-alone mobile geodatabase created with ArcGIS Pro and contains a controller dataset, such as a utility network or parcel fabric, the feature tables on this geodatabase are read-only. The presence of utility networks can be checked using Geodatabase::utilityNetworks.

    Constructing a geodatabase from a path to a geodatabase file does not automatically load the geodatabase. You must load it explicitly.

    See also load.

    [override virtual] Geodatabase::~Geodatabase()

    Destructor.

    [since Esri::ArcGISRuntime 100.3] void Geodatabase::beginTransaction()

    Starts a transaction on the geodatabase.

    This method starts a new transaction on the geodatabase. The transaction fails to begin if another transaction is already active. A geodatabase cannot be synchronized while a transaction is active.

    Transactions can be started and stopped on any thread. Any edits that take place after a call to beginTransaction but before a call to either commitTransaction or rollbackTransaction will be considered part of that transaction, no matter what thread made the edit.

    This function was introduced in Esri::ArcGISRuntime 100.3.

    [override virtual] void Geodatabase::cancelLoad()

    Reimplements: Loadable::cancelLoad().

    See Loadable.

    [since Esri::ArcGISRuntime 100.1] void Geodatabase::close()

    Closes the Geodatabase by forcefully removing all internal references to it.

    This is to allow for deleting a Geodatabase when you're done using it. That can be problematic in some workflows since there can be outstanding references to it and it may be difficult to track and delete them all.

    This method is not needed for typical workflows.

    The close method has no effect on the loadStatus of the Geodatabase. Once closed, the object cannot be reloaded or used again and the loadStatus is no longer indicative of the state.

    Warning: Once close is called the Geodatabase object is in an undefined state and should no longer be used.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [since Esri::ArcGISRuntime 100.3] void Geodatabase::commitTransaction()

    Commits the edits in the transaction to the geodatabase.

    Commits the edits in the current transaction to the geodatabase. This will also end the transaction. An error will be thrown if a transaction has not been started on the geodatabase.

    Transactions can be started and stopped on any thread. Any edits that take place after a call to beginTransaction but before a call to either commitTransaction or rollbackTransaction will be considered part of that transaction, no matter what thread made the edit.

    This function was introduced in Esri::ArcGISRuntime 100.3.

    [static, since Esri::ArcGISRuntime 200.2] QFuture<Esri::ArcGISRuntime::Geodatabase *> Geodatabase::createAsync(const QString &path, QObject *parent)

    An empty mobile geodatabase at the specified path.

    • path - The path at which the mobile geodatabase is created.
    • parent - A mandatory QObject parent. Since this method is static, results will have no parent by default.

    The path must be non-empty, available, allow read/write access, and end in ".geodatabase". If any of these restrictions are violated, the task will not succeed and a task error will be set.

    If you want the result to have no parent, pass nullptr as the parent. Be sure to manage the memory of the result or it will leak.

    This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.

    See Working with QFuture for further details.

    This function was introduced in Esri::ArcGISRuntime 200.2.

    [since Esri::ArcGISRuntime 200.2] QFuture<Esri::ArcGISRuntime::Domain> Geodatabase::createDomainAsync(Esri::ArcGISRuntime::DomainDescription *domainDescription)

    A new domain in the geodatabase.

    • domainDescription - The description of the domain to create.

    Creating domains is only supported in mobile geodatabases (either created in Pro or via createAsync(const QString&, QObject*)). The FieldType of the domain cannot be unknown. The domain name must not already exist in the geodatabase. For additional domain name constraints, see DomainDescription::name.

    This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.

    See Working with QFuture for further details.

    This function was introduced in Esri::ArcGISRuntime 200.2.

    [since Esri::ArcGISRuntime 200.2] QFuture<Esri::ArcGISRuntime::GeodatabaseFeatureTable *> Geodatabase::createTableAsync(Esri::ArcGISRuntime::TableDescription *tableDescription, QObject *parent = nullptr)

    A new table in the geodatabase.

    • tableDescription - The description of the table to create.
    • parent - The optional parent QObject

    Creating tables is only supported in mobile geodatabases (either created in Pro or via createAsync(const QString&, QObject*)). The table name must not already exist in the geodatabase. For additional table name constraints, see TableDescription::tableName.

    This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.

    See Working with QFuture for further details.

    This function was introduced in Esri::ArcGISRuntime 200.2.

    [since Esri::ArcGISRuntime 200.2] QFuture<void> Geodatabase::deleteDomainAsync(const QString &domainName)

    Deletes the domain with the specified name from the geodatabase.

    • domainName - The name of the domain to delete.

    Deleting domains is only supported in mobile geodatabases (either created in Pro or via createAsync(const QString&, QObject*)). The domain with the specified name must exist in the geodatabase. The domain must not be in use by any fields in existing tables.

    This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.

    See Working with QFuture for further details.

    This function was introduced in Esri::ArcGISRuntime 200.2.

    [since Esri::ArcGISRuntime 200.2] QFuture<void> Geodatabase::deleteTableAsync(const QString &tableName)

    Deletes an existing table from the geodatabase.

    • tableName - The name of the table to delete.

    Deleting tables is only supported in mobile geodatabases created in ArcGIS Pro or using createAsync(const QString&, QObject*). Attempting further use of a deleted table, such as rendering it in a feature layer or querying it, may result in errors.

    This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.

    See Working with QFuture for further details.

    This function was introduced in Esri::ArcGISRuntime 200.2.

    [since Esri::ArcGISRuntime 100.14] QList<Esri::ArcGISRuntime::Domain> Geodatabase::domains() const

    Returns a QList of the domains that exist in the geodatabase.

    The returned QList will be empty if the geodatabase itself is not loaded.

    This function was introduced in Esri::ArcGISRuntime 100.14.

    [signal] void Geodatabase::doneLoading(const Esri::ArcGISRuntime::Error &loadError)

    Signal emitted when this object is done loading.

    • loadError - Details about any error that may have occurred.

    Note: If there is a load error it will also be emitted on the errorOccurred signal.

    See also Loadable and Object.

    [since Esri::ArcGISRuntime 100.7] Esri::ArcGISRuntime::Geometry Geodatabase::generateGeodatabaseGeometry() const

    Returns the geometry that was used to generate the sync-enabled geodatabase.

    If the geodatabase was created using the GenerateGeodatabaseJob, the geometry matches the GenerateGeodatabaseParameters::extent. If the geodatabase was created using the GenerateOfflineMapJob, the geometry reflects the GenerateOfflineMapParameters::areaOfInterest. If the geodatabase was downloaded as part of a PreplannedMapArea, this property will match the geometry used by the web map author when the offline map area was created. See Build offline applications for more information on taking data offline.

    Edits made to a sync-enabled Geodatabase must intersect this geometry. If an edit is made outside this extent, or area of interest, it will be rejected.

    This property is empty if the geodatabase was authored using ArcGIS Pro or if the Geodatabase. loadStatus is not LoadStatus::Loaded.

    This function was introduced in Esri::ArcGISRuntime 100.7.

    [since Esri::ArcGISRuntime 100.6] Esri::ArcGISRuntime::GeodatabaseFeatureTable *Geodatabase::geodatabaseAnnotationTable(const QString &tableName) const

    Returns a feature table containing annotation features from the geodatabase, as specified by the given tableName.

    • tableName - The name of the geodatabase feature table containing annotation features.

    If the specified table contains annotation or dimension feature data, then no table is returned.

    This function was introduced in Esri::ArcGISRuntime 100.6.

    [since Esri::ArcGISRuntime 100.6] Esri::ArcGISRuntime::GeodatabaseFeatureTable *Geodatabase::geodatabaseAnnotationTable(qint64 serviceLayerId) const

    Returns a feature table containing annotation features from the geodatabase, as specified by the given feature service layer ID.

    • serviceLayerId - The service layer ID of the geodatabase feature table containing annotation features.

    The service layer ID must match the ArcGISFeatureLayerInfo::serviceLayerId.

    This function was introduced in Esri::ArcGISRuntime 100.6.

    [since Esri::ArcGISRuntime 100.6] QList<Esri::ArcGISRuntime::GeodatabaseFeatureTable *> Geodatabase::geodatabaseAnnotationTables() const

    Returns a collection of GeodatabaseFeatureTable from the geodatabase that contain annotation features.

    The collection is empty if the geodatabase is not loaded.

    This function was introduced in Esri::ArcGISRuntime 100.6.

    [since Esri::ArcGISRuntime 100.13] Esri::ArcGISRuntime::GeodatabaseFeatureTable *Geodatabase::geodatabaseDimensionTable(qint64 serviceLayerId) const

    Returns a feature table containing dimension features from the geodatabase, as specified by the given feature service layer ID.

    • serviceLayerId - The service layer ID of the geodatabase feature table containing dimension features.

    The service layer ID must match the ArcGISFeatureLayerInfo::serviceLayerId.

    This function was introduced in Esri::ArcGISRuntime 100.13.

    [since Esri::ArcGISRuntime 100.13] Esri::ArcGISRuntime::GeodatabaseFeatureTable *Geodatabase::geodatabaseDimensionTable(const QString &tableName) const

    Returns a feature table containing dimension features from the geodatabase, as specified by the given tableName.

    • tableName - The name of the geodatabase feature table containing dimension features.

    This function was introduced in Esri::ArcGISRuntime 100.13.

    [since Esri::ArcGISRuntime 100.13] QList<Esri::ArcGISRuntime::GeodatabaseFeatureTable *> Geodatabase::geodatabaseDimensionTables() const

    Returns the geodatabase feature tables that contain dimension features in a QList of GeodatabaseFeatureTable objects

    The results will not include feature tables that contain geometries such as points, lines, polygons, or annotation features. The returned array will be empty if the geodatabase itself is not loaded.

    This function was introduced in Esri::ArcGISRuntime 100.13.

    Esri::ArcGISRuntime::GeodatabaseFeatureTable *Geodatabase::geodatabaseFeatureTable(const QString &tableName) const

    Returns a feature table from the geodatabase containing point, line, or polygon features, as specified by the given tableName.

    • tableName - The name of the geodatabase feature table containing point, line, or polygon features.

    Esri::ArcGISRuntime::GeodatabaseFeatureTable *Geodatabase::geodatabaseFeatureTable(qint64 serviceLayerId) const

    Returns a feature table from the geodatabase containing point, line or polygon features, as specified by the given feature service layer ID.

    • serviceLayerId - The service layer ID of the geodatabase feature table containing point, line or polygon features.

    The feature table returned is read-only when the geodatabase is a stand-alone mobile geodatabase created with ArcGIS Pro and the table participates in a controller dataset, such as a utility network or parcel fabric. The presence of utility networks can be checked using utilityNetworks.

    QList<Esri::ArcGISRuntime::GeodatabaseFeatureTable *> Geodatabase::geodatabaseFeatureTables() const

    Returns a collection of GeodatabaseFeatureTable from the geodatabase that contain geometries, such as points, lines or polygons.

    Feature tables in this array are read-only when the geodatabase is a stand-alone mobile geodatabase created with ArcGIS Pro and tables participate in a controller dataset, such as a utility network or parcel fabric. The presence of utility networks can be checked using utilityNetworks.

    The collection will be empty if the geodatabase is not loaded.

    bool Geodatabase::hasLocalEdits() const

    Returns true if the geodatabase has local edits, false otherwise.

    If the geodatabase was created by ArcGIS Pro, this method returns false because there is no concept of uploading or applying edits. If you want to determine which tables have local edits, examine GeodatabaseFeatureTable::hasLocalEditsSince(const QDateTime&).

    [since Esri::ArcGISRuntime 100.3] bool Geodatabase::isInTransaction() const

    Returns true if a transaction is active on the geodatabase, false otherwise.

    A transaction manages a series of geodatabase edits as a single unit of work. You can start a transaction by calling beginTransaction. All edits made after this call are part of the transaction.

    A geodatabase transaction stays active until you end it by calling commitTransaction or rollbackTransaction. commitTransaction saves all edits in the transaction to the geodatabase and ends the transaction. rollbackTransaction discards all edits in the transaction and ends the transaction.

    If the app unexpectedly disconnects from the database, any active transaction will be rolled back. If the app crashes, or the user closes the app without saving edits, the transaction will be rolled back and the edits discarded.

    This function was introduced in Esri::ArcGISRuntime 100.3.

    See also beginTransaction, rollbackTransaction, and commitTransaction.

    bool Geodatabase::isSyncEnabled() const

    Returns true if the geodatabase was originally downloaded from a sync-enabled ArcGIS feature service, false otherwise.

    A sync-enabled geodatabase can be requested from an ArcGIS feature service using the GenerateGeodatabaseJob or the GenerateOfflineMapJob. It can also be downloaded as part of a PreplannedMapArea. See GeodatabaseSyncTask and OfflineMapTask for more information.

    If true, the geodatabase's data can be synchronized with its original ArcGIS feature service.

    See also GeodatabaseSyncTask and OfflineMapTask.

    [override virtual] void Geodatabase::load()

    Reimplements: Loadable::load().

    See Loadable.

    [override virtual] Esri::ArcGISRuntime::Error Geodatabase::loadError() const

    Reimplements: Loadable::loadError() const.

    See Loadable.

    [override virtual] Esri::ArcGISRuntime::LoadStatus Geodatabase::loadStatus() const

    Reimplements: Loadable::loadStatus() const.

    See Loadable.

    [signal] void Geodatabase::loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus)

    Signal emitted when the load status changes for this object.

    See also Loadable.

    [since Esri::ArcGISRuntime 100.6] qint64 Geodatabase::minServerGeneration() const

    Returns the minimum server generation number for the geodatabase.

    Server generation numbers indicate the state of a geodatabase or individual layers with respect to changes which have been synced with the online service. The number increases as new changes from the online feature service are synced to the local geodatabase.

    If the syncModel is SyncModel::Geodatabase, the value will indicate the server generation number for the entire geodatabase. If the syncModel is SyncModel::Layer, the value will be the lowest server generation number for all of the layers in the geodatabase. This property will be -1 if the geodatabase does not support sync (SyncModel::None).

    This property will be -1 until the geodatabase is LoadStatus::Loaded.

    Note that this property is only required when using advanced workflows to manually apply pre-generated changes and not when performing a sync directly against the online service.

    This function was introduced in Esri::ArcGISRuntime 100.6.

    See also GeodatabaseSyncTask::importDeltaAsync(Esri::ArcGISRuntime::Geodatabase*, const QString&, QObject*).

    QString Geodatabase::path() const

    Returns the path to the mobile geodatabase file on disk.

    [override virtual] void Geodatabase::retryLoad()

    Reimplements: Loadable::retryLoad().

    See Loadable.

    [since Esri::ArcGISRuntime 100.3] void Geodatabase::rollbackTransaction()

    Rolls back the the edits in the transaction from the geodatabase.

    Discards the edits in the current transaction from the geodatabase. This will also end the transaction. An error will be thrown if a transaction has not been started on the geodatabase.

    Transactions can be started and stopped on any thread. Any edits that take place after a call to beginTransaction but before a call to either commitTransaction or rollbackTransaction will be considered part of that transaction, no matter what thread made the edit.

    This function was introduced in Esri::ArcGISRuntime 100.3.

    QUrl Geodatabase::serviceUrl() const

    Returns the service URL from where the mobile geodatabase was obtained.

    [since Esri::ArcGISRuntime 100.2] QUuid Geodatabase::syncId() const

    Returns the sync ID of the geodatabase.

    Sync ID is available if isSyncEnabled is true. The sync ID is the same as the replica ID described in the REST documentation. It is used by the geodatabase's service to uniquely identify the geodatabase when carrying out sync operations. It is also used to unregister the geodatabase using the GeodatabaseSyncTask::unregisterGeodatabaseAsync.

    Note: The returned QUuid will be null if there is an error or if this is not a sync-enabled geodatabase or the geodatabase is not loaded.

    {GeodatabaseSyncTask::unregisterGeodatabaseAsync(const QUuid&)}

    This function was introduced in Esri::ArcGISRuntime 100.2.

    See also Esri::ArcGISRuntime::GeodatabaseSyncTask::unregisterGeodatabaseAsync(const QUuid&).

    Esri::ArcGISRuntime::SyncModel Geodatabase::syncModel() const

    Returns the sync model defining how datasets within the geodatabase are synchronized with the originating ArcGIS feature service.

    Sync model only applies to the geodatabase if isSyncEnabled is true.

    [signal, since Esri::ArcGISRuntime 100.3] void Geodatabase::transactionStatusChanged(bool isInTransaction)

    Signal emitted when the transaction status of the geodatabase changes.

    • isInTransaction - Whether a transaction is currently active on a geodatabase.

    This function was introduced in Esri::ArcGISRuntime 100.3.

    [since Esri::ArcGISRuntime 100.11] Esri::ArcGISRuntime::UtilityNetwork *Geodatabase::utilityNetwork(const QString &utilityNetworkName) const

    Returns a UtilityNetwork from the geodatabase with the specified utility network name.

    • utilityNetworkName - The name of the utility network.

    This function was introduced in Esri::ArcGISRuntime 100.11.

    [since Esri::ArcGISRuntime 100.11] QList<Esri::ArcGISRuntime::UtilityNetwork *> Geodatabase::utilityNetworks() const

    Returns the UtilityNetwork objects that are packaged within the Geodatabase.

    The returned QList will be empty if the geodatabase itself is not loaded or if no utility networks exist in the geodatabase.

    This function was introduced in Esri::ArcGISRuntime 100.11.

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