Map Overlays (iOS)

This article describes how to add interactive map overlays.

Map Overlays Overview

Map overlays are colored shapes you can draw on your maps using area placemarks. You can make these overlays interactive.

A map overlay example is included in the Android Sample app.

Map Overlay Code

Use this code to implement a map overlay.

MRPlacemark *myPlacemark;  // known placemark
if (myPlacemark.area != NULL) {
    // Create the MRPathOverlay
    MRPathOverlay* overlay = [[MRPathOverlay alloc] initWithPlacemark:myPlacemark];
    // Enables willTapOverlay() and didTapOverlay() callbacks
    overlay.userInteractionEnabled = TRUE;
    // Add the MRPathOverlay to the map
    [mapView addOverlay:overlay];
    // Set the color after it has been added to map (when the renderer is ready)
    MRPathRenderer *renderer = [mapView rendererForOverlay:overlay];
    if(renderer != NULL){
        renderer.strokeColor = [UIColor colorWithRed:0.1333
            green: 0.1333 blue:0.666 alpha:0.333];
        renderer.fillColor = [UIColor colorWithRed: 0.1333
            green: 0.1333 blue:0.666 alpha:0.200];
    }
}