mapbox / mapbox/mapbox-gl-js

Ability to cancel request in `requestTransform` for overzooming purposes

Open
#13,258 0 comments 0 reactions 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

## Motivation

I am trying to implement overzooming so that I don't need to load vector tile source for each zoom level but just for some.
It would be great to be able to parse zoom levels for which I need to get data from server and for which I can cancel a request.

For example, lets say my tiles extent is such that I can overzoom 3 levels. that means, if I want some data from the source to show on zoom levels 15-21, I could:

`15 > load`
`16, 17 > cancel`
`18 > load`
`19,21 > cancel`

this way I could save 4 requests per source.

## Design Alternatives

The way we can do it now is to have separate layer per zoom level range each with its corresponding source:
`15-17 > layer15-17 > source15`
`18-21 > layer18-21 > source18`

alternative approach might be to be able to define an array of zoom levels (within `minZoom-maxZoom` range) for which source should be loaded. This would be an optional parameter on the `source`.

## Design

The advantage of being able to cancel/skip the request based on `zoom level` is simplification on layers side (single layer instead of many): we keep single layer with single source and introduce stepped requests based on overzooming strategy.

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 requestTransform behavior and how sources and layers currently handle zoom levels. Compare the proposed cancellation approach with the separate-layer and optional-source alternatives; done should mean a single source can skip the specified zoom-level requests while preserving the intended loads.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.