Skip to content

feature: getLayer / getLayers #5

@cvietor

Description

@cvietor

Is your feature request related to a problem? Please describe.
Currently, the ui-mapbox plugin does not allow to get (and interact) with map style layers.
A use case would be to show or hide certain layers like "hide motorways", "show bikelanes"

Describe the solution you'd like
I propose to introduce the concept of a "Layer" type as following:

interface Layer {
  id: string;
  visibility(): boolean;
  show(): void;
  hide(): void;
}

The native SDKs for Android and iOS provide more properties, but additional properties can be added later when needed (i.e. getMaxZoom, getMinZoom, etc). For now, imho that basic structure should be good enough for now.

To be able to get a single layer or a list of all map style layers, the MapboxViewApi needs to be extended with the following methods:

getLayer(name: string, nativeMap?): Promise<Layer>;

getLayers(nativeMap?: any): Promise<Array<Layer>>;

Additional context
I would be happy to provide a PR that adds this functionality

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions