You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Offline raster tiles does not use correct zoom level #9563
In this case, it looks like my offline tiles are expired. So it first draw the old one, then tries to fetch a fresh tile and then when the network is down the download failes and it jumps to z-1. It should probably use the tile in the database in this case even when it has expired. Does this make sense?
I worked around this issue by making sure that the offline tiles that I insert into the database has a expire value in the future. That seem to prevent mapbox from attempting to refetch the expired tiles in offline mode and then failing resulting in jumping to z-1.
Normal behavior when internet connection is available
0:35 - 1:04
Unexpected behavior when internet connection is not available (The green rectangle seen at 0:35 indicates the area that has been downloaded for offline use.)
As you can see in the video, it appears that the offline tiles load correctly for a brief moment, and then the map cycles through tiles from lower zoom levels until it just renders blank tiles.
I'm not sure if this matters, but I'm hosting raster tiles on my own server, with the following style. (Note that the listing below omits the full tile URL.)
@namannik Could it be that your tile provider does not have an Expires http header? And that the tiles are inserted in the tiles-table with null value in the expires column? Are you able to change the tile provider so that an Expires-header are included with the tiles?
Thanks, @kkaefer. I've rolled back the SDK used in my app to v3.5.4, so I'll be good for now.
@halset The server hosting the tiles is one that I set up, and I didn't set it to provide an "Expires" http header. (I wasn't aware this was necessary.) I can give that a try. As for how the tiles are inserted into the tiles table, I'm using Mapbox's built-in MGLOfflineStorage, so I don't know that I have direct visibility to the contents of the table.
@namannik The Expires http header should not be required. During tile fetching, some of the http headers are stored with the tiles. When offline, the tile is first fetched from the database. As the tile has expired (Expires is missing), it is refetched in the background. And when that failes, it jump to the z-1 tile and so it goes. So setting the Expires header can be a workaround for this issue. This is at least how it looks for me.
Activity
halset commentedon Jul 20, 2017
This is not related to offline packs. I do not use offline packs. The tiles got into the database without using offline packs.
halset commentedon Jul 20, 2017
Looks like I have a similar, but less visible problem with vector tiles.
halset commentedon Jul 20, 2017
This might be a duplicate of #9493, but that one is closed as a dup of som offline pack case. I do not use offline packs.
jfirebaugh commentedon Jul 20, 2017
My guess is it's caused by #7741. cc @tmpsantos
halset commentedon Jul 20, 2017
I bisected this to 9a9408e. cc @kkaefer.
jfirebaugh commentedon Jul 20, 2017
Great, thanks for bisecting. That means this is a duplicate of #8678 and will be fixed by #9415 / #9468.
halset commentedon Jul 20, 2017
Tried now. The current state of #9468 does not fix this problem. Hopefully it will in the future.
jfirebaugh commentedon Jul 20, 2017
Ok, reopening so we can investigate.
halset commentedon Jul 20, 2017
In this case, it looks like my offline tiles are expired. So it first draw the old one, then tries to fetch a fresh tile and then when the network is down the download failes and it jumps to z-1. It should probably use the tile in the database in this case even when it has expired. Does this make sense?
halset commentedon Jul 20, 2017
I worked around this issue by making sure that the offline tiles that I insert into the database has a expire value in the future. That seem to prevent mapbox from attempting to refetch the expired tiles in offline mode and then failing resulting in jumping to z-1.
tmpsantos commentedon Jul 24, 2017
We had something like this before, but it was fixed by e962b79
namannik commentedon Aug 14, 2017
I seem to be experiencing this issue also. Here's a video of what I'm seeing:
https://www.dropbox.com/s/p89hb976d9qha5g/offline-raster-map-issue.mov?dl=0
This video shows the following:
As you can see in the video, it appears that the offline tiles load correctly for a brief moment, and then the map cycles through tiles from lower zoom levels until it just renders blank tiles.
I'm not sure if this matters, but I'm hosting raster tiles on my own server, with the following style. (Note that the listing below omits the full tile URL.)
As mentioned by @halset, the log is outputting a lot of messages like this:
namannik commentedon Aug 14, 2017
I tried previous versions of the iOS SDK and found that this issue does not occur when using v3.5.4, but does occur starting with v3.6.0-alpha.1.
halset commentedon Aug 14, 2017
@namannik Could it be that your tile provider does not have an Expires http header? And that the tiles are inserted in the tiles-table with null value in the expires column? Are you able to change the tile provider so that an Expires-header are included with the tiles?
kkaefer commentedon Aug 14, 2017
@namannik @halset I was able to reproduce this error; but the fix will take a little.
namannik commentedon Aug 14, 2017
Thanks, @kkaefer. I've rolled back the SDK used in my app to v3.5.4, so I'll be good for now.
@halset The server hosting the tiles is one that I set up, and I didn't set it to provide an "Expires" http header. (I wasn't aware this was necessary.) I can give that a try. As for how the tiles are inserted into the tiles table, I'm using Mapbox's built-in
MGLOfflineStorage, so I don't know that I have direct visibility to the contents of the table.halset commentedon Aug 14, 2017
Looking forward to the fix, @kkaefer 👍 Thanks!
@namannik The Expires http header should not be required. During tile fetching, some of the http headers are stored with the tiles. When offline, the tile is first fetched from the database. As the tile has expired (Expires is missing), it is refetched in the background. And when that failes, it jump to the z-1 tile and so it goes. So setting the Expires header can be a workaround for this issue. This is at least how it looks for me.
kkaefer commentedon Sep 16, 2017
@halset fix is in #10011 / #10012 (for the current release branch).
I verified that this fixes flickering raster tiles when tiles are expired in offline mode. Can you confirm that this fixes the issue for you as well?
halset commentedon Sep 25, 2017
@kkaefer It is working very well. Thank you!