GLMapManager


@interface GLMapManager : NSObject

Map manager used to work with list of offline maps

  • Unavailable

    It’s singleton object. Use [GLMapManager sharedManager]

    Plain -init is disabled

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • A path to folder where offline maps is stored

    Declaration

    Objective-C

    @property (atomic, strong, readwrite) NSString *_Nonnull storagePath;
  • Path to network activity log file. By default it’s nil and logging is disabled.

    Declaration

    Objective-C

    @property (atomic, strong, readwrite) NSString *_Nullable networkActivityLogPath;
  • Allows to download map tiles one by one

    By default tileDownloadingAllowed = NO. GLMapView checks tile in world offline map first, then in embed and downloaded offline maps, then in downloaded earlier tiles and at last step if tile downloading is allowed it tries to download map tile.

    Declaration

    Objective-C

    @property (atomic, assign, unsafe_unretained, readwrite)
        BOOL tileDownloadingAllowed;
  • Cached tile will be refreshed if it will stay in cache more than given time. Time interval is measured in seconds.

    By default tileRefreshTimeInterval = -1. If tileRefreshTimeInterval < 0 no tile refreshing will be triggered.

    Declaration

    Objective-C

    @property (atomic, assign, unsafe_unretained, readwrite)
        int64_t tileRefreshTimeInterval;
  • Number of donwloded maps. World map is not counted as downloaded map.

    Declaration

    Objective-C

    @property (atomic, readonly) NSInteger downloadedMapsCount;
  • All tasks created by [GLMapManager downloadMap:withCompletionBlock] Map download task is removed from array when map downloading is finished

    Declaration

    Objective-C

    @property (atomic, readonly)
        NSArray<GLMapDownloadTask *> *_Nonnull allDownloadTasks;
  • Blocks what will called on the main thread when subtask is completed or cancelled.

    Declaration

    Objective-C

    @property (atomic, strong, readwrite)
        GLMapDownloadStatsBlock _Nullable downloadStatsBlock;
  • An API key used to download vector maps and tiles

    Declaration

    Objective-C

    @property (atomic, strong, readwrite) NSString *_Nullable apiKey;
  • Singleton manager object

    Declaration

    Objective-C

    @property (class, nonatomic, readonly) GLMapManager *_Nonnull sharedManager;
  • Bundle with resources

    Declaration

    Objective-C

    @property (class, nonatomic, readonly) NSBundle *_Nonnull resourcesBundle;
  • Declaration

    Objective-C

    - (NSArray<GLMapInfo *> *_Nullable)cachedMapList;

    Return Value

    Returns array of GLMapInfo objects downloaded earlier and cached by GLMapManager

  • Declaration

    Objective-C

    - (NSDictionary<NSNumber *, GLMapInfo *> *_Nullable)cachedMaps;

    Return Value

    Returns dictionary of all GLMapInfo objects (including submaps) downloaded earlier and cached by GLMapManager

  • Updates map list

    Declaration

    Objective-C

    - (void)updateMapListWithCompletionBlock:(GLMapListUpdateBlock _Nullable)block;

    Parameters

    block

    A block called when map list is downloaded

  • Updates downloaded maps. Call this after placing map data files to storage path.

    Declaration

    Objective-C

    - (void)updateDownloadedMaps;
  • Sorts maps by distance from border.

    Declaration

    Objective-C

    - (void)sortMaps:(nonnull NSMutableArray<GLMapInfo *> *)maps
           fromPoint:(GLMapPoint)point;

    Parameters

    maps

    maps to sort

    point

    point to meashure distance *

  • Deletes downloaded map data sets

    Declaration

    Objective-C

    - (void)deleteDataSets:(GLMapInfoDataSetMask)dataSets
                    forMap:(nonnull GLMapInfo *)map;

    Parameters

    dataSets

    data sets to delete

    map

    map object

  • Starts download task

    It’s up to you save download task or not. Active map download task could be received later from -downloadTaskForMap:.

    Declaration

    Objective-C

    - (nonnull NSArray<GLMapDownloadTask *> *)
           downloadDataSets:(GLMapInfoDataSetMask)dataSets
                     forMap:(nonnull GLMapInfo *)map
        withCompletionBlock:(GLMapDownloadCompletionBlock _Nullable)completionBlock;

    Parameters

    dataSets

    data sets to download

    map

    map object

    completionBlock

    completion block

    Return Value

    A new download task object

  • Used to check if there is a download task for a given map

    Declaration

    Objective-C

    - (GLMapDownloadTask *_Nullable)downloadTaskForMap:(nonnull GLMapInfo *)map
                                               dataSet:(GLMapInfoDataSet)dataSet;

    Parameters

    map

    A map info object

    Return Value

    Returns GLMapDownloadTask previously created for a map

  • Used to check if there is a download task for a given map and data set

    Declaration

    Objective-C

    - (NSArray<GLMapDownloadTask *> *_Nullable)
        downloadTasksForMap:(nonnull GLMapInfo *)map
                   dataSets:(GLMapInfoDataSetMask)dataSets;

    Parameters

    map

    A map info object

    dataSets

    data set to check

    Return Value

    Returns array of GLMapDownloadTask previously created for a map

  • Adds vector map. Could be used for maps embed into the app resources.

    When map is added, it becomes available for all GLMapView objects.

    Declaration

    Objective-C

    - (BOOL)addMap:(nonnull NSString *)path;

    Parameters

    path

    Path to the vector map

    Return Value

    YES if file exists and was added to list of custom maps.

  • Removes vector map from map manager. When removed is safe to delete map file.

    Declaration

    Objective-C

    - (void)removeMap:(nonnull NSString *)path;

    Parameters

    path

    Path to the embed map

  • Returns map info with downloaded map data

    Declaration

    Objective-C

    - (GLMapInfo *_Nullable)downloadedMapAtPoint:(GLMapPoint)point;

    Parameters

    point

    Some point in internal format

    Return Value

    GLMapInfo of downloaded map

  • Returns map at given point

    Declaration

    Objective-C

    - (NSArray<GLMapInfo *> *_Nullable)mapsAtPoint:(GLMapPoint)point;

    Parameters

    point

    Some point in internal format

    Return Value

    GLMapInfo of map

  • Removes GLMap cached objects and closes opened databases

    clearCaches called automatically on UIApplicationDidEnterBackgroundNotification

    Declaration

    Objective-C

    - (void)clearCaches;
  • Saves state for downloading tasks. It allows to resume downloads in case of crash or unexpected behavior

    Called automatically when app is minimized

    Declaration

    Objective-C

    - (void)saveDownloadsState;
  • Returns vector tiles that bbox contains or intersects

    Declaration

    Objective-C

    - (nonnull NSArray<NSNumber *> *)vectorTilesAtBBox:(GLMapBBox)bbox;

    Parameters

    bbox

    bbox of area

    Return Value

    Returns vector tiles array contained or intersected by bbox

  • Returns not cached vector tiles that bbox contains or intersects

    Declaration

    Objective-C

    - (nonnull NSArray<NSNumber *> *)notCachedVectorTilesAtBBox:(GLMapBBox)bbox;

    Parameters

    bbox

    bbox of area

    Return Value

    Returns not cached vector tiles contained or intersected by bbox

  • Check if tiles cached. If not tile will be downloaded.

    Declaration

    Objective-C

    - (void)cacheTiles:(nonnull NSArray<NSNumber *> *)tiles
         progressBlock:(GLMapTileDownloadProgressBlock _Nullable)progressBlock;

    Parameters

    tiles

    tiles to check

    progressBlock

    block that will be called when one tile is checked.

  • Returns bbox for given tile

    Declaration

    Objective-C

    - (GLMapBBox)bboxForTile:(uint64_t)tile;

    Parameters

    tile

    tile to calculate bbox

    Return Value

    Returns bbox of tile

  • Enable fix of gcj coordinates to wgs *

    Declaration

    Objective-C

    - (void)setNeedsChinaFix:(BOOL)needsChinaFix;