mapbox / mapbox/mapbox-gl-js

Map#getLayer should return the serialized representation

Open
#3,713 5 comments 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

breaking change :warning: medium priority
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

The type currently returned by `Map#getLayer` is private and has no documented methods. The only documented thing you can do with it is check if it's `null` or not. This isn't very useful. It would be more useful to return the _serialized_, style spec representation of the layer.

However, this implies that `Map#getSource` should also return the serialized representation, rather than the internal object. In this case though, we do document things such as `GeoJSONSource#setData`, which has no `Map`-level equivalent.

We need to commit one way or the other with these APIs. Mixing and matching behavior is confusing.

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 Map#getLayer and Map#getSource API entry points and their documentation, then compare the documented GeoJSONSource#setData behavior. Done means choosing and documenting a consistent serialized-versus-internal representation for these APIs.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.