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

[BUG] Old tiles remain visible beneath new tiles after zoom until new gesture #1837

Open
corepuncher opened this issue Feb 21, 2024 · 9 comments · Fixed by #2007
Open

[BUG] Old tiles remain visible beneath new tiles after zoom until new gesture #1837

corepuncher opened this issue Feb 21, 2024 · 9 comments · Fixed by #2007
Labels
bug This issue reports broken functionality or another error needs triage This new bug report needs reproducing and prioritizing S: core Scoped to the core flutter_map functionality

Comments

@corepuncher
Copy link

corepuncher commented Feb 21, 2024

What is the bug?

After a fast change in zoom, my simple state/country border webp tiles do not redraw correctly. My GUESS is that the "old" tiles are not being REMOVED until a map interaction. All other tiles redraw fine.

How can we reproduce it?

I am using transparent webp tiles for my maps. They have black or white state/country lines, that's it. They are actually VERY small, the largest being 1-2kb.

Make a set of transparent tiles with only state boundaries (or I can send you mine), then zoom in or out fast to the point of needing to download a new zoom level of tiles.

After the zoom gesture, you will notice the lines appear "brighter". That is because temporarily, there are two layers of tiles loaded. Since the old (now stretched) tile image from the lower zoom level has "thicker" lines, I can actually see the new lines plot on top of the previous lines. Then when I move the map, the old/stretched tiles disappear.

  • Can someone please contact me privately so I can send you a video of the behavior? I would rather not showcase the app yet, thank you.

  • I can upload 2 or 3 dirs of my tiles if you would like to test them.

Just a simple tile layer:

                TileLayer(
                    tileProvider: CancellableNetworkTileProvider(),
                    urlTemplate: 'https://site.com/{z}/{x}/{y}.webp',
                    tms: false,
                    minNativeZoom: 4,
                    maxNativeZoom: 10,
                  ),

Do you have a potential solution?

Since I have never seen this issue before with all my other tiles, it makes me wonder:

Has this been going on before, but I only noticed now because these are transparent tiles? In other words, the previous set of tiles remain on the screen, but most of the time, with opaque tiles, you don't see it? Anyway, it would be nice if once the new tiles are downloaded, the old would immediately disappear, without a map gesture.

Also, I have ruled out: Cancellable vs NetworkTileProvider...no difference.
Also commended out keep/pan buffers and tileDisplay property. No difference.

Platforms

Galaxy S23

Severity

Obtrusive: Prevents normal functioning but causes no errors in the console

@corepuncher corepuncher added bug This issue reports broken functionality or another error needs triage This new bug report needs reproducing and prioritizing labels Feb 21, 2024
@corepuncher corepuncher changed the title [BUG] After Zoom, old tiles remain on screen along with new tiles, only disappearring after map gesture or rebuild. [BUG] After Zoom, old tiles remain on screen along with new tiles, only disappearing after map gesture or rebuild. Feb 22, 2024
@corepuncher
Copy link
Author

corepuncher commented Feb 22, 2024

FYI, if I zoom slowly, it gives it time for the tiles to update correctly. In addition, I tested my other transparent layer. Same behavior, I just didn't notice before. For my other layer I zoom in really fast, I see the new tiles render, but just underneath, is the old one, and it only disappears upon panning the map (or natural rebuild).

Interestingly, even with a large keepBuffer value, and after panning and zooming to "precache" those images, the same behavior is still observed.

@mootw
Copy link
Contributor

mootw commented Jun 5, 2024

I am able to replicate this behavior on the latest release, however once tiles are cached they do instantly update and load when the new zoom level is reached. Its only tiles that are not cached that experience this issue. Panning "fixes" both zoom levels of tiles being loaded at the same time and unloads the lower zoom level

@mootw mootw added P: 1 (important) and removed needs triage This new bug report needs reproducing and prioritizing labels Jun 5, 2024
@JaffaKetchup
Copy link
Member

For workaround (very much a workaround) see https://discord.com/channels/951867686378409984/1215063056208633897/1258228136810647604.

@JaffaKetchup JaffaKetchup added P: 2 (soon™?) S: core Scoped to the core flutter_map functionality and removed P: 1 (important) labels Aug 7, 2024
@JaffaKetchup
Copy link
Member

This looks a little similar to #1813, although not directly. It looks like the 'new' tile manager introduced in v6 isn't handling pruning, evicting and loading properly.

@JaffaKetchup JaffaKetchup changed the title [BUG] After Zoom, old tiles remain on screen along with new tiles, only disappearing after map gesture or rebuild. [BUG] Old tiles remain visible beneath new tiles after zoom until new gesture Aug 7, 2024
@JaffaKetchup
Copy link
Member

#1961 reports the same issue.

@edeetee
Copy link

edeetee commented Oct 31, 2024

This is a problem on our app: https://app.smartaccess.enterprises

@edeetee
Copy link

edeetee commented Jan 17, 2025

It is loading new tiles correctly but the higher layer isn't being pruned.
This is testing using the repo as the dependency reference

dependency_overrides:
  flutter_map:
    # ^7.0.2
    git: https://github.com/fleaflet/flutter_map

Uploading videos here is giving me an error so here is a link to the video uploaded to google photos:

https://photos.app.goo.gl/xTR3NDsZ38AEbURL8

@JaffaKetchup JaffaKetchup reopened this Jan 19, 2025
@JaffaKetchup JaffaKetchup added needs triage This new bug report needs reproducing and prioritizing and removed P: 2 (soon™?) labels Jan 19, 2025
@JaffaKetchup
Copy link
Member

@mootw Was this issue (last comment) supposed to be fixed by your fix?

@mootw
Copy link
Contributor

mootw commented Jan 19, 2025

i suspect the dependency didnt fully update, or there are really slow to load tiles in the map. My fix only applies to after ALL tiles are loaded at the zoom level, it should clear out old tiles. For a proper progressive tile clearing, we need to re-write the tile pruning logic to correctly setState.

Note there are a small number of edge cases (~10% of the time) in my testing when quickly panning, and >1 zoom actions where it does not clear after all tiles are loaded but the patch did fix MOST of the issue, but to be clear again, its only after ALL tiles are loaded at that zoom level

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue reports broken functionality or another error needs triage This new bug report needs reproducing and prioritizing S: core Scoped to the core flutter_map functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants