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

[FEATURE] Add Option To Preload Tiles Around Current Area #1337

Closed
3 tasks done
JaffaKetchup opened this issue Aug 11, 2022 · 12 comments · Fixed by #1405
Closed
3 tasks done

[FEATURE] Add Option To Preload Tiles Around Current Area #1337

JaffaKetchup opened this issue Aug 11, 2022 · 12 comments · Fixed by #1405
Labels
feature This issue requests a new feature

Comments

@JaffaKetchup
Copy link
Member

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

@JaffaKetchup JaffaKetchup added the feature This issue requests a new feature label Aug 31, 2022
This was referenced Sep 17, 2022
@github-actions
Copy link

github-actions bot commented Oct 1, 2022

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.

@github-actions
Copy link

github-actions bot commented Nov 1, 2022

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.

@SalsabeelaHasan
Copy link

Hello ! any updates?

@JaffaKetchup
Copy link
Member Author

Not yet, we will wait on a greater rewrite first.

@SalsabeelaHasan
Copy link

All the best.
if there is clear timeline, it would be great. thank you!

@JaffaKetchup
Copy link
Member Author

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.

@ibrierley
Copy link
Contributor

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.

@JaffaKetchup
Copy link
Member Author

@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.

@ibrierley
Copy link
Contributor

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.

@SalsabeelaHasan
Copy link

Thank you all, waiting for your improvements.

@aytunch
Copy link
Contributor

aytunch commented Nov 30, 2022

@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
Copy link
Contributor

@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?

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue requests a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants