addGeoJSONSourceFeatures

open override fun addGeoJSONSourceFeatures(sourceId: String, dataId: String, features: List<Feature>): Expected<String, None>

Add additional features to a GeoJSON style source.

This method is thread-safe.

Note that when calling this method from a thread other than the main thread, the return value does not contain the actual operation status. To ensure the success of the operation, use the events API, which will propagate a MapLoaded event upon success or a MapLoadingError event upon failure.

Partially updating a GeoJSON source is not compatible with using shared cache and generated IDs. It is important to ensure that every feature in the GeoJSON style source, as well as the newly added feature, has a unique ID (or a unique promote ID if in use). Failure to provide unique IDs will result in a MapLoadingError.

The method allows the user to provide a data ID, which will be returned as the dataId parameter in the SourceDataLoaded event. However, it's important to note that multiple partial updates can be queued for the same GeoJSON source when ongoing source parsing is taking place. In these cases, the partial updates will be applied to the source in batches. Only the data ID provided in the most recent call within each batch will be included in the SourceDataLoaded event. If no data ID is provided in the most recent call, the data ID in the SourceDataLoadedevent will be null.

Return

A string describing an error if the operation was not successful, empty otherwise.

Parameters

sourceId

The identifier of the style source.

dataId

An arbitrary string used to track the given GeoJSON data, empty string means null ID.

features

An array of GeoJSON features to be added to the source.