Please refer to theGithub Sample Appfor getting better clarity on same.
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,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
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.
If you want to show the annoattion on the map you can use CustomAnnotationView andsetAnnotationMarker
You can remove a marker from the map by calling this method removeAnnotation.
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:
Polylines allow you to draw lines on the map. The below example demonstrates how to draw a polyline.
We can listen to 2 types of event
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:
Using the OlaMapServiceDelegate, you can listen when map region changes. Gesture param with it signifies the reason for change
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 |
To enable navigation, you must supply route data to the navigation service. This data can be obtained from the Direction Service.
Please refer to theAPI documentationfor further details.
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
Once navigation has been started it can be terminated any time using following api
You can listen to navigation events using the OlaMapNavigationServiceDelegate protocol. Below is an example:
Once Navigation starts, user will get callbacks depending on journey progress he is making
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
OlaMapNavigationSDK is dependent on following Dependencies