mapbox / mapbox/mapbox-gl-js

Detect and warn incorrect source-layer

Open
#8,420 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api :memo: needs discussion :speech_balloon:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

[This question](https://stackoverflow.com/questions/56827408/tippecanoe-generated-pbf-stored-on-s3-visualised-on-mapbox-gl/56830320) on Stack Overflow reminded of this common pain point: when a layer definition includes `source-layer` that doesn't correspond to any actual source layer, Mapbox-GL simply fails to render anything, with no warning.

My understanding is that the library should have access to the list of actual source layers for any vector source loaded via TileJSON. So in theory it should be possible to check that the requested `source-layer` is in that list, and if not, output a warning, something like:

`Warning: source-layer "trees" does not exist in vector tile source "test". No features will be displayed.`.

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 tracing how vector sources loaded via TileJSON expose their actual source layers and how style layers consume source-layer. Done means warning when a requested source-layer is absent, while valid source layers continue rendering normally.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.