mapbox / mapbox/mapbox-gl-draw

How to get layer or layer id after drawing successfully?

Open
#1,185 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged needs information
Dominant language
JavaScript
Stars
1.1k
Forks
612
Avg merge
8d 9h
Merged PRs (30d)
5

Description

I want to get the layers or layers' ids after drawing successfully, and then do some layers' processing by mabox-gl api. How to do that? At present,mapbox-gl "map.getStyle().layers" api can return all layers, at the same time, mapbox-gl-draw "get()" and "getAll()" can provide features, so I have a idea, do some loops by using these three apis. But is there a performance issue with this solution?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the mapbox-gl-draw get() and getAll() APIs alongside mapbox-gl's map.getStyle().layers API. The issue does not name a file or test; done would be a documented, supported answer explaining how to obtain drawn layer information and whether combining these APIs has performance implications.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.