Helps create an IFeatureModel given a list of features, model metadata, feature model metadata, and optionally bounds.
Creates a new in-memory IFeatureModel instance, based on the given model metadata, feature model metadata and the list of features.
Depending on the setting of the Editable flag, it is possible to add,remove, or update the features of this model after it has been created.
The metadata can be supplied in two ways. Either pass the metadata objects themselves with modelMetadata() and featureModelMetadata(), or use the title(), reference() and dataModel() shortcuts and let this function assemble the metadata. The two ways cannot be mixed.
- Returns
- An in-memory
IFeatureModel instance.
- Exceptions
-
| System.InvalidOperationException | If the metadata is supplied in both ways at once, or if there is not enough information to assemble it. Without featureModelMetadata(), either dataModel() or at least one feature is required, so that the data model can be determined. |
Sets the data model that describes the features.
Calling this function is optional.
This is a shortcut that makes this builder assemble the FeatureModelMetadata, so featureModelMetadata() does not have to be called. It is an alternative to featureModelMetadata(), not an addition: neither wins when both are set, build() throws a System.InvalidOperationException instead.
Without this call the data model is derived from the DataType of the features passed to features(), and is named after the model's title. Set it explicitly for a model that starts out without features, or to control the data model's name.
- Parameters
-
| dataModel | the data model that describes the features. |
- Returns
- this
- Since
- 2026.1
Sets whether the model spatially indexes its features or not.
Enabling this flag can improve performance when you are querying a specific area, or when you are using this model in a FeatureLayer with the spatial loading strategy. Spatial indexing may also cause a small performance penalty for feature additions, updates, and removals.
Calling this function is optional. By default, this value is false.
- Parameters
-
| spatialIndex | whether the model spatially indexes its features or not. |
- Returns
- this
- Since
- 2025.0.04
Sets the title of the feature model.
Calling this function is optional.
This is a shortcut that makes this builder assemble the ModelMetadata, with the title as its only content, so modelMetadata() does not have to be called. It is an alternative to modelMetadata(), not an addition: neither wins when both are set, build() throws a System.InvalidOperationException instead.
When neither this function nor modelMetadata() is called, the model gets the title "Feature model", so that it is never nameless.
- Parameters
-
| title | the title of the feature model. |
- Returns
- this
- Since
- 2026.1