跳到主要内容

flywave-features-datasource.featuresdatasource

Home > @flywave/flywave-features-datasource > FeaturesDataSource

FeaturesDataSource class

[[DataSource]] implementation to use for the addition of custom features.

Signature:

export declare class FeaturesDataSource extends VectorTileDataSource 

Extends: VectorTileDataSource

Constructors

Constructor

Modifiers

Description

(constructor)(options)

Builds a FeaturesDataSource.

Methods

Method

Modifiers

Description

add(features)

Adds a custom feature in the datasource.

attach(mapView)

Override [[DataSource.attach]] to know if we're really connected to [[MapView]].

clear()

Removes all the custom features in this FeaturesDataSource.

connect()

detach(mapView)

Override [[DataSource.detach]] to know if we're really connected to [[MapView]].

getGeoBox()

Get [[GeoBox]] containing all the points in datasource.

Returns undefined if there were no features added to this DS.

remove(features)

Removes a custom feature in the datasource.

setFromGeojson(geojson)

This method allows to directly add a GeoJSON without using [[MapViewFeature]] instances. It also overwrites existing features in this data source. To add a GeoJSON without overwriting the data source, one should loop through it to create [[MapViewFeature]] and add them with the add method.