MaplyMBTileSource

@interface MaplyMBTileSource : NSObject <MaplyTileSource>

MapBox Tiles format tile source object.

This is the MBTiles format tile source. It’ll read local MBTiles archives (https://github.com/mapbox/mbtiles-spec?source=c) which are basically just collections of image tiles in a sqlite database.

The sqlite file must be local, that is contained within the bundle or copied into it at some point. To access remote tile sources look at the MaplyRemoteTileSource.

MBtiles archives tell us how big they are, including min and max zoom levels. You can also limit the max zoom by setting it directly.

See

MaplyRemoteTileSource

See

MaplyQuadImageTilesLayer
  • Initialize with the name or path to the MBTiles file.

    This initializer will look for the the MBTiles file as if it was given a full path. If that fails it will look for it in the bundle as if it was given just the first part of the name. I’ll tack on the sqlite extension.

    Declaration

    Objective-C

    - (nullable instancetype)initWithMBTiles:(NSString *_Nonnull)fileName;

    Swift

    init?(mbTiles fileName: String)

    Return Value

    Returns a new MaplyMBTileSource object on success, nil on failure.

  • The maximum zoom level in the MBTiles archive.

    This is initially the max zoom level read out of the MBTiles archive. However, you can override it to limit the zoom level, if that’s what you need.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) int maxZoom;

    Swift

    var maxZoom: Int32 { get set }
  • The minimum zoom level in the MBTiles archive.

    This is initially the min zoom level read out of the MBTiles archive. However, you can override it to limit the zoom level, if that’s what you need.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) int minZoom;

    Swift

    var minZoom: Int32 { get set }
  • Returns the bounding box of the MBTiles file.

    This returns the bounding box of the MBTiles file in degrees. Keep in mind that bounding boxes aren’t required to be accurage. This just reports what was in the file.

    Declaration

    Objective-C

    - (MaplyBoundingBox)getBounds;

    Swift

    func getBounds() -> MaplyBoundingBox
  • The coordinate system for the MBTiles file.

    The coordinate system for an MBTiles file is always web mercator with the web extents. This is known as web mercator and it makes cartographers cry.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nonnull) MaplyCoordinateSystem *coordSys;

    Swift

    var coordSys: MaplyCoordinateSystem { get }