Link Search Menu Expand Document

MapmyIndia APIs

Table of contents
  1. e-Location Strategy in MapmyIndia’s Map SDK for iOS
    1. Add Marker Using eLoc
      1. Single Marker
      2. Multiple Markers
    2. Set Map Center Using eLoc
    3. Set Map View Bounds Using List of eLoc
    4. Distance Between Locations Using eLocs
    5. Directions Between Locations Using eLocs

e-Location Strategy in MapmyIndia’s Map SDK for iOS

Add Marker Using eLoc

A marker on MapmyIndia Map can be added using only eLoc. For this it will require an object of MapmyIndiaPointAnnotation.

To create object of MapmyIndiaPointAnnotation it will require MapmyIndia eLoc(unique code of a Place) in its initializer.

Single Marker

Swift

let annotation11 = MapmyIndiaPointAnnotation(eloc: "eLoc")
mapmyIndiaMapView.addMapmyIndiaAnnotation(annotation11, completionHandler: nil)

Multiple Markers

Swift

var annotations = [MapmyIndiaPointAnnotation]()            
let eLocs = [ "mmi000", "7gbcyf", "5MEQEL", "k595cm"]
for eLoc in eLocs {
    let annotation = MapmyIndiaPointAnnotation(eloc: eLoc)
    annotations.append(annotation)
}
self.mapView.addMapmyIndiaAnnotations(annotations, completionHandler: nil)

Set Map Center Using eLoc

MapmyIndia’s Map can be centered to a Place using its eLoc. Different functions are available to achieve this. Below are code snippets to use it.

Swift

mapmyIndiaMapView.setMapCenterAtEloc("mmi000", animated: false, completionHandler: nil)
mapmyIndiaMapView.setMapCenterAtEloc("mmi000", zoomLevel: 17, animated: false, completionHandler: nil)
mapmyIndiaMapView.setMapCenterAtEloc("mmi000", zoomLevel: 17, direction: 0, animated: false, completionHandler: nil)

Set Map View Bounds Using List of eLoc

MapmyIndia’s Map’s bounds can be set to fit bounds for a list of eLocs. A method showELocs: is available to achieve this. Below is code snipped to demonstrated its usage

Swift

let eLocs = ["mmi000", "7gbcyf", "5MEQEL", "k595cm"]
self.mapView.showElocs(eLocs, animated: false, completionHandler: nil)

Distance Between Locations Using eLocs

Code snipet for getting distance between different locations using eLocs is below. For more information please see here.

Directions Between Locations Using eLocs

Directions between different locations can be get using eLocs. For more information please see here and here.

For any queries and support, please contact:

Email Email us at apisupport@mapmyindia.com

MapmyIndia Stack Overflow Stack Overflow Ask a question under the mapmyindia-api

MapmyIndia Support Support Need support? contact us!

MapmyIndia Blog Blog Read about the latest updates & customer stories

© Copyright 2020. CE Info Systems Pvt. Ltd. All Rights Reserved.Terms & Conditions