LuciadRIA (2026.0.10)
    Preparing search index...

    Class Feature<TShape, TProperties>

    Represents a vector data object with a shape and application-specific properties.

    Type Parameters

    • TShape extends Shape | null = Shape | null

      Represents the type of feature's shape. The default type is inferred from the 'shape' passed to the constructor.

    • TProperties extends FeatureProperties = FeatureProperties

      Represents the type of feature's properties. The default type is inferred from the 'properties' passed to the constructor. If the 'properties' is not provided the type is defaulted to FeatureProperties.

        // Creates a type-guarded Feature with the Point shape and specific properties
      const leuvenCity = new Feature(point, {name: 'Leuven'});
      // TypeScript infers the shape and properties type from the constructor inputs
      const {x, y} = leuvenCity.shape;
      console.log(`city: ${leuvenCity.properties.name}`);

      // Let TypeScript know the types explicitly
      interface CityProps {name: string, population: number}
      const anotherCity = new Feature<Point, CityProps>(point, {name: 'Brussels', population: 2_100_000});
      anotherCity.properties.population += 20_000;

    Hierarchy (View Summary)

    Constructors

    Accessors

    Methods

    Constructors

    • Creates a new feature with the given shape and properties.

      A feature represents a vector data object with a shape (geometry). It may include application-specific properties.

      Type Parameters

      • TShape extends Shape | null = Shape | null

        Represents the type of feature's shape. The default type is inferred from the 'shape' passed to the constructor.

      • TProperties extends FeatureProperties = FeatureProperties

        Represents the type of feature's properties. The default type is inferred from the 'properties' passed to the constructor. If the 'properties' is not provided the type is defaulted to FeatureProperties.

          // Creates a type-guarded Feature with the Point shape and specific properties
        const leuvenCity = new Feature(point, {name: 'Leuven'});
        // TypeScript infers the shape and properties type from the constructor inputs
        const {x, y} = leuvenCity.shape;
        console.log(`city: ${leuvenCity.properties.name}`);

        // Let TypeScript know the types explicitly
        interface CityProps {name: string, population: number}
        const anotherCity = new Feature<Point, CityProps>(point, {name: 'Brussels', population: 2_100_000});
        anotherCity.properties.population += 20_000;

      Parameters

      • shape: TShape

        The geometry of the feature.

      • Optionalproperties: TProperties

        An optional object containing the feature’s properties.

      • Optionalid: FeatureId

        the identifier of the feature. This parameter can be omitted when creating a new feature, for example, before adding it to a MemoryStore. However, features returned by FeatureModel.query are required to have IDs.

      Returns Feature<TShape, TProperties>

    Accessors

    • get properties(): TProperties

      The properties of the data object. This is optional and may be left undefined. Usually, this object is a key/value pair object.

      Returns TProperties

    • set properties(value: TProperties): void

      Parameters

      Returns void

    • get shape(): TShape

      The shape of the feature.

      Returns TShape

    • set shape(shape: TShape): void

      Parameters

      Returns void

    Methods