# Class Feature

Represents a record in a data/FeatureSource!FeatureSource. Both spatial and non-spatial features have attributes, while only spatial features have geometry.

#### Hierarchy (view full)

- EntityBase<FeatureProperties>
  - Feature

#####
Index

### Constructors

constructor

### Properties

_handles
_id
_itemType
@eventTypes
attachments
attributes
expressionFieldValues
schema
settings

### Accessors

attachmentsInitialized
description
expressionsInitialized
failureMode
geometry
geometryType
globalId
hasGlobalId
hyperlinks
id
isDestroyed
isInitialized
itemType
presentableAttributes
primaryKey
relatedFeatures
relatedFeaturesInitialized
source
title
type

### Methods

_getSerializableProperties
_initializableChildCollections
_initializeChildren
_onDestroy
_onInitialize
_postInitialize
_toPropertyDef
addAttachment
assignProperties
assignPropertiesAsync
clearExpressionInfos
deleteAttachments
destroy
fetchAttachments
fetchExpressionInfos
fetchRelatedFeatures
finishAssignProperties
format
getDefault
getDefaults
getSerializableProperties
initialize
toGraphic
toItemUri
toJSON

##
Constructors

### constructor

- new Feature(properties?): Feature

- #### Parameters

  - `Optional` properties: FeatureProperties

  #### Returns Feature

  Overrides EntityBase.constructor

##
Properties

### `Protected` `Readonly`_handles

_handles: Handles<unknown, ResourceHandle>

Inherited from EntityBase._handles

### `Protected`_id

_id: string

The unique ID for this entity. Once set, this should never change.

Inherited from EntityBase._id

### `Protected` `Readonly`_itemType

_itemType: string = ItemType.FEATURE

The item type for this entity when it participates in an App.

Overrides EntityBase._itemType

### @eventTypes

@eventTypes: InitializableBaseEvents

#### Deprecated

Do not directly reference this property. Use EventNames and EventTypes helpers from @arcgis/core/Evented.

Inherited from EntityBase.@eventTypes

### `Readonly` attachments

attachments: Collection<Attachment>

Attachments associated with this feature. See fetchAttachments.

### `Readonly` attributes

attributes: CaseInsensitiveObservableMap<unknown>

The feature's attributes, keyed by field name.

### `Readonly` expressionFieldValues

expressionFieldValues: ReadOnlyMap<string, unknown>

The Expression values associated with this feature. See fetchExpressionInfos.

### `Readonly` schema

schema: Schema

Metadata about the feature, such as fields, domains, geometry type, etc.

### `Readonly` settings

settings: FeatureSettings

Settings for this feature.

##
Accessors

### attachmentsInitialized

- get attachmentsInitialized(): boolean

- Indicates whether attachments have been fetched at least once.

  #### Returns boolean

### description

- get description(): string

- A human-readable description for the feature.

  #### Returns string

### expressionsInitialized

- get expressionsInitialized(): boolean

- Indicates whether async Arcade expressions have been evaluated at least once.

  #### Returns boolean

### failureMode

- get failureMode(): FailureMode

- Determines how a parent object should handle initialization failure in this object. The default is "warn".

  - `"error"`: support/InitializeError!InitializeError is thrown.
  - `"warn"`: Message is logged and support/InitializableBase!InitializeWarningEvent is raised.
  - `"ignore"`: support/InitializableBase!InitializeWarningEvent is raised.

  #### Returns FailureMode

  Inherited from EntityBase.failureMode

- set failureMode(value): void

- #### Parameters

  - value: FailureMode

  #### Returns void

  Inherited from EntityBase.failureMode

### geometry

- get geometry(): GeometryUnion

- The feature's geometry. For non-spatial features, this will be undefined.

  #### Returns GeometryUnion

- set geometry(value): void

- #### Parameters

  - value: GeometryUnion

  #### Returns void

### geometryType

- get geometryType(): string

- The type of geometry. This property will be undefined if the data is not spatial.

  #### Returns string

### globalId

- get globalId(): string

- Returns the feature's global ID if set and supported by its underlying source. If the feature's source does not support global IDs, then reading this value will return `undefined`, and attempting to set this property will result in an error. Use `hasGlobalId` to check if it's supported.

  #### Returns string

- set globalId(value): void

- #### Parameters

  - value: string

  #### Returns void

### hasGlobalId

- get hasGlobalId(): boolean

- Determines whether this feature has a global ID field.

  #### Returns boolean

### hyperlinks

- get hyperlinks(): Collection<Hyperlink>

- Hyperlinks associated with the feature. Note: This collection is read-only. To change hyperlinks, modify the hyperlinkTemplates setting instead.

  #### Returns Collection<Hyperlink>

### id

- get id(): string

- The unique ID for this entity.

  #### Returns string

  Inherited from EntityBase.id

### isDestroyed

- get isDestroyed(): boolean

- See support/InitializableBase!Initializable.isDestroyed.

  #### Returns boolean

  Inherited from EntityBase.isDestroyed

### isInitialized

- get isInitialized(): boolean

- See support/InitializableBase!Initializable.isInitialized.

  #### Returns boolean

  Inherited from EntityBase.isInitialized

### itemType

- get itemType(): string

- The item type for this entity when it participates in an App.

  #### Returns string

  Inherited from EntityBase.itemType

### presentableAttributes

- get presentableAttributes(): PresentableAttributes

- Feature attributes that have been formatted for display. Read-only.

  #### Returns PresentableAttributes

### primaryKey

- get primaryKey(): string

- The attribute value of the Feature's OBJECTID (oid) field.

  #### Returns string

### relatedFeatures

- get relatedFeatures(): ObservableMap<Relationship, FeatureSet>

- Gets features that are related to this feature. Returns sets of related features keyed by the relationship that they came from. In order to make related feature available, you must call fetchRelatedFeatures.

  #### Returns ObservableMap<Relationship, FeatureSet>

### relatedFeaturesInitialized

- get relatedFeaturesInitialized(): boolean

- Indicates whether related features have been fetched at least once, if this feature has relationships.

  #### Returns boolean

### source

- get source(): FeatureSource

- The source of this feature.

  #### Returns FeatureSource

- set source(value): void

- #### Parameters

  - value: FeatureSource

  #### Returns void

### title

- get title(): string

- A human readable title for the feature.

  #### Returns string

### type

- get type(): FeatureType

- The Esri API FeatureType object that is associated with this feature.

  #### Returns FeatureType

##
Methods

### `Protected`_getSerializableProperties

- _getSerializableProperties(): PropertyDefs<FeatureProperties>

- The property keys and their metadata that are used to implement serializing and deserializing the class instance.

  #### Returns PropertyDefs<FeatureProperties>

  Overrides EntityBase._getSerializableProperties

### `Protected`_initializableChildCollections

- _initializableChildCollections(): IterableIterator<Collection<InitializableBase<InitializableBaseProperties>>, any, any>

- Collections of child items to initialize. Items that fail to initialize are removed from the collection.

  #### Returns IterableIterator<Collection<InitializableBase<InitializableBaseProperties>>, any, any>

  Inherited from EntityBase._initializableChildCollections

### `Protected`_initializeChildren

- _initializeChildren(): Promise<void>

- Initializes child entities.

  #### Returns Promise<void>

  Inherited from EntityBase._initializeChildren

### `Protected`_onDestroy

- _onDestroy(): Promise<void>

- Called to perform cleanup. Subclasses should override this method rather than destroy() to perform custom cleanup.

  #### Returns Promise<void>

  Inherited from EntityBase._onDestroy

### `Protected`_onInitialize

- _onInitialize(): Promise<void>

- Called to perform initialization of the support/InitializableBase!InitializableBase. Subclasses should override this method rather than initialize() to perform custom initialization.

  #### Returns Promise<void>

  Overrides EntityBase._onInitialize

### `Protected`_postInitialize

- _postInitialize(): Promise<void>

- Called after normal initialization. Note: Child items are initialized before this is called.

  #### Returns Promise<void>

  Inherited from EntityBase._postInitialize

### `Protected`_toPropertyDef

- _toPropertyDef<T>(def): PropertyDef<T>

- Converts the value to a PropertyDef object.

  #### Type Parameters

  - T

  #### Parameters

  - def: PropertyDefSerializeMode | PropertyDefSerializeMode[] | PropertyDef<T>

    The value to convert.

  #### Returns PropertyDef<T>

  Inherited from EntityBase._toPropertyDef

### addAttachment

- addAttachment(attachment): Promise<Attachment>

- Adds an attachment to the feature. Returns the created Attachment item.

  #### Parameters

  - attachment: AttachmentProperties | Attachment | File

    The attachment to add to the feature.

  #### Returns Promise<Attachment>

### assignProperties

- assignProperties(properties): void

- #### Parameters

  - properties: Partial<FeatureProperties>

  #### Returns void

  #### Inherit Doc

  Inherited from EntityBase.assignProperties

### assignPropertiesAsync

- assignPropertiesAsync(properties): Promise<void>

- #### Parameters

  - properties: Partial<FeatureProperties>

  #### Returns Promise<void>

  #### Inherit Doc

  Inherited from EntityBase.assignPropertiesAsync

### clearExpressionInfos

- clearExpressionInfos(): void

- Clears the cached values for all "expression info" contained in the PopupTemplate.

  #### Returns void

### deleteAttachments

- deleteAttachments(attachments): Promise<void>

- Deletes attachments from the feature.

  #### Parameters

  - attachments: (string | Attachment)[]

    The attachments or the ids of the attachments to delete.

  #### Returns Promise<void>

### destroy

- destroy(): Promise<void>

- A clean-up function that should get called whenever the item is disposed of.

  #### Returns Promise<void>

  Inherited from EntityBase.destroy

### fetchAttachments

- fetchAttachments(): Promise<void>

- Retrieves attachments that are associated with this feature.

  #### Returns Promise<void>

### fetchExpressionInfos

- fetchExpressionInfos(watch?): Promise<IHandle>

- Fetches or updates the cached values for all "expression infos" contained in the PopupTemplate.

  #### Parameters

  - watch: boolean = false

    If specified "expression infos" will be reevaluated when the feature's attributes change.

  #### Returns Promise<IHandle>

### fetchRelatedFeatures

- fetchRelatedFeatures(relationships?, options?): Promise<void>

- Fetches features that are related to this feature. Features are available through Feature.relatedFeatures.

  #### Parameters

  - `Optional` relationships: string | Relationship | (string | Relationship)[]

    The relationships or relationship IDs to fetch related features for. If omitted, all related features will be fetched.

  - `Optional` options: FetchRelatedFeaturesOptions

    Additional options that affect fetching related features.

  #### Returns Promise<void>

### finishAssignProperties

- finishAssignProperties(): Promise<void>

- #### Returns Promise<void>

  #### Inherit Doc

  Inherited from EntityBase.finishAssignProperties

### format

- format(format, ...args): string

- Same as utilities/format/string!StringFormatter.format, except that the format string may also contain field format items, which have this syntax: `{field-name[:format]}`.

  These items will be substituted with the appropriate field value. Null and undefined values will be converted into empty strings.

  #### Parameters

  - format: string

    The format string to use.

  - `Rest`...args: unknown[]

  #### Returns string

- format(options, ...args): string

- Same as utilities/format/string!StringFormatter.format, except that the format string may also contain field format items, which have this syntax: `{field-name[:format]}`.

  These items will be substituted with the appropriate field value. Null and undefined values will be converted into empty strings.

  #### Parameters

  - options: FormatOptions
  - `Rest`...args: unknown[]

  #### Returns string

### getDefault

- getDefault<K>(key): FeatureProperties[K]

- #### Type Parameters

  - K extends keyof FeatureProperties

  #### Parameters

  - key: K

  #### Returns FeatureProperties[K]

  #### Inherit Doc

  Inherited from EntityBase.getDefault

### getDefaults

- getDefaults(): FeatureProperties

- #### Returns FeatureProperties

  #### Inherit Doc

  Inherited from EntityBase.getDefaults

### getSerializableProperties

- getSerializableProperties(serializeMode?): PropertyDefs<FeatureProperties>

- Returns the serializable properties.

  #### Parameters

  - `Optional` serializeMode: SerializeMode

    Optional. If specified, only properties that support the given serialization mode will be returned.

  #### Returns PropertyDefs<FeatureProperties>

  Inherited from EntityBase.getSerializableProperties

### initialize

- initialize(): Promise<void>

- Initializes the item.

  #### Returns Promise<void>

  Inherited from EntityBase.initialize

### toGraphic

- toGraphic(): Graphic

- Converts the feature to an Esri Graphic object.

  #### Returns Graphic

### toItemUri

- toItemUri(): string

- Creates an item:// URI reference to this entity.

  #### Returns string

  Inherited from EntityBase.toItemUri

### toJSON

- toJSON(serializeMode?): FeatureProperties

- #### Parameters

  - serializeMode: SerializeMode = "all"

  #### Returns FeatureProperties

  #### Inherit Doc

  Inherited from EntityBase.toJSON