# Class FeatureSet

A set of features that share a common schema.

#### Hierarchy

- Evented<this> & ObservableMixin<this>
  - FeatureSet

#### Implements

- Entity
- Serializable<FeatureSetProperties>
- Set<Feature>

#####
Index

### Constructors

constructor

### Properties

[toStringTag]
id
schema
settings
title

### Accessors

itemType
size
source

### Methods

_add
_delete
_getSerializableProperties
[iterator]
add
addMany
assignProperties
assignPropertiesAsync
clear
delete
deleteMany
entries
findById
findByPrimaryKey
finishAssignProperties
forEach
getDefault
getDefaults
getSerializableProperties
has
keys
on
toItemUri
toJSON
values
fromFeatureStream

##
Constructors

### constructor

- new FeatureSet(properties?): FeatureSet

- #### Parameters

  - `Optional` properties: FeatureSetProperties

  #### Returns FeatureSet

  Overrides observable(Evented).constructor

##
Properties

### `Readonly`[toStringTag]

[toStringTag]

Used by Object.toString().

Implementation of Set.[toStringTag]

### `Readonly` id

id: string

The unique ID for this entity.

Implementation of Entity.id

### `Readonly` schema

schema: Schema = ...

Metadata about features such as fields, domains, and geometry type.

### `Readonly` settings

settings: FeatureSettings = ...

Default settings that apply to features in this set.

### title

title: string

A human-readable name for the feature set.

##
Accessors

### itemType

- get itemType(): string

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

  #### Returns string

  Implementation of Entity.itemType

### size

- get size(): number

- The number of elements in the set.

  #### Returns number

  Implementation of Set.size

### source

- get source(): FeatureSource

- The source for the features.

  #### Returns FeatureSource

- set source(value): void

- #### Parameters

  - value: FeatureSource

  #### Returns void

##
Methods

### `Protected`_add

- _add(feature, notify?): this

- #### Parameters

  - feature: Feature
  - notify: boolean = true

  #### Returns this

### `Protected`_delete

- _delete(feature, notify?): boolean

- #### Parameters

  - feature: Feature
  - notify: boolean = true

  #### Returns boolean

  #### Inherit Doc

### `Protected`_getSerializableProperties

- _getSerializableProperties(): PropertyDefs<FeatureSetProperties>

- #### Returns PropertyDefs<FeatureSetProperties>

  #### Inherit Doc

### [iterator]

- [iterator](): SetIterator<Feature>

- Returns each element in the set in insertion order.

  #### Returns SetIterator<Feature>

  Implementation of Set.[iterator]

### add

- add(feature): this

- #### Parameters

  - feature: Feature

  #### Returns this

  #### Inherit Doc

  Implementation of Set.add

### addMany

- addMany(features): this

- #### Parameters

  - features: Iterable<Feature, any, any>

  #### Returns this

  #### Inherit Doc

### assignProperties

- assignProperties(properties): void

- Sets the values of this object's properties.

  #### Parameters

  - properties: Partial<FeatureSetProperties>

    An object containing property values to set.

  #### Returns void

  Implementation of Serializable.assignProperties

### assignPropertiesAsync

- assignPropertiesAsync(properties): Promise<void>

- Sets the properties for this item.

  This version will also await any asynchronous logic that is needed to set the properties.

  #### Parameters

  - properties: Partial<FeatureSetProperties>

    A plain object containing property values to set, keyed by property name.

  #### Returns Promise<void>

  Implementation of Serializable.assignPropertiesAsync

### clear

- clear(): void

- #### Returns void

  #### Inherit Doc

  Implementation of Set.clear

### delete

- delete(feature): boolean

- #### Parameters

  - feature: Feature

  #### Returns boolean

  #### Inherit Doc

  Implementation of Set.delete

### deleteMany

- deleteMany(features): boolean

- #### Parameters

  - features: Iterable<Feature, any, any>

  #### Returns boolean

  #### Inherit Doc

### entries

- entries(): SetIterator<[Feature, Feature]>

- #### Returns SetIterator<[Feature, Feature]>

  #### Inherit Doc

  Implementation of Set.entries

### findById

- findById(id): Feature

- Finds a feature in the set with the given ID, or undefined if there is no match.

  #### Parameters

  - id: string

    The ID to search for.

  #### Returns Feature

### findByPrimaryKey

- findByPrimaryKey(primaryKey): Feature

- Finds a feature in the set with the given primary key, or undefined if there is no match.

  #### Parameters

  - primaryKey: string

    The primary key to search for.

  #### Returns Feature

### finishAssignProperties

- finishAssignProperties(): Promise<void>

- Waits for all deserialization logic initiated thus far to finish, whether invoked by passing properties into the constructor, or by invoking `assignProperties()` or `assignPropertiesAsync()`.

  #### Returns Promise<void>

  Implementation of Serializable.finishAssignProperties

### forEach

- forEach(callbackfn, thisArg?): void

- #### Parameters

  - callbackfn: ((value: Feature, value2: Feature, set: Set<Feature>) => void)

    Function to execute for each element.

    - - (value, value2, set): void

      - #### Parameters

        - value: Feature
        - value2: Feature
        - set: Set<Feature>

        #### Returns void

  - `Optional` thisArg: unknown

    Value to use as `this` when executing callback.

  #### Returns void

  #### Inherit Doc

  Implementation of Set.forEach

### getDefault

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

- Gets the default value of an object's property.

  #### Type Parameters

  - K extends keyof FeatureSetProperties

  #### Parameters

  - key: K

    The property of the object for which to get the default value.

  #### Returns FeatureSetProperties[K]

  Implementation of Serializable.getDefault

### getDefaults

- getDefaults(): Partial<FeatureSetProperties>

- Gets the object's default property values.

  #### Returns Partial<FeatureSetProperties>

  Implementation of Serializable.getDefaults

### getSerializableProperties

- getSerializableProperties(serializeMode?): PropertyDefs<FeatureSetProperties>

- Returns the serializable properties.

  #### Parameters

  - serializeMode: SerializeMode = "all"

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

  #### Returns PropertyDefs<FeatureSetProperties>

  Implementation of Serializable.getSerializableProperties

### has

- has(feature): boolean

- Indicates whether or not the set contains the specified element.

  #### Parameters

  - feature: Feature

    The element to test for.

  #### Returns boolean

  Implementation of Set.has

### keys

- keys(): SetIterator<Feature>

- #### Returns SetIterator<Feature>

  #### Inherit Doc

  Implementation of Set.keys

### on

- on(name, callback): IHandle

- Registers an event handler on the instance.

  #### Parameters

  - name: "dehydrated-features-added"
  - callback: ((dehydratedFeatures: Feature[]) => void)
    - - (dehydratedFeatures): void

      - #### Parameters

        - dehydratedFeatures: Feature[]

        #### Returns void

  #### Returns IHandle

  Overrides observable(Evented).on

- on(name, callback): IHandle

- #### Parameters

  - name: "feature-hydration-complete"
  - callback: ((hydratedFeatures: Feature[]) => void)
    - - (hydratedFeatures): void

      - #### Parameters

        - hydratedFeatures: Feature[]

        #### Returns void

  #### Returns IHandle

  Overrides observable(Evented).on

- on(name, callback): IHandle

- #### Parameters

  - name: "change"
  - callback: ((event: ChangeEvent<Feature>) => void)
    - - (event): void

      - #### Parameters

        - event: ChangeEvent<Feature>

        #### Returns void

  #### Returns IHandle

  Overrides observable(Evented).on

### toItemUri

- toItemUri(): string

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

  #### Returns string

  Implementation of Entity.toItemUri

### toJSON

- toJSON(serializeMode?): FeatureSetProperties

- Returns a serializable representation of the feature set.

  #### Parameters

  - serializeMode: SerializeMode = "all"

    If specified, only properties that are appropriate for the given mode are returned. Otherwise, all properties will be serialized.

  #### Returns FeatureSetProperties

  Implementation of Serializable.toJSON

### values

- values(): SetIterator<Feature>

- #### Returns SetIterator<Feature>

  #### Inherit Doc

  Implementation of Set.values

### `Static` fromFeatureStream

- fromFeatureStream(features, properties?): Promise<FeatureSet>

- Reads a stream of features into a data/FeatureSet!FeatureSet.

  #### Parameters

  - features: AsyncIterable<Feature, any, any>

    The features to read.

  - `Optional` properties: FeatureSetProperties

    Optional properties for the new feature set.

  #### Returns Promise<FeatureSet>