Vector-based map data, provides mapping capabilities with features such as routing, navigation, historical traffic patterns

MapmyIndia Map iOS SDK

Getting Started

MapmyIndia’s iOS Map SDK helps to embed MapmyIndia maps within your iOS application. Through customized raster tiles, you can add different map layers to your application and add bunch of controls and gestures to enhance map usability thus creating potent map based solutions for your customers.

API Usage

Your MapmyIndia Maps SDK usage needs a set of license keys (get them here) and is governed by the API terms and conditions. As part of the terms and conditions, you cannot remove or hide the MapmyIndia logo and copyright information in your project.

The allowed SDK hits are described on the plans page. Note that your usage is shared between platforms, so the API hits you make from a web application, Android app or an iOS app all add up to your allowed daily limit.

Setup your project

  • Create a new project in Xcode
  • Drag and drop the MapmyIndia Map SDK framework (MMIFramework.framework) and resource bundle file (MMIFramework.bundle) to your project
  • Add these dependencies to your project (Build Phases > Link Binary with Libraries) -
    • libsqlite3.0.dylib
    • libz.dylib
  • Add compiler flag (Project target > Build Settings > Other Linker Flags > Set `-ObjC`)
  • For iOS8 or later, make this change to your info.plist (Project target > info.plist > Add row and set key `NSLocationWhenInUseUsageDescription`)
  • Add your MapmyIndia Map API keys to your AppDelegate.m as follows-
      1. Add the following import statement
        #import <MMIFramework/MMIFramework.h>
      2. Add the following to your application:didFinishLaunchingWithOptions: method, replacing restAPIKey and mapSDKKey with your own API keys:
        [LicenceManager sharedInstance].restAPIKey=your_rest_api_key;
        [LicenceManager sharedInstance].mapSDKKey=your_java_script_key;

Add a MapmyIndia Map

#import <MMIFramework/MMIFramework.h>
@interface MapViewController : UIViewController
MMIMapView* mapView;


@implementation MapViewController

- (void)viewDidLoad {
   [super viewDidLoad];
mapView = [MMIMapView alloc] 
    [self.view addSubview:mapView];

Map Interactions

Set Zoom Level

//Set zoom to 4 for country level display and 18 for house number display
[mapView setZoom:14];

Current Location

The following function will display user’s current location on the map.


NSLog(@"User's location: %@", mapView.userLocation);

Map Events

The Map object should implement the methods of the MMIDelegate protocol corresponding to the events you wish it to receive. This delegate can also be used to detect map overlays selection. Delegate handles gesture events, tap on annotation (marker), long press on map and map center coordinates.

-(void)mapViewRegionDidChange:(MMIMapView *)mapView;
-(void)afterMapMove:(MMIMapView *)map byUser:(BOOL)wasUserAction;
-(void)afterMapZoom:(MMIMapView *)map byUser:(BOOL)wasUserAction;
-(void)tapOnAnnotation:(MMIAnnotation *)annotation onMap:(MMIMapView *)mapView

Map Tap/Long Press

To capture single tap on map events, use singleTapOnMap method from MMIDelegate -

- (void)singleTapOnMap:(MMIMapView *)map at:(CGPoint)point;

For long press event, use longPressOnMap method of MMIDelegate -

- (void)longPressOnMap:(MMIMapView *)map at:(CGPoint)point;

Map Overlays


Add a Marker
To add a marker, create a MMIAnnotation object that includes a location, title/subtitle and markerImage etc.

MMIAnnotation* annotation=[[MMIAnnotation alloc] init];
annotation.title=@"Delhi" ; //the title is shown in the info window as described below
[mapView addAnnotation:annotation];

Remove a Marker

[mapView removeAnnotation:annotation]; // to remove a single marker

[mapView removeAllAnnotations]; // to clear all markers on map

Change default marker icon

annotation.markerImage=[UIImage imageNamed:@"placemarker.png"]; //formats supported - png,jpg
annotation.makerSize=CGSizeMake(48, 48); //set any size that looks good with your image

Marker Opacity

MMIAnnotation* annotation=[[MMIAnnotation alloc] init];
[mapView addAnnotation:annotation];

Info Windows

Enable display of info windows on annotation tap event.

MMIAnnotation* annotation=[[MMIAnnotation alloc] init];

Marker Clustering

To enable auto-clustering on all markers displayed on map, set the value to True. Default is False. See marker clustering in action in the samples bundled in the SDK.



Add a Polyline

NSArray *locations = [NSArray arrayWithObjects:
[[CLLocation alloc] initWithLatitude:28.54937553 longitude:77.26795197],
[[CLLocation alloc] initWithLatitude:28.54939461 longitude:77.26816559],
[[CLLocation alloc] initWithLatitude:28.54946899 longitude:77.26811981],
[[CLLocation alloc] initWithLatitude:28.54972458 longitude:77.26800537],nil];
[mapView drawPolyLine:locations];

Remove a Polyline

[mapView removePolyLine];

Customize a Polyline
Change width of polyline -


Change color of polyline –

mapView.polylineColor=[UIColor greenColor];


Add a Polygon

NSMutableArray* polygonVertices = [[NSMutableArray alloc] initWithCapacity:50]; 

CLLocation* location1=[[CLLocation alloc] initWithLatitude:26.613434longitude:75.758556]; 
CLLocation* location2=[[CLLocation alloc] initWithLatitude:26.311922longitude:76.492635]; 
CLLocation* location3=[[CLLocation alloc] initWithLatitude:26.230916longitude:76.130366]; 
CLLocation* location4=[[CLLocation alloc] initWithLatitude:26.364601longitude:75.832132]; 
CLLocation* location5=[[CLLocation alloc] initWithLatitude:26.613434longitude:75.758556];
[polygonVertices addObject:location1]; 
[polygonVertices addObject:location2]; 
[polygonVertices addObject:location3]; 
[polygonVertices addObject:location4]; 
[polygonVertices addObject:location5];     


Add a Circle
You must specify the following parameters to add a circle on the map –

  • position (latitude, longitude)
  • radiusInMeters (in meters)
  • lineWidthInPixels (width of circle stroke)
MMIAnnotation* annotation=[[MMIAnnotationalloc] init];
Customize a Circle
annotation.lineColor=[UIColor redColor]; //change the stroke color of the circle
annotation.fillColor=[UIColor colorWithRed:.5 green:.466 blue:.733 alpha:.25]; //change the fill color of the circle

The following search services are available as part of the SDK bundled by default (Make sure you include following import in your code) –

#import <MMIFramework/MMIFramework.h>


You can read more on MapmyIndia's Geocoding API. To geocode an address, create an instance of GeocodeManager class and call the getPlace method –

GeocodeManager *managerObject = [[GeocodeManager alloc] init];
[managerObject getPlace:@“New Delhi” completion:^(NSDictionary *result,NSError* error){
  // if error is nil, then result is success.    
 // response includes responseCode,version and results Array   

Reverse Geocoding

You can find address for a point on the map by using the MapmyIndia Maps Reverse Geocoding API. Pass the GeoPoint to the ReverseGeocodeManager class –

ReverseGeocodeManager *reverseGeoCodeManagerObject=[[ReverseGeocodeManager alloc]init];    
 [reverseGeoCodeManagerObject getPlace:CLLocationCoordinate2DMake(startPoint, finalPoint) completion:^(NSDictionary *result,NSError* error){ 
 // if error is nil, then result is success.  // response is the results array      

Routes & Navigation

Routing API

Routing and displaying driving directions on map, including instructions for navigation, distance to destination, traffic etc. are few of the most important parts of developing a map based application. This REST API calculates driving routes between specified locations including via points based on route type(fastest or shortest), includes delays for traffic congestion , and is capable of handling additional route parameters like: type of roads to avoid, travelling vehicle type etc.

DirectionManager *directionManagerObject=[[DirectionManager alloc]init]; 
[directionManagerObject getInstance].with_advices=@"1"; 
	//if you want full textual advice in the response
		[directionManagerObject getDirections:CLLocationCoordinate2DMake(28.568, 78.573) endPoint:CLLocationCoordinate2DMake(28.325, 78.845)  viaPoints:@[[NSString 
stringWithFormat:@"%f,%f",28.123,78.451]] completion:^(NSDictionary *result,NSError* error){
// if error is nil, then result is success. // result is response 

Driving Distance Matrix API

Adding driving directions API would help to add predicted travel time & duration from a given origin point to a number of points. The Driving Distance Matrix API provides driving distance and estimated time to go from a start point to multiple destination points, based on recommended routes from MapmyIndia Maps and traffic flow conditions

DistanceManager*distanceManagerObject=[[DistanceManager alloc]init];
[distanceManagerObject getDistance:CLLocationCoordinate2DMake(28.568, 78.573)  points:@[[NSString stringWithFormat:@"%f,%f",28.123,78.451]] 
completion:^(NSDictionary *result,NSError* error){ 
// if error is nil, then result is success.
// result is response