mapbox / mapbox/mapbox-gl-js

Provide alternative to layer id in MapBox GL 3.x queryRenderedFeatures() result

Open
#12,859 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged feature :green_apple:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

Motivation

In MapBox GL 2.x, when using queryRenderedFeatures(), the id of the layer can be useful in deciding whether I care about the particular feature or not. Information about the layer is not available in the 3.0 beta, and the properties do not give definitive information such as "hey, this is a road", or "hey, this is a POI" (I can intuit it from the class property and other things, but to do that I need a definitive list of all classes that could be a road, for example).

If built-in layers aren't going to be exposed to us in 3.x, it would be nice if equivalent information was provided in some other way.

Design Alternatives

Expose information on the feature in some way that makes it clear what broad category of feature this is.

Design

As long as the information is available, I don't particularly mind how it is made available 🙂.

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 examining the queryRenderedFeatures() result in MapBox GL 3.x and compare it with the layer information available in 2.x. Determine a concrete way to expose equivalent built-in layer or broad feature-category information, then verify that callers can distinguish relevant features without relying on an incomplete class list.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.