GLMapRasterTileSource

Objective-C


@interface GLMapRasterTileSource : GLMapTileSource

Swift

class GLMapRasterTileSource : GLMapTileSource

GLMapRasterTileSource is used to set up a custom raster tile source.

  • Initializes the tile source. If cachePath == nil, caching will not occur.

    Declaration

    Objective-C

    - (instancetype _Nullable)initWithCachePath:(NSString *_Nullable)cachePath;

    Swift

    init?(cachePath: String?)

    Parameters

    cachePath

    The path for tile caching.

  • Returns the URL of the tile. The default implementation returns nil.

    Declaration

    Objective-C

    - (NSURL *_Nullable)urlForTilePos:(GLMapTilePos)pos;

    Swift

    func url(for pos: GLMapTilePos) -> URL?

    Parameters

    pos

    The tile position.

  • Returns the image data of the tile. The default implementation returns nil.

    Declaration

    Objective-C

    - (NSData *_Nullable)imageDataForTilePos:(GLMapTilePos)pos
                                     expired:(BOOL *_Nonnull)expired;

    Swift

    func imageData(for pos: GLMapTilePos, expired: UnsafeMutablePointer<ObjCBool>) -> Data?

    Parameters

    pos

    The tile position.

    expired

    A boolean pointer indicating whether the tile has expired.

  • Returns the image of the tile. The default implementation returns nil.

    Declaration

    Objective-C

    - (PlatformImage *_Nullable)imageForTilePos:(GLMapTilePos)pos
                                        expired:(BOOL *_Nonnull)expired;

    Swift

    func image(for pos: GLMapTilePos, expired: UnsafeMutablePointer<ObjCBool>) -> NSImage?

    Parameters

    pos

    The tile position.

    expired

    A boolean pointer indicating whether the tile has expired.

  • Override this to implement custom caching. The default implementation does nothing.

    Declaration

    Objective-C

    - (void)saveTileData:(NSData *_Nonnull)data forTilePos:(GLMapTilePos)pos;

    Swift

    func saveTileData(_ data: Data, for pos: GLMapTilePos)

    Parameters

    data

    The tile data to save.

    pos

    The tile position.

  • Cached tiles will be refreshed if they remain in cache beyond the specified time interval. This interval is measured in seconds. By default, tileRefreshTimeInterval is set to 2,592,000 seconds (30 days). If tileRefreshTimeInterval is less than 0, no tile refreshing will be triggered. Note: Tiles will continue to operate offline even after the refresh interval has passed, although the framework will attempt to download them again.

    Declaration

    Objective-C

    @property int64_t tileRefreshTimeInterval;

    Swift

    var tileRefreshTimeInterval: Int64 { get set }
  • Defines valid zoom levels for the tile source. The default is 0xFFFFFFFF.

    Declaration

    Objective-C

    @property uint32_t validZoomMask;

    Swift

    var validZoomMask: UInt32 { get set }
  • Allows drawing tiles after the maximum zoom level.

    Declaration

    Objective-C

    @property BOOL overzoom;

    Swift

    var overzoom: Bool { get set }
  • The size of the tile in points. Can be used to magnify raster tiles. The default is 256.

    Declaration

    Objective-C

    @property uint32_t tileSize;

    Swift

    var tileSize: UInt32 { get set }
  • Sets the attribution text for the map source. The default is @“© OpenStreetMap”.

    Declaration

    Objective-C

    @property (strong) NSString *_Nullable attributionText;

    Swift

    var attributionText: String? { get set }
  • Returns the size of the cache file.

    Declaration

    Objective-C

    @property (readonly) uint64_t cacheSize;

    Swift

    var cacheSize: UInt64 { get }
  • Removes all cached data.

    Declaration

    Objective-C

    - (void)dropCache;

    Swift

    func dropCache()