iOS - Some tiles not rendered in a custom MKTileOverlay
Asked Answered
O

1

8

I have a custom MKTileOverlay in my iOS project using MapKit, it works fine most of the time. However, after zooming in/out a few times and panning the map some of the tiles are not being drawn.

At first I thought it was a simple case of tiles not being loaded so I subclassed the MKTileOverlay and added logging in the console. It showed that all tiles were loaded perfectly fine and delivered to the result block.

As I was running out of ideas I created a local tile generator that just returns images with their path x/y/z and frame drawn to see what tiles are missing.

Missing tile example image

Unfortunately the problem persists even with locally generated tiles so it has nothing to do with Internet connectivity. Another weird behaviour is that if I have two custom overlays on top of one another, it will be exactly the same tiles that are not being rendered on both overlays.

The only solution I can think of right now is subclassing the tile renderer and making sure that everything is displayed as there is no way to know that the tile is not rendered. This, however, sounds like a lot of work and a "reinventing the wheel" kinda task...

Overstay answered 7/11, 2016 at 8:14 Comment(4)
Did you find a solution? I believe this is caused by the user having zoomed passed your overlay's maximumZ. When this happens, MapKit no longer requests tiles from this overlay; so when the user pans around at a zoom level beyond maximumZ and reaches a tile that was not previously rendered, MapKit doesn't request it, and thus displays an empty tile. Check these: #4352224 #4418045Tirado
Unfortunately I don't think it's not zoom related. It happens att many different zoom levels within the min/max range. My friend was at the WWDC 2017 and presented this issue during some workshop. Apple engineers filled a bug report and now we are hoping it will be fixed together with iOS 11.Overstay
I can reproduce it on my project, but only when having zoomed passed the maximumZ level. Do you have any reference to this bug report @pppd?Tirado
have the same issue, did someone found a solution for it? I see this issue only on the border of 180.0/0.0 ... but on every zoom levelHeadrest
A
1

We were also experiencing this problem of missing tiles - trying to draw map tiles around New Zealand. The MKOverlayRenderer was not even requesting the tiles. We went down a rabbit hole thinking it must be because New Zealand is near the 180/0 latitude boundary. Nope. It was because the sub-classed method:-

- (void)loadTileAtPath:(MKTileOverlayPath)path result:(void (^)(NSData * __nullable data, NSError * __nullable error))result;

Must always call the result method even if there is no data to return! To give credit where credit is due this was the source of the solution for us:-

MKTileOverlay not drawing every tile?

Ablepsia answered 15/8, 2018 at 17:24 Comment(5)
Thanks for your answer, wish I found this 5 hours ago!Bentlee
It doesn't help in our case. My sample code generates artificial tiles so there's always data to return, yet some of it wouldn't be rendered.Overstay
As with @Overstay this doesn't help us. Some tiles don't get rendered as described in the bounty I've offered, but we always call the result block with valid non-null data when we are called.Array
We have reported that problem to Apple together with a minimal sample app to reproduce it during the WWDC 2017, but as far as I know it's still there.Overstay
@Overstay Is this still a bug? I just asked a questions and I'm wondering if I'm hitting the same bug you experienced? Though I can't get any tile to render. #62824557Coumarone

© 2022 - 2024 — McMap. All rights reserved.