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

Tiles are loading but not displaying. #53

Closed
christianroyal opened this issue Feb 25, 2022 · 13 comments
Closed

Tiles are loading but not displaying. #53

christianroyal opened this issue Feb 25, 2022 · 13 comments

Comments

@christianroyal
Copy link

Any reason that tiles may be displaying like such. They do show up as you zoom in but they disappear again.
Screen Shot 2022-02-25 at 5 36 44 PM

@p-lr
Copy link
Owner

p-lr commented Feb 26, 2022

I would check if the missing tiles are effectively provided by the TileStreamProvider. Some tiles are probably missing, or (if you're using an api), something went wrong while fetching tiles.
If not, try to reproduce it in the demo app - that should be easy.

@christianroyal
Copy link
Author

W/BitmapFactory: bitmap marked for reuse (262144 bytes) can't fit new bitmap (524288 bytes) would this warning have anything to do with it?

@christianroyal
Copy link
Author

Screen Shot 2022-03-07 at 2 45 45 PM

Screen Shot 2022-03-07 at 2 46 09 PM

Comparison of two different instances. The top is expected but I can't figure out what is causing the bottom to happen. I checked and the tiles are all there. I can reproduce it in the demo app as well still can't figure out what's going on to cause the issue. My thoughts on a solution is to just do the tiling on my end and not take them from my server.

@p-lr
Copy link
Owner

p-lr commented Mar 7, 2022

would this warning have anything to do with it?

Sure it does. Are you using highFidelityColors(false) on your MapState?

I can reproduce it in the demo app as well still can't figure out what's going on to cause the issue.

Just share your fork of the project and the bug reproduction. It's the best way for me to pin point the issue.

@christianroyal
Copy link
Author

Yes I am. I will share a fork of the demo project as I don't think I can share my company project due to work rules. I will add my snippit into a fork and raise a PR so you can look into it?

When I add the highFidelityColor(false) it changes to now doing this and showing more tiles overall but still missing some:

Screen Shot 2022-03-07 at 5 23 15 PM

Screen Shot 2022-03-07 at 5 23 40 PM

maState = MapState(4, 5760, 3840, workerCount = 15, tileSize = 256) { highFidelityColors(false) maxScale(40f) scroll(0.5, 0.5) scale(0.0f) }.apply { request.filePath?.let { path -> addLayer(makeTileStreamProvider(path)) } shouldLoopScale = false enableRotation() disableMarkerDrag("marker$markerCount") }

@p-lr
Copy link
Owner

p-lr commented Mar 8, 2022

Just create a branch on your fork, reproduce the issue and let me know which repo/branch to look at.

@christianroyal
Copy link
Author

forked and created missingtilesbug branch, reproduced the issue please let me know if you need anything else from me.

Thank you!

@p-lr
Copy link
Owner

p-lr commented Mar 9, 2022

I could fix the problem. The main issue is your images have different color depth. Some are 64bit, others 32bit, and others 8bit..
This library is designed to reuse memory as much as possible. When it loads an image for the first time, it tries to reuse a memory slot used by a former image (which isn't needed anymore). That works as long as slots have the same size. Which isn't the case when images have different color depth.
To fix the problem, I changed the color depth to 32bit (which is more than enough to display a floor plan). I used ImageMagic, and ran the following command on each level directory:

convert *.png -set filename:base "%[basename]" png32:"%[filename:base]".png

Other issues:

  • At level 0 you had a ".jpg" file.
  • The configured size of the map was too big

If you set me as contributor to your fork, I can push the changes on a fix-missing-tiles branch.

@christianroyal
Copy link
Author

christianroyal commented Mar 9, 2022

Disregard the .jpg file that was in error. I have added you.

@p-lr
Copy link
Owner

p-lr commented Mar 9, 2022

I've pushed the branch fix-missing-tiles

@christianroyal
Copy link
Author

Thank you. So for my actual use case in its full scope I will need to do the ImageMagic for all my tiles coming from the server and then store them once converted.

@p-lr
Copy link
Owner

p-lr commented Mar 9, 2022

Or, if possible, have it changed server side.

@christianroyal
Copy link
Author

Doing so now you can consider this closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants