ArcGIS Runtime SDK for iOS: AGSGeodatabase Class Reference
ArcGIS Runtime SDK for iOS  100.15
AGSGeodatabase Class Reference

Description

A geodatabase on disk.

Instances of this class represent a local geodatabase (.geodatabase file) containing geographic datasets. The geodatabase is based on the SQLite database engine.

Since
100
See also
AGSGeodatabaseSyncTask to generate and synchronize a geodatabase with a supporting ArcGIS Feature service.
Inheritance diagram for AGSGeodatabase:
AGSLoadableBase AGSObject <AGSLoadable>

Instance Methods

(BOOL) - beginTransaction:
 
(void) - cancelLoad
 
(void) - close
 
(BOOL) - commitTransaction:
 
(id< AGSCancelable >) - createDomainWithDomainDescription:completion:
 
(id< AGSCancelable >) - createTableWithTableDescription:completion:
 
(id< AGSCancelable >) - deleteDomainWithDomainName:completion:
 
(id< AGSCancelable >) - deleteTableWithTableName:completion:
 
(void) - doCancelLoading
 
(void) - doStartLoading:
 
(nullable AGSGeodatabaseFeatureTable *) - geodatabaseAnnotationTableWithServiceLayerID:
 
(nullable AGSGeodatabaseFeatureTable *) - geodatabaseAnnotationTableWithTableName:
 
(nullable AGSGeodatabaseFeatureTable *) - geodatabaseDimensionTableWithServiceLayerID:
 
(nullable AGSGeodatabaseFeatureTable *) - geodatabaseDimensionTableWithTableName:
 
(nullable AGSGeodatabaseFeatureTable *) - geodatabaseFeatureTableByServiceLayerID:
 
(nullable AGSGeodatabaseFeatureTable *) - geodatabaseFeatureTableWithName:
 
(BOOL) - hasLocalEdits
 
(instancetype) - initWithFileURL:
 
(instancetype) - initWithName:
 
(void) - loadDidFinishWithError:
 
(void) - loadWithCompletion:
 
(void) - onLoadStatusChanged
 
(void) - retryLoadWithCompletion:
 
(BOOL) - rollbackTransaction:
 
(nullable AGSUtilityNetwork *) - utilityNetworkWithName:
 

Class Methods

(id< AGSCancelable >) + createWithFileURL:completion:
 
(instancetype) + geodatabaseWithFileURL:
 
(instancetype) + geodatabaseWithName:
 

Properties

NSArray< AGSDomain * > * domains
 
NSURL * fileURL
 
AGSEnvelopegenerateGeodatabaseExtent
 
AGSGeometrygenerateGeodatabaseGeometry
 
NSArray< AGSGeodatabaseFeatureTable * > * geodatabaseAnnotationTables
 
NSArray< AGSGeodatabaseFeatureTable * > * geodatabaseDimensionTables
 
NSArray< AGSGeodatabaseFeatureTable * > * geodatabaseFeatureTables
 
BOOL inTransaction
 
NSError * loadError
 
AGSLoadStatus loadStatus
 
NSInteger minServerGeneration
 
NSURL * serviceURL
 
BOOL syncEnabled
 
NSUUID * syncID
 
AGSSyncModel syncModel
 
NSArray< AGSUtilityNetwork * > * utilityNetworks
 

Method Documentation

◆ beginTransaction:

- (BOOL) beginTransaction: (NSError **)  error

Starts a new transaction on the geodatabase. An error will be provided if another transaction is already active on the geodatabase. A geodatabase cannot be synchronized while a transaction is active.

Note
Nested transactions are not supported.
Since
100.2

◆ cancelLoad

- (void) cancelLoad
requiredinherited

Cancels loading if it is in progress, otherwise it does nothing. This should be called carefully because other objects could be waiting for loadWithCompletion: or retryLoadWithCompletion: to complete and this will call them all back with the error of NSUserCancelledError

Since
100

◆ close

- (void) close

Close connection to the geodatabase. All use of a geodatabase should cease before closing it. For example: terminate geodatabase synchronization, remove feature layers from maps, and release feature tables. Any attempt to access a geodatabase after it is closed will fail, resulting in an error. After closing a geodatabase, the geodatabase file can be deleted.

Since
100.1

◆ commitTransaction:

- (BOOL) commitTransaction: (NSError **)  error

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

Since
100.2

◆ createDomainWithDomainDescription:completion:

- (id<AGSCancelable>) createDomainWithDomainDescription: (AGSDomainDescription *)  domainDescription
completion: (void(^)(AGSDomain *__nullable result, NSError *__nullable error))  completion 

Creates a new domain in the geodatabase.

Creating domains is only supported in mobile geodatabases (either created in ArcGIS Pro or via createWithFileURL:completion:). The AGSFieldType of the domain cannot be unknown. The domain name must not already exist in the geodatabase. For additional domain name constraints, see AGSDomainDescription::name.

Parameters
domainDescriptionThe description of the domain to create.
completionA Block that is invoked when the operation finishes. The result parameter is populated if the operation completed successfully, otherwise the error parameter is populated.
Returns
An operation which can be canceled.
Since
100.14

◆ createTableWithTableDescription:completion:

- (id<AGSCancelable>) createTableWithTableDescription: (AGSTableDescription *)  tableDescription
completion: (void(^)(AGSGeodatabaseFeatureTable *__nullable result, NSError *__nullable error))  completion 

Creates a new table in the geodatabase.

Creating tables is only supported in mobile geodatabases (either created in ArcGIS Pro or via createWithFileURL:completion:). The table name must not already exist in the geodatabase. For additional table name constraints, see AGSTableDescription::tableName.

Parameters
tableDescriptionThe description of the table to create.
completionA block that is invoked when the operation finishes. The result parameter is populated if the operation completed successfully, otherwise the error parameter is populated.
Returns
An operation which can be canceled.
Since
100.14

◆ createWithFileURL:completion:

+ (id<AGSCancelable>) createWithFileURL: (NSURL *)  fileURL
completion: (void(^)(AGSGeodatabase *__nullable result, NSError *__nullable error))  completion 

Creates an empty mobile geodatabase at the specified URL.

The URL 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.

Parameters
fileURLThe URL (including .geodatabase file extension) at which the mobile geodatabase should be created.
completionA block that is invoked when the operation finishes. The result parameter is populated if the operation completed successfully, otherwise the error parameter is populated.
Returns
An operation which can be canceled.
Since
100.14

◆ deleteDomainWithDomainName:completion:

- (id<AGSCancelable>) deleteDomainWithDomainName: (NSString *)  domainName
completion: (void(^)(NSError *__nullable error))  completion 

Deletes the domain with the specified name from the geodatabase.

Deleting domains is only supported in mobile geodatabases (either created in ArcGIS Pro or via createWithFileURL:completion:). The domain with the specified name must exist in the geodatabase. The domain must not be in use by any fields in existing tables.

Parameters
domainNameThe name of the domain to delete.
completionThe error parameter is populated on failure.
Returns
An operation which can be canceled.
Since
100.14

◆ deleteTableWithTableName:completion:

- (id<AGSCancelable>) deleteTableWithTableName: (NSString *)  tableName
completion: (void(^)(NSError *__nullable error))  completion 

Deletes an existing table from the geodatabase.

Deleting tables is only supported in mobile geodatabases (either created in ArcGIS Pro or via createWithFileURL:completion:). A table with the specified name must exist in the geodatabase. Attempting further use of a deleted table, such as rendering it in a feature layer or querying it, may result in errors. Only spatial and non-spatial tables can be deleted.

Parameters
tableNameThe name of the table to delete.
completionThe error parameter is populated on failure.
Returns
An operation which can be canceled.
Since
100.14

◆ doCancelLoading

- (void) doCancelLoading

Never call this method directly. The framework calls this method on a background thread when cancelLoad (AGSLoadable-p) is called. It is meant to be overriden by subclasses. Subclasses should override this method to cancel loading their data and call loadDidFinishWithError: (AGSLoadableBase(ForSubclassEyesOnly)) at the end passing in an error representing NSUserCancelledError.

Since
100

Provided by category AGSLoadableBase(ForSubclassEyesOnly).

◆ doStartLoading:

- (void) doStartLoading: (BOOL)  retrying

Never call this method directly. The framework calls this method on a background thread when loadWithCompletion: (AGSLoadable-p) or retryLoadWithCompletion: (AGSLoadable-p) is called. It is meant to be overriden by subclasses. Subclasses should override this method to load their data and call loadDidFinishWithError: (AGSLoadableBase(ForSubclassEyesOnly)) upon completion, passing in the error if any.

Parameters
retryingflag that is true if this method was called from retryLoadWithCompletion: (AGSLoadable-p).
Since
100

Provided by category AGSLoadableBase(ForSubclassEyesOnly).

◆ geodatabaseAnnotationTableWithServiceLayerID:

- (nullable AGSGeodatabaseFeatureTable *) geodatabaseAnnotationTableWithServiceLayerID: (NSInteger)  serviceLayerID

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

Parameters
serviceLayerIDThe service layer ID of the geodatabase feature table containing annotation features.
Returns
If the specified table does not contain annotation feature data, then no table is returned.
Since
100.6

◆ geodatabaseAnnotationTableWithTableName:

- (nullable AGSGeodatabaseFeatureTable *) geodatabaseAnnotationTableWithTableName: (NSString *)  tableName

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

Parameters
tableNameThe name of the geodatabase feature table containing annotation.
Returns
If the specified table does not contain annotation feature data, then no table is returned.
Since
100.6

◆ geodatabaseDimensionTableWithServiceLayerID:

- (nullable AGSGeodatabaseFeatureTable *) geodatabaseDimensionTableWithServiceLayerID: (NSInteger)  serviceLayerID

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

Parameters
serviceLayerIDThe service layer ID of the geodatabase feature table containing dimension features.
Returns
If the specified table does not contain dimension feature data, then no table is returned.
Since
100.13

◆ geodatabaseDimensionTableWithTableName:

- (nullable AGSGeodatabaseFeatureTable *) geodatabaseDimensionTableWithTableName: (NSString *)  tableName

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

Parameters
tableNameThe name of the geodatabase feature table containing dimension.
Returns
If the specified table does not contain dimension feature data, then no table is returned.
Since
100.13

◆ geodatabaseFeatureTableByServiceLayerID:

- (nullable AGSGeodatabaseFeatureTable *) geodatabaseFeatureTableByServiceLayerID: (NSInteger)  serviceLayerID

Returns a feature table from the geodatabase containing point, line or polygon features, as specified by the given feature service layer ID. The ID must match AGSArcGISFeatureLayerInfo::serviceLayerID

Parameters
serviceLayerIDThe service layer ID of the geodatabase feature table.
Returns
The feature table that has a matching layer ID. If the given layer ID matches a table in the geodatabase containing annotation feature data, then no table is returned.
Since
100

◆ geodatabaseFeatureTableWithName:

- (nullable AGSGeodatabaseFeatureTable *) geodatabaseFeatureTableWithName: (NSString *)  tableName

Returns a feature table from the geodatabase containing point, line or polygon features, as specified by the given tableName. If the geodatabase was generated from an ArcGIS Feature service, the name corresponds to a layer in the ArcGIS Feature service (AGSArcGISFeatureLayerInfo::serviceLayerName)

Parameters
tableNameThe name of the geodatabase feature table.
Returns
The feature table that has a matching name. If the specified table contains annotation feature data, then no table is returned.
Since
100

◆ geodatabaseWithFileURL:

+ (instancetype) geodatabaseWithFileURL: (NSURL *)  fileURL

Instantiates an existing geodatabase at the given path.

Parameters
fileURLto existing geodatabase (including .geodatabase file extension).
Since
100
Returns
A new geodatabase object.

◆ geodatabaseWithName:

+ (instancetype) geodatabaseWithName: (NSString *)  name

Initialize this object with the name of an existing geodatabase (.geodatabase file), excluding the ".geodatabase" extension, within the application bundle or shared documents directory.

Parameters
nameof the geodatabase (excluding the .geodatabase extension).
Returns
A new geodatabase object.
Since
100

◆ hasLocalEdits

- (BOOL) hasLocalEdits

Indicates whether the geodatabase has local edits.

For mobile geodatabases created by ArcGIS Pro, this method returns NO because there is no concept of uploading or applying edits. For tables from mobile geodatabases, use hasLocalEditsSince: (AGSGeodatabaseFeatureTable).

Returns
Whether the geodatabase has local edits or not.
Since
100
Note
This method could take a long time to complete for geodatabase containing very large number of features (~50,000+). Do not invoke it on the main thread as it may degrade the responsiveness of your application.

◆ initWithFileURL:

- (instancetype) initWithFileURL: (NSURL *)  fileURL

Instantiates an existing geodatabase at the given path.

Parameters
fileURLto existing geodatabase (including .geodatabase file extension).
Since
100

◆ initWithName:

- (instancetype) initWithName: (NSString *)  name

Initialize this object with the name of an existing geodatabase (.geodatabase file), excluding the ".geodatabase" extension, within the application bundle or shared documents directory.

Parameters
nameof the geodatabase (excluding the .geodatabase extension).
Since
100

◆ loadDidFinishWithError:

- (void) loadDidFinishWithError: (nullable NSError *)  error

Only subclasses should call this method in doStartLoading: (AGSLoadableBase(ForSubclassEyesOnly)) and doCancelLoading (AGSLoadableBase(ForSubclassEyesOnly)) when done loading or failed to load.

Since
100

Provided by category AGSLoadableBase(ForSubclassEyesOnly).

◆ loadWithCompletion:

- (void) loadWithCompletion: (nullable void(^)(NSError *__nullable error))  completion
requiredinherited

Loads data for the object asynchronously. The completion block is invoked upon completion.

You can call this method any number of times, however only one attempt is made to load the data. If it is already loading, it will just continue to load (i.e. not force a reload). If it has already loaded successfully, the completion block will be invoked right away. If it has already failed to load, the completion block will be invoked right away with error previously encountered. This method supports multiple callers and will call them all back on completion. However, each caller's completion block will be invoked once and only once.

Parameters
completionblock that is invoked when object loads successfully or fails to load. An error is passed to the block if the object fails to load.
Note
The completion block is always invoked on the main thread.
Since
100
See also
- cancelLoad to cancel loading
- retryLoadWithCompletion: to force reload

◆ onLoadStatusChanged

- (void) onLoadStatusChanged

Never call this method directly. The framework calls this method on a background thread when AGSLoadable::loadStatus changes is called. Subclasses can optionally implement this to know when their loading status has changed.

Since
100

Provided by category AGSLoadableBase(ForSubclassEyesOnly).

◆ retryLoadWithCompletion:

- (void) retryLoadWithCompletion: (nullable void(^)(NSError *__nullable error))  completion
requiredinherited

Tries to reload when an object has failed to load. This method should be called judiciously. It should be called when:

  1. you didn't have network connectivity earlier when it failed and you want to retry now that you have connectivity
  2. the server was down earlier when it failed and you want to retry
  3. the request is taking too long and you want to cancel it and retry, in which case you will first call cancelLoad and then this method

If the data hasn't started loading, it will start loading. If it is already loading, it will just continue to load. If it has already loaded successfully, calls back right away. If it has already failed to load, tries again. This method supports multiple callers and will call them all back on completion. However, each caller's completion block will be invoked once and only once.

Parameters
completionblock that is invoked when object loads successfully or fails to load. An error is passed to the block if the object fails to load.
Note
The completion block is always invoked on the main thread.
Since
100

◆ rollbackTransaction:

- (BOOL) rollbackTransaction: (NSError **)  error

Discard changes in the current transaction from the geodatabase. This will also end the transaction. An error will be provided if a transaction has not been started on the geodatabase.

Since
100.2

◆ utilityNetworkWithName:

- (nullable AGSUtilityNetwork *) utilityNetworkWithName: (NSString *)  name

Returns an AGSUtilityNetwork from the geodatabase with the specified utility network name.

Parameters
nameThe name of the utility network.
Returns
If the specified utility network is not found, then no AGSUtilityNetwork is returned.
Since
100.11

Property Documentation

◆ domains

- (NSArray<AGSDomain *>*) domains
readnonatomiccopy

Returns an observable array of the domains that exist in the geodatabase.

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

Since
100.14

◆ fileURL

- (NSURL*) fileURL
readnonatomicstrong

The file URL of the geodatabase.

Since
100

◆ generateGeodatabaseExtent

- (AGSEnvelope*) generateGeodatabaseExtent
readnonatomicstrong

The extent used to generate the geodatabase.

Since
100
Deprecated:
100.7 This property has been replaced by AGSGeodatabase::generateGeodatabaseGeometry. A geodatabase can be generated using geometry including an AGSEnvelope or an AGSPolygon - this property will always return the bounding envelope. The AGSGeodatabase::generateGeodatabaseGeometry property will return the underlying geometry.

Provided by category AGSGeodatabase(AGSDeprecated).

◆ generateGeodatabaseGeometry

- (AGSGeometry*) generateGeodatabaseGeometry
readnonatomicstrong

The geometry (for example an AGSEnvelope or AGSPolygon) used to generate a sync enabled geodatabase. Edits made to a sync enabled AGSGeodatabase must intersect the geometry used to generate the geodatabase. If an edit is made outside this extent, or area of interest, it will be rejected. This property will return the geometry which was used to create this geodatabase. For example, if the geodatabase was created using an AGSGenerateGeodatabaseJob, this property reflects the AGSGenerateGeodatabaseParameters::extent property. If the geometry was created using an AGSGenerateOfflineMapJob, this property reflects the AGSGenerateOfflineMapParameters::areaOfInterest property. If the geodatabase was downloaded as part of an AGSPreplannedMapArea, this property will match the geometry used by the web map author when the map area was created. If no geometry was used to create the geodatabase (for example if it was authored using ArcGIS Pro), this property may be nil. This property will also be nil until the geodatabase is loaded and the AGSGeodatabase::loadStatus is AGSLoadStatusLoaded.

Since
100.7

◆ geodatabaseAnnotationTables

- (NSArray<AGSGeodatabaseFeatureTable *>*) geodatabaseAnnotationTables
readnonatomiccopy

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

Since
100.6

◆ geodatabaseDimensionTables

- (NSArray<AGSGeodatabaseFeatureTable *>*) geodatabaseDimensionTables
readnonatomiccopy

The geodatabase feature tables that contain dimension features. An array of AGSGeodatabaseFeatureTable objects.

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

Since
100.13

◆ geodatabaseFeatureTables

- (NSArray<AGSGeodatabaseFeatureTable*>*) geodatabaseFeatureTables
readnonatomiccopy

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

◆ inTransaction

- (BOOL) inTransaction
readnonatomicassign

Indicates whether or not a transaction is active in the geodatabase.

Since
100.2

◆ loadError

- (NSError*) loadError
readnonatomicstronginherited

The error that was encountered during the most recent load operation. Will be nil if the operation succeeded.

Since
100

◆ loadStatus

- (AGSLoadStatus) loadStatus
readrequirednonatomicassigninherited

Status of the load operation.

Since
100

◆ minServerGeneration

- (NSInteger) minServerGeneration
readnonatomicassign

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 are applied to the geodatabase. New changes from the online feature service are synced to the local geodatabase. If the AGSGeodatabase::syncModel is AGSSyncModelGeodatabase, the value will indicate the server generation number for the entire geodatabase. If the AGSGeodatabase::syncModel is AGSSyncModelLayer, 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 (AGSSyncModelNone).

This property will be -1 until the geodatabase's AGSLoadable::loadStatus is AGSLoadStatusLoaded.

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.

See also
- importDeltaWithGeodatabase:inputPath:completion: (AGSGeodatabaseSyncTask(AGSDeprecated))
Since
100.6

◆ serviceURL

- (NSURL*) serviceURL
readnonatomicstrong

The geodatabase service URL.

Since
100

◆ syncEnabled

- (BOOL) syncEnabled
readnonatomicassign

Indicates whether this geodatabase was originally downloaded from a sync-enabled ArGIS feature service. If YES, its data can be snychronized with the service.

Since
100

◆ syncID

- (NSUUID*) syncID
readnonatomicstrong

The sync ID of the geodatabase. Only available if the geodatabase is syncEnabled. The sync ID is the same as the replica ID described in the REST documentation. This is used by the service that created the geodatabase to uniquely identify it when carrying out sync operations. It can also be used when unregistering the geodatabase after it has already been deleted locally using unregisterGeodatabaseWithSyncID:completion: (AGSGeodatabaseSyncTask)

Since
100.2

◆ syncModel

- (AGSSyncModel) syncModel
readnonatomicassign

The sync model defining how datasets within this geodatabase can be synchronized with the originating source. Only applicable if this geodatabase was originally downloaded from a sync-enabled ArGIS feature service (syncEnabled).

Since
100

◆ utilityNetworks

- (NSArray<AGSUtilityNetwork *>*) utilityNetworks
readnonatomiccopy

The AGSUtilityNetwork objects that are packaged within the AGSGeodatabase.

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

Since
100.11