Classes

The following classes are available globally.

  • Overwrites the default overlay to store downloaded images

    See more

    Declaration

    Swift

    public class CachedTileOverlay : MKTileOverlay
  • Hey! I need to download this area No problemo.

    See more

    Declaration

    Swift

    @objc
    public class RegionDownloader : NSObject
  • Class to convert from Map Tiles to coordinates and from coordinates to tiles

    Coordinates (latitude and longitude) are ALWAYS expressed in degrees. The max latitude that can be converted to tiles is +85.0511 and the minimum is -85.0511 (see https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames).

    Zoom level (z) range is from 0 to 19.

    The earth is represented by a square that is divided in small pieces (tiles). The number of tiles depends on the zoom value and is equal to: 2^z x 2^z

    The values of tiles can be from 0 to 2^z - 1. For instance, for z=10 the max tile would be 1023 (2^10 - 1 = 1024 - 1)

    This diagram represents the equivalent lat/long vs tileX/tileY

    (-180,85.0511)           (180,85.0511)  <----- coords (lat, long)
    0,0                      2^z -1, 0 <---------- Tile number (x,y)
    +-------------------------+
    |                         |
    |            + (0.0,0.0)  |
    |                         |
    +-------------------------+
    0,2^z - 1                 2^z - 1, 2^z - 1
    (-180,-85.0511)           (180,-85.0511)
    

    All the wisdom of this class comes from: https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames

    See more

    Declaration

    Swift

    public class TileCoords
  • 3 dimensional square region in a tile map. The three dimensions are:

    • latitude (y)
    • longitude (x)
    • zoom (z)

    A region is represented by two TileCoords one holds the topLeft corner and the other the bottomRight corner.

    Notice that, in general, map UIs represent an infinite scroll in the longitude (x) axis, when the map ends, it is displayed the beginning.

    In this scenario, if we allow user to pick two points to select a region, we may end up with two sub-regions.

    +---------------------++---------------------++---------------------+
    |                     ||                     ||                     |
    |             * P1    ||                     ||                     |
    |                     ||                     ||                     |
    |       Map 1         ||        Map 1bis     ||       Map 1 bis bis |
    |                     ||                     ||                     |
    |                     ||  * P2               ||                     |
    |                     ||                     ||                     |
    +---------------------++---------------------++---------------------+
    
    See more

    Declaration

    Swift

    public class TileCoordsRegion