Skip to content

A reliable way to reload tiles from a vector tile source #415

Closed
@douglasg14b

Description

@douglasg14b

Existing Behavior

The current behavior seems to support this, but it is buggy for some reason.

sourceCache.clearTiles();
this.load();

The above causes the layers that rely on the source to flash, and then reload. However, if this action (clearing the tiles & loading) is performed in quick succession (Even a couple seconds apart), the tiles do not actually reload at all. Why this is, I'm not sure, is there non-synchronous code running that takes it's time to actually finish up?

Expected Solution Behavior:

  • Map layers do NOT flash
  • Tiles are reliably re-fetched when action is performed over-and-over

Observed Current Behavior:

  • Map layers flash
  • If action is performed in quick succession, layers do not reload, but they do still flash
    • There are no browser cache hits during this period.

Motivation

If you need to update a vector tile source, you need a way to force the tiles to be re-fetched.

Currently this can be hacked around by manually clearing tiles from a source's tilecache, but even that's buggy & unreliable.

For instance this PR added some ability there, but it still doesn't entirely work.

Use Cases:

  • Dynamic data
  • User actions change map data
  • Map data change events are pushed to the client (Client needs to reload tiles)

Design Alternatives

Unknown?

Design

Unknown?

Mock-Up

User Point of view:

  • map.getSource('mySource').reload()

Concepts

Unknown

Implementation

Unknown

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions