Map SDK - iOS

Ola Map SDK offers a robust toolkit for seamlessly integrating both basic and advanced mapping features into your iOS applications. By utilizing the Maps SDK for iOS, you can incorporate maps powered by Ola's data directly into your app. The SDK takes care of displaying the map and responding to user interactions like clicks and drags. Additionally, you can enhance your maps by adding markers, polylines, ground overlays, and info windows, which provide extra information for specific locations and enable user interaction with the map.

Specifications

Before proceeding, ensure that you meet the following prerequisites:
  • Minimum iOS version: iOS 13.0
  • Xcode Version: 12 or later

Sample App

Please refer to theGithub Sample Appfor getting better clarity on same.

Set up

You have to iOS Map SDK import all the xcframeworks in your iOS project. Make sure you embed all the frameworks in General > Frameworks, Libraries and Embedded Content. Next, You need to add Location Permission Authorization in your Info.plist file,
Now, you are good to initialize the OlaMapService instance in your view controller.

Load the map using the service instance. Ideally this method should be called in viewdidLoad() method of viewcontroller

Features

  • Dynamic Maps
  • Camera and View
  • Polyline
  • Shape
  • Marker
  • Info Window
  • Map Events and Gesture
  • Traffic Polyline
  • Marker Clustering
Dynamic Map

To render a map, you need to initialise OlaMapService first and then call loadMap(_:)

Parameter nameDescription
apikeyAPIKey from Ola Maps Dashboard
tileURLRefer Tiles API in API Reference
projectIdRefer Dashboard for Project Identifier
userIdCustom UserID which is identified by Organization
Map Camera

You can control the Map POV area and bounds area which you want to show.

Events and Gestures

This will enable rotation selection capability on Map, you can rotate the map by using two fingers.

Then, You will set of extra gesture delegate callback which comes with OlaMapServiceDelegate

Info Window

You can draw a Info Window which is a tool tip kind of view on Map.

And, to delete Info Window you can use

Map Region Bounds

You can control the Map Visible Bounds when you have array of coordinates.

Marker
  • Create Annotation Marker
  • We have created CustomAnnotationView Type which is inherited from OlaAnnotation.

  • Delete Annotation
  • You will need AnnotationId to delete any annotation from the map.

Polyline

You will need an array of OlaCoordinates to draw a solid polyline

  • Create Polyline
  • Delete Polyline
Shape

We have a capability to draw a geometrical shape like Polygon or Circle.

  • Create Polygon
  • You need to call drawPolgon(_:) to draw Polygon Geometry

  • Remove Polygon
  • You need to use deletePolygon(_:) method

For Circle, you can use `drawCircle(_:)` method.

Traffic Polyline

Along with Solid Polyline, we have the capability to draw Segmented Polyline. This data you will get from Directions API. Check Platform Documentation.

Marker Clustering

We have a capability to cluster markers under a single labled marker. In simple words, if you've large marker rendered in a single area, then map will automatically cluster them in a single marker with a label on in.

To customize the Cluster, we have a class called ClusterViewDecorator, where you can
  • backgroundColor: Background Color of Cluster View
  • opacity: Opacity of Cluster View
  • radius: Cluster's Zone Radius
  • cluserViewRadius: Radius of Cluster View
  • borderWidth: Border Width of Cluster View
  • borderColor: Border Width of Cluster View
  • fontSize: Text Size of Text Label on Cluster View
  • fontColor: Color of Text Label on Cluster View

And, to remove the Clusters from map, you need to just call a single method