Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Reload source tiles when GeoJSON data is mutated #6264

Closed
jfirebaugh opened this issue Sep 6, 2016 · 4 comments
Closed

Reload source tiles when GeoJSON data is mutated #6264

jfirebaugh opened this issue Sep 6, 2016 · 4 comments
Assignees

Comments

@jfirebaugh
Copy link
Contributor

Followup from #6201.

@jfirebaugh
Copy link
Contributor Author

jfirebaugh commented Sep 13, 2016

GeoJSON tile reloading will be similar to reloading for style changes in #6201, but also different.

The pathway for reloading for style changes is:

  1. A layout property or layer filter is changed
  2. Triggering LayerObserver::onLayer{Filter,Visibility}Changed
  3. Triggering Style::onLayer{Filter,Visibility}Changed
  4. Style queues the layer source ID in updateBatch.sourceIDs and triggers style::Observer::onUpdate with Update::Layout
  5. Map::Impl::onUpdate adds Update::Layout and triggers an asyncUpdate signal (if not already triggered)
  6. The signal is processed; Map::Impl::update is called
  7. Triggering Style::relayout
  8. Loop over updateBatch.sourceIDs, calling Source::Impl::reloadTiles for each
  9. Source::Impl::reloadTiles loops over tiles, calling Tile::redoLayout for each
  10. Which is overridden in GeometryTile::redoLayout to trigger the workers to reprocess with a new copy of the style layers

All this only handles changes to style layers. It's fairly complex in order to support batching multiple updates into a single redoLayout operation. For GeoJSON data changes, maybe we can get away without batching, and instead just add a loop over tiles in GeoJSONSource::Impl::setGeoJSON, calling GeometryTile::setData on each one with the new data.

@tobrun
Copy link
Member

tobrun commented Sep 15, 2016

I have been working with @mollymerp to get this feature in.
We were able to get the the following working:

For GeoJSON data changes, maybe we can get away without batching, and instead just add a loop over tiles in GeoJSONSource::Impl::setGeoJSON, calling GeometryTile::setData on each one with the new data.

An example of this can be seen in:

ezgif com-video-to-gif 5

Which is the equivalent of the GL-JS example here.

@tobrun
Copy link
Member

tobrun commented Sep 21, 2016

@jfirebaugh would you like to see the improved version happening?
(implementing the observer approach with batching)

@jfirebaugh
Copy link
Contributor Author

jfirebaugh commented Sep 21, 2016 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants