mapbox / mapbox/mapbox-gl-js

Add `map.setSprite(spriteUrl)`method

Open
#2,058 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

The style diff utility defines an [operation to change the sprite sheet](https://github.com/mapbox/mapbox-gl-style-spec/blob/ef23dd1e8141a60bac2a0ed0fe3ec2ec9e792d82/lib/diff.js#L77-L80) for a style. Mapbox GL JS does not support this method currently causing a fall back to the more invasive setStyle when this operation is encountered.

When this method is invoked, the current sprite sheet should be removed and recreated.

Minimally `setSprite(spriteUrl)` should be added to the style batch, it would also be helpful to expose this method on the map instance.

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 reading the style diff operation in lib/diff.js at the linked lines, then trace the style batch and map instance entry points in Mapbox GL JS. Done means setSprite(spriteUrl) is supported, the current sprite sheet is removed and recreated, and the fallback to setStyle is avoided when this operation is encountered.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend, web-dev
Issue type
Feature
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.