API (v3.0.0-dev) - Giro3D
    Preparing search index...

    An image source that reads vector data. Internally, this wraps an OpenLayers' VectorSource. This uses OpenLayers' styles and features.

    Note: to assign a new style to the source, use setStyle instead of the style property.

    // To load a remote GeoJSON file
    const source = new VectorSource({
    data: 'http://example.com/data.geojson',
    format: new GeoJSON(), // Pass the OpenLayers FeatureFormat here
    style: new Style(...), // Pass an OpenLayers style here
    });

    // To load a local GeoJSON
    const source = new VectorSource({
    data: { "type": "FeatureCollection" ... },
    format: new GeoJSON(), // Pass the OpenLayers FeatureFormat here
    style: new Style(...), // Pass an OpenLayers style here
    });

    // To load features directly (no need to pass a format as the features are already decoded.)
    const source = new VectorSource({
    data: [new Feature(...)], // Pass the OpenLayers features here
    style: new Style(...), // Pass an OpenLayers style here
    });

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    containsFn: CustomContainsFn | undefined
    dataProjection: CoordinateSystem | undefined
    datatype: TextureDataType

    Gets the datatype of images generated by this source.

    flipY: boolean

    Gets whether images generated from this source should be flipped vertically.

    isImageSource: boolean = ...
    isMemoryUsage: true = ...

    Readonly flag to indicate that his object implements MemoryUsage.

    isVectorSource: true = ...
    priority: RequestPriority = 'auto'
    source: VectorSource
    style?: Style | Style[] | StyleFunction

    The current style. Note: to set a new style, use setStyle() instead.

    synchronous: boolean = false

    If true, this source can immediately generate images without any delay.

    transparent: boolean
    type: "VectorSource" = ...

    Accessors

    • get colorSpace(): ColorSpace

      Gets the color space of the textures generated by this source.

      Returns ColorSpace

    • get featureCount(): number

      Returns number

    Methods

    • Adds a feature to this source.

      Parameters

      • feature: Feature

        The feature to add.

      Returns void

    • Adds features to this source.

      Parameters

      • features: Feature<Geometry, { [x: string]: any }>[]

        The features to add.

      Returns void

    • Returns an adjusted extent, width and height so that request pixels are aligned with source pixels, and requests do not oversample the source.

      Parameters

      • requestExtent: Extent

        The request extent.

      • requestWidth: number

        The width, in pixels, of the request extent.

      • requestHeight: number

        The height, in pixels, of the request extent.

      • margin: number = 0

        The margin, in pixels, around the initial extent.

      Returns GridExtent | null

      The adjusted parameters.

    • Removes all feature in this source.

      Returns void

    • Gets whether this source contains the specified extent. If a custom contains function is provided, it will be used. Otherwise, intersects is used.

      This method is mainly used to discard non-relevant requests (i.e don't process regions that are not relevant to this source).

      Parameters

      • extent: Extent

        The extent to test.

      Returns boolean

    • Disposes unmanaged resources of this source.

      Returns void

    • Applies the callback for each feature in this source.

      Parameters

      • callback: (arg0: Feature<Geometry>) => unknown

        The callback.

      Returns void

    • Returns Extent | null

    • Returns the extent of this source expressed in the CRS of the source. Might be null if the extent of the source is not known.

      Returns Extent

      The extent of the source, if any.

    • Returns the feature with the specified id.

      Parameters

      • id: string | number

        The feature id.

      Returns Feature<Geometry, { [x: string]: any }> | null

      The feature.

    • Returns an array with the feature in this source.

      Returns Feature<Geometry, { [x: string]: any }>[]

      The features.

    • Initializes the source.

      Parameters

      Returns Promise<void>

      A promise that resolves when the source is initialized.

    • Test the intersection between the specified extent and this source's extent. This method may be overriden to perform special logic.

      Parameters

      • extent: Extent

        The extent to test.

      Returns boolean

      true if the extent and this source extent intersects, false otherwise.

    • Loads the features from this source, either from:

      • the URL
      • the data string (for example a GeoJSON string)
      • the features array

      Returns Promise<void>

    • Removes a feature from this source.

      Parameters

      • feature: Feature

        The feature to remove.

      Returns void

    • Reprojects a feature from the source projection into the target (instance) projection.

      Parameters

      • feature: Feature

        The feature to reproject.

      Returns void

    • Change the style of this source. This triggers an update of the source.

      Parameters

      • style: Style | StyleFunction

        The style, or style function.

      Returns void

    • Raises an event to reload the source.

      Parameters

      Returns void

    • Updates the region associated with the feature(s).

      Parameters

      • ...feature: Feature<Geometry, { [x: string]: any }>[]

        The feature(s) to update.

      Returns void