fleaflet / flutter_map

A versatile mapping package for Flutter. Simple and easy to learn, yet completely customizable and configurable, it's the best choice for mapping in your Flutter app.
https://pub.dev/packages/flutter_map
BSD 3-Clause "New" or "Revised" License
2.76k stars 860 forks source link

[FEATURE] Add option to automatically retry missed tiles #1856

Open corepuncher opened 7 months ago

corepuncher commented 7 months ago

What do you want implemented?

When downloading large numbers of tiles, sometimes a few are missed for whatever reason, resulting in ye olde checkerboard pattern.

However, the next time the tile layers rebuild (for example, when my timer updates with new data), all the previously missed tiles get filled in. So it appears they are "remembered" in some way. This fill-in behavior is reliable.

Instead of waiting for a rebuild (which in my case is 10 minutes later), it would be nice to have the option to automatically retry missed/failed tile downloads. It could take two parameters:

delay: The length of time to wait before retrying retries: The number of times to retry

What other alternatives are available?

No response

Can you provide any other information?

I'd be happy to test this out, tune the parameters, etc.

Severity

Obtrusive: No workarounds are available, and this is essential to me

corepuncher commented 6 months ago

I will say that using fallbackUrl seems to really mitigate the issue. To my surprise the images remain cached, although I have been told this may be more of a flutter bug, and is not really a "fix".

In addition, another workaround I have found (especially for slow web rendering) is to split TileLayers up among CancellableNetworkTileProvider and NetworkTileProvider. I have scores of TileLayers, and for some reason, changing a portion of them to NetworkTileProvider alleviates the load somewhat, resulting in less missed tiles.

JaffaKetchup commented 6 months ago

Indeed, as discussed, if fallbackUrl is still caching tiles, that could be considered a bug. See the discussion at https://github.com/fleaflet/flutter_map/pull/1629 for info.

The equality method does implement this properly, but the hashCode does not, which could be causing the bug: https://github.com/fleaflet/flutter_map/blob/master/lib%2Fsrc%2Flayer%2Ftile_layer%2Ftile_provider%2Fnetwork_image_provider.dart#L120.


Does using the reset stream make a difference? Not sure if we've already tried that. (Although it might not work, see #1808).