Generate warning when `setWorldview()` is paired with a filter expression
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
Motivation
We now have a method to set the worldview in our SDKs. This method is part of pattern that diverges from how we previously set worldviews - by using a filter expression in the style. As a result, using setWorldview() paired with a style filter expression will lead to undesired visual results, such as missing borders. While in new styles we can build in tools to remove the filter expression, we cannot change old styles retroactively that still contain these filter expressions.
This solution proposes that when a user wishes to use setWorldview() in their implementation and a filter expression is set at the same time, a warning is generated by the SDK indicating to the user that a filter expression was set in the style.
The full proposal across map styles, Mapbox Studio and the SDKs was outlined in a separate document.
Design Alternatives
- Do nothing: it may be difficult for users to understand why using SDK methods to set the worldview leads to unexpected results. This will affect a majority of users, because most styles use filter expressions to set worldviews.
- One alternative that seems rather brittle, but does not require to parse the stylesheet, would be to check if the style is using an old core template and generate a warning if an old template is detected (tbd what property, but
idin the stylesheet could be used).
Mock-Up
The design would entail a simple warning when users make use of setWorldview(), indicating that the filter expression in the style needs to be removed.
Implementation
TBD
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 locating the setWorldview() entry point and the style filter-expression handling in the SDK. Determine how a style filter expression can be detected alongside setWorldview(), then verify that a warning is produced for that combination and not otherwise.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100