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

TileLayer on IOs phones "breaks" and don't show parts when you zoom in/out multiple times [BUG] #1509

Closed
fabionfd opened this issue May 9, 2023 · 13 comments
Labels
bug This issue reports broken functionality or another error needs triage This new bug report needs reproducing and prioritizing

Comments

@fabionfd
Copy link

fabionfd commented May 9, 2023

What is the bug?

I download some zip files, unzip them on the phone and use it to source some TileLayers on my app, I use the same pattern of {z}-{x}-{y} but locally so the layers will work offline. When you zoom in and out the Layers starts to bug and don't show correctly as it does on Android. I've upgraded to the last version(4.0.0) and the bug persists, and only occurs on IOs phones(just tested on android and ios phones).

How can we reproduce it?

In my usecase I have up to 8 local tilelayers showing at once, it's quite simple to reproduce, just zoom in and out several times on an iphone and the layers start to lose some parts. I couldn't reproduce it on ios emulator so you need a real device to see the bug.

              String url = '';
              url = "${dir.path}/{z}-{x}-{y}.sigma";
                layers.add(
                  TileLayer(
                    maxNativeZoom: 15,
                    tileProvider: FileTileProvider(),
                    urlTemplate: url,
                    tms: true,
                    backgroundColor: Colors.transparent,
                  ),
                );

this is a sample of a tile that I use on my app, it's inside a for loop for each of the directories of tiles.
I don't know if I could be clear but if you can't undestant something just ask me and I can provide more context to the problem, also I'm not a native english speaker so, sorry about any mistakes of that sort.

Do you have a potential solution?

No response

Platforms

IOs 16.4.1(but other versions seems to have the same problem)

Severity

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

@fabionfd fabionfd added bug This issue reports broken functionality or another error needs triage This new bug report needs reproducing and prioritizing labels May 9, 2023
@JaffaKetchup
Copy link
Member

JaffaKetchup commented May 9, 2023

Hi @fabionfd,

This sounds like the OS restricting the number of files openable at once, especially as you are using 8 file tile layers.

Can you try executing ulimit -S -n 2048 in a console in your app directory, then running normally? You can also try increasing that number if 2048 doesn't appear to have an effect.
This used to be a part of this library's much older README, but we removed it because I assumed it was out of date. Original source from Flutter SDK: flutter/flutter#18225.

@fabionfd
Copy link
Author

fabionfd commented May 9, 2023

Hi, thanks for the quick reply!

Definitely there are more than 2048 files in the directoriesof the tiles( I use zoom 9 to 15 and the files are all inside the same folder for each tile), but I could not quite understand how, or where, to execute this ulimit command, can you give me a little guidance? Just open the terminal and type it at the app folder?

@JaffaKetchup
Copy link
Member

No problem.
I don't think it matters how many tiles total there are, I think that's just the number of open file handlers that can be alive at once.
You should just be able to open up the app folder, open a terminal in it, then run that (on a Mac I guess). Never tried it before, so not 100% sure.

@fabionfd
Copy link
Author

fabionfd commented May 9, 2023

I've tried the method but it only increases the amount of open file handlers within mac, the problem is occuring on the Iphones that installed the app from the store. Even with only one tile enabled the problem still happens, I'd need to change this config on the project itself, or something like that. Funny thing is that it don't occur inside emulators, neither ios and android(my guess is that the PC/Mac/Android have more handlers than IOs phones, if that is the problem), and don't occur on Android devices too.

@fabionfd
Copy link
Author

fabionfd commented May 9, 2023

I've published a video of the bug, so you can better understand the problem. In the video there are 3 tiles enabled, but we tested with only one, and the problem happens too

https://veed.io/view/c0ee51e6-85ca-401a-b740-7c86ced45cb6

@JaffaKetchup
Copy link
Member

Unfortunately, I'm not really sure what can be done here then. We can't bypass OS restrictions!

@mohammedX6
Copy link

I had this problem before, if i kill the app the problem goes away but it will come back

@fabionfd
Copy link
Author

Well, this is very odd but after I comment my openstreet layer the bug didn't happen anymore, even with several of my own layers active.

TileLayer(
  urlTemplate:
  'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
  userAgentPackageName: 'blabla',
),

@mohammedX6
Copy link

So OpenStreetMap causing this problem !!
This is very strange

@ibrierley
Copy link
Collaborator

Isn't that just because you are removing a layer, hence less tiles loaded ? (I may be misunderstanding tho)

@JaffaKetchup
Copy link
Member

Closing for now due to lack of information and some discussion on a similar matter on the Discord server. We're still keeping an eye on this!

@fabionfd
Copy link
Author

Isn't that just because you are removing a layer, hence less tiles loaded ? (I may be misunderstanding tho)

I think you are right, the bug happened again. there are just too many files open I guess.

@mohammedX6
Copy link

I am able to fix the issue by setting bounds to the tile layer, so unnecessary tiles don't strain the file OS

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
Projects
None yet
Development

No branches or pull requests

4 participants