Getting started with Map-Update

This tutorial demonstrates how to update a map using the Heidelberg Mobil Map Update Server. Updating your map will not require more than two simple steps:

  1. Check for updates: is a new version of the currently loaded map available on the update server?

  2. Update the map: If a new version is available, download & install it.

Precondition: Please note that in order to update a map, you’ll need to have one installed. The “[1] Getting started with Map v2” tutorial gives more information on how to do this.

Check for map updates

Use the checkForMapUpdate method of our HDMMapViewController:

Objective-C

// ViewController.m

[self checkMapUpdate:^(BOOL isUpdateAvailable, NSError *error) {
    if (isUpdateAvailable) {
        NSLog(@"Map Update is available");
        return;
    } else {
        NSLog(@"Error: %@", error);
    }
}];

Swift

// ViewController.swift
self.checkMapUpdate { (isUpdateAvailable, error) in
    if isUpdateAvailable {
        print("Map Update is available")return
    }

    guard let theError = error as NSError? else { return}

    let errorCode = DeepmapError(rawValue: theError.code)

    if let errorCode = errorCode {
        switch (errorCode) {
            case DeepmapError.network: print("Network error while checking map update")
            case DeepmapError.sameMap: print("Current map already was up to date")
            default: print("Detected corrupted file or package while map update")
        }
    }
}

Update the map

Objective-C

// ViewController.m
[self installMapUpdate:^(BOOL success, NSError *error) {
    if (success) {
        NSLog(@"Map was installed");
    } else {
        NSLog(@"Error: %@", error);
    }
}];

Swift

// ViewController.swift
    self.installMapUpdate({ (success, error) in
    if (success) {
        print("Map was installed")
    } else {
        print(error! as NSError)
    }
})

Done! Your current map has been updated.

Note

  1. Our HDMMapViewController will try to check & download map data from http://update.deepmap.de/ based on the currently loaded map package (DeepMap.zip).

  2. The installMapUpdate() method downloads and installs the latest map data even if it has already been installed. To avoid unnecessary traffic, please check for map updates first (using the checkForMapUpdate() method).