The MapplsDrivingRangePlugin allows you to plot driving range area to drive based on time or distance on Mappls's vector map component.
The plugin offers the following basic functionalities:
-
Get and Plot driving range as polygon on map.
-
Update driving range on map.
-
Clear already plotted driving range on map.
This can be done by following simple steps.
Step 1:-
To add a package dependency to your Xcode project, select File > Swift Packages > Add Package Dependency and enter its repository URL. See Adding Package Dependencies to Your App.
Version | Dated | Description |
---|---|---|
2.0.0 |
10 Jun 2025 | - Updated minimum iOS deployment target to 13.0 - Authentication and authorization mechanisms have been revised. |
--- | --- | --- |
1.0.2 |
29 Jun, 2023 | API wrappers are moved to MapplsAPIKit and so minimum dependency changed. |
1.0.1 |
08 Jul, 2022 | Issue fixed where SDK was not compatible to Xcode 13+. MapplsDrivingRangePlugin is renamed to MapplsDrivingRange and Protocol class MapplsDrivingRangePluginDelegate is renamed to MapplsDrivingRangeDelegate . |
1.0.0 |
14 Jun, 2022 | Initial MAPPLS release. |
This library depends upon several Mappls's own libraries. All dependent libraries will be automatically installed using CocoaPods.
Below are list of dependcies which are required to run this SDK:
It is required to set Mappls keys to use any MAPPL's SDK. Please refer the documenatation here.
Step 2:-
MapplsDrivingRange
is the main class which is need to initialize to use different functionality of plugin. It requires an instance of MapplsMapView.
It allows you to plot driving range area to drive based on time or distance.
var drivingRangePlugin = MapplsDrivingRange(mapView: self.mapView)
self.drivingRangePlugin.delegate = self // optional
Step 3:-
A function getAndPlotDrivingRange
of instance of MapplsDrivingRange
will be used to get driving range and plot on map. This function will accept an instance of MapplsDrivingRangeOptions
as request to get driving range.
Below is code for reference:
let location = CLLocation(latitude: 28.551060, longitude: 77.268989)
let contours = [MapplsDrivingRangeContours(value: 2)]
let rangeInfo = MapplsDrivingRangeRangeTypeInfo(rangeType: .distance, contours: contours)
let drivingRangeOptions = MapplsDrivingRangeOptions(location: location, rangeTypeInfo: rangeInfo)
self.drivingRangePlugin.getAndPlotDrivingRange(options: drivingRangeOptions)
Plotted driving range on Map can be removed by calling function clearDrivingRangeFromMap
.
Below is line of code to use it:
drivingRangePlugin.clearDrivingRangeFromMap()
Plotted driving range on map can be upated by calling function getAndPlotDrivingRange
again with new request object (instance of MapplsDrivingRangeOptions).
Below is some code for reference:
let location = CLLocation(latitude: 28.612972, longitude: 77.233529)
let contours = [MapplsDrivingRangeContour(value: 15)]
let rangeInfo = MapplsDrivingRangeRangeTypeInfo(rangeType: .time, contours: contours)
let speedInfo = MapplsDrivingRangeOptimalSpeed()
let drivingRangeOptions = MapplsDrivingRangeOptions(location: location, rangeTypeInfo: rangeInfo, speedTypeInfo: speedInfo)
self.drivingRangePlugin.getAndPlotDrivingRange(options: drivingRangeOptions)
It is a protocol class which provides different callbacks of events of MapplsDrivingRange
.
Below are different callback functions avaialble:
Called when the plugin fails to get and plot driving range.
DECLARATION
optional func drivingRange(_ plugin: MapplsDrivingRange, didFailToGetAndPlotDrivingRange error: Error)
PARAMETERS
-
plugin:- The plugin that has calculated a driving range.
-
error:- An error raised during the process of obtaining a new route.
Called when the plugin succeed to get and plot driving range on map.
DECLARATION
@objc optional func drivingRangeDidSuccessToGetAndPlotDrivingRange(_ plugin: MapplsDrivingRange)
PARAMETERS
- plugin:- The plugin that has calculated a driving range.
For any queries and support, please contact:
Email us at [email protected]
Support
Need support? contact us!