mapbox / mapbox/mapbox-gl-js

map.queryRenderedFeatures(...) fails to return geojson MutliPolygon features where a MutliPolygon overlaps

Open
#9,964 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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**: 1.11.1, 1.12.0

**browser**: google chrome, firefox, safari, etc.

## Summary

map.queryRenderedFeatures(...) fails to return geojson MutliPolygon features where a MutliPolygon overlaps.

The following geojson contains a mutlipolygon that contains overlap:
```
{
"id": 1,
"type": "Feature",
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]]
[[[100.5, 0.5], [101.5, 0.5], [101.5, 1.5], [100.5, 1.5], [100.5, 0.5]]],

]
}
}
```

![Screen Shot 2020-09-02 at 12 11 10 PM](https://user-images.githubusercontent.com/121667/92021597-43751a00-ed17-11ea-987c-53b1c7d3753a.png)

map.queryRenderedFeatures(...) will not return any features where the first polygon in the multipolygon overlaps the second polygon in the multipolygon.

### Link to Demonstration

If you have a mapboxgl accessToken, see the demo here:
https://jsfiddle.net/5on0krp8/

### Expected Behavior

map.queryRenderedFeatures(...) should return MutliPolygon features where a MutliPolygon overlaps.

### Actual Behavior

map.queryRenderedFeatures(...) fails to return MutliPolygon features where a MutliPolygon overlaps.

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

Reproduce the issue using the linked JSFiddle with mapbox-gl-js 1.11.1 or 1.12.0, focusing on map.queryRenderedFeatures for the overlapping MultiPolygon. Trace the query entry point and rendering geometry handling; done means the feature is returned when the pointer is over the overlapping area.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.