For GeoJSON sources, can query*Features return the original geometry?
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
Currently, `queryRenderedFeatures` or `querySourceFeatures` on a GeoJSON source return geometries that have gone through a round trip to tiled form, reducing coordinate precision and therefore giving different coordinates at different zoom levels. This has proven to be confusing: #5638, #4733, #5397, https://github.com/mapbox/mapbox-gl-native/issues/8992.
For GeoJSON sources specifically, we may be able to change the behavior of `queryRenderedFeatures` or `querySourceFeatures` such that features are always returned with their original, input geometry, regardless of zoom level.
I can't _guarantee_ that we'll be able to do this -- there are considerations that we'll need to work through, like whether this means that GeoJSON sources will have different behavior with regards to features being clipped along tile edges, and whether we'd have to give up on #3220. But we should at least investigate it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the queryRenderedFeatures and querySourceFeatures entry points for GeoJSON sources and how their returned geometries are produced across zoom levels. Determine whether original input geometry can be preserved, then document and test the expected behavior for tile-edge clipping and the compatibility concern raised by #3220.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100