A feature collection represents a lightweight collection of features that can be saved in a map or portal item. A feature collection is typically used to hold features with mixed geometry or unstructured data. The features are stored in feature collection tables, where all the features that belong to a table share the same attribute schema (fields), geometry type, and spatial reference. The feature collection groups these different feature tables together so that you can display and manage them in a single layer.

There are a number of ways to create a feature collection:

  • You can build a feature collection in ArcGIS Online by creating a sketch layer[https://doc.arcgis.com/en/arcgis-online/create-maps/create-sketch-layers-mv.htm] and saving it as part of the map. The sketch layer may contain points, lines, polygons, and associated text to describe things in the map. Because they have different schema and geometry types, these features are stored in several distinct feature collection tables.

  • You can import features into ArcGIS Online from files, such as CSV or shapefiles, and save them in a separate PortalItem (of type PortalItemType.FeatureCollection).

  • You can create a FeatureCollection programmatically by constructing an empty FeatureCollectionTable and adding features to the table.

If you need to share the feature collection between several maps or scenes, it is best to store it as a separate portal item. If you need to make frequent (near real-time) edits to features in a collection, consider storing these in a feature service instead, because the feature collection is not refreshed until the map or portal item is reloaded. If features are used by a single map or are not subject to frequent updates, it might be best to store them directly in the map. Edits made to features stored in a map will be saved when the map is saved. Edits made to features stored in a portal item (and loaded into a map, for example) must be explicitly saved to the original portal item.

To render the features in a map or scene, construct a FeatureCollectionLayer using the FeatureCollection and add the layer to the collection of operational layers.




Link copied to clipboard

Create a feature collection object.

constructor(item: Item)

Creates a feature collection object from a PortalItem.

constructor(featureCollectionTables: Iterable<FeatureCollectionTable>)

Creates a feature collection object from a set of feature collection tables.


Link copied to clipboard
object Companion


Link copied to clipboard
var item: Item?

The item the feature collection has been created from. This is only available if the FeatureCollection is associated with a PortalItem. This is the case if the FeatureCollection had been created from an item using FeatureCollection.FeatureCollection(Item) or if the FeatureCollection had been previously saved as a PortalItem.

Link copied to clipboard

The feature collection tables of a feature collection.

Inherited properties

Link copied to clipboard
open override val loadStatus: StateFlow<LoadStatus>

The load status.


Link copied to clipboard
suspend fun save(): Result<Unit>

Saves any changes that have been made to the FeatureCollection to the associated PortalItem. Updates the FeatureCollection content data on the portal and the portal item properties stored on the portal to match those stored within the FeatureCollection.item object.

Link copied to clipboard
suspend fun saveAs(portal: Portal, folder: PortalFolder?, title: String, description: String, tags: Iterable<String>, thumbnail: BitmapDrawable?): Result<Unit>

Saves the feature collection as a new PortalItem (of type PortalItemType.FeatureCollection). To be saved, the FeatureCollection does not need to be associated with an existing PortalItem object but it must be loaded.

Inherited functions

Link copied to clipboard
open override fun cancelLoad()

Cancels loading metadata for the Loadable object.

Link copied to clipboard
open suspend override fun load(): Result<Unit>

Loads the metadata for the object.

Link copied to clipboard
open suspend override fun retryLoad(): Result<Unit>

Loads or retries loading metadata for the object.

Link copied to clipboard
open override fun toJson(): String

Convert an object to JSON string.