Navigation SDK provides a comprehensive toolkit for integrating basic & advanced navigation capabilities into your iOS applications. Whether you're developing a mobile navigation app, a fleet management solution, or a location-based service, our SDK offers the tools you need to deliver seamless and reliable navigation experiences to your users. With the Navigation SDK, you can access a wide range of features, including real-time turn-by-turn navigation, route planning, traffic-aware routing, and waypoint addition. Our SDK is designed to be easy to integrate, allowing you to focus on building compelling navigation experiences without the complexity of managing underlying navigation logic.
Specifications
Before proceeding, ensure that you meet the following prerequisites:
Minimum iOS version: iOS 13.0
Xcode Version: 12 or later
Sample App
We wrote a sample app for the Navigation SDK. Please refer to the sample app for reference.Please refer to theGithub Sample Appfor reference.
Setup Map
You have to download OlaNavigation SDK and import all the xcframeworks in your iOS project. Make sure youembed 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,
Parameter name
Description
apikey
API Key from Platform Dashboard
tileURL
Refer Tiles API in API Reference
projectId
Refer Dashboard for Project Identifier
userId
Custom UserID which is identified by Organization
Load the map using the service instance. Ideally this method should be called in viewdidLoad() method of viewcontroller
Annotation
To draw an annotation, we need to call setAnnotationMarker with coordinate and Annotation View. Make sure, you have unique Identifier for every nnotation you have on map.
Add Annotation
If you want to show the annoattion on the map you can use CustomAnnotationView andsetAnnotationMarker
Remove Annotation
You can remove a marker from the map by calling this method removeAnnotation.
Polygons
Polygons are designed to define solid regions within a closed loop which can be used to mark a particular zone. They consist of a series of coordinates in an ordered sequence.
You can draw Polygons by calling this method drawPolygon(), here is the example below:
To draw circle call this method drawCircle(), here is the example below:
Polyline
Polylines allow you to draw lines on the map. The below example demonstrates how to draw a polyline.
Listening to events
We can listen to 2 types of event
Longpress event
Tap event
MapRegion changed event
Tap and Longpress Events
To listen to events, you must implement the OlaMapServiceDelegate protocol. Typically, you implement this protocol on the view controller that displays the map. Below is an example:
Map Region changed Events
Using the OlaMapServiceDelegate, you can listen when map region changes. Gesture param with it signifies the reason for change
Navigation
Enhance your mobile app with seamless, turn-by-turn navigation. Harness the capabilities of Ola Maps to deliver real-time navigation with intuitive voice guidance. You can instantiate navigation service as follows
Parameter name
Description
apikey
API Key from Platform Dashboard
tileURL
Refer Tiles API in API Reference
projectId
Refer Dashboard for Project Identifier
userId
Custom UserID which is identified by Organization
Route Data
To enable navigation, you must supply route data to the navigation service. This data can be obtained from the Direction Service.
Once Route data is fetched from above section, we can call navigate()api on navigation service to display route and start navigation using following code snippet
End Navigation
Once navigation has been started it can be terminated any time using following api
Navigation callbacks
You can listen to navigation events using the OlaMapNavigationServiceDelegate protocol. Below is an example:
Instructions
Text Instructions
Once Navigation starts, user will get callbacks depending on journey progress he is making
Audio Instructions
We can enable audio guide for user during journey using following api. Also Voice guidance can be programatically toggled using toggleVoiceNavigation() api
To get callback of when instructions has been played, implement following method from OlaMapNavigationServiceDelegate
Dependencies
OlaMapNavigationSDK is dependent on following Dependencies