Interface VectorLayerAdapter<M, L, O, F, PROP, P>

Adapter for vector data display control.

Type Parameters

  • M = any

  • L = any

  • O extends VectorAdapterOptions = VectorAdapterOptions

  • F extends Feature = Feature

  • PROP extends Record<string, any> | null = F extends Feature
        ? F["properties"]
        : Record<string, string>

  • P extends Record<string, any> = PROP extends null
        ? Record<string, any>
        : PROP

Hierarchy

Properties

id?: string
layer?: L
map?: M
name?: string
options: O
order?: number
selected?: boolean

True if there are selected features in the layer

source?: unknown

Experimental option, only for MVT. Points to a data source instead of loading data into a layer.

Methods

  • Remove layer data.

    Parameters

    • Optional cb: ((feature) => boolean)

      Delete only those objects that match the filter.

        • (feature): boolean
        • Parameters

          • feature: F

          Returns boolean

    Returns void | Promise<void>

  • Ability to filter a layer with a callback function. It is necessary for the adapter to provide access to the layer objects before output to the map. It is not possible to apply such a filter to vector tiles and data on the remote server. So, where possible, use the propertiesFilter.

    Example

    layer.filter((e) => e.feature.properties.id === 2011);
    // but in this case it’s better to do so:
    layer.propertiesFilter([['id', 'eq', 2011]])

    Parameters

    Returns LayerDefinition<Feature<Geometry, GeoJsonProperties>, L>[]

  • The way to filter layer objects through serializable expressions. To clear the filter, pass null or undefined as the second parameter.

    Example

    layer.propertiesFilter(['all', ['color', 'eq', 'green'], ['year', 'gt', 2011]]);
    layer.propertiesFilter([[
    'any',
    ['color', 'eq', 'green'],
    ['color', 'eq', 'red']
    ],
    ['year', 'gt', 2011]
    ]);

    Parameters

    • filters: PropertiesFilter<P>

      Filter, conforming to the PropertiesFilter expression specification's.

    • Optional options: FilterOptions<P>

      Options object.

    Returns Promise<void>

  • Method for selecting objects on the map. The selectedPaint option will be applied to the selected objects.

    Remarks

    It is strongly recommended to use an PtropertiesFilter expression to set selected objects, since the selecting by the callback function is not supported by vector tiles and other asynchronous adapters.

    Parameters

    Returns void

Generated using TypeDoc