openlayers / openlayers/openlayers

'loadstart' and 'loadend' events for singular layers

Open
#17,467 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
JavaScript
Stars
12.6k
Forks
3.2k
Avg merge
2d 17h
Merged PRs (30d)
21

Description

Is your feature request related to a problem? Please describe.
Currently, we use map.on('loadstart') and map.on('loadend') for displaying a loading spinner while the map finishes loading in. This works well, but ideally we'd like a way to know when each layer is done loading in (assuming multiple layers on the same map).

I tried using source.on('tileloadstart') and source.on('tileloadend') for some of our layers using OlSourceWMTS source, and it doesn't really do exactly what we want. The number of tiles being loaded increase over time as the layer loads in, meaning we don't know how many tiles total are going to be loaded for each layer. This also means that, once all tiles that have triggered tileloadstart for a particular layer have also triggered tileloadend, we have no way to know if that layer has further tiles to load still that just haven't triggered tileloadstart yet, or if all the tiles for that layer are done loading.

Describe the solution you'd like
Ideally, being able to use something like layer.on('loadstart') and layer.on('loadend'), the same way you can for the map as a whole. This would allow easy tracking of when each layer is done loading individually, which would allow showing much more precise loading feedback to a user.

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 tracing the existing map-level loadstart/loadend events and the WMTS source tileloadstart/tileloadend path. Define how layer-level loading boundaries should work when tiles begin loading over time, then verify the behavior with tests for singular layers and multiple layers.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.