mapbox / mapbox/mapbox-gl-js

queryRenderedFeatures is not working on latest Mapbox Standard Map style

Open
#13,332 5 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

**mapbox-gl-js version**: ^3.8.0

**browser**: Any browser

### Steps to Trigger Behavior

Create a new map instance using the Mapbox Standard style
Add click handler that uses queryRenderedFeatures()
Click on various map features (buildings, roads, POIs)
Check console output or handler results

### Link to Demonstration
React Example

```tsx
import type { MapRef } from 'react-map-gl';
import MAP, { FullscreenControl, GeolocateControl, NavigationControl, Popup, ScaleControl } from 'react-map-gl';

const MapboxMap: React.FC = () => {
const handleMapClick = (event) => {
const map = mapRef.current.getMap();
const features = map.queryRenderedFeatures(event.point);
console.log('Features:', features); // Returns empty array when clicking on map features
};

return (

{/* map contents */}

);
```

### Expected Behavior

Clicking on map features (buildings, roads, POIs) should return an array of features with their properties
Should work similarly to how it works with 'streets-v12' style

### Actual Behavior

queryRenderedFeatures() returns an empty array when clicking on map features
No features are detected even when clicking on visible map elements

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 with the provided React example and reproduce the empty results using the Mapbox Standard style and queryRenderedFeatures() in the click handler. Compare the behavior with the streets-v12 style while inspecting which visible map features are available to query. Done means clicks on visible buildings, roads, and POIs return feature objects with their properties.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
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.