2️⃣Prepare For Downloading

BaseRegions must be converted to DownloadableRegions before they can be used to download tiles.

These contain the original BaseRegion, but also some other information necessary for downloading, such as zoom levels and URL templates.

See this basic example:

final downloadable = region.toDownloadable(
    1, // Minimum Zoom
    18, // Maximum Zoom
    TileLayer(
        urlTemplate: '',
    ),
    // Additional Parameters
),

Additional Parameters

Sea Tile Removal

By not storing pure tiles of sea, we can save a bunch of space on the user's device with every download. But how to do this?

Well, this package does it by analysing the bytes of the tile and checking if it's identical to a sample taken at lat/lng 0, 0 (Null Island) with zoom level 17. This tile should always be sea, and therefore any matching tile must also be sea.

In this way, we can delete tiles after we've checked them, if they are indeed sea. This method also means that tiles with ferry paths and other markings remain safe.

Sea Tile Removal does not reduce time or data consumption. Every tile must still be downloaded to check it.

Checking Number Of Tiles

Before downloading the region, you can count the number of tiles it will attempt to download. This is done by the check() method.

The method takes the DownloadableRegion generated above, and will return an int number of tiles. Note that this may take a while for large regions, as it is generating a list of all the tiles within the region.

Last updated

© Luka Stillingfleet (JaffaKetchup)