ArcGIS Runtime SDK for iOS: AGSArcGISFeature Class Reference
ArcGIS Runtime SDK for iOS  100.9
AGSArcGISFeature Class Reference

Description

An AGSFeature stored in an AGSArcGISFeatureTable.

An AGSArcGISFeature can contain:

  • A set of attributes that describe the real-world entity it represents.
  • A geometry that defines its location and shape. The geometry might contain m-values, which are typically used for linear referencing.
  • Zero or more feature attachments such as images or documents.

A feature's attribute values can be changed, but attribute definitions cannot be added, deleted, or modified. If you create an AGSServiceFeatureTable from the URL of a feature service, features in the table are initially in one of the following states: A minimum set of attributes are available in the table, and m-values are omitted. This is an optimization for faster rendering. All attributes defined by the service are available in the table, including m-values, which might be NaN. The initial state of features is determined by the feature request mode of the table. For important details, see AGSFeatureRequestMode.

By default, a query on AGSArcGISFeature objects in a minimum state will return them in the same state. To access all attributes (or the m-values) of features returned by a query, you must load the features. You can do one of the following: Call loadWithCompletion: (AGSLoadable-p) on each feature. Call loadOrRefreshFeatures:completion: (AGSServiceFeatureTable) and pass an array of features to be loaded. Call queryFeaturesWithParameters:queryFeatureFields:completion: (AGSServiceFeatureTable) with the constant AGSQueryFeatureFieldsLoadAll, which returns all features in a fully loaded state. For more information, see the class description for AGSServiceFeatureTable.

Since
100.0
Inheritance diagram for AGSArcGISFeature:
AGSFeature <AGSLoadable> AGSObject <AGSGeoElement>

Instance Methods

(id< AGSCancelable >) - addAttachmentWithName:contentType:data:completion:
 
(void) - cancelLoad
 
(id< AGSCancelable >) - deleteAttachment:completion:
 
(id< AGSCancelable >) - deleteAttachments:completion:
 
(nullable AGSFeatureSubtype *) - featureSubtype
 
(id< AGSCancelable >) - fetchAttachmentsWithCompletion:
 
(void) - loadWithCompletion:
 
(BOOL) - refresh
 
(BOOL) - refreshObjectID
 
(void) - relateToFeature:
 
(void) - relateToFeature:relationshipInfo:
 
(void) - retryLoadWithCompletion:
 
(void) - unrelateToFeature:
 
(id< AGSCancelable >) - updateAttachment:name:contentType:data:completion:
 

Properties

NSMutableDictionary< NSString *, id > * attributes
 
BOOL canEditAttachments
 
BOOL canUpdateGeometry
 
AGSFeatureTablefeatureTable
 
AGSGeometrygeometry
 
NSError * loadError
 
AGSLoadStatus loadStatus
 

Method Documentation

§ 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

§ featureSubtype()

- (nullable AGSFeatureSubtype *) featureSubtype

Gets the corresponding AGSFeatureSubtype for this feature If this feature belongs to an AGSArcGISFeatureTable that defines an AGSArcGISFeatureTable::subtypeField, an AGSFeatureSubtype that matches AGSFeatureSubtype::code with this feature's attribute value for subtype field is returned; otherwise, this will return nil.

Returns
The AGSFeatureSubtype for this feature.
Since
100.9

§ fetchAttachmentsWithCompletion:()

- (id<AGSCancelable>) fetchAttachmentsWithCompletion: (nullable void(^)(NSArray< AGSAttachment * > *__nullable result, NSError *__nullable error))  completion

Fetch information about attachments that belong to this feature.

Parameters
completionblock that is called when the operation is complete. The attachments are passed in as an array of AGSAttachment objects.
Returns
operation which can be canceled
Since
100

§ 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

§ refresh()

- (BOOL) refresh

Resets the attributes and geometry to the values in the data source. This will discards any in-memory changes to the feature that have not been applied to the table, and reloads the feature geometry and all attributes.

Returns
a value indicating whether the geometry or attributes were updated.
Since
100.4

§ refreshObjectID()

- (BOOL) refreshObjectID

Refreshes the ObjectID and GlobalID attributes of this feature by fetching them again from the geodatabase on disk. This is useful when you create a new feature and add it to the service but still keep holding on to the original reference you got when you created the feature. The original reference does not automatically get the new IDs it was assigned by the service. You can call this method to update the reference with the new IDs.

Since
100
Deprecated:
100.4. Use refresh (AGSFeature) instead.

§ relateToFeature:()

- (void) relateToFeature: (AGSArcGISFeature *)  feature

Relates this feature to the provided feature if their owning feature tables are related (see relatedTables (AGSArcGISFeatureTable)). The relationship between the features is established by updating the destination feature's attribute on which the relationship is based.

Note
You must commit this change to the feature table using addFeature:completion: (AGSFeatureTable) or updateFeature:completion: (AGSFeatureTable) to finish relating the features. After committing the change, you can use validateRelationshipConstraintsForFeature:completion: (AGSArcGISFeatureTable) to check if any relationship constraints have been violated.

If the relationship is keyed on an Object ID or Global ID, and the origin feature in this call has been newly created and added to a service feature table, you must first call applyEditsWithCompletion: (AGSServiceFeatureTable) after the feature is added and then refresh (AGSFeature) to obtain the new Object ID and Global ID generated by the service for the origin feature. If this is not done, then the destination feature will end up referring to an outdated ID and will not be considered related.

Parameters
featurethat this feature needs to be related to
Since
100.1

§ relateToFeature:relationshipInfo:()

- (void) relateToFeature: (AGSArcGISFeature *)  feature
relationshipInfo: (nullable AGSRelationshipInfo *)  relationshipInfo 

Relates this feature to the provided feature if their owning feature tables are related through the specified relationship (see relatedTablesWithRelationshipInfo: (AGSArcGISFeatureTable)). The relationship between the features is established by updating the destination feature's attribute on which the relationship is based.

Note
You must commit this change to the feature table using addFeature:completion: (AGSFeatureTable) or updateFeature:completion: (AGSFeatureTable) to finish relating the features. After committing the change, you can use validateRelationshipConstraintsForFeature:completion: (AGSArcGISFeatureTable) to check if any relationship constraints have been violated.

If the relationship is keyed on an Object ID or Global ID, and the origin feature in this call has been newly created and added to a service feature table, you must first call applyEditsWithCompletion: (AGSServiceFeatureTable) after the feature is added and then refresh (AGSFeature) to obtain the new Object ID and Global ID generated by the service for the origin feature. If this is not done, then the destination feature will end up referring to an outdated ID and will not be considered related.

Parameters
featurethat this feature needs to be related to
relationshipInfospecifying how to relate the features
Since
100.1

§ 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

§ unrelateToFeature:()

- (void) unrelateToFeature: (AGSArcGISFeature *)  feature

Unrelates this feature to the provided feature

Note
You must commit this change to the feature table using addFeature:completion: (AGSFeatureTable) or updateFeature:completion: (AGSFeatureTable) to finish unrelating the features. After committing the change, you can use validateRelationshipConstraintsForFeature:completion: (AGSArcGISFeatureTable) to check if any relationship constraints have been violated.
Parameters
featurethat this feature needs to be unrelated to
Since
100.1

Property Documentation

§ attributes

- (NSMutableDictionary<NSString*,id>*) attributes
readnonatomicstronginherited

A dictionary containing all the attributes. Attribute types supported are NSNull, NSString, NSDate, and NSNumber. Other attribute types will be ignored.

Since
100

§ canEditAttachments

- (BOOL) canEditAttachments
readnonatomicassign

Indicates whether the feature's attachments can be edited.

Since
100

§ canUpdateGeometry

- (BOOL) canUpdateGeometry
readnonatomicassign

Indicates whether the feature's geometry can be updated.

Since
100

§ featureTable

- (AGSFeatureTable*) featureTable
readnonatomicweakinherited

The dataset that this feature belongs to

Since
100

§ geometry

- (AGSGeometry*) geometry
readwritenonatomicstronginherited

The geometry that defines shape and location.

Since
100

§ 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