mapbox-gl-native icon indicating copy to clipboard operation
mapbox-gl-native copied to clipboard

Offline Tile Count API

Open nitrag opened this issue 7 years ago • 9 comments

Since there is a limit the offline tiles to 6000 per user I need two methods:

  • How many tiles in a given MGLCoordinateBounds
  • How many tiles are currently saved on the device (so I can calculate remaining available)

This way I can appropriately inform user if their MGLCoordinateBounds is going to successfully download or not. AKA "Choose a smaller area, zoom size, or go delete your other offline packs to make room".

nitrag avatar Jul 08 '17 19:07 nitrag

How many tiles in a given MGLCoordinateBounds

This tool estimates the number of tiles needed for an arbitrary tile pyramid, but it hasn’t been ported to the SDKs themselves, since the actual number of tiles would depend on various factors, such as how many tiles could be reused from another downloaded pack. mapbox/mapbox-gl-native#4258 has some ideas for a more rigorous estimate.

How many tiles are currently saved on the device (so I can calculate remaining available)

You can obtain the pack’s progress and count its downloaded tiles.

1ec5 avatar Sep 22 '17 22:09 1ec5

With #9906, we should be able to implement: +[MGLOfflineStorage tileCountForRegion:] or something similar.

asheemmamoowala avatar Sep 27 '17 23:09 asheemmamoowala

Note that the tile count depends on the minzoom and maxzoom specified in the source's TileJSON, so calculating it depends on having downloaded at least that resource.

jfirebaugh avatar Sep 27 '17 23:09 jfirebaugh

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

stale[bot] avatar Dec 04 '18 06:12 stale[bot]

This is still a fairly popular feature request, any objections to reopening?

riastrad avatar Feb 12 '19 21:02 riastrad

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

stale[bot] avatar Aug 11 '19 22:08 stale[bot]

Whenever this issue is closed, its status on project boards automatically moves to “Resolved”... but when it’s inevitably reopened, it stays as “Resolved”. Not sure who owns those project board(s), but this seems like a flaw in the stalebot/project board relationship.

friedbunny avatar Aug 13 '19 19:08 friedbunny

Hi, this feature is requested recently again by our customer. Is there any plan to further develop or invest in this feature?

shabnomnom avatar Jan 11 '20 01:01 shabnomnom

I agree this feature is a must for us too. We're getting crashes and have to "hack" our way into downloading a pack, suspending it, and then deleting it to approximate the size of the region the user wants to save. There is a huge need for this and it seems to be getting ignored.

Hartistic avatar Sep 28 '21 04:09 Hartistic