NextGIS Frontend
    Preparing search index...

    Interface VectorAdapterOptions<F, L, A, N, P>

    interface VectorAdapterOptions<
        F extends Feature = Feature,
        L = any,
        A extends FeatureProperties = Record<string, any>,
        N extends FeatureProperties = Record<string, any>,
        P extends FeatureProperties = ExtractFeatureProperties<F>,
    > {
        adapter?: string;
        attribution?: string;
        baselayer?: boolean;
        cluster?: boolean;
        clusterMaxZoom?: number;
        clusterRadius?: number;
        crossOrigin?: "anonymous";
        featureIdName?: string;
        fields?: null | false | (keyof P)[];
        filter?: DataLayerFilter<F, L>;
        fit?: boolean;
        headers?: Record<string, any>;
        heightOffset?: number;
        id?: string;
        interactive?: boolean;
        intersects?: string | LngLatBoundsArray | LngLatArray[];
        label?: (e: LayerDefinition<F, L>) => string;
        labelField?: keyof P extends null ? string : keyof P;
        labelOnHover?: boolean;
        labelVisibility?: boolean;
        layers?: string;
        layout?: any;
        limit?: number;
        maxScale?: number;
        maxZoom?: number;
        minScale?: number;
        minZoom?: number;
        multiselect?: boolean;
        name?: string;
        nativeFilter?: unknown;
        nativeOptions?: N;
        nativePaint?: boolean | Record<string, any>;
        offset?: number;
        onAdded?: (layer: LayerAdapter) => void;
        opacity?: null | number;
        order?: number;
        orderBy?: (string | keyof P)[];
        paint?: Paint<F>;
        popup?: boolean;
        popupOnHover?: boolean;
        popupOnSelect?: boolean;
        popupOptions?: PopupOptions<F, L>;
        propertiesFilter?: PropertiesFilter<P>;
        props?: A;
        ratio?: number;
        selectable?: boolean;
        selectedLayout?: any;
        selectedPaint?: Paint<F>;
        selectOnHover?: boolean;
        setViewDelay?: number;
        source?: unknown;
        srs?: number;
        strategy?: "BBOX" | "BBOX+";
        type?: VectorAdapterLayerType;
        unselectOnClick?: boolean;
        unselectOnSecondClick?: boolean;
        visibility?: boolean;
        waitFullLoad?: boolean;
        withCredentials?: boolean;
        onClick(opt: OnLayerMouseOptions<F, L>): void;
        onDoubleClick(opt: OnLayerMouseOptions<F, L>): void;
        onLayerClick(opt: OnLayerMouseOptions<F, L>): Promise<any>;
        onLayerSelect(opt: OnLayerSelectOptions<F, L>): Promise<any>;
        onMouseOut(
            opt: Omit<OnLayerMouseOptions<F, L>, keyof FeaturePosition>,
        ): void;
        onMouseOver(opt: OnLayerMouseOptions<F, L>): void;
        onSelect(opt: OnLayerSelectOptions<F, L>): void;
    }

    Type Parameters

    Hierarchy (View Summary)

    Index

    Properties

    adapter?: string
    attribution?: string

    String to be shown in the attribution control. It describes the layer data and is often a legal obligation towards copyright holders and tile providers.

    baselayer?: boolean

    Indicate on a cartographic base layer.

    cluster?: boolean
    clusterMaxZoom?: number

    Max zoom to cluster points on

    clusterRadius?: number

    Radius of each cluster when clustering points

    50
    
    crossOrigin?: "anonymous"

    Parameter added when forming a request for layer data. This is needed if you want to access tile pixel data. Refer to CORS Settings for valid String values.

    featureIdName?: string
    fields?: null | false | (keyof P)[]
    filter?: DataLayerFilter<F, L>
    fit?: boolean

    Fit map to layer extent

    false
    
    headers?: Record<string, any>
    heightOffset?: number
    id?: string

    Unique Layer ID. If not specified, will be added automatically.

    If the layer adapter is asynchronous, its id will be assigned only after the promise is resolved. While adapter is loading, methods for obtaining layers will ignore the added layer.

    interactive?: boolean
    intersects?: string | LngLatBoundsArray | LngLatArray[]

    WKT polygon geometry

    label?: (e: LayerDefinition<F, L>) => string
    labelField?: keyof P extends null ? string : keyof P
    labelOnHover?: boolean
    labelVisibility?: boolean

    Show set label immediately

    false
    
    layers?: string
    layout?: any
    • TODO: move to nativeOptions
    limit?: number

    Limit (paginated) - max number of entities should be taken.

    maxScale?: number

    TODO: replace by maxZoom

    use maxZoom instead

    maxZoom?: number

    Maximum zoom level of the map.

    minScale?: number

    TODO: replace by minZoom

    use minZoom instead

    minZoom?: number

    Minimum zoom level of the map.

    multiselect?: boolean

    Indicates whether several objects can be selected in one layer.

    // multiselect: false
    layer.select(({ feature }) => feature.properties.color === 'green'); // one feature will be selected
    // multiselect: true
    layer.select(({ feature }) => feature.properties.color === 'green'); // all 'green' features will be selected
    name?: string

    Non-unique name of the layer. Can be used for user interfaces.

    nativeFilter?: unknown
    • TODO: move to nativeOptions
    nativeOptions?: N

    Map and layer adapter base options Use with care. There may be a conflict in the addLayer method by the adapter of the NextGIS Frontend library

    nativePaint?: boolean | Record<string, any>
    • TODO: move to nativeOptions
    offset?: number

    Offset (paginated) where from entities should be taken.

    onAdded?: (layer: LayerAdapter) => void
    opacity?: null | number

    Layer transparency. From 0-transparent to 1-visible

    1
    
    order?: number

    Indicates the map layers display sequence. A layer with a larger order value overlaps smaller ones. Zero value used to indicate baselayer. If the value is not specified explicitly, it will be assigned automatically with an increase of one for each new layer.

    orderBy?: (string | keyof P)[]

    set fields for order

    TODO: use typescript 4.1 template string type for map -${field}

    { "orderBy": ["field1", "-field2"] }
    
    paint?: Paint<F>

    Determine the appearance of the vector data geometries.

    const circlePaint = { paint: { color: 'green', radius: 6 } };
    const paintCb = (feature) => {
    return { color: 'red', opacity: feature.properties.opacity }
    }
    // Use global paint function
    // set paint function inside WebMap static property
    WebMap.getPaintFunctions.customPaintFunction = customIconPaintFunction

    webMap.addLayer('GEOJSON', {
    paint: {
    type: 'get-paint',
    from: 'customPaintFunction',
    options: {}
    }
    }
    popup?: boolean
    popupOnHover?: boolean
    popupOnSelect?: boolean
    popupOptions?: PopupOptions<F, L>
    propertiesFilter?: PropertiesFilter<P>
    props?: A

    Any properties to save in layer. May be useful to get additional info from layer event.

    ratio?: number
    selectable?: boolean

    Determines whether objects are selected by mouse click.

    const layer = webMap.addLayer('GEOJSON', {
    paint: { color: 'red' },
    selectedPaint: { color: 'green' },
    selectable: false
    });
    // programmatically selection - ok, but not on mouse click
    layer.select(({ feature }) => feature.properties.id === ID_FOR_SELECT);
    selectedLayout?: any
    • TODO: move to nativeOptions
    selectedPaint?: Paint<F>

    The paint that applies to the features after it becomes selected.

    webMap.addLayer('GEOJSON', {
    paint: { color: 'red' },
    selectedPaint: { color: 'green' }
    });
    selectOnHover?: boolean

    Make the feature selected while mouseover.

    setViewDelay?: number

    Experimental option to set the map loading delay when changing position

    source?: unknown
    srs?: number

    Experimental only for Ol yet

    strategy?: "BBOX" | "BBOX+"

    Type for geometries painting, for each layer may be only one of: point, polygon or line.

    unselectOnClick?: boolean

    If false, the selection will be reset when the user clicks the map.

    true
    
    unselectOnSecondClick?: boolean

    Deselects layer feature by second click.

    visibility?: boolean

    Show layer on the map immediately after adding. Such layers are always under others. Only one base layer can be displayed on the map at a time.

    TODO: replace by show

    true
    
    waitFullLoad?: boolean

    Wait until the layer data is fully loaded before allowing added to the map.

    If true, addLayer promise resolve only after data loading. This is useful for GeoJson vector layer adapters when you need to process downloaded data before displaying.

    withCredentials?: boolean

    Methods