Skip to content

Latest commit

 

History

History
112 lines (68 loc) · 4.01 KB

MapmyIndia-Safety-Strip.md

File metadata and controls

112 lines (68 loc) · 4.01 KB

MapmyIndia APIs

Guide - Show COVID-19 Safety Status on MapmyIndia's Map

It is a guide to display a user's safety status for COVID-19 on a map. It will show whether user is in a containment zone or not if yes how much is distance from current location.

Following this guide it will be possible to display user's safety status on MapmyIndia's Map[1] in the form of a safety strip depending upon the user's current location. MapmyIndiaMaps SDK for iOS is SDK to display map on iOS platform.

A method need to be called to check safety status. SDK has inbuild view with button which can be used to call that method.

A sample application project can be found on github by following link: iOS MapDemo.

Note This fetatue is available from version 5.7.8 of MapmyIndiaMaps SDK.

After loading of MapmyIndia's Map[1], a mthod can be called to get safety status. showCurrentLocationSafety is the method which helps to find user's safety status. On successfully fetching of status a safety strip will be shown on map.

Objective-C
[_mapView showCurrentLocationSafety];
Swift
mapView.showCurrentLocationSafety()

Note: showCurrentLocationSafety will only works if user's location is available. So best practice to call this function when map is ready to show user's location. A delegate method didUpdateUserLocation of map SDK can be used to check when map is ready to show user location.

On successfully receiving status based on location from server, a view will be shown on map with safety information like distance, containment zone location etc. By default its position will be on top of map.

By default safety status strip will be shown on top of map. But its position can be changed by property safetyStripPosition which is of type MGLOrnamentPosition.

Objective-C
[_mapView setSafetyStripPosition:MGLOrnamentPositionBottomLeft];
Swift
mapView.safetyStripPosition = .bottomLeft

By default margins of safety status is zero. But margins can be set by property safetyStripMargins which is of type CGPoint.

Objective-C
[_mapView setSafetyStripMargins:CGPointMake(0, 30)];
Swift
mapView.safetyStripMargins = CGPoint(x: 0, y: 30)

Safety Strip can be hidden from map by calling method hideSafetyStrip.

Objective-C
[_mapView hideSafetyStrip];
Swift
mapView.hideSafetyStrip()

A MapmyIndia's map component which is part of MapmyIndiaMaps SDK for iOS.

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