Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Reference the underlying Layer from AnnotationManager classes  #1027

@keinix

Description

@keinix

I’m enjoying the ease of adding annotations to the map with the combination of the various AnnotationManager and Options classes, however I've run into a few problems that require the use of the Layer API. Seeing as the annotation plugin is a simpler, striped down version of this API, running into these types of issues is no surprise. I see a real benefit in the annotation plugin coexisting with the classic Layer API in a project, but this is made more difficult without being able to reference an AnnotationManger’s underlying Layer.

Example Problems:

  • SymbolOptions: .withIconSize() only accepts a static size as a float.
    SymbolLayer: .setProperties() allows size to be defined as an Expression that scales the symbol based on the zoom level
    (A different solution to this particular case is being tracked in Expression support #736)

  • Dynamically inserting and removing layers with AnnotationManger is tricky to handle. AnnotationMangers support a constructor with a belowLayerId parameter which is difficult to use with automatically generated layer ids.

Adding extra properties to or rearranging the underlying layers would be trivial, but when using multiple AnnotationMangers (as per PR #941) it becomes cumbersome to keep track of which layers corresponds to which AnnotationManager.

Would it be possible to add a way to either:
a. Publicly reference the underlying Layer from an AnnotationManger
b. Set a custom Layer id from an AnnotationManger
c. Publicly reference the underlying layer’s automatically generated id from an AnnotationManger

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions