[FEATURE] Add Option To Preload Tiles Around Current Area
What do you want implemented?
A property that can take a number of tiles in each direction outside of the current viewport to preload and render for smoother appearance. Additionally (if possible), a method to preload and render a list of tile coordinates or URLs.
What other alternatives are available?
No response
Can you provide any other information?
Related to #1336.
Platforms Affected
Android, iOS, Web, Windows, MacOS, Linux
Severity
Obtrusive: No workarounds are available, and this is essential to me
Requirements
- [X] I agree to follow this project's Code of Conduct
- [X] I am using the latest stable version of this package
- [X] I have checked for similar feature requests which may be duplicates
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
Hello ! any updates?
Not yet, we will wait on a greater rewrite first.
All the best. if there is clear timeline, it would be great. thank you!
Unfortunately no timeline at the moment. We maintain this in our spare time, and at the moment, we are quite busy.
If your business/employer is waiting for this, it may help to offer a bounty to @MooNag (probably best to contact him via Discord), as he was the one originally suggesting the rewrite - but I'm not him so I can't say. Of course, absolutely 0 requirement/pressure to do this (we are open source after all), but it has worked in the past to fix a rather specific bug that someone needed. At the moment, I'm far too busy to do any major work here - I've got exams approaching.
it shouldn't be too fiddly I would have thought if someone needs it to have a bash and do a PR. Pass in a param for number of extra tiles in each direction. Then subtract this from the min extent of the tile range, and add to the max in both x,y directions. Eg around line 605 of
// create a queue of coordinates to load tiles from
for (var j = tileRange.min.y; j <= tileRange.max.y; j++) {
for (var i = tileRange.min.x; i <= tileRange.max.x; i++) {
Add a test that the values aren't below 0 or above the max tile extent for that xoom.
@ibrierley I've tried this before and it didn't work - can't remember why though. Maybe I was just trying to do it externally through a tile provider.
Ok, I'm away atm, but will see if I can get time to take a peek when back if no one else wants a bash before that.
Thank you all, waiting for your improvements.
@ibrierley @JaffaKetchup Hi friends, long time no see :)
Can this preloading also be used in this use-case:
Assume that before the FlutterMap is created and rendered, we know which center latlng and zoom level to display.
And when the first frame of the map is rendered, we will see the map tiles immediately without waiting for them from the network.
So maybe the MapController object can do the preloading behind the scenes since we pass it the viewport info. And as devs, we can manage when to create the controller (most probably once we know the users location, instead of when the user presses the map page tab)
Do you think this is a valid use-case?
@ibrierley @JaffaKetchup Hi friends, long time no see :) Can this preloading also be used in this use-case: Assume that before the
FlutterMapis created and rendered, we know which center latlng and zoom level to display. And when the first frame of the map is rendered, we will see the map tiles immediately without waiting for them from the network. So maybe theMapControllerobject can do the preloading behind the scenes since we pass it the viewport info. And as devs, we can manage when to create the controller (most probably once we know the users location, instead of when the user presses the map page tab) Do you think this is a valid use-case?
The suggested PR wouldn't add that ability. I feel like that's a separate issue/solution ? Maybe that just needs an Offstate widget until a certain timeframe or something, but I'm not sure there's currently a way to know when all the tiles are loaded (if I'm reading right, it feels like that maybe the key part, but what about if one tile doesn't get loaded for some reason... ?). So maybe it needs a new issue raised for discussion.