mapbox / mapbox/mapbox-gl-draw
Feature request: customizable source id
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 612
- Avg merge
- 8d 9h
- Merged PRs (30d)
- 5
Description
The scenario is: I need to create multiple draw instances and tailor them for different purposes, say one for measuring distance/area, one for creating poi geojson.
Yet since all mapbox-gl-draw instances are using the same source id, it throws the following error when adding multiple draw instance to the map:
``There is already a source with this ID``.
My current approach is setting a type property for each feature generated by different draw instance during event ```'draw.create'``` to distinguish them..
I think this can be better implemented by passing a source id parameter to create separated source and layer for each draw instance.
Thank you.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named in the issue. Start by locating where each draw instance creates its shared source and layers, then trace how a configurable source ID could be applied. Done means multiple draw instances can be added without the duplicate-source error while retaining separate sources and layers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100