Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect when raster layer has retrieved all tiles #548

Closed
ishiland opened this issue Mar 2, 2018 · 2 comments
Closed

Detect when raster layer has retrieved all tiles #548

ishiland opened this issue Mar 2, 2018 · 2 comments

Comments

@ishiland
Copy link

ishiland commented Mar 2, 2018

Is it possible to detect when a raster layer has finished retrieving all tiles? My particular use case is to update the state when the raster layer is retrieving tiles and then again when it has finished.

here is my layer/source setup:

         <Source id={ "raster_source"}
                onSourceLoaded={e => this.rasterLayerLoaded(e)}  // Only fired when initially loaded
                tileJsonSource={{
                          type:  "raster",
                          tiles: "https://myTileServer.com/xyz/{z}/{x}/{y}.png8",
                          tileSize: 256
                      }}/>,
               <Layer
                    type={"raster"}
                     id={"raster_layer"}
                    sourceId={ "raster_source"}
                />
@kdedakia
Copy link

kdedakia commented Mar 6, 2018

I'm also attempting to do the same thing and am unable to figure out a good solution.
I've been trying to use mapbox's built in events but map.areTilesLoaded() is set to true before the raster tiles have actually been loaded and rendered.

this.map.on('sourcedata', (e) => {
   if (this.map.areTilesLoaded()) {
      // Do stuff here
   }
}

Please let me know if you find a solution!

@ishiland
Copy link
Author

ishiland commented Apr 4, 2018

Looks like this has been an open issue for awhile now in mapbox/mapbox-gl-js#1715. I will track the progress there.

@ishiland ishiland closed this as completed Apr 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants