diff --git a/Podfile b/Podfile index 05eaa2c..99a1d99 100644 --- a/Podfile +++ b/Podfile @@ -6,7 +6,7 @@ target 'MapplsSDKDemo' do use_frameworks! pod 'IQKeyboardManagerSwift' pod 'MapplsAPICore', '1.0.7' - pod 'MapplsAPIKit/Base', '2.0.15' + pod 'MapplsAPIKit/Base', '2.0.16' pod 'MapplsMap/Base', '5.13.9' pod 'MapplsFeedbackKit/Base', '1.0.0' pod 'MapplsFeedbackUIKit/Base', '1.0.0' @@ -15,6 +15,6 @@ target 'MapplsSDKDemo' do pod 'MapplsNearbyUI/Base', '1.0.1' pod 'MapplsGeofenceUI/Base', '1.0.1' pod 'MapplsGeoanalytics/Base', '1.0.0' - pod 'MapplsDrivingRangePlugin/Base', '1.0.1' + pod 'MapplsDrivingRangePlugin/Base', '1.0.2' pod 'MapplsRasterCatalogue/Base', '0.1.0' end diff --git a/README.md b/README.md index 2407133..3ceac80 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@ You can get your api key to be used in this document here: [https://apis.mappls. | Version | Supported SDK Version | | ------- | --------------------- | +| [v1.0.13](./docs/v1.0.13/README.md) | - [MapplsAPICore - 1.0.7](./docs/v1.0.13/MapplsAPICore.md)
- [MapplsAPIKit - 2.0.16](./docs/v1.0.13/MapplsAPIKit.md)
- [MappplsMap - 5.13.9](./docs/v1.0.13/MapplsMap.md#Vector-iOS-Map)
- [MapplsUIWidget - 1.0.3](./docs/v1.0.13/MapplsUIWidgets.md)
- [MapplsNearbyUI - 1.0.0](./docs/v1.0.13/MapplsNearbyUI.md)
- [MapplsDirectionUI - 1.0.4](./docs/v1.0.13/MapplsDirectionUI.md)
- [MapplsGeoanalytics - 1.0.0](./docs/v1.0.13/MapplsGeoanalytics.md)
- [MapplsFeedbackKit - 1.0.0](./docs/v1.0.13/MapplsFeedbackKit.md)
- [MapplsFeedbackUIKit - 1.0.0](./docs/v1.0.13/MapplsFeedbackUIKit.md)
- [MapplsDrivingRangePlugin - 1.0.2](./docs/v1.0.13/MapplsDrivingRangePlugin.md)
- [MapplsAnnotationExtension - 1.0.0](./docs/v1.0.13/MapplsAnnotationExtension.md)
- [MapplsGeofenceUI - 1.0.1](./docs/v1.0.13/MapplsGeofenceUI.md)
- [MapplsRasterCatalogue - 0.1.0](./docs/v1.0.13/RasterCatalouge.md)
- [MapplsIntouch - 1.0.1](./docs/v1.0.13/MapplsIntouch.md)| | [v1.0.12](./docs/v1.0.12/README.md) | - [MapplsAPICore - 1.0.7](./docs/v1.0.12/MapplsAPICore.md)
- [MapplsAPIKit - 2.0.15](./docs/v1.0.12/MapplsAPIKit.md)
- [MappplsMap - 5.13.9](./docs/v1.0.12/MapplsMap.md#Vector-iOS-Map)
- [MapplsUIWidget - 1.0.3](./docs/v1.0.12/MapplsUIWidgets.md)
- [MapplsNearbyUI - 1.0.0](./docs/v1.0.12/MapplsNearbyUI.md)
- [MapplsDirectionUI - 1.0.4](./docs/v1.0.12/MapplsDirectionUI.md)
- [MapplsGeoanalytics - 1.0.0](./docs/v1.0.12/MapplsGeoanalytics.md)
- [MapplsFeedbackKit - 1.0.0](./docs/v1.0.12/MapplsFeedbackKit.md)
- [MapplsFeedbackUIKit - 1.0.0](./docs/v1.0.12/MapplsFeedbackUIKit.md)
- [MapplsDrivingRangePlugin - 1.0.1](./docs/v1.0.12/MapplsDrivingRangePlugin.md)
- [MapplsAnnotationExtension - 1.0.0](./docs/v1.0.12/MapplsAnnotationExtension.md)
- [MapplsGeofenceUI - 1.0.1](./docs/v1.0.12/MapplsGeofenceUI.md)
- [MapplsRasterCatalogue - 0.1.0](./docs/v1.0.12/RasterCatalouge.md)
- [MapplsIntouch - 1.0.1](./docs/v1.0.12/MapplsIntouch.md)| -| [v1.0.11](./docs/v1.0.11/README.md) | - [MapplsAPICore - 1.0.7](./docs/v1.0.11/MapplsAPICore.md)
- [MapplsAPIKit - 2.0.15](./docs/v1.0.11/MapplsAPIKit.md)
- [MappplsMap - 5.13.9](./docs/v1.0.11/MapplsMap.md#Vector-iOS-Map)
- [MapplsUIWidget - 1.0.3](./docs/v1.0.11/MapplsUIWidgets.md)
- [MapplsNearbyUI - 1.0.0](./docs/v1.0.11/MapplsNearbyUI.md)
- [MapplsDirectionUI - 1.0.3](./docs/v1.0.11/MapplsDirectionUI.md)
- [MapplsGeoanalytics - 1.0.0](./docs/v1.0.11/MapplsGeoanalytics.md)
- [MapplsFeedbackKit - 1.0.0](./docs/v1.0.11/MapplsFeedbackKit.md)
- [MapplsFeedbackUIKit - 1.0.0](./docs/v1.0.11/MapplsFeedbackUIKit.md)
- [MapplsDrivingRangePlugin - 1.0.1](./docs/v1.0.11/MapplsDrivingRangePlugin.md)
- [MapplsAnnotationExtension - 1.0.0](./docs/v1.0.11/MapplsAnnotationExtension.md)
- [MapplsGeofenceUI - 1.0.1](./docs/v1.0.11/MapplsGeofenceUI.md)
- [MapplsRasterCatalogue - 0.1.0](./docs/v1.0.11/RasterCatalouge.md)
- [MapplsIntouch - 1.0.1](./docs/v1.0.11/MapplsIntouch.md)| . . . . . . @@ -24,87 +24,87 @@ For More History Go Here: [Version History](./Version-History.md) Reference to the documentation of Previous SDK versions [here](https://github.com/mappls-api/mapmyindia-maps-vectorSDK-iOS) ## [Table Of Content](#Table-Of-Content) -- [Mappls API Core](./docs/v1.0.12/MapplsAPICore.md)[](#Mappls-API-Core) - -- [Mappls API Kit](./docs/v1.0.12/MapplsAPIKit.md) - * [Autosuggest API](./docs/v1.0.12/MapplsAPIKit.md#Autosuggest-API) - * [Reverse Geocode API](./docs/v1.0.12/MapplsAPIKit.md#Reverse-Geocoding-API) - * [Nearby API](./docs/v1.0.12/MapplsAPIKit.md#Nearby-API) - * [Place Detail](./docs/v1.0.12/MapplsAPIKit.md#Place-Detail) - * [Geocode API](./docs/v1.0.12/MapplsAPIKit.md#Geocoding-API) - * [Routing API](./docs/v1.0.12/MapplsAPIKit.md#Routing-API) - * [Driving Distance - Time Matrix API](./docs/v1.0.12/MapplsAPIKit.md#Driving-Distance-Time-Matrix-API) - * [POI Along The Route](./docs/v1.0.12/MapplsAPIKit.md#POI-Along-The-Route-API) - * [Nearby Reports API](./docs/v1.0.12/MapplsAPIKit.md#Nearby-Reports-API) - * [Current Weather Condition API](./docs/v1.0.12/MapplsAPIKit.md#Current-Weather-Condition-API) - * [Trip Cost Estimation API](./docs/v1.0.12/MapplsAPIKit.md#Trip-Cost-Estimation-API) - -- [Set Country Regions](./docs/v1.0.12/Regions.md) +- [Mappls API Core](./docs/v1.0.13/MapplsAPICore.md)[](#Mappls-API-Core) + +- [Mappls API Kit](./docs/v1.0.13/MapplsAPIKit.md) + * [Autosuggest API](./docs/v1.0.13/MapplsAPIKit.md#Autosuggest-API) + * [Reverse Geocode API](./docs/v1.0.13/MapplsAPIKit.md#Reverse-Geocoding-API) + * [Nearby API](./docs/v1.0.13/MapplsAPIKit.md#Nearby-API) + * [Place Detail](./docs/v1.0.13/MapplsAPIKit.md#Place-Detail) + * [Geocode API](./docs/v1.0.13/MapplsAPIKit.md#Geocoding-API) + * [Routing API](./docs/v1.0.13/MapplsAPIKit.md#Routing-API) + * [Driving Distance - Time Matrix API](./docs/v1.0.13/MapplsAPIKit.md#Driving-Distance-Time-Matrix-API) + * [POI Along The Route](./docs/v1.0.13/MapplsAPIKit.md#POI-Along-The-Route-API) + * [Nearby Reports API](./docs/v1.0.13/MapplsAPIKit.md#Nearby-Reports-API) + * [Current Weather Condition API](./docs/v1.0.13/MapplsAPIKit.md#Current-Weather-Condition-API) + * [Trip Cost Estimation API](./docs/v1.0.13/MapplsAPIKit.md#Trip-Cost-Estimation-API) + +- [Set Country Regions](./docs/v1.0.13/Regions.md) - [Country List](https://github.com/mappls-api/mapmyindia-rest-api/blob/master/docs/countryISO.md) -- [Mappls Map](./docs/v1.0.12/MapplsMap.md#Vector-iOS-Map) - * [Getting Started](./docs/v1.0.12/MapplsMap.md#Getting-Started) - * [Setup your Project](./docs/v1.0.12/MapplsMap.md#Setup-your-Project) - * [Usage](./docs/v1.0.12/MapplsMap.md#Usage) - * [Add a Mappls Map View](./docs/v1.0.12/MapplsMap.md#Add-a-Mappls-Map-View) - * [SwiftUI](./docs/v1.0.12/MapplsMap.md#SwiftUI) - * [Map Interactions](./docs/v1.0.12/MapplsMap.md#Map-Interactions) - * [Map Features](./docs/v1.0.12/MapplsMap.md#Map-Features) - * [Map Events](./docs/v1.0.12/MapplsMap.md#Map-Events) - * [Map Overlays](./docs/v1.0.12/MapplsMap.md#Map-Overlays) - * [Polylines](./docs/v1.0.12/MapplsMap.md#Polylines) - * [Polygons](./docs/v1.0.12/MapplsMap.md#Polygons) - * [Map Camera](./docs/v1.0.12/MapplsMap.md#Map-Camera) - * [Miscellaneous](./docs/v1.0.12/MapplsMap.md#Miscellaneous) - * [Cluster Based Authentication](./docs/v1.0.12/MapplsMap.md#Cluster-Based-Authentication) - -- [Mappls Pin Strategy - Mappls Map](./docs/v1.0.12/MapplsPinStrategy.md) - -- [Mappls Map Styles - Mappls Map](./docs/v1.0.12/MapplsMapStyle.md) - -- [Interactive Layers - Mappls Map](./docs/v1.0.12/InteractiveLayers.md) - -- [Traffic Vector Tiles Overlay - Mappls Map](./docs/v1.0.12/MapplsTrafficVectorTileOverlay.md) - -- [Mappls UI Widgets](./docs/v1.0.12/MapplsUIWidgets.md) - - [Introduction](./docs/v1.0.12/MapplsUIWidgets.md#Introduction) - - [Installation](./docs/v1.0.12/MapplsUIWidgets.md#Installation) - - [Version History](./docs/v1.0.12/MapplsUIWidgets.md#Version-History) - - [Autocomplete](./docs/v1.0.12/MapplsUIWidgets.md#Autocomplete) - - [SwiftUI](./docs/v1.0.12/MapplsUIWidgets.md#SwiftUI-Full-Screen-Control) - - [Place Picker View](./docs/v1.0.12/MapplsUIWidgets.md#Place-Picker-View) - - [Autocomplete Attribution Appearance](./docs/v1.0.12/MapplsUIWidgets.md#Autocomplete-Attribution-Appearance) - -- [Mappls Nearby UI](./docs/v1.0.12/MapplsNearbyUI.md) - - [Introduction](./docs/v1.0.12/MapplsNearbyUI.md#Introduction) - - [Installation](./docs/v1.0.12/MapplsNearbyUI.md#Installation) - - [Version History](./docs/v1.0.12/MapplsNearbyUI.md#Version-History) - - [Launching with default configuration](./docs/v1.0.12/MapplsNearbyUI.md#Launching-with-default-configuration) - - [MapplsNearbyCategoriesViewControllerDelegate](./docs/v1.0.12/MapplsNearbyUI.md#MapplsNearbyCategoriesViewControllerDelegate) - -- [Mappls Direction UI Widget](./docs/v1.0.12/MapplsDirectionUI.md) - - [Introduction](./docs/v1.0.12/MapplsDirectionUI.md#Introduction) - - [Installation](./docs/v1.0.12/MapplsDirectionUI.md#Installation) - - [Version History](./docs/v1.0.12/MapplsDirectionUI.md#Version-History) - - [Usage](./docs/v1.0.12/MapplsDirectionUI.md#Usage) - - [MapplsDirectionsViewController](./docs/v1.0.12/MapplsDirectionUI.md#MapplsDirectionsViewController) - -- [Mappls Geoanalytics](./docs/v1.0.12/MapplsGeoanalytics.md) - -- [Mappls Feedback Kit](./docs/v1.0.12/MapplsFeedbackKit.md) - -- [Mappls Feedback UI Kit](./docs/v1.0.12/MapplsFeedbackUIKit.md) - -- [Mappls Raster Catalogue Plugin](./docs/v1.0.12/RasterCatalouge.md) - -- [Mappls Driving Range plugin](./docs/v1.0.12/MapplsDrivingRangePlugin.md) - - [Introduction](./docs/v1.0.12/MapplsDrivingRangePlugin.md#Introduction) - - [Installation](./docs/v1.0.12/MapplsDrivingRangePlugin.md#Installation) - - [Version History](./docs/v1.0.12/MapplsDrivingRangePlugin.md#Version-History) - -- [Mappls Annotation Extension](./docs/v1.0.12/MapplsAnnotationExtension.md) - -- [Mappls Geofence UI Plugin](./docs/v1.0.12/MapplsGeofenceUI.md) +- [Mappls Map](./docs/v1.0.13/MapplsMap.md#Vector-iOS-Map) + * [Getting Started](./docs/v1.0.13/MapplsMap.md#Getting-Started) + * [Setup your Project](./docs/v1.0.13/MapplsMap.md#Setup-your-Project) + * [Usage](./docs/v1.0.13/MapplsMap.md#Usage) + * [Add a Mappls Map View](./docs/v1.0.13/MapplsMap.md#Add-a-Mappls-Map-View) + * [SwiftUI](./docs/v1.0.13/MapplsMap.md#SwiftUI) + * [Map Interactions](./docs/v1.0.13/MapplsMap.md#Map-Interactions) + * [Map Features](./docs/v1.0.13/MapplsMap.md#Map-Features) + * [Map Events](./docs/v1.0.13/MapplsMap.md#Map-Events) + * [Map Overlays](./docs/v1.0.13/MapplsMap.md#Map-Overlays) + * [Polylines](./docs/v1.0.13/MapplsMap.md#Polylines) + * [Polygons](./docs/v1.0.13/MapplsMap.md#Polygons) + * [Map Camera](./docs/v1.0.13/MapplsMap.md#Map-Camera) + * [Miscellaneous](./docs/v1.0.13/MapplsMap.md#Miscellaneous) + * [Cluster Based Authentication](./docs/v1.0.13/MapplsMap.md#Cluster-Based-Authentication) + +- [Mappls Pin Strategy - Mappls Map](./docs/v1.0.13/MapplsPinStrategy.md) + +- [Mappls Map Styles - Mappls Map](./docs/v1.0.13/MapplsMapStyle.md) + +- [Interactive Layers - Mappls Map](./docs/v1.0.13/InteractiveLayers.md) + +- [Traffic Vector Tiles Overlay - Mappls Map](./docs/v1.0.13/MapplsTrafficVectorTileOverlay.md) + +- [Mappls UI Widgets](./docs/v1.0.13/MapplsUIWidgets.md) + - [Introduction](./docs/v1.0.13/MapplsUIWidgets.md#Introduction) + - [Installation](./docs/v1.0.13/MapplsUIWidgets.md#Installation) + - [Version History](./docs/v1.0.13/MapplsUIWidgets.md#Version-History) + - [Autocomplete](./docs/v1.0.13/MapplsUIWidgets.md#Autocomplete) + - [SwiftUI](./docs/v1.0.13/MapplsUIWidgets.md#SwiftUI-Full-Screen-Control) + - [Place Picker View](./docs/v1.0.13/MapplsUIWidgets.md#Place-Picker-View) + - [Autocomplete Attribution Appearance](./docs/v1.0.13/MapplsUIWidgets.md#Autocomplete-Attribution-Appearance) + +- [Mappls Nearby UI](./docs/v1.0.13/MapplsNearbyUI.md) + - [Introduction](./docs/v1.0.13/MapplsNearbyUI.md#Introduction) + - [Installation](./docs/v1.0.13/MapplsNearbyUI.md#Installation) + - [Version History](./docs/v1.0.13/MapplsNearbyUI.md#Version-History) + - [Launching with default configuration](./docs/v1.0.13/MapplsNearbyUI.md#Launching-with-default-configuration) + - [MapplsNearbyCategoriesViewControllerDelegate](./docs/v1.0.13/MapplsNearbyUI.md#MapplsNearbyCategoriesViewControllerDelegate) + +- [Mappls Direction UI Widget](./docs/v1.0.13/MapplsDirectionUI.md) + - [Introduction](./docs/v1.0.13/MapplsDirectionUI.md#Introduction) + - [Installation](./docs/v1.0.13/MapplsDirectionUI.md#Installation) + - [Version History](./docs/v1.0.13/MapplsDirectionUI.md#Version-History) + - [Usage](./docs/v1.0.13/MapplsDirectionUI.md#Usage) + - [MapplsDirectionsViewController](./docs/v1.0.13/MapplsDirectionUI.md#MapplsDirectionsViewController) + +- [Mappls Geoanalytics](./docs/v1.0.13/MapplsGeoanalytics.md) + +- [Mappls Feedback Kit](./docs/v1.0.13/MapplsFeedbackKit.md) + +- [Mappls Feedback UI Kit](./docs/v1.0.13/MapplsFeedbackUIKit.md) + +- [Mappls Raster Catalogue Plugin](./docs/v1.0.13/RasterCatalouge.md) + +- [Mappls Driving Range plugin](./docs/v1.0.13/MapplsDrivingRangePlugin.md) + - [Introduction](./docs/v1.0.13/MapplsDrivingRangePlugin.md#Introduction) + - [Installation](./docs/v1.0.13/MapplsDrivingRangePlugin.md#Installation) + - [Version History](./docs/v1.0.13/MapplsDrivingRangePlugin.md#Version-History) + +- [Mappls Annotation Extension](./docs/v1.0.13/MapplsAnnotationExtension.md) + +- [Mappls Geofence UI Plugin](./docs/v1.0.13/MapplsGeofenceUI.md)


diff --git a/Version-History.md b/Version-History.md index 2f66b31..b781795 100644 --- a/Version-History.md +++ b/Version-History.md @@ -6,6 +6,7 @@ | Version | Supported SDK Version | | ------- | --------------------- | +| [v1.0.13](./docs/v1.0.13/README.md) | - [MapplsAPICore - 1.0.7](./docs/v1.0.13/MapplsAPICore.md)
- [MapplsAPIKit - 2.0.16](./docs/v1.0.13/MapplsAPIKit.md)
- [MappplsMap - 5.13.9](./docs/v1.0.13/MapplsMap.md#Vector-iOS-Map)
- [MapplsUIWidget - 1.0.3](./docs/v1.0.13/MapplsUIWidgets.md)
- [MapplsNearbyUI - 1.0.0](./docs/v1.0.13/MapplsNearbyUI.md)
- [MapplsDirectionUI - 1.0.4](./docs/v1.0.13/MapplsDirectionUI.md)
- [MapplsGeoanalytics - 1.0.0](./docs/v1.0.13/MapplsGeoanalytics.md)
- [MapplsFeedbackKit - 1.0.0](./docs/v1.0.13/MapplsFeedbackKit.md)
- [MapplsFeedbackUIKit - 1.0.0](./docs/v1.0.13/MapplsFeedbackUIKit.md)
- [MapplsDrivingRangePlugin - 1.0.2](./docs/v1.0.13/MapplsDrivingRangePlugin.md)
- [MapplsAnnotationExtension - 1.0.0](./docs/v1.0.13/MapplsAnnotationExtension.md)
- [MapplsGeofenceUI - 1.0.1](./docs/v1.0.13/MapplsGeofenceUI.md)
- [MapplsRasterCatalogue - 0.1.0](./docs/v1.0.13/RasterCatalouge.md)
- [MapplsIntouch - 1.0.1](./docs/v1.0.13/MapplsIntouch.md)| | [v1.0.12](./docs/v1.0.12/README.md) | - [MapplsAPICore - 1.0.7](./docs/v1.0.12/MapplsAPICore.md)
- [MapplsAPIKit - 2.0.15](./docs/v1.0.12/MapplsAPIKit.md)
- [MappplsMap - 5.13.9](./docs/v1.0.12/MapplsMap.md#Vector-iOS-Map)
- [MapplsUIWidget - 1.0.3](./docs/v1.0.12/MapplsUIWidgets.md)
- [MapplsNearbyUI - 1.0.0](./docs/v1.0.12/MapplsNearbyUI.md)
- [MapplsDirectionUI - 1.0.4](./docs/v1.0.12/MapplsDirectionUI.md)
- [MapplsGeoanalytics - 1.0.0](./docs/v1.0.12/MapplsGeoanalytics.md)
- [MapplsFeedbackKit - 1.0.0](./docs/v1.0.12/MapplsFeedbackKit.md)
- [MapplsFeedbackUIKit - 1.0.0](./docs/v1.0.12/MapplsFeedbackUIKit.md)
- [MapplsDrivingRangePlugin - 1.0.1](./docs/v1.0.12/MapplsDrivingRangePlugin.md)
- [MapplsAnnotationExtension - 1.0.0](./docs/v1.0.12/MapplsAnnotationExtension.md)
- [MapplsGeofenceUI - 1.0.1](./docs/v1.0.12/MapplsGeofenceUI.md)
- [MapplsRasterCatalogue - 0.1.0](./docs/v1.0.12/RasterCatalouge.md)
- [MapplsIntouch - 1.0.1](./docs/v1.0.12/MapplsIntouch.md)| | [v1.0.11](./docs/v1.0.11/README.md) | - [MapplsAPICore - 1.0.7](./docs/v1.0.11/MapplsAPICore.md)
- [MapplsAPIKit - 2.0.15](./docs/v1.0.11/MapplsAPIKit.md)
- [MappplsMap - 5.13.9](./docs/v1.0.11/MapplsMap.md#Vector-iOS-Map)
- [MapplsUIWidget - 1.0.3](./docs/v1.0.11/MapplsUIWidgets.md)
- [MapplsNearbyUI - 1.0.0](./docs/v1.0.11/MapplsNearbyUI.md)
- [MapplsDirectionUI - 1.0.3](./docs/v1.0.11/MapplsDirectionUI.md)
- [MapplsGeoanalytics - 1.0.0](./docs/v1.0.11/MapplsGeoanalytics.md)
- [MapplsFeedbackKit - 1.0.0](./docs/v1.0.11/MapplsFeedbackKit.md)
- [MapplsFeedbackUIKit - 1.0.0](./docs/v1.0.11/MapplsFeedbackUIKit.md)
- [MapplsDrivingRangePlugin - 1.0.1](./docs/v1.0.11/MapplsDrivingRangePlugin.md)
- [MapplsAnnotationExtension - 1.0.0](./docs/v1.0.11/MapplsAnnotationExtension.md)
- [MapplsGeofenceUI - 1.0.1](./docs/v1.0.11/MapplsGeofenceUI.md)
- [MapplsRasterCatalogue - 0.1.0](./docs/v1.0.11/RasterCatalouge.md)
- [MapplsIntouch - 1.0.1](./docs/v1.0.11/MapplsIntouch.md)| | [v1.0.10](./docs/v1.0.10/README.md) | - [MapplsAPICore - 1.0.6](./docs/v1.0.10/MapplsAPICore.md)
- [MapplsAPIKit - 2.0.14](./docs/v1.0.10/MapplsAPIKit.md)
- [MappplsMap - 5.13.8](./docs/v1.0.10/MapplsMap.md#Vector-iOS-Map)
- [MapplsUIWidget - 1.0.3](./docs/v1.0.10/MapplsUIWidgets.md)
- [MapplsNearbyUI - 1.0.0](./docs/v1.0.10/MapplsNearbyUI.md)
- [MapplsDirectionUI - 1.0.3](./docs/v1.0.10/MapplsDirectionUI.md)
- [MapplsGeoanalytics - 1.0.0](./docs/v1.0.10/MapplsGeoanalytics.md)
- [MapplsFeedbackKit - 1.0.0](./docs/v1.0.10/MapplsFeedbackKit.md)
- [MapplsFeedbackUIKit - 1.0.0](./docs/v1.0.10/MapplsFeedbackUIKit.md)
- [MapplsDrivingRangePlugin - 1.0.1](./docs/v1.0.10/MapplsDrivingRangePlugin.md)
- [MapplsAnnotationExtension - 1.0.0](./docs/v1.0.10/MapplsAnnotationExtension.md)
- [MapplsGeofenceUI - 1.0.1](./docs/v1.0.10/MapplsGeofenceUI.md)
- [MapplsRasterCatalogue - 0.1.0](./docs/v1.0.10/RasterCatalouge.md)
- [MapplsIntouch - 1.0.1](./docs/v1.0.10/MapplsIntouch.md)| diff --git a/docs/v1.0.13/CHANGELOG/MapplsAPICore.md b/docs/v1.0.13/CHANGELOG/MapplsAPICore.md new file mode 100644 index 0000000..6f1a2c7 --- /dev/null +++ b/docs/v1.0.13/CHANGELOG/MapplsAPICore.md @@ -0,0 +1,45 @@ +# Changes to the MapplsAPICore SDK for iOS + +## 1.0.7 - 07 Jun, 2023 + +### Changed +- Bug fixes & Improvements. + +## 1.0.6 - 30 May, 2023 + +### Changed +- Domain of APIs changed. + +### Fixed +- Bug fixes. + +## 1.0.5 - 30 Jan, 2023 + +### Changed +- Error code opimization for initializing Map. + +## 1.0.4 - 09 Dec, 2022 + +### Changed +- A custom property `modelName` of extension `UIDevice` is made public. + +## 1.0.3 - 13 Oct, 2022 + +### Changed +- Timeout interval is reduced for some of APIs to improve performance. +- A new enum `MapplsRawInfoType` is added. + +## 1.0.2 - 23 Aug, 2022 + +### Fixed +- Fixed a crash while using `MapplsTokenAuthenticationAPISharedManager` in `MapplsLicenseInterceptor` class. + +## 1.0.1 - 17 Aug, 2022 + +### Added +- Introduced a property `isEnableLogging` In MapplsAccountManager +- On the based of Who am i respose region is set in MapplsAccountManage. + +## 1.0.0 - 10 June, 2022 + +Initial version of `MapplsAPICore`. \ No newline at end of file diff --git a/docs/v1.0.13/CHANGELOG/MapplsAPIKit.md b/docs/v1.0.13/CHANGELOG/MapplsAPIKit.md new file mode 100644 index 0000000..27e064b --- /dev/null +++ b/docs/v1.0.13/CHANGELOG/MapplsAPIKit.md @@ -0,0 +1,129 @@ +# Changes to the MapplsAPIKit SDK for iOS + +## 2.0.16 - 27 Jun, 2023 + +### Added +- Driving Range API wrapper is added. + +### Changed +- In routing api correct the value of direction profile for trucking. +- Some improvements. + +## 2.0.15 - 07 Jun, 2023 + +### Changed +- Bug fixes & Improvements. + +## 2.0.14 - 30 May, 2023 + +### Changed +- Domain of APIs changed. +- In APIs of Distance Matrix and Reverse Geocode authentication process is changed. + +### Fixed +- Bug Fixes. + +## 2.0.13 - 2 May, 2023 + +### Added +- Added `responseLanguage` request parameter in AtlasOptions class. +- Added `path` parameter in the direction init meathod. +- Added `instructions` in request paramter of direction api. +- Added `language` in request paramter of reverseGocode api. + +### Fixed +- Fixed mappls length formator. + +## 2.0.12 - 9 Feb, 2023 + +### Added +- Added Fuel Cost api in MapplsAPIKit. + +### Fixed +- Fixed an issue in api call for costEstimation. + +## 2.0.11 - 9 Feb, 2023 + +### Fixed +- Fixed an issue in api call for costEstimation. + +## 2.0.10 - 30 Jan, 2023 + +### Changed +- Error code opimization for initializing Map. + +## 2.0.9 - 02 Jan, 2023 + +### Added +- API wrapper added to get cost of tolls etc which can be consumed by Manager class `MapplsCostEstimationManager` and request class `MapplsCostEstimationOptions`. + +## 2.0.8 - 09 Dec, 2022 + +### Fixed +- Issue of incorrect `Lanes` is fixed. +- A bug of ETA refresh is fixed where driving profile was not dynamic based on route requested. +- Turf code is refactored. + +## 2.0.7 - 21 Oct, 2022 + +### Added +- Turf library related claasses are added. +- To get congestion delays for a route, a helper function `getCongestionDelays` added in class of MapplsDirectionUtility. + +### Fixed +- For some of API managers host was not setting correctly on passing programmatically. + +## 2.0.6 - 13 Oct, 2022 + +### Added +- A new property `richInfoDictionary` is added in response class of place detail request. +- As a new enum `MapplsRawInfoType` is added in Core SDK, A function `getRawInfo` is added in response class of place detail request to get specific dictionary object based on type. + +### Changed +- Timeout interval is reduced for some of APIs to improve performance. + +## 2.0.5 - 05 sept, 2022 + +### Added + +- Introduced MapplsWeatherAPI. + + +## 2.0.4 - 06 sept, 2022 + +### Added + +- added a userActivity and media in respnse of placeDetails apis. + +## 2.0.3 - 24 Aug, 2022 + +### Added + +- added a parameter to set host and scheme in init method of manager class. + +## 2.0.2 - 22 Aug, 2022 + +### Added + +- In response of Reverse Geocode `areaCode` is added. + +### Fixed + +- Fixed a crash while using sharedInstance of `MapplsDirection` class. + +## 2.0.1 - 05 Jul, 2022 + +### Added + +- In response of Reverse Geocode `Mappls Pin` is added. + +## 2.0.0 - 11 Jun, 2022 + +Initial version of `MapplsAPIKit`. + +**Changes Since last version released:** + +### Merged + +- Direction/Route API sdk is merged into this and upcoming updates no longer will be avaialable separately. +- Dependency of `MapplsAPICore` is added. \ No newline at end of file diff --git a/docs/v1.0.13/CHANGELOG/MapplsAnnotationExtension.md b/docs/v1.0.13/CHANGELOG/MapplsAnnotationExtension.md new file mode 100644 index 0000000..8a8b205 --- /dev/null +++ b/docs/v1.0.13/CHANGELOG/MapplsAnnotationExtension.md @@ -0,0 +1,7 @@ +# Changes to the MapplsAnnotationExtension SDK for iOS + +## 1.0.0 - 14 Jun, 2022 + +### Changed + +- Initial MAPPLS's release. diff --git a/docs/v1.0.13/CHANGELOG/MapplsDirectionUI.md b/docs/v1.0.13/CHANGELOG/MapplsDirectionUI.md new file mode 100644 index 0000000..4826656 --- /dev/null +++ b/docs/v1.0.13/CHANGELOG/MapplsDirectionUI.md @@ -0,0 +1,50 @@ +# Changes to the MapplsDirectionUI SDK for iOS + + +## 1.0.4 - 10 Jun, 2023 +### Added + +- UI issue fixed +- Added a delegate for favourates is added + + +## 1.0.3 - 03 May, 2023 +### Added + +- Added a retry UI on direction screen +- Added a delegate to provide option for route request + +### Fixed + +- Fixed UI on preview screen. + + +## 1.0.2 - 17 April, 2023 + +### Changed + +- added a parameter `viewController` of type `UIViewController` in a delegate function (didRequestForStartNavigation) of `MapplsDirectionViewController` + +### Added: + +- Added a overlay screen while requesting for route +- Some UI Enchancment +- Introduced a property `shouldShowTollCostEstimation` to show toll information its default value is `false` +- Introduced a property `shouldShowRouteReportSummary` to show routeReportSummary information, its default value is `false` +- Introduced a property `isShowCongestionDelayOnRoute` to show congestion delay information on route, its default value is `false` + +### Fixed +- Bug fixes and improvements. + +## 1.0.1 - 22 Jun, 2022 + +### Changed + +- Added Objective c support. and Added directionListDefault button. + +## 1.0.0 - 14 Jun, 2022 + +### Changed + +- Initial release as per Mappls branding. + \ No newline at end of file diff --git a/docs/v1.0.13/CHANGELOG/MapplsDrivingRangePlugin.md b/docs/v1.0.13/CHANGELOG/MapplsDrivingRangePlugin.md new file mode 100644 index 0000000..d94673a --- /dev/null +++ b/docs/v1.0.13/CHANGELOG/MapplsDrivingRangePlugin.md @@ -0,0 +1,20 @@ +# Changes to the MapplsDrivingRangePlugin for iOS + +## 1.0.2 - 29 Jun, 2023 + +#### Changed + +- API wrappers are moved to MapplsAPIKit and so minimum dependency changed. + +## 1.0.1 - 08 Jul, 2022 + +#### Changed + +- Issue fixed where SDK was not compatible to Xcode 13+. +- To fix above issue class `MapplsDrivingRangePlugin` is renamed to `MapplsDrivingRange` and Protocol class `MapplsDrivingRangePluginDelegate` is renamed to `MapplsDrivingRangeDelegate`. + +## 1.0.0 - 14 Jun, 2022 + +#### Changed + +- Initial MAPPLS's release. diff --git a/docs/v1.0.13/CHANGELOG/MapplsFeedbackKit.md b/docs/v1.0.13/CHANGELOG/MapplsFeedbackKit.md new file mode 100644 index 0000000..3946a0e --- /dev/null +++ b/docs/v1.0.13/CHANGELOG/MapplsFeedbackKit.md @@ -0,0 +1,5 @@ +# Changes to the MapplsFeedbackKit - SDK for iOS + +## 1.0.0 - 22 Jun, 2022 + +- Initial release. diff --git a/docs/v1.0.13/CHANGELOG/MapplsFeedbackUIKit.md b/docs/v1.0.13/CHANGELOG/MapplsFeedbackUIKit.md new file mode 100644 index 0000000..65ecdf8 --- /dev/null +++ b/docs/v1.0.13/CHANGELOG/MapplsFeedbackUIKit.md @@ -0,0 +1,5 @@ +# Changes to the MapplsFeedbackUIKit - SDK for iOS + +## 1.0.0 - 22 Jun, 2022 + +- Initial release. diff --git a/docs/v1.0.13/CHANGELOG/MapplsGeoanalytics.md b/docs/v1.0.13/CHANGELOG/MapplsGeoanalytics.md new file mode 100644 index 0000000..a8f2436 --- /dev/null +++ b/docs/v1.0.13/CHANGELOG/MapplsGeoanalytics.md @@ -0,0 +1,7 @@ +# Changes to the MapplsGeoanalytics SDK for iOS + +## 1.0.0 - 20 Jun, 2022 + +### Changed + +- Initial Mappls release. diff --git a/docs/v1.0.13/CHANGELOG/MapplsGeofenceUI.md b/docs/v1.0.13/CHANGELOG/MapplsGeofenceUI.md new file mode 100644 index 0000000..36e93ac --- /dev/null +++ b/docs/v1.0.13/CHANGELOG/MapplsGeofenceUI.md @@ -0,0 +1,13 @@ +# Changes to the MapplsGeofenceUI SDK for iOS + +## 1.0.1 - 01 Nov, 2022 + +### Changed + +- Bug fixes due to dependency of APIKit version 2.0.7 + +## 1.0.0 - 14 Jun, 2022 + +### Changed + +- Initial release as per Mappls branding. diff --git a/docs/v1.0.13/CHANGELOG/MapplsIntouch.md b/docs/v1.0.13/CHANGELOG/MapplsIntouch.md new file mode 100644 index 0000000..8154d6f --- /dev/null +++ b/docs/v1.0.13/CHANGELOG/MapplsIntouch.md @@ -0,0 +1,13 @@ +# Changes to the MapplsIntouch SDK for iOS + +## 1.0.1 - 24 Mar, 2023 + +### Fixes + +- Some fixes are done in result of `getDevices` and `getLocationsEvent`. + +## 1.0.0 - 30 Jan, 2023 + +### Changed + +- Initial MAPPLS release. \ No newline at end of file diff --git a/docs/v1.0.13/CHANGELOG/MapplsMap.md b/docs/v1.0.13/CHANGELOG/MapplsMap.md new file mode 100644 index 0000000..0db5597 --- /dev/null +++ b/docs/v1.0.13/CHANGELOG/MapplsMap.md @@ -0,0 +1,60 @@ +# Changes to the MapplsMap SDK for iOS + +## 5.13.9 - 07 Jun, 2023 + +### Changed +Bug fixes & Improvements. + +## 5.13.8 - 30 May, 2023 + +### Added +- Domain of APIs changed. + +## 5.13.7 - 02 May, 2023 + +### Optimization + +- Performance improvements and optimization. +- fixed retry handler. + +## 5.13.6 - 20 Mar, 2023 + +### Optimization + +- Performance improvements and optimization. + +## 5.13.5 - 31 Jan, 2023 + +### Added + +- A class `MapplsMapAuthenticator` can be used to initialize SDK using the method `initializeSDKSession`. + +## 5.13.4 - 13 Oct, 2022 + +### Added +- On tap of any label on map delegate function `didTapPlaceWithMapplsPin` will be called to return `mapplsPin`. + +### Changed +- An issue is fixed where tiles were not loading on initializing map at particular location. +- An issue is fixed where `didFinishLoadingStyle` function was calling two times on map initialization. +- Timeout interval is reduced for some of APIs to improve performance. + +## 5.13.3 - 08 Sep, 2022 + +An issue resolved where tiles were not loading on CarPlay when phone is in locked state. + +## 5.13.2 - 18 Aug, 2022 + +A Bug Resolved, session was not resetting if already a session is running. | + +## 5.13.1 - 20 Jul, 2022 + +### Changed + +- A Bug resolved of an error of "Duplicate bundle identifier of `MapmyIndiaAPIKit`" shows while uploading build on App Store. + +## 5.13.0 - 11 Jun, 2022 + +Initial version of `MapplsMap`. + +- Dependencies are `MapplsAPICore` and `MapplsAPIKit`. \ No newline at end of file diff --git a/docs/v1.0.13/CHANGELOG/MapplsNearbyUI.md b/docs/v1.0.13/CHANGELOG/MapplsNearbyUI.md new file mode 100644 index 0000000..7154d33 --- /dev/null +++ b/docs/v1.0.13/CHANGELOG/MapplsNearbyUI.md @@ -0,0 +1,13 @@ +# Changes to the MapplsNearbyUI SDK for iOS + +## 1.0.1 - 01 Nov, 2022 + +### Changed + +- Bug fixes due to dependency of APIKit version 2.0.7 + +## 1.0.0 - 14 June, 2022 + +### Changed + +- Initial MAPPLS's release with renaming. diff --git a/docs/v1.0.13/CHANGELOG/MapplsUIWidgets.md b/docs/v1.0.13/CHANGELOG/MapplsUIWidgets.md new file mode 100644 index 0000000..659bc81 --- /dev/null +++ b/docs/v1.0.13/CHANGELOG/MapplsUIWidgets.md @@ -0,0 +1,29 @@ +# Changes to the MapplsUIWidgets SDK for iOS + +## 1.0.3 - 02 June, 2023 + +### Added +- Added functionality to show favourites/custom places in Autosuggest Widget. +- Added callback for selected favourite item. + +### Changed + +- Callbacks are modified of selected place of autosuggest. One property `resultType` of type `MapplsAutosuggestResultType`is added in delegate function. See documentation for more details. + +## 1.0.2 - 02 May, 2023 + +### Added +- Added `debounceInterval` property in `MapplsAutocompleteViewController` class. its default value is `0` its value is in milisecond +- Added `responseLanguage` property in `MapplsAutocompleteFilter` class. + +## 1.0.1 - 03 sept, 2022 + +### Added +- Added `hyperLocal` property in `MapplsAutocompleteFilter` class. + +## 1.0.0 - 12 June, 2022 + +### Changed + +- Initial MAPPLS's release with renaming. +- One Dependency `MapplsAPICore` is added along with `MapplsAPIKit` and `MapplsMap`. diff --git a/docs/v1.0.13/InteractiveLayers.md b/docs/v1.0.13/InteractiveLayers.md new file mode 100644 index 0000000..a5c3da4 --- /dev/null +++ b/docs/v1.0.13/InteractiveLayers.md @@ -0,0 +1,250 @@ +[

](https://www.mapmyindia.com/api) + +# Interactive Layers Plugin - Mappls Map + +## [Introduction](#Introduction) + +It is a guide to display Interactive Layers(such as Covid WMS Layers) on Mappls's Map. + +In the current scenario, where social distancing is paramount, technology is playing a key role in maintaining daily communication and information transfer. Mappls is serving individuals, companies and the government alike, to spread critical information related to COVID-19 through deeply informative, useful and free-to-integrate geo-visualized COVID-19 Layers in your application. + +Following this COVID - 19 guide it will be possible to display different Covid 19 related areas, zone and location on Mappls's Map[[1]](#1) for iOS. [MapplsMap SDK for iOS](https://github.com/mappls-api/mappls-ios-sdk) is SDK to display map on iOS platform. + +It would be extremely helpful for people who are looking forward to joining offices or visiting markets etc. This tool can help you check the zone and other details of any area. + +## [Getting Started](#Getting-Started) + +### [Get Layers](#Get-Layers) + +On launch of Mappls's Map[[1]](#1), List of available layers can be fetched/refreshed from server by calling method `getCovidLayers` of map object. Layers can be accessed by property `interactiveLayers` of map as explained in section [Access Layers](#Access-Layers). + +A delegate method `mapViewInteractiveLayersReady` will be called when it successfully fetches list of layers from server. This method can be accessed by refereing delegate of map object to any ViewController and implementing protocol class `MapplsMapViewDelegate`. Go to section [Layers Ready Callback](#Layers-Ready-Callback) for more details. + +#### [Map Auhtorizaton](#Map-Auhtorizaton) + +Map Authorization is part of MapplsMap SDK. Map will only display if your keys are provisoned to display map. + +A delegate method `authorizationCompleted` from Maps SDK is called onece it checks for Map Authorization. + +This delegate method is called when Maps authorization process completes. In delegate method a boolean property `isSuccess` receives which represents is authorization successed or not. + +**Note:** `getCovidLayers` function will only work if Map SDK is authenticated. So best place to call this function is in delegate method `authorizationCompleted`. + +##### Objective-C + +```objectivec +- (void)mapView:(MapplsMapView *)mapView authorizationCompleted:(BOOL)isSuccess +{ + if(isSuccess) { + [self.mapView getCovidLayers]; + } +} +``` + +##### Swift + +```swift +func mapView(_ mapView: MapplsMapView, authorizationCompleted isSuccess: Bool) { + if isSuccess { + self.mapView.getCovidLayers() + } +} +``` + +### [Layers Ready Callback](#Layers-Ready-Callback) + +Delegate method `mapViewInteractiveLayersReady` is called when it successfully fetches list of layers after calling function `getCovidLayers`. + +So get ready your application once pointer comes to this delegate method. + +A scenario can be made in application to allow or disallow to access WMS layers using this deleage method. Please see below code for reference: + +##### Objective-C + +```objectivec +- (void)mapViewInteractiveLayersReady:(MapplsMapView *)mapView +{ + // Put your logic here to allow to access WMS layers, either by some boolean property or by setting visiblity of a button as it is demonstrated in sample. + if (self.mapView.interactiveLayers && self.mapView.interactiveLayers.count > 0) { + [_covid19Button setHidden:NO]; + } +} +``` + +##### Swift + +```swift +func mapViewInteractiveLayersReady(_ mapView: MapplsMapView) { + // Put your logic here to allow to access WMS layers, either by some boolean property or by setting visiblity of a button as it is demonstrated in sample. + if self.mapView.interactiveLayers?.count ?? 0 > 0 { + covid19Button.isHidden = false + } +} +``` + +### [Access Layers](#Access-Layers) + +List of available layers can be accessed using porperty `interactiveLayers` which is type of an array of `MapplsInteractiveLayer` class. + +**Note:** Fetching of list of layers will only succeed if your `Authorization keys` for map are `provisoned` to get these layers otherwise this will be an empty list. + +##### Objective-C + +```objectivec +NSArray *interactiveLayers = self.mapView.interactiveLayers; +``` + +##### Swift + +```swift +let interactiveLayers = self.mapView.interactiveLayers +``` + +`MapplsInteractiveLayer` class has two properties `layerId` and `layerName`. + +`layerId` is unique identifier for a layer using which a layer can be shown or hide on map + +`layerName` is display name for a layer which can be used to show in a list or label. + +### [Access Visible Layers](#Access-Visible-Layers) + +List of available layers can be accessed using porperty `visibleInteractiveLayers`. + +##### Objective-C + +```objectivec +NSArray *visibleInteractiveLayers = self.mapView.visibleInteractiveLayers; +``` + +##### Swift + +```swift +let visibleInteractiveLayers = self.mapView.visibleInteractiveLayers +``` + +### [Show or Hide Layer](Show-or-Hide-Layer) + +A Covid WMS layer can be shown or hide from map using helper function available. + +#### [Show Layer](#Show-Layer) + +A Covid WMS layer can be shown on map by calling a function `showInteractiveLayerOnMapForLayerId`. This function accepts a string value which must be layerId of one of object from list of interactive layers. + +##### Objective-C + +```objectivec +[self.mapView showInteractiveLayerOnMapForLayerId:@"pass-unique-layerId-here"]; +``` + +##### Swift + +```swift +mapView.showInteractiveLayerOnMap(forLayerId: "pass-unique-layerId-here") +``` + +#### [Hide Layer](#Hide-Layer) + +A Covid WMS layer can be hide from map by calling a function `hideInteractiveLayerFromMapForLayerId`. This function accepts a string value which must be layerId of one of object from list of interactive layers. + +##### Objective-C + +```objectivec +[self.mapView hideInteractiveLayerFromMapForLayerId:@"pass-unique-layerId-here"]; +``` + +##### Swift + +```swift +mapView.hideInteractiveLayerFromMap(forLayerId: "pass-unique-layerId-here") +``` + +## [Covid Related Information](#Covid-Related-Information) + +On tap on Map object covid related information for visible codvid layers will we fetched from server. + +Information from top visible covid layer, will be received in delegate method `didDetectCovidInfo`, which is part of MapplsMapViewDelegate protocol class. + +`didDetectCovidInfo` delegate methods will return an object of `MapplsCovidInfo` class which can be used to display different information. It will return `nil` if no info exists. + +##### Objective-C + +```objectivec +- (void)didDetectCovidInfo:(MapplsCovidInfo *)covidInfo +{ + if (covidInfo) { + } +} +``` + +##### Swift + +```swift +func didDetect(_ covidInfo: MapplsCovidInfo?) { + if let covidInfo = covidInfo { + } +} +``` + +## [Map Marker for Covid Related Information](#Map-Marker-for-Covid-Related-Information) + +A marker at tapped location can be plotted on map after succesfully query covid related WMS layers. + +Marker can be allowed or disallowed to plot on map by setting value of boolean property `shouldShowPopupForInteractiveLayer`. To allow to show marker set its value to `true`. By default it is false, means no marker shows on tap of covid WMS Layers. + +Below is code for refrence to create a toggle button to enable or disable Covid Marker: + +##### Objective-C + +```objectivec +- (IBAction)covidMarkerToggleButtonPressed:(UIButton *)sender { + BOOL newState = !_covidMarkerToggleButton.isSelected; + [_covidMarkerToggleButton setSelected:newState]; + [_mapView setShouldShowPopupForInteractiveLayer:newState]; +} +``` + +##### Swift + +```swift +@IBAction func covidMarkerToggleButtonPressed(_ sender: UIButton) { + let newState = !sender.isSelected; + covidMarkerToggleButton.isSelected = newState + self.mapView.shouldShowPopupForInteractiveLayer = newState +} +``` + +## [References](#References) + +##### [1](#1) + +A Mappls's map component which is part of [MapplsMap SDK for iOS](https://github.com/mappls-api/mappls-ios-sdk/docs/v1.0.0/MapplsMap.md). + +


+ +## Our many happy customers: + +![](https://www.mapmyindia.com/api/img/logos1/PhonePe.png)![](https://www.mapmyindia.com/api/img/logos1/Arya-Omnitalk.png)![](https://www.mapmyindia.com/api/img/logos1/delhivery.png)![](https://www.mapmyindia.com/api/img/logos1/hdfc.png)![](https://www.mapmyindia.com/api/img/logos1/TVS.png)![](https://www.mapmyindia.com/api/img/logos1/Paytm.png)![](https://www.mapmyindia.com/api/img/logos1/FastTrackz.png)![](https://www.mapmyindia.com/api/img/logos1/ICICI-Pru.png)![](https://www.mapmyindia.com/api/img/logos1/LeanBox.png)![](https://www.mapmyindia.com/api/img/logos1/MFS.png)![](https://www.mapmyindia.com/api/img/logos1/TTSL.png)![](https://www.mapmyindia.com/api/img/logos1/Novire.png)![](https://www.mapmyindia.com/api/img/logos1/OLX.png)![](https://www.mapmyindia.com/api/img/logos1/sun-telematics.png)![](https://www.mapmyindia.com/api/img/logos1/Sensel.png)![](https://www.mapmyindia.com/api/img/logos1/TATA-MOTORS.png)![](https://www.mapmyindia.com/api/img/logos1/Wipro.png)![](https://www.mapmyindia.com/api/img/logos1/Xamarin.png) + +
+ +For any queries and support, please contact: + +[

](https://about.mappls.com/api/) + +Email us at [apisupport@mappls.com](mailto:apisupport@mappls.com) + +![](https://www.mapmyindia.com/api/img/icons/support.png) +[Support](https://about.mappls.com/contact/) +Need support? contact us! + +

+ +[

](https://stackoverflow.com/questions/tagged/mappls-api)[![](https://www.mapmyindia.com/api/img/icons/blog.png)](https://about.mappls.com/blog/)[![](https://www.mapmyindia.com/api/img/icons/gethub.png)](https://github.com/mappls-api)[

](https://www.npmjs.com/org/mapmyindia) + +[

](https://www.facebook.com/Mapplsofficial)[![](https://www.mapmyindia.com/june-newsletter/icon2.png)](https://twitter.com/mappls)[![](https://www.mapmyindia.com/newsletter/2017/aug/llinkedin.png)](https://www.linkedin.com/company/mappls/)[![](https://www.mapmyindia.com/june-newsletter/icon3.png)](https://www.youtube.com/channel/UCAWvWsh-dZLLeUU7_J9HiOA) + +

@ Copyright 2022 CE Info Systems Pvt. Ltd. All Rights Reserved.
+ +
Terms & Conditions | Privacy Policy | Supplier Sustainability Policy | Health & Safety Policy | Environmental Policy & CSR Report + +
Customer Care: +91-9999333223
diff --git a/docs/v1.0.13/MapplsAPICore.md b/docs/v1.0.13/MapplsAPICore.md new file mode 100644 index 0000000..eab6e8f --- /dev/null +++ b/docs/v1.0.13/MapplsAPICore.md @@ -0,0 +1,109 @@ +[

](https://www.mapmyindia.com/api) + +# [MapplsAPICore]() + +## [Introduction](#Introduction) + +This SDK provides core features for authentication and access for various Mappls's SDKs in a very simple way. +The preferred way of integrating the SDK can be found in the below. + +## [Authentication](#Authentication) + +To initialize and authenticate any **Mappls's SDK**, it is required to set keys (provided by Mappls) in `MapplsAPICore` through `MapplsAccountManager` or `Info.plist`. + +Mappls's Keys can be get from [here](http://about.mappls.com/api/signup) which is governed by the API [terms and conditions](https://about.mappls.com/api/terms-&-conditions). + +## [Version History](#Version-History) + +| Version | Dated | Description | +| :---- | :---- | :---- | +| `1.0.7 `| 07 Jun 2023 | - Bug fixes & Improvements.| +| `1.0.6 `| 30 May 2023 | - Domain of APIs changed.| +| `1.0.5 `| 30 Jan 2023 | - Error code opimization for initializing Map.| +| `1.0.4` | 09 Dec 2022 | - A custom property `modelName` of extension `UIDevice` is made public.| +| `1.0.3` | 13 Oct 2022 | - Some performance improvements and optimization.| + +### [MapplsAccountManager](#MapplsAccountManager) + +You can set required keys using class `MapplsAccountManager`. + + - To access `MapplsAccountManager` addition to import statement for `MapplsAPICore` is required. + + Objective C + ```objectivec + #import + ``` + + Swift + ```swift + import MapplsAPICore + ``` + +- Use below methods of `MapplsAccountManager` to set different keys as follows. + + Objective C + ```objectivec + [MapplsAccountManager setMapSDKKey:@"MAP_SDK_KEY"]; + [MapplsAccountManager setRestAPIKey:@"REST_API_KEY"]; + [MapplsAccountManager setClientId:@"CLIENT_ID"]; + [MapplsAccountManager setClientSecret:@"CLIENT_SECRET"]; + [MapplsAccountManager setGrantType:@"client_credentials"]; //optional + ``` + Swift + ```swift + MapplsAccountManager.setMapSDKKey("MAP_SDK_KEY") + MapplsAccountManager.setRestAPIKey("REST_API_KEY") + MapplsAccountManager.setClientId("CLIENT_ID") + MapplsAccountManager.setClientSecret("CLIENT_SECRET") + MapplsAccountManager.setGrantType("client_credentials") //optional + ``` + _Note: Add the above to your's application's initialization i.e `application:didFinishLaunchingWithOptions` method of AppDelegate_ + +### [Info Plist](#Info-Plist) + + You can set required Mappls's keys by application's `Info.plist`. + + To set different Mappls's keys add different keys in `Info.plist` and set value against each key. + + Below are different keys which can be added in `Info.plist`. + + - `MapplsSDKKey` + - `MapplsRestKey` + - `MapplsClientId` + - `MapplsClientSecret` + - `MapplsGrantType` + +Below is screenshot for reference. + +[

](https://www.mapmyindia.com/api) + + +


+ +## Our many happy customers: + +![](https://www.mapmyindia.com/api/img/logos1/PhonePe.png)![](https://www.mapmyindia.com/api/img/logos1/Arya-Omnitalk.png)![](https://www.mapmyindia.com/api/img/logos1/delhivery.png)![](https://www.mapmyindia.com/api/img/logos1/hdfc.png)![](https://www.mapmyindia.com/api/img/logos1/TVS.png)![](https://www.mapmyindia.com/api/img/logos1/Paytm.png)![](https://www.mapmyindia.com/api/img/logos1/FastTrackz.png)![](https://www.mapmyindia.com/api/img/logos1/ICICI-Pru.png)![](https://www.mapmyindia.com/api/img/logos1/LeanBox.png)![](https://www.mapmyindia.com/api/img/logos1/MFS.png)![](https://www.mapmyindia.com/api/img/logos1/TTSL.png)![](https://www.mapmyindia.com/api/img/logos1/Novire.png)![](https://www.mapmyindia.com/api/img/logos1/OLX.png)![](https://www.mapmyindia.com/api/img/logos1/sun-telematics.png)![](https://www.mapmyindia.com/api/img/logos1/Sensel.png)![](https://www.mapmyindia.com/api/img/logos1/TATA-MOTORS.png)![](https://www.mapmyindia.com/api/img/logos1/Wipro.png)![](https://www.mapmyindia.com/api/img/logos1/Xamarin.png) + +
+ +For any queries and support, please contact: + +[

](https://about.mappls.com/api/) + +Email us at [apisupport@mappls.com](mailto:apisupport@mappls.com) + +![](https://www.mapmyindia.com/api/img/icons/support.png) +[Support](https://about.mappls.com/contact/) +Need support? contact us! + +

+ +[

](https://stackoverflow.com/questions/tagged/mappls-api)[![](https://www.mapmyindia.com/api/img/icons/blog.png)](https://about.mappls.com/blog/)[![](https://www.mapmyindia.com/api/img/icons/gethub.png)](https://github.com/mappls-api)[

](https://www.npmjs.com/org/mapmyindia) + +[

](https://www.facebook.com/Mapplsofficial)[![](https://www.mapmyindia.com/june-newsletter/icon2.png)](https://twitter.com/mappls)[![](https://www.mapmyindia.com/newsletter/2017/aug/llinkedin.png)](https://www.linkedin.com/company/mappls/)[![](https://www.mapmyindia.com/june-newsletter/icon3.png)](https://www.youtube.com/channel/UCAWvWsh-dZLLeUU7_J9HiOA) + +

@ Copyright 2022 CE Info Systems Pvt. Ltd. All Rights Reserved.
+ +
Terms & Conditions | Privacy Policy | Supplier Sustainability Policy | Health & Safety Policy | Environmental Policy & CSR Report + +
Customer Care: +91-9999333223
diff --git a/docs/v1.0.13/MapplsAPIKit.md b/docs/v1.0.13/MapplsAPIKit.md new file mode 100644 index 0000000..1fdee7e --- /dev/null +++ b/docs/v1.0.13/MapplsAPIKit.md @@ -0,0 +1,1422 @@ +[

](https://www.mapmyindia.com/api) + +# [MapplsAPIKit (REST API Kit for iOS)]() + +## [Introduction](#Introduction) + +Our APIs, SDKs, and live updating map data available for [200+ countries & territories](https://github.com/MapmyIndia/mapmyindia-rest-api/blob/master/docs/countryISO.md) give developers tools to build better experiences across various platforms. + +1. You can get your api key to be used in this document here: [https://apis.mappls.com/console/](https://apis.mappls.com/console/) + +2. The sample code is provided to help you understand the basic functionality of Mappls REST APIs working on iOS native development platform. + +## [Installation](#Installation) + +This library is available through `CocoaPods`. To install, simply add the following line to your `podfile`: + +```ruby +pod 'MapplsAPIKit', '2.0.16' +``` + +Run pod repo update && pod install and open the resulting Xcode workspace. + +### [Dependencies](#Dependencies) + +This library depends upon `MapplsAPICore`. All dependent libraries will be automatically installed on using CocoaPods. + +## [Version History](#Version-History) + +| Version | Dated | Description | +| :---- | :---- | :---- | +| `2.0.16 `| 27 Jun 2023 | - Driving Range API wrapper is added. - In routing api correct the value of direction profile for trucking. etc. | +| `2.0.15 `| 01 Jun 2023 | - Bug fixes & Improvements. | +| `2.0.14 `| 30 May 2023 | Domain of APIs changed. In APIs of Distance Matrix and Reverse Geocode authentication process is changed See Docs below. | +| `2.0.13 `| 2 May 2023 | - Added `responseLanguage` request parameter in AtlasOptions class, Added `instructions` in request paramter of direction api and Added `language` in request paramter of reverseGocode api.| +| `2.0.12 `| 17 Mar 2023 | - Added Fuel cost api., Fixed an api call for costEstimation.| +| `2.0.11 `| 9 Feb 2023 | - Fixed an api call for costEstimation.| +| `2.0.10 `| 30 Jan 2023 | - Error code opimization for initializing Map.| +| `2.0.9` | 02 Jan 2023 | - API wrapper added to get cost of tolls etc which can be consumed by Manager class `MapplsCostEstimationManager` and request class `MapplsCostEstimationOptions`.| +| `2.0.8` | 09 Dec 2022 | - Issue of incorrect `Lanes` is fixed. A bug of ETA refresh is fixed where driving profile was not dynamic based on route requested. Turf code is refactored.| +| `2.0.7` | 21 Oct 2022 | - Function added to calculate congestion delays. Host issue is resolved. Turf library's source code added.| +| `2.0.6` | 13 Oct 2022 | - Some performance improvements and optimization.| +| `2.0.5` | 28 Sept 2022 | - Added weather api.| +| `2.0.4` | 06 Sept 2022 | - Added userActivity and media in response of placeDetails.| +| `2.0.3` | 24 Aug 2022 | - added a parameter to set host and scheme in init method of manager class.| +| `2.0.2` | 22 Aug 2022 | - In response of Reverse Geocode `areaCode` is added and Fixed a crash while using shared instance of MapplsDirection class.| +| `2.0.1` | 05 Jul 2022 | In response of Reverse Geocode `Mappls Pin` is added.| +| `2.0.0` | 11 Jun 2022 | Initial release with `Mappls` branding and merging of Directions SDK. Supports Xcode 13+.| + +## [Getting Started](#Getting-Started) + +Mappls Map SDK for iOS lets you easily add Mappls Map and services to your own iOS app.It supports iOS SDK 9.0 and above and Xcode 10.1 or later. You can have a look at the map and features you will get in your own app by using the Mappls Map app for iOS. The SDK handles Map Display along with a bunch of controls and native gestures. + +## [Authorization](#Authorization) + +### [MapplsAPICore](#MapplsAPICore) +It is required to set Mappls keys and authenticate before using any Mappls SDK. Please see the reference [here](MapplsAPICore.md). + +## [API Usage and Requirements](#API-Usage-and-Requirements) + +The allowed SDK hits are described on the plans page. Note that your usage is shared between platforms, so the API hits you make from a web application, Android app or an iOS app all add up to your allowed daily limit. + +## [Autosuggest API](#Autosuggest-API) + +Get "type as you go" suggestion while searching for a location. + +The Autosuggest API helps users to complete queries faster by adding intelligent search capabilities to your web or mobile app. This API returns a list of results as well as suggested queries as the user types in the search field. + +For live demo click [LIVE DEMO](https://about.mappls.com/api/advanced-maps/doc/sample/mapmyindia-maps-auto-suggest-api-example.php) + +The Autosuggest helps users to complete queries faster by adding intelligent search capabilities to your iOS mobile app. It takes a human readable query such as place name, address or Mappls Pin and returns a list of results. + +Class used for Autosuggest search is `MapplsAutoSuggestManager`. Create a `MapplsAutoSuggestManager` object using your rest key or alternatively, you can place your rest key in the `MapplsRestKey` key of your application's Info.plist file, then use the shared instance of `MapplsAutoSuggestManager` class. + +To perform auto suggest use `MapplsAutoSearchAtlasOptions` class to pass query parameter to get auto suggest search with an option to pass region in parameter `withRegion`, which is an enum of type `MapplsRegionType`. If no value is passed for region, It will take default value which is India. + +`MapplsRegionType` is used to validate and get result for different countries availble with Mappls [200+ countries & territories](https://github.com/MapmyIndia/mapmyindia-rest-api/blob/master/docs/countryISO.md) + +Additionally you can also set location and restriction filters in object of `MapplsAutoSearchAtlasOptions`. + +### Request Parameters + +1. **location:** Location is required to get location bias autosuggest results. +2. **zoom:** takes the zoom level of the current scope of the map (min: 4, max: 18). +3. **includeTokenizeAddress**: On setting value of this property to true it provides the different address attributes in a structured object in response. +4. **pod**: It takes place type which helps in restricting the results to certain chosen type + Below mentioned are the codes for the pod - + - Sublocality + - Locality + - City + - Village + - Subdistrict + - District + - State + - Subsublocality +5. **filter**: This helps you restrict the result either by mentioning a bounded area or to certain Mappls Pin. Below mentioned are both types whose instance can be set to this parameter - + - (a) `MapplsMapplsPinFilter`: to filter results on basis of Mappls Pin. + - (b) `MapplsBoundsFilter`: to filter results on basis of geo bound. It accepts a value of type `MapplsRectangularRegion`. +6. **hyperLocal**: This parameter lets the search give results that are hyper-localized to the reference location passed in the location parameter. This means that nearby results are given a higher ranking than results far from the reference location. Highly prominent results will still appear in the search results, however they will be lower in the list of results. This parameter will work ONLY in conjunction with the location parameter. +7. **isBridgeEnabled:** To get suggested searches in response. Value must be set `true` of this. + +8. **responseLanguage:** It is of type `string` it is use to get the response in specified language. + +### Response Parameters + +In response of auto suggest search either you will receive an error or an object of `MapplsAutoSuggestLocationResults`(derived from `MapplsLocationResults`) which contains an array of `MapplsAtlasSuggestion` (derived from `MapplsSuggestion`) and an array of suggested searches of type `MapplsSearchPrediction`. + +***Note:*** As class of response object will be derived from `MapplsLocationResults`, You will need to cast it into `MapplsAutoSuggestLocationResults`. + +You will find below useful properties in suggestion object : + +1. **type:** type of location POI or Country or City +2. **mapplsPin:** Mappls Pin of the location 6-char alphanumeric. +3. **placeAddress:** Address of the location. +4. **latitude:** Latitude of the location. +5. **longitude:** longitude of the location. +6. **entranceLatitude:** entry latitude of the location +7. **entrancelongitude:** entry longitude of the location +8. **placeName:** Name of the location. +9. **orderIndex:** the order where this result should be placed +10. **addressTokens**: + + **houseNumber**: house number of the location. + + **houseName**: house name of the location. + + **poi**: name of the POI (if applicable) + + **street**: name of the street. (if applicable) + + **subSubLocality**: the sub-sub-locality to which the location belongs. (if applicable) + + **subLocality**: the sub-locality to which the location belongs. (if applicable) + + **locality**: the locality to which the location belongs. (if applicable) + + **village**: the village to which the location belongs. (if applicable) + + **subDistrict**: the sub-district to which the location belongs. (if applicable) + + **district**: the district to which the location belongs. (if applicable) + + **city**: the city to which the location belongs. (if applicable) + + **state**: the state to which the location belongs. (if applicable) + + **pincode**: the PIN code to which the location belongs. (if applicable) + +***Note:*** Values of `latitude`, `longitude`, `entranceLatitude` and `entrancelongitude` will depend upon claims provided on `Keys`. + +### [Code Samples]() + +#### Objective C +```objectivec +MapplsAutoSuggestManager * autoSuggestManager = [MapplsAutoSuggestManager sharedManager]; +// or +MapplsAutoSuggestManager *autoSuggestManager = [[MapplsAutoSuggestManager alloc] initWithRestKey:MapplsAccountManager.restAPIKey clientId:MapplsAccountManager.atlasClientId clientSecret:MapplsAccountManager.atlasClientSecret grantType:MapplsAccountManager.atlasGrantType]; + +MapplsAutoSearchAtlasOptions * autoSuggestOptions = [[MapplsAutoSearchAtlasOptions alloc] initWithQuery:@"mmi000" withRegion:MapplsRegionTypeIndia]; +autoSuggestOptions.location = [[CLLocation alloc] initWithLatitude:28.2323234 longitude:72.3434123]; +autoSuggestOptions.zoom = [[NSNumber alloc] initWithInt:5]; +[autoSuggestManager getAutoSuggestionResultsWithOptions:autoSuggestOptions completionHandler:^(MapplsLocationResults * _Nullable locationResults, NSError * _Nullable error) { + if (error) { + NSLog(@"%@", error); + } else if (locationResults) { + MapplsAutoSuggestLocationResults * results = (MapplsAutoSuggestLocationResults *) locationResults; + if(results && results.suggestions) { + for (MapplsAtlasSuggestion * suggestion in results.suggestions) { + NSLog(@"Auto Suggest %@%@", suggestion.latitude, suggestion.longitude); + } + } + if(results && results.suggestedSearches) { + for (MapplsSearchPrediction * suggestion in results.suggestedSearches) { + NSLog(@"Auto Suggest %@", suggestion.identifier); + } + } + } else { + NSLog(@"No Results"); + } +}]; +``` +#### Swift +```swift +let autoSuggestManager = MapplsAutoSuggestManager.shared +//Or +let autoSuggestManager = MapplsAutoSuggestManager(restKey: +MapplsAccountManager.restAPIKey(), clientId: +MapplsAccountManager.atlasClientId(), clientSecret: +MapplsAccountManager.atlasClientSecret(), grantType: +MapplsAccountManager.atlasGrantType()) + +let autoSearchAtlasOptions = MapplsAutoSearchAtlasOptions(query: "mmi000", +withRegion: .india) +autoSearchAtlasOptions.location = CLLocation(latitude: 28.2323234, longitude: 72.3434123) +autoSearchAtlasOptions.zoom = 5 +autoSuggestManager.getAutoSuggestionResults(autoSearchAtlasOptions) { (locationResults, error) in + if let error = error { + print("error: \(error.localizedDescription)") + } else if let locationResults = locationResults as? MapplsAutoSuggestLocationResults { + if let suggestions = locationResults.suggestions { + for suggestion in suggestions { + print("suggestion: \(suggestion.placeName)") + } + } + if let suggestions = locationResults.suggestedSearches { + for suggestion in suggestions { + print("suggestedSearches: \(suggestion.identifier)") + } + } + } else { + print("No Results") + } +} +``` + +For more details visit our [api reference documentation](https://about.mappls.com/api/advanced-maps/doc/autosuggest-api#/Autosuggest%20API/AutoSuggestAPI). + +## [Reverse Geocoding API](#Reverse-Geocoding-API) + +For live demo click [LIVE DEMO](https://about.mappls.com/api/advanced-maps/doc/sample/mapmyindia-maps-reverse-geocoding-rest-api-example) + +Gets the nearest address for a given lat long combination. + +Reverse Geocoding is a process to give the closest matching address to a provided geographical coordinates (latitude/longitude). Mappls's reverse geocoding API provides real addresses along with nearest popular landmark for any such geo-positions on the map. + +Class used for geocode is `MapplsReverseGeocodeManager`. Create a `MapplsReverseGeocodeManager` object using your rest key or alternatively, you can place your rest key in the `MapplsRestKey` key of your application's Info.plist file, then use the shared instance of `MapplsReverseGeocodeManager` class. + +To perform the translation use `MapplsReverseGeocodeOptions` class to pass coordinates as parameters to reverse geocode with an option to pass region in parameter `withRegion`, which is an enum of type `MapplsRegionType`. If no value is passed for region, It will take default value which is India. + +### Request Parameters + +- **coordinate:** +- **language** + + +`MapplsRegionType` is used to validate and get result for different countries. + +### Response Parameters + +In response of geocode search either you will receive an error or an array of `MapplsGeocodedPlacemark`. Yo will find below useful properties in suggestion object: + +- **houseNumber:** The house number of the location. +- **houseName:** The name of the location. +- **poi:** The name of the POI if the location is a place of interest (POI). +- **poiDist:** distance from nearest POI in metres. +- **street:** The name of the street of the location. +- **streetDist:** distance from nearest Street in metres. +- **subSubLocality:** The name of the sub-sub-locality where the location exists. +- **subLocality:** The name of the sub-locality where the location exists. +- **locality:** The name of the locality where the location exists. +- **village:** The name of the village if the location exists in a village. +- **district:** The name of the district in which the location exists. +- **subDistrict:** The name of the sub-district in which the location exists. +- **city:** The name of the city in which the location exists. +- **state:** The name of the state in which the location exists. +- **pincode:** The pin code of the location area. +- **latitude:** The latitude of the location. +- **longitude:** The longitude of the location. +- **formattedAddress:** The complete human readable address string that is usually the complete postal address of the result. +- **areaCode:** The area code of region. +- **area:** in-case the co-ordinate lies in a country the name of the country would be returned or if the co-ordinate lies in an ocean, the name of the ocean will be returned. + +### Code Samples + +#### Objective C +```objectivec +MapplsReverseGeocodeManager * reverseGeocodeManager = [MapplsReverseGeocodeManager sharedManager]; +//Or +MapplsReverseGeocodeManager * reverseGeocodeManager = [[MapplsReverseGeocodeManager alloc] initWithClientId:MapplsAccountManager.clientId clientSecret:MapplsAccountManager.clientSecret grantType:nil host:nil scheme:nil]; + +MapplsReverseGeocodeOptions *revOptions = [[MapplsReverseGeocodeOptions alloc] initWithCoordinate:CLLocationCoordinate2DMake(28.553291, 77.258876) withRegion:MapplsRegionTypeIndia]; + +[reverseGeocodeManager reverseGeocodeWithOptions:revOptions completionHandler:^(NSArray * _Nullable placemarks, NSString * _Nullable attribution, NSError * _Nullable error) { + if (error) { + NSLog(@"%@", error); + } else if (placemarks.count > 0) { + NSLog(@"Reverse Geocode %@", + placemarks[0].formattedAddress); + } else { + NSLog(@"No results"); + } +}]; +``` + +#### Swift +```swift +let reverseGeocodeManager = MapplsReverseGeocodeManager.shared +//Or +let reverseGeocodeManager = MapplsReverseGeocodeManager(clientId: MapplsAccountManager.clientId(), clientSecret: MapplsAccountManager.clientSecret()) + +let revOptions = MapplsReverseGeocodeOptions(coordinate: CLLocationCoordinate2D(latitude: 28.553291, longitude: 77.258876), withRegion: .india) +reverseGeocodeManager.reverseGeocode(revOptions) { (placemarks, attribution, error) in + if let error = error { + print("%@", error) + } else if let placemarks = placemarks, !placemarks.isEmpty { + print("Reverse Geocode: \(placemarks[0].formattedAddress)") + } else { + print("No results") + } +} +``` + +For more details visit our [api reference documentation](https://about.mappls.com/api/advanced-maps/doc/reverse-geocoding-api#/Reverse%20Geocode%20API/ReverseGeocodeAPI). + + +## [Nearby API](#Nearby-API) + +For live demo click [LIVE DEMO](https://about.mappls.com/api/advanced-maps/doc/sample/mapmyindia-maps-near-by-api-example) + +Nearby Places API, enables you to add discovery and search of nearby places by searching for a generic keyword used to describe a category of places or via the unique code assigned to that category. + +Class used for nearby search is `MapplsNearByManager`. Create a `MapplsNearByManager` object using your rest key or alternatively, you can place your rest key in the `MapplsRestKey` key of your application's Info.plist file, then use the shared instance of `MapplsNearByManager` class. + +To perform nearby search use `MapplsNearbyAtlasOptions` class to pass keywords/categories and a reference location as parameters to get Nearby search results with an option to pass region in parameter `withRegion`, which is an enum of type `MapplsRegionType`. If no value is passed for region, It will take default value which is India. + +`MapplsRegionType` is used to validate and get result for different countries. + +*Additionally you can also set location and zoom in object of `MapplsNearbyAtlasOptions` location coordinate can be set in comma seprated format i.e `("latitue", "longitue")` or location can be Mappls Pin for eg. `("MMI000")`* + + +### Request Parameters +1. **refLocation** A location provides the location around which the search will be performed it can be coordinte (latitude, longitude) or Mappls Pin in `String` format. + +1. **page:** provides number of the page to provide results from. + +2. **sort:** provides configured sorting operations for the client on cloud. Below are the available sorts: + - dist:asc & dist:desc - will sort data in order of distance from the passed location (default). + - name:asc & name:desc - will sort the data on alphabetically bases. + +3. **radius (integer):** provides the range of distance to search over (default: 1000, min: 500, max: 10000). + +4. **sortBy:** It is used to sort results based on value provided. It can accept object of `MapplsSortBy` or `MapplsSortByDistanceWithOrder` + +5. **searchBy:** It is used to search places based on preference provided. It is of enum type `MapplsSearchByType` its value can be either `.importance` or `.distance` + +6. **filters:** On basis of this only specific type of response returned. it can of type `MapplsNearbyKeyValueFilter` (derived from `MapplsNearbySearchFilter`). +MapplsNearbySearchFilter have following properties. + - **filterKey:-** It takes value for `key` to filter result. + - **filterValues:-** It takes an array of different query values. + - **logicalOperator:-** `logicalOperator` of enum `MapplsLogicalOperator` its default value is `and`. + + + ``` swift + let filter = MapplsNearbyKeyValueFilter(filterKey: "brandId", filterValues: [String,String]) + ``` + +7. **bounds (x1,y1;x2,y2):** Allows the developer to send in map bounds to provide a nearby search of the geobounds. where x1,y1 are the latitude and langitude. + +8. **isRichData:** It is of type `Bool`. It allows some additional information to receive in `richInfo` parameter of response. + +9. **shouldExplain:** It is of type `Bool`. + +10. **userName:** It is of type `String`. On basis of value of this some specific results bounded to a user. + +11. **pod**: It takes place type which helps in restricting the results to certain chosen type + Below mentioned are the codes for the pod - + - Sublocality + - Locality + - City + - Village + +### Response Parameters + +You will find below useful properties in suggestion object : + +- **distance:** provides the distance from the provided location bias in meters. +- **mapplsPin:** Mappls Pin, unique id of the location 6-char alphanumeric. +- **email:** Email for contact. +- **entryLatitude:** latitude of the entrance of the location. +- **entryLongitude:** longitude of the entrance of the location. +- **keywords:** provides an array of matched keywords or codes. +- **landlineNo:** Email for contact. +- **latitude:** Latitude of the location. +- **longitude:** longitude of the location. +- **mobileNo :** Phone number for contact. +- **orderIndex:** the order where this result should be placed +- **placeAddress:** Address of the location. +- **placeName:** Name of the location. +- **type:** Type of location POI or Country or City. +- **city:** Name of city. +- **state:** Name of state +- **pincode:** Pincode of area. +- **categoryCode:** Code of category with that result belongs to. +- **richInfo:** A dictionary object with dynamic information +- **hourOfOperation:** A string value which describes hour of operation. +- **addressTokens**: + - **houseNumber**: house number of the location. + - **houseName**: house name of the location. + - **poi**: name of the POI (if applicable) + - **street**: name of the street. (if applicable) + - **subSubLocality**: the sub-sub-locality to which the location belongs. (if applicable) + - **subLocality**: the sub-locality to which the location belongs. (if applicable) + - **locality**: the locality to which the location belongs. (if applicable) + - **village**: the village to which the location belongs. (if applicable) + - **subDistrict**: the sub-district to which the location belongs. (if applicable) + - **district**: the district to which the location belongs. (if applicable) + - **city**: the city to which the location belongs. (if applicable) + - **state**: the state to which the location belongs. (if applicable) + - **pincode**: the PIN code to which the location belongs. (if applicable) + - **pageInfo**: + - **pageCount** + - **totalHits** + - **totalPages** + - **pageSize** + +### Code Samples + +#### Objective C +```objectivec +MapplsNearByManager * nearByManager = [MapplsNearByManager sharedManager]; +//Or +MapplsNearByManager * nearByManager = [[MapplsNearByManager alloc] initWithRestKey:MapplsAccountManager.restAPIKey clientId:MapplsAccountManager.atlasClientId clientSecret:MapplsAccountManager.atlasClientSecret grantType:MapplsAccountManager.atlasGrantType]; + +NSString *refLocation = @"28.550667, 77.268959"; + +MapplsNearbyAtlasOptions *nearByOptions = [[MapplsNearbyAtlasOptions alloc] initWithQuery:@"EV Charging" location:refLocation withRegion:MapplsRegionTypeIndia]; + +[nearByManager getNearBySuggestionsWithOptions:nearByOptions completionHandler:^(MapplsNearbyResult * _Nullable result, NSError * _Nullable error) { + if (error) { + NSLog(@"%@", error); + } else if (result.suggestions.count > 0) { + NSLog(@"Nearby %@", result.suggestions[0].placeAddress); + } else { + NSLog(@"No results"); + } +}]; +``` +#### Swift +```swift +let nearByManager = MapplsNearByManager.shared +//Or +let nearByManager = MapplsNearByManager(restKey: MapplsAccountManager.restAPIKey(), clientId: MapplsAccountManager.atlasClientId(), clientSecret: MapplsAccountManager.atlasClientSecret(), grantType: MapplsAccountManager.atlasGrantType()) + +var refLocations: String! +refLocations = "28.543014, 77.242342" +let filter = MapplsNearbyKeyValueFilter(filterKey: "brandId", filterValues: ["Brand1", "Brand2"]) +let sortBy = MapplsSortByDistanceWithOrder(orderBy: .ascending) + +let nearByOptions = MapplsNearbyAtlasOptions(query:"EV Charging" , location: refLocations, withRegion: .india) +nearByOptions.filters = [filter] +nearByOptions.sortBy = sortBy +nearByOptions.searchBy = .importance +nearByManager.getNearBySuggestions(nearByOptions) { (result, error) in + if let error = error { + print("\(error.localizedDescription)") + } else if let result = result, let suggestions = result.suggestions, !suggestions.isEmpty { + print("Near by: \(suggestions[0].placeAddress)") + } else { + print("No results") + } +} +``` + + ### [NearBy using Mappls Pin](#NearBy-using-MapplsPin) + +### Code Samples + + ```swift +let nearByManager = MapplsNearByManager.shared +//Or +let nearByManager = MapplsNearByManager(restKey: MapplsAccountManager.restAPIKey(), clientId: MapplsAccountManager.atlasClientId(), clientSecret: MapplsAccountManager.atlasClientSecret(), grantType: MapplsAccountManager.atlasGrantType()) + let nearByOptions = MapplsNearbyAtlasOptions(query: "Shoes", location: "MMI000", withRegion: .india) + +nearByManager.getNearBySuggestions(nearByOptions) { (result, error) in + if let error = error { + print(error.localizedDescription) + } else if let result = result, let suggestions = result.suggestions, !suggestions.isEmpty { + print("Near by: \(suggestions[0].placeAddress)") + } else { + print("No results") + } +} +``` + +For more details visit our [api reference documentation](https://about.mappls.com/api/advanced-maps/doc/nearby-api#/Nearby%20API/AtlasNearbyAPI). + +## [Place Detail](#Place-Detail) + +The Mappls Pin is a simple, standardised and precise PAN India digital address system. Every location has been assigned a unique digital address or an Mappls Pin. The Place Detail can be used to extract the details of a place with the help of its Mappls Pin i.e. a 6 digit code. + +Class used for Mappls Pin search is `MapplsPlaceDetailManager`. Create a `MapplsPlaceDetailManager` object using your authenticated Mappls's keys or alternatively, you can use the shared instance of `MapplsPlaceDetailManager` class. + +To perform Place Detail use `MapplsPlaceDetailOptions` class to pass digital address code (Mappls Pin) as parameters to get detail result with an option to pass region in parameter withRegion, which is an enum of type `MapplsRegionType`. If no value is passed for region, it will take default value which is India. + +### Response Parameters + +In response of Mappls Pin search either you will receive an error or an object of `MapplsPlaceDetail`. + +- **mapplsPin:** The Mappls Pin assigned for a place in map database. A Mappls Pin is the digital identity for an address or business to identify its unique location. +- **latitude:** The latitude of the location. +- **longitude:** The longitude of the location. +- **houseNumber:** The house number of the location. +- **houseName:** The name of the location. +- **poi:** The name of the POI if the location is a place of interest (POI). +- **street:** The name of the street of the location. +- **subSubLocality:** The name of the sub-sub-locality where the location exists. +- **subLocality:** The name of the sub-locality where the location exists. +- **locality:** The name of the locality where the location exists. +- **village:** The name of the village if the location exists in a village. +- **district:** The name of the district in which the location exists. +- **subDistrict:** The name of the sub-district in which the location exists. +- **city:** The name of the city in which the location exists. +- **state:** The name of the state in which the location exists. +- **pincode:** The pin code of the location area. +- **type:** defines the type of location matched (HOUSE_NUMBER, HOUSE_NAME, POI, STREET, SUB_LOCALITY, LOCALITY, VILLAGE, DISTRICT, SUB_DISTRICT, CITY, STATE, SUBSUBLOCALITY, PINCODE) +- **keyInfo:** The dynamic custom information related to a place. + +**Note: Not all response parameters are available by default. These parameters are available on demand as per mutually agreed use case. For details, please contact [Mappls API support](api_support@mappls.com).** + +### Code Samples + +#### Objective C +```objectivec +MapplsPlaceDetailManager * placeDetailManager = MapplsPlaceDetailManager.shared +//or +MapplsPlaceDetailManager * placeDetailManager = [[MapplsPlaceDetailManager alloc] initWithRestKey:MapplsAccountManager.restAPIKey clientId:MapplsAccountManager.atlasClientId clientSecret:MapplsAccountManager.atlasClientSecret grantType:MapplsAccountManager.atlasGrantType]; + +MapplsPlaceDetailOptions * placeOptions = [[MapplsPlaceDetailOptions alloc] initWithMapplsPin:@"mmi000" withRegion:MapplsRegionTypeIndia]; + +[placeDetailManager getResultsWithOptions:placeOptions completionHandler:^(MapplsPlaceDetail * _Nullable placeDetail, NSError * _Nullable error) { + if (error) { + NSLog(@"%@", error); + } else if(placeDetail) { + NSLog(@"Place DetailL: %@", placeDetail.address); + } else { + NSLog(@"No results"); + } +}]; + +#### Swift +```swift +let placeDetailManager = MapplsPlaceDetailManager.shared +let placeOptions = MapplsPlaceDetailOptions(mapplsPin: "mmi000", withRegion: .india) +placeDetailManager.getResults(placeOptions) { (placeDetail, error) in + if let error = error { + print(error) + } else if let placeDetail = placeDetail, let latitude = placeDetail.latitude, let longitude = placeDetail.longitude { + print("Place Detail : \(latitude),\(longitude)") + } else { + print("No results") + } +} +``` + +## [Geocoding API](#Geocoding-API) + +For live demo click [LIVE DEMO](https://about.mappls.com/api/advanced-maps/doc/sample/mapmyindia-atlas-geocoding-rest-api-example) + +Get most accurate lat long combination for a given address + +All mapping APIs that are used in mobile or web apps need some geo-position coordinates to refer to any given point on the map. Our Geocoding API converts real addresses into these geographic coordinates (latitude/longitude) to be placed on a map, be it for any street, area, postal code, POI or a house number etc. + +Class used for geocode is `MapplsAtlasGeocodeManager`. To create instance of `MapplsAtlasGeocodeManager` initialize using your rest key, clientId, clientSecret , grantType **or** use shared instance of `MapplsAtlasGeocodeManager` after setting key values `MapplsRestKey`, `MapplsAtlasClientId`, `MapplsAtlasClientSecret`, `MapplsAtlasGrantType` in your application’s `Info.plist` file. + +To perform geocode use `getGeocodeResults` method of instance of `MapplsAtlasGeocodeManager` class which accepts an instance of `MapplsAtlasGeocodeOptions` class. To create instance of `MapplsAtlasGeocodeOptions`, pass any address as query parameters to geocode. + +### Request Parameters + +1. **`query`**: The address of a location (e.g. 237 Okhla Phase-III). + +Additionally you can also set some other parameters in object of `MapplsAtlasGeocodeOptions` to get some specific results. Which are: + +2. **`maximumResultCount`**: The number of results which needs to be return in response. + +### Response Parameters + +In response of `geocode` search either you will receive an error or an array of `MapplsGeocodedPlacemark`. Yo will find below useful properties in suggestion object : + +1. `houseNumber`: The house number of the location. +2. `houseName`: The name of the location. +3. `poi`: The name of the POI if the location is a place of interest (POI). +4. `street`: The name of the street of the location. +5. `subSubLocality`: The name of the sub-sub-locality where the location exists. +6. `subLocality`: The name of the sub-locality where the location exists. +7. `locality`: The name of the locality where the location exists. +8. `village`: The name of the village if the location exists in a village. +9. `district`: The name of the district in which the location exists. +10. `subDistrict`: The name of the sub-district in which the location exists. +11. `city`: The name of the city in which the location exists. +12. `state`: The name of the state in which the location exists. +13. `pincode`: The pin code of the location area. +14. `latitude`: The latitude of the location. +15. `longitude`: The longitude of the location. +16. `formattedAddress`: The complete human readable address string that is usually the complete postal address of the result. +17. `mapplsPin`: The Mappls Pin assigned for a place in map database. A Mappls Pin is the digital identity for an address or business to identify its unique location. For more information on Mappls Pin, click [here](https://about.mappls.com/app/features/mapplspin/). +18. `geocodeLevel`: It defines depth level of search for geocode. + + +### Code Samples + +#### Objective C +```objectivec +MapplsAtlasGeocodeManager * atlasGeocodeManager = [MapplsAtlasGeocodeManager sharedManager]; +// or +MapplsAtlasGeocodeManager * atlasGeocodeManager = [[MapplsAtlasGeocodeManager alloc] initWithRestKey:MapplsAccountManager.restAPIKey clientId:MapplsAccountManager.atlasClientId clientSecret:MapplsAccountManager.atlasClientSecret grantType:MapplsAccountManager.atlasGrantType]; + +MapplsAtlasGeocodeOptions *atlasGeocodeOptions = [[MapplsAtlasGeocodeOptions alloc] initWithQuery: @"237 Mappls" withRegion:MapplsRegionTypeIndia]; + +[atlasGeocodeManager getGeocodeResultsWithOptions:atlasGeocodeOptions completionHandler:^(MapplsAtlasGeocodeAPIResponse * _Nullable response, NSError * _Nullable error) { + if (error) { + NSLog(@"%@", error); + } else if (response!= nil && response.placemarks.count > 0) { + NSLog(@"Forward Geocode %@%@", response.placemarks[0].latitude, response.placemarks[0].longitude); + } else { + NSLog(@"No results"); + } +}]; +``` +#### Swift +```swift +let atlasGeocodeManager = MapplsAtlasGeocodeManager.shared +// or +let atlasGeocodeManager = MapplsAtlasGeocodeManager(restKey: MapplsAccountManager.restAPIKey(), clientId: MapplsAccountManager.atlasClientId(), clientSecret: MapplsAccountManager.atlasClientSecret(), grantType: MapplsAccountManager.atlasGrantType()) + +let atlasGeocodeOptions = MapplsAtlasGeocodeOptions(query: "237 Mappls", withRegion: .india) + +atlasGeocodeManager.getGeocodeResults(atlasGeocodeOptions) { (response, error) in + if let error = error { + NSLog("%@", error) + } else if let result = response, let placemarks = result.placemarks, placemarks.count > 0 { + print("Atlas Geocode: \(placemarks[0].latitude),\(placemarks[0].longitude)") + } else { + print("No results") + } +} +``` +For more details visit our [api reference documentation](https://about.mappls.com/api/advanced-maps/doc/geocoding-api#/Geocode%20API/AtlasGeocodeAPI). + + +## [Routing API](#Routing-API) + +For live demo click [LIVE DEMO](https://about.mappls.com/api/advanced-maps/doc/sample/mapmyindia-maps-route-adv-api-example) + +Get optimal & alternate routes between various locations with or without considering live traffic + +Routing and displaying driving directions on map, including instructions for navigation, distance to destination, traffic etc. are few of the most important parts of developing a map based application. This REST API calculates driving routes between specified locations including via points based on route type(optimal or shortest) and includes delays for traffic congestion. + +Use `Directions` to get route between locations. You can use it either by creating object using your rest key **or** use shared instance of `Directions` class by setting rest key in the `MapplsRestKey` key of your application’s `Info.plist` file. + +#### Swift +```swift +let directions = Directions.shared +``` + +#### Objective-C +```objc +MapplsDirections *directions = [MapplsDirections sharedDirections]; +``` + +To perform this operation use object of `RouteOptions` class as request to pass source location and destination locations and other parameters. + +### Request Parameters + +To use **Route with traffic based ETA** feature, to get duration inclusive of traffic for a distance between locations use parameter resourceIdentifier as described below: + +- `resourceIdentifier:` This property is type of enum `MapplsDirectionsResourceIdentifier` with acceptable values `routeAdv`, `routeETA` and `routeTraffic`. The default value of this property is `routeAdv`. + +To choose **Travelling Mode** use parameter profileIdentifier as described below: + +- `profileIdentifier:` This property is type of enum `MapplsDirectionsProfileIdentifier` with acceptable values `driving`, `biking`, `walking` and `trucking`. The default value of this property is `driving`. + +**Additionally** you can set some more parameters on instance of `RouteOptions` to get filtered/specific results as : + +1. `routeType`: It is type of enum `MapplsRouteType` which can accept values `quickest`, `shortest`, `none`. By default its value is `none`. +2. `region`: It is type of enum `MapplsRegionType`. It is used to validate and get result for different countries. Currently five countries are supported including India which are Sri Lanka, India, Bhutan, Bangladesh, Nepal. +3. `instructions`: it is of type `boolean` its default value is `false` + +**Note**: If you are using **Routing with traffic** `routeType` and `region` values are not considered. Traffic is only available in India and only optimal route calculation is allowed with traffic. + +### Steps to get directions + +- To get directions create an array of `Waypoint` class, add two objects of `Waypoint` class to this array to get route path. For origin position also set heading of instance of `Waypoint` class. +- Next create an instance of `RouteOptions` class by passing waypoints created in previous step. +```swift +let options = RouteOptions(waypoints: [Waypoint(coordinate: CLLocationCoordinate2D(latitude: 28.551078, longitude: 77.268968), name: "Mappls"), Waypoint(coordinate: CLLocationCoordinate2D(latitude: 28.565065, longitude: 77.234193), name: "Moolchand")]) +``` +- Use `Directions` singleton class from `Directions` framework to get available routes. +- You can plot polylines on map for available routes by using Map framework. + +### [Directions Using Mappls Pins](#Directions-Using-MapplsPins) + +An object of Waypoint can be created using coordinate as well as [Mappls Pin](#https://about.mappls.com/app/features/mapplspin/) (unique identifier of place). + +```swift +Waypoint(coordinate: CLLocationCoordinate2D(latitude: 28.551078, longitude: 77.268968), name: "Mappls") + +or + +Waypoint(mapplsPin: "MMI000", name: "Mappls") +``` + +### Code Samples + +#### Swift +```swift +let waypoints = [ + Waypoint(coordinate: CLLocationCoordinate2D(latitude: 28.551078, longitude: 77.268968), name: "Mappls"), + Waypoint(coordinate: CLLocationCoordinate2D(latitude: 28.565065, longitude: 77.234193), name: "Moolchand"), +] + +let options = RouteOptions(waypoints: waypoints, resourceIdentifier: .routeAdv, profileIdentifier: .driving) +options.includesSteps = true + +let task = Directions.calculate(options) { (waypoints, routes, error) in + guard error == nil else { + print("Error calculating directions: \(error!)") + return + } + + if let route = routes?.first, let leg = route.legs.first { + print("Route via \(leg):") + + let distanceFormatter = LengthFormatter() + let formattedDistance = distanceFormatter.string(fromMeters: route.distance) + + let travelTimeFormatter = DateComponentsFormatter() + travelTimeFormatter.unitsStyle = .short + let formattedTravelTime = travelTimeFormatter.string(from: route.expectedTravelTime) + + print("Distance: \(formattedDistance); ETA: \(formattedTravelTime!)") + + for step in leg.steps { + print("\(step.instructions)") + let formattedDistance = distanceFormatter.string(fromMeters: step.distance) + print("— \(formattedDistance) —") + } + } +} +``` + +#### Objective-C +```objc +NSArray *waypoints = @[ + [[MapplsWaypoint alloc] initWithCoordinate:CLLocationCoordinate2DMake(28.551078, 77.268968) coordinateAccuracy:-1 name:@"Mappls"], + [[MapplsWaypoint alloc] initWithCoordinate:CLLocationCoordinate2DMake(28.565065, 77.234193) coordinateAccuracy:-1 name:@"Moolchand"], +]; +MapplsRouteOptions *options = [[MapplsRouteOptions alloc] initWithWaypoints:waypoints + resourceIdentifier:MapplsDirectionsResourceIdentifierRouteETA + profileIdentifier:MapplsDirectionsProfileIdentifierDriving]; +options.includesSteps = YES; + +NSURLSessionDataTask *task = [directions calculateDirectionsWithOptions:options + completionHandler:^(NSArray * _Nullable waypoints, + NSArray * _Nullable routes, + NSError * _Nullable error) { + if (error) { + NSLog(@"Error calculating directions: %@", error); + return; + } + + MapplsRoute *route = routes.firstObject; + MapplsRouteLeg *leg = route.legs.firstObject; + if (leg) { + NSLog(@"Route via %@:", leg); + + NSLengthFormatter *distanceFormatter = [[NSLengthFormatter alloc] init]; + NSString *formattedDistance = [distanceFormatter stringFromMeters:leg.distance]; + + NSDateComponentsFormatter *travelTimeFormatter = [[NSDateComponentsFormatter alloc] init]; + travelTimeFormatter.unitsStyle = NSDateComponentsFormatterUnitsStyleShort; + NSString *formattedTravelTime = [travelTimeFormatter stringFromTimeInterval:route.expectedTravelTime]; + + NSLog(@"Distance: %@; ETA: %@", formattedDistance, formattedTravelTime); + + for (MapplsRouteStep *step in leg.steps) { + NSLog(@"%@", step.instructions); + NSString *formattedDistance = [distanceFormatter stringFromMeters:step.distance]; + NSLog(@"— %@ —", formattedDistance); + } + } +}]; +``` + +### [**Usage with other Mappls Libraries**](Usage-with-other-Mappls-Libraries) + +#### [**Drawing Route on mappls's Map**](Drawing-Route-on-Mappls's-Map) + +Refer the code below to draw the route on a map: + +```swift +// main.swift + +if route.coordinateCount > 0 { + // Convert the route’s coordinates into a polyline. + var routeCoordinates = route.coordinates! + let routeLine = MGLPolyline(coordinates: &routeCoordinates, count: route.coordinateCount) + + // Add the polyline to the map and fit the viewport to the polyline. + mapView.addAnnotation(routeLine) + mapView.setVisibleCoordinates(&routeCoordinates, count: route.coordinateCount, edgePadding: .zero, animated: true) +} +``` + +```objc +// main.m + +if (route.coordinateCount) { + // Convert the route’s coordinates into a polyline. + CLLocationCoordinate2D *routeCoordinates = malloc(route.coordinateCount * sizeof(CLLocationCoordinate2D)); + [route getCoordinates:routeCoordinates]; + MGLPolyline *routeLine = [MGLPolyline polylineWithCoordinates:routeCoordinates count:route.coordinateCount]; + + // Add the polyline to the map and fit the viewport to the polyline. + [mapView addAnnotation:routeLine]; + [mapView setVisibleCoordinates:routeCoordinates count:route.coordinateCount edgePadding:UIEdgeInsetsZero animated:YES]; + + // Make sure to free this array to avoid leaking memory. + free(routeCoordinates); +} +``` + +## [Driving Distance Time Matrix API](#Driving-Distance-Time-Matrix-API) + +For live demo click [LIVE DEMO](https://about.mappls.com/api/advanced-maps/doc/sample/mapmyindia-maps-distance-matrix-api-example) + +Get driving distance & time from a point to multiple destination + +Adding driving distance matrix API would help to add predicted travel time & duration from a given origin point to a number of points. The Driving Distance Matrix API provides driving distance and estimated time to go from a start point to multiple destination points, based on recommended routes from Mappls Map and traffic flow conditions. + +Class used for driving distance is `MapplsDrivingDistanceMatrixManager`. Create a `MapplsDrivingDistanceMatrixManager` object using your rest key or alternatively, you can place your rest key in the `MapplsRestKey` key of your application’s `Info.plist` file, then use the shared instance of `MapplsDrivingDistanceMatrixManager` class. + +To perform this operation use `MapplsDrivingDistanceMatrixOptions` class to pass center location and points parameters. + +To use API **Distance Matrix with traffic** to get duration inclusive of traffic for a distance between locations use parameter `resourceIdentifier` as described below: + +- `resourceIdentifier:` This property is type of enum `MapplsDistanceMatrixResourceIdentifier` with acceptable values `default`, `eta` and `traffic`. The default value of this property is `default`. + +To choose **Travelling Mode** use parameter profileIdentifier as described below: + +- `profileIdentifier:` This property is type of enum `MapplsDirectionsProfileIdentifier` with acceptable values `driving`, `biking`, `walking` and `trucking`. The default value of this property is `driving`. + +### Request Parameters + +Additionally you can pass some other parameters to get filtered/specific results. Which are as : + +1. **routeType:** It is type of enum `DistanceRouteType`. +2. **region:** It is type of enum `MapplsRegionType`. It is used to validate and get result for different countries. Currently five countries are supported including India which are Sri Lanka, India, Bhutan, Bangladesh, Nepal. +3. **sourceIndexes**: It is an array of int which specifie index of the source locations +4. **destinationIndexes**: It is an array of int which specifie index of the destinations locations. + +**Note**: If you are using **Distance Matrix with traffic** `routeType` and `region` values are not considered. Traffic is only available in India and only optimal route calculation is allowed with traffic. + +### Response Parameters + +In response either you will receive an error or an object of `MapplsDrivingDistanceMatrixResponse` where structure of object is as described below: + +1. `responseCode`: API status code. +2. `version`: API’s version information +3. `results`: Array of results, each consisting of the following parameters + - `code`: if the request was successful, code is “ok”. + - `durations`: duration in seconds for source to secondary locations in order as passed. + - `distances`: distance in meters for source to secondary locations in order as passed. + +### Code Samples + +**Objective C** +```objectivec +MapplsDrivingDistanceMatrixManager *distanceMatrixManager = [MapplsDrivingDistanceMatrixManager sharedManager]; + +MapplsDrivingDistanceMatrixOptions *distanceMatrixOptions = [[MapplsDrivingDistanceMatrixOptions alloc] initWithCenter:[[CLLocation alloc] initWithLatitude: 28.543014 longitude:77.242342] points:[NSArray arrayWithObjects: [[CLLocation alloc] initWithLatitude:28.520638 longitude:77.201959], [[CLLocation alloc] initWithLatitude:28.511810 longitude: 77.252773], nil] withRegion:MapplsRegionTypeIndia]; + +[distanceMatrixManager getResultWithOptions:distanceMatrixOptions completionHandler:^(MapplsDrivingDistanceMatrixResponse * _Nullable result, NSError * _Nullable error) { + if (error) { + NSLog(@"%@", error); + } else if (result != nil && result.results != nil) { + NSArray *durations = result.results.durations.firstObject; + NSArray *distances = result.results.distances.firstObject; + + NSUInteger pointCount = [distanceMatrixOptions points].count; + for (NSUInteger i = 0; i < pointCount; i++) { + if (i < durations.count && i < distances.count) { + NSLog(@"Driving Distance Matrix ETA %lu duration: %@, distance: %@", (unsigned long)i, durations[i], distances[i]); + } + } + } else { + NSLog(@"No results"); + } +}]; + +``` +**Swift** +```swift +let distanceMatrixManager = MapplsDrivingDistanceMatrixManager.shared +let distanceMatrixOptions = MapplsDrivingDistanceMatrixOptions(center: CLLocation(latitude: 28.543014, longitude: 77.242342), points: [CLLocation(latitude: 28.520638, longitude: 77.201959), CLLocation(latitude: 28.511810, longitude: 77.252773)]) +distanceMatrixOptions.profileIdentifier = .driving +distanceMatrixOptions.resourceIdentifier = .eta +distanceMatrixManager.getResult(distanceMatrixOptions) { (result, error) in + if let error = error { + NSLog("%@", error) + } else if let result = result, let results = result.results, let durations = results.durations?[0], let distances = results.distances?[0] { + let pointCount = distanceMatrixOptions.points?.count ?? -1 + for i in 0.. * _Nullable suggestions, NSError * _Nullable error) { + if (error) { + + } else if (suggestions) { + for (MapplsPOISuggestion *suggestion in suggestions) { + NSLog(@"POI Along %@%@ %@ %@", suggestion.latitudeObjC, suggestion.longitudeObjC, suggestion.mapplsPin, suggestion.distanceObjC); + } + } +}]; +``` + +
+ +For more details visit our [api reference documentation](https://about.mappls.com/api/advanced-maps/doc/poi-along-the-route) + +## [Nearby Reports API](#Nearby-Reports-API) + +Nearby Reports enables the user to get required reports related to traffic, safety, community issues etc on the basis of input bound. + +Class used to get list of Nearby Reports API is `MapplsNearbyReportManager`. Create an object of this class using Mappls's API Keys or alternatively use shared instance of `MapmyIndidiaNearbyReportManager` class. + +**Note:** To use shared SDK must be initilized by setting Mappls's API Acesss Keys using class `MapplsAccountManager` of framework `MaplsAPIKit`. For more information please see [here](https://github.com/mappls-api/mappls-ios-sdk/blob/main/docs/v1.0.0/MapplsAPICore.md). + +### Request Parameters + +`MapplsNearbyReportOptions` is request class which will be used to pass all required and optional parameters. So it will be require to create an instance of `MapplsNearbyReportOptions` and pass that instance to `getNearbyReportResult` function of `MapmyIndidiaNearbyReportManager`. + +#### Mandatory Parameters: +1. **bound:** This parameter takes bound. It is of type `MapplsRectangularRegion` which is s a rectangular bounding box for a geographic region. whic contains following parameters + a. bottomRight :- Coordinate at the bottomRight corner which is of type `CLLocationCoordinate2D` + b. topLeft:- Coordinate at the northeast corner which is of type `CLLocationCoordinate2D` + +### Response Parameters: + +In callback of `getPOIsAlongTheRoute` function it will either return an error object of type 'NSError' or an array of type `MapplsNearbyReportResponse`. Below is list of parameters of `MapplsNearbyReportResponse`: + +- **`id`(String)**: Id of the report. +- **`latitude`(Double):** Latitude of the report. +- **`longitude`(Double):** Longitude of the report. +- **`category`(String):** Report category +- **`createdOn`(Int):** Timestamp when event created + +**Swift** +```swift +let nearbyReportManager = MapplsNearbyReportManager.shared +let topleft = CLLocationCoordinate2D(latitude: 28.0, longitude: 78.32) +let bottomRight = CLLocationCoordinate2D(latitude: 34.0, longitude: 78.32) + +let bound = MapplsRectangularRegion(topLeft: topleft, bottomRight: bottomRight) +let option = MapplsNearbyReportOptions(bound: bound) +nearbyReportManager.getNearbyReportResult(option) { (response, error) in + if let error = error { + print("error: \(error.localizedDescription)") + } else { + if let res: MapplsNearbyReportResponse = response, let totalItem = res.pagination?.totalItems { + if let reports = res.reports { + for i in reports { + if let lat = i.latitude, let long = i.longitude { + let coordinate = CLLocationCoordinate2D(latitude: lat, longitude: long) + print("Reported Coordinate: \(coordinate)") + } + } + } + print("Total item : \(totalItem)") + } + } +} +``` + + +## [Current Weather Condition API](#Current-Weather-Condition-API) + +API enables the developer to access current weather condition around whole India. This also enable developer to fetch current +1. Air quality index +2. Temperature +3. Humidity +4. Wind +5. Visibility + +Class used to get list of Current Weather Condition API is `MapplsWeatherManager`. Create an object of this class using Mappls's API Keys or alternatively use shared instance of `MapplsWeatherManager` class. + +**Note:** To use shared SDK must be initilized by setting Mappls's API Acesss Keys using class `MapplsAccountManager` of framework `MaplsAPIKit`. For more information please see [here](https://github.com/mappls-api/mappls-ios-sdk/blob/main/docs/v1.0.0/MapplsAPICore.md). + +### Request Parameters + +`MapplsWeatherRequestOptions` is request class which will be used to pass all required and optional parameters. So it will be require to create an instance of `MapplsWeatherRequestOptions` and pass that instance to `getResults` function of `MapplsWeatherManager`. + +#### Mandatory Parameters: +1. `location`: It is of type `CLLLocation` which takes `Latitude` and `longitude` of place + +#### Optional Parameter +1. `tempUnit (String)`: Unit of temperature. **Below are the available value:** + - "C" celcius(°C) + - "F" farenheit (F) +2. `theme (MapplsIconTheme)`: This parameter is used to define the theme of icon. **Below are the available value:** + - MapplsIconThemeDark + - MapplsIconThemeLight +3. `size (MapplsWeatherIconSize )`: This parameter is used to define the size of icon. **Below are the available value:** + - MapplsWeatherIconSize36PX (Default) + - MapplsWeatherIconSize24PX +4. `unitType (MapplsWeatherForcastUnitType)`: This parameter defines the unit type on the basis of which weather forecast information is sought for. **Below are the available value:** + - MapplsWeatherForcastUnitTypeDay + - MapplsWeatherForcastUnitTypeHour +5. `unit (string)`: This parameter is the value for which forecast information is sought for. Valid values are: + - For Days + - `1` + - `5` + - `10` + - For Hours + - `1` + - `24` + + +### Response Parameters: + +In callback of `getResults` function it will either return an error object of type `NSError` or an array of type `MapplsWeatherResponse`. Below is list of parameters of `MapplsWeatherResponse`: + +## Response parameters +1. `data` (`MapplsWeatherData`) + +#### MapplsWeatherData result parameters: +1. `temperature` (`MapplsWeatherTemperature`) + #### MapplsWeatherTemperature result parameters: + 1. `value` (`NSNumber`): Temperature value.For eg:31.3 + 2. `unit` (`String`): Temperature unit.For eg:"°C" + +2. `weatherCondition` (`MapplsWeatherCondition`): Weather condition info + + #### MapplsWeatherCondition result parameters: + 1. `weatherId` (`NSNumber`): Id of Weather condition. For eg:5 + 2. `weatherText` (`String`): Weather condition info text.For eg:"Hazy sunshine" + 3. `weatherDescription` (`String`): Description of weather For eg: "Total cloud cover between 20%-60%" + 4. `weatherIcon` (`String`): Weather condition icon url. + 5. `realFeelWeatherText` (`String`):Description of weather For eg:"Feels Like 41.0 °C" + + +3. `airQuality` (`MapplsAirQuality`): Air Quality info + #### AirQuality result parameters: + 1. `airQualityIndex` (`NSNumber`): Give the value of air quality index. For eg:104 + 2. `airQualityIndexText` (`String`): Description for AQI given. For eg: "Unhealthy for Sensitive Groups" + 3. `airQualityIndexUnit` (`String`): Gives the values of airquality index unit. For eg: "PM2.5" + +4. `humidity` (`MapplsHumidity`): MapplsHumidity info + + #### MapplsHumidity result parameters: + 1. `relHumidity` (`NSNumber`): Provides the value for humidity. For Eg: 65 + 2. `indoorRelHumidity` (`NSNumber`): Provide value for indoor relative humidity . For eg: 65 + +5. `wind` (`MapplsWind`): Mappls Info + + #### Mappls result parameters: + 1. `windSpeed`(`NSNumber`):For Eg:12.8 + 2. `windSpeedUnit` (`String`):For Eg: "KM/H" + 3. `windAngle` (`NSNumber`):For Eg: 338 + 4. `windAngleUnit` (`String`): For Eg: "NNW" + +6. `visibility` (`MapplsVisibility`): MapplsVisibility Info + #### MapplsVisibility result parameters: + 1. `value` (`NSNumber`): Visibilty value. For eg: 2 + 2. `unit` (`String`): Unit of Visibilty value. For eg: "KM" + +7. `forecastData`: This feature is available for your solutions to get forecast details. The API is able to populate current weather condition and `forecast` of `1`, `5` & `10` days (depending on input)or hours based forecast for `1` hr and `24` hrs. + + #### MapplsForecastData result parameters: + 1. `hour`(`String`): Value Returned when request is made for hours. For eg: "26/09/2022 18:00", + 2. `date` (`String`): Value Returned when request is made for multiple day/days. For eg: "28/09/2022", + 3. `day` (`String`): Represents day name when request is made for multiple day/days. For eg: "Wednesday". + 4. `temperature` (`MapplsWeatherTemperature`): + + - `minTemperature`(`NSNumber`): Minimum temperature value for the day/night.For eg:31.3 + - `minTemperatureUnit` (`String`): Minimum Temperature Unit. For eg:"°C" + - `maxTemperature` (`NSNumber`): Maximum Temperature value for the day/night.For eg:31.3 + - `maxTemperatureUnit` (`String`): Maximum Temperature Unit. For eg:"°C" + + 5. `weatherCondition` (`MapplsWeatherCondition`) + + - `weatherIdDay` (`NSNumber`): Shows the ID of the day For Eg: 1 + - `weatherTextDay` (`String`): Shows the forcast description for the day For Eg: "Sunny" + - `weatherIconDay` (`String`): Shows the forcast icon for day For Eg: "1.png" + - `weatherIdNight` (`NSNumber`): Shows the ID of the night For Eg: 33 + - `weatherTextNight` (`String`): Shows the forcast description for the night For Eg: "Clear" + - `weatherIconNight` (`String`): Shows the forcast icon for the night For Eg: "33.png" + +**Swift** +```swift + let location = CLLocation(latitude: 28.787, longitude: 77.7873) + let options = MapplsWeatherRequestOptions(location: location) + // for 5 day weather forcast + options.unitType = .day + options.unit = "5" + + // for icon theme + options.theme = .light + MapplsWeatherManager.shared.getResults(options) { weatherResponse, error in + if let error = error { + print("error: \(error.localizedDescription)") + } else { + if let temp = weatherResponse?.data?.temperature?.value , let unit = weatherResponse?.data?.temperature?.unit { + print("current temperature: \(temp) \(unit)") + } + + if let forcast = weatherResponse?.data?.forecastData { + for forecastData in forcast { + if let day = forecastData.day, let date = forecastData.date { + print("day: \(forecastData.day) Date: \(date)") + } + } + } + } + } +``` +**Objective-c** + +```objc + MapplsWeatherManager * manager = [MapplsWeatherManager sharedManager]; + CLLocation *location = [[CLLocation alloc] initWithLatitude:28.00 longitude:78.00]; + MapplsWeatherRequestOptions *options = [[MapplsWeatherRequestOptions alloc] initWithLocation:location]; + options.theme = MapplsIconThemeLight; + options.unitType = MapplsWeatherForcastUnitTypeHour; + options.unit = @"5"; + [manager getResultsWithOptions:options completionHandler:^(MapplsWeatherResponse * _Nullable response, NSError * _Nullable error) { + if (error != nil ) { + NSLog(@"error: %@", error.localizedDescription); + } else {} + NSLog(@"temperature %@", response.data.temperature.value); + NSLog(@"temperatureUnit %@", response.data.temperature.unit); + + for (MapplsForecastData* weatherForcast in response.data.forecastData){ + NSLog(@"day %@", weatherForcast.day); + NSLog(@"date %@", weatherForcast.date); + } + } + }]; +``` + +## [Congestion Delays](#Congestion-Delays) + +To get congestion delays for a route, a helper function `getCongestionDelays` added in class of MapplsDirectionUtility. + +**`getCongestionDelays`** + +**Parameters:** +- route: An instance of 'Route'. +- fromLocation: Location coordinate from which congestion is to be calculate on a route. The coordinate should lie on line of coordinates of route. +- uptoDistane: Distance in meters, upto which congestion is to be calculate on a route +- minCongestionDelay: Minimum delay in minutes, greater than that only congestion will be returned. This value should be greated then or equal to 1. + +**Returns:** +Will return an array of `CongestionDelayInfo` which contains delay in seconds and center coordinate. + +**Swift** + +```swift +let congestionDelays = MapplsDirectionsUtility().getCongestionDelays(forRoute: route, fromLocation: currentLocation, uptoDistane: 50, minCongestionDelay: 5) +``` +## [Driving Range](#Driving-Range) + +The allows you to get driving range area to drive based on time or distance. + +### [MapplsDrivingRangeManager](#MapplsDrivingRangeManager) + +`MapplsDrivingRangeManager` is the main class which will be used to get driving range. It allows you to get driving range area to drive based on time or distance. + +```swift +let location = CLLocation(latitude: 28.612972, longitude: 77.233529) +let contours = [MapplsDrivingRangeContour(value: 15)] +let rangeInfo = MapplsDrivingRangeRangeTypeInfo(rangeType: .distance, contours: contours) + +let drivingRangeOptions = MapplsDrivingRangeOptions(location: location, rangeTypeInfo: rangeInfo) + +var drivingRangeManager = MapplsDrivingRangeManager.shared + +drivingRangeManager.getDrivingRange(drivingRangeOptions) { (data, error) in + if let error = error { + // error + } else if let data = data { + // Response is geoJSON NSData + // Create shape/source object from data + let polygonFeatureCollection = try? MGLShape(data: data, encoding: String.Encoding.utf8.rawValue) as? MGLShapeCollectionFeature + } else { + // no results + } +} +``` + +### [MapplsDrivingRangeOptions](#MapplsDrivingRangeOptions) + +It is a structure that specifies the criteria for request for geting polygons as range to drive based on time or distance. + +It contains following properties. + +- **name:-** It is of type `String` used for name of the isopolygon request. If name is specified, the name is returned with the response. + +- **location:-** It is of type `CLLocation`, Center point for range area that will surrounds the roads which can be reached from this point in specified time range(s). + +- **drivingProfile:-** It is of type `MapplsDirectionProfileIdentifier`. Driving profile for routing engine. Default value is `auto`. + +- **speedTypeInfo:-** It is of protocol type `MapplsDrivingRangeSpeed`. It is used to calculate the polygon. Instance of `MapplsDrivingRangeSpeedOptimal`, `MapplsDrivingRangeSpeedPredictiveFromCurrentTime` or `MapplsDrivingRangePredictiveSpeedFromCustomTime` can be set. + +- **rangeTypeInfo:-** It is of type `MapplsDrivingRangeRangeTypeInfo`. To specify the type of range which is used to calculate the polygon. + +- **isForPolygons:-** A Boolean value to determine whether to return geojson polygons or linestrings. The default is true. + +- **isShowLocations:-** A boolean indicating whether the input locations should be returned as MultiPoint features: one feature for the exact input coordinates and one feature for the coordinates of the network node it snapped to. The default is false. + +- **denoise:-** A floating point value from 0 to 1 (default of 1) which will be used to remove smaller contours. Default value is 0.5. + +- **generalize:-** A floating point value in meters used as the tolerance for Douglas-Peucker generalization. Default value is 1.2 + + +### [MapplsDrivingRangeRangeTypeInfo](#MapplsDrivingRangeRangeTypeInfo) + +Use instance of it to set speed type in instance of `MapplsDrivingRangeOptions`. + +It contains following properties. + +- **rangeType:-** It is type of enum `MapplsDrivingRangeRangeType`. It specify the type of range which is used to calculate the polygon. Acceptable values are time and distance. Default value is time + +- **contours:-** An array of contour (of type `MapplsDrivingRangeContour`) objects Each contour object is combination of value and colorHexString. There must be minimum one item in the array if not set by default one value will be passed with default value. + +Below is line of code to initilize instance of it: + +```swift +let contours = [MapplsDrivingRangeContour(value: 2)] +let rangeInfo = MapplsDrivingRangeRangeTypeInfo(rangeType: .time, contours: contours) +``` + +### [MapplsDrivingRangeContour](#MapplsDrivingRangeContour) + +Use instance of it to set speed type in instance of `MapplsDrivingRangeOptions`. + +It contains following properties. + +- **value:-** It is of type `Int`. It's value be considered as time or distance depending upon type of Range in instance of `MapplsDrivingRangeRangeTypeInfo`. If type of range is time then value will considered in minute/s where default value will be 15 and maximun acceptable value will be 120. If type of range is distance then value will considered in kilometer/s where default value will be 1 and maximun acceptable value will be 100. + +- **colorHexString:-** It is of type `String`. It specify the color for the output of the contour. Pass a hex value, such as `ff0000` for red. If no color is specified, default color will be assigned. + +Below is line of code to initilize instance of it: + +```swift +let contour = MapplsDrivingRangeContour(value: 15) +``` + +### [MapplsDrivingRangeOptimalSpeed](#MapplsDrivingRangeOptimalSpeed) + +It is a structure to specify the type of speed to use to calculate the polygon. +Type of speed will be optimal. + +Use instance of it to set speed type in instance of `MapplsDrivingRangeOptions`. + +Below is line of code to initilize instance of it: + +```swift +let speedInfo = MapplsDrivingRangeOptimalSpeed() +``` + +### [MapplsDrivingRangePredictiveSpeedFromCurrentTime](#MapplsDrivingRangePredictiveSpeedFromCurrentTime) + +It is a structure to specify the type of speed and timestamp to use to calculate the polygon. Type of speed will be predicitve and timestamp will be current. + +Use instance of it to set speed type in instance of `MapplsDrivingRangeOptions`. + +Below is line of code to initilize instance of it: + +```swift +let speedInfo = MapplsDrivingRangePredictiveSpeedFromCurrentTime() +``` + +### [MapplsDrivingRangePredictiveSpeedFromCustomTime](#MapplsDrivingRangePredictiveSpeedFromCustomTime) + +It is a structure to specify the type of speed and timestamp to use to calculate the polygon. Type of speed will be predicitve and timestamp will be required to initialize instance of this. + +Use instance of it to set speed type in instance of `MapplsDrivingRangeOptions`. + +Below is line of code to initilize instance of it: + +```swift +let speedInfo = MapplsDrivingRangePredictiveSpeedFromCustomTime(timestamp: 1633684669) +``` + +


+ +## Our many happy customers: + +![](https://www.mapmyindia.com/api/img/logos1/PhonePe.png)![](https://www.mapmyindia.com/api/img/logos1/Arya-Omnitalk.png)![](https://www.mapmyindia.com/api/img/logos1/delhivery.png)![](https://www.mapmyindia.com/api/img/logos1/hdfc.png)![](https://www.mapmyindia.com/api/img/logos1/TVS.png)![](https://www.mapmyindia.com/api/img/logos1/Paytm.png)![](https://www.mapmyindia.com/api/img/logos1/FastTrackz.png)![](https://www.mapmyindia.com/api/img/logos1/ICICI-Pru.png)![](https://www.mapmyindia.com/api/img/logos1/LeanBox.png)![](https://www.mapmyindia.com/api/img/logos1/MFS.png)![](https://www.mapmyindia.com/api/img/logos1/TTSL.png)![](https://www.mapmyindia.com/api/img/logos1/Novire.png)![](https://www.mapmyindia.com/api/img/logos1/OLX.png)![](https://www.mapmyindia.com/api/img/logos1/sun-telematics.png)![](https://www.mapmyindia.com/api/img/logos1/Sensel.png)![](https://www.mapmyindia.com/api/img/logos1/TATA-MOTORS.png)![](https://www.mapmyindia.com/api/img/logos1/Wipro.png)![](https://www.mapmyindia.com/api/img/logos1/Xamarin.png) + +
+ +For any queries and support, please contact: + +[

](https://about.mappls.com/api/) + +Email us at [apisupport@mappls.com](mailto:apisupport@mappls.com) + +![](https://www.mapmyindia.com/api/img/icons/support.png) +[Support](https://about.mappls.com/contact/) +Need support? contact us! + +

+ +[

](https://stackoverflow.com/questions/tagged/mappls-api)[![](https://www.mapmyindia.com/api/img/icons/blog.png)](https://about.mappls.com/blog/)[![](https://www.mapmyindia.com/api/img/icons/gethub.png)](https://github.com/mappls-api)[

](https://www.npmjs.com/org/mapmyindia) + +[

](https://www.facebook.com/Mapplsofficial)[![](https://www.mapmyindia.com/june-newsletter/icon2.png)](https://twitter.com/mappls)[![](https://www.mapmyindia.com/newsletter/2017/aug/llinkedin.png)](https://www.linkedin.com/company/mappls/)[![](https://www.mapmyindia.com/june-newsletter/icon3.png)](https://www.youtube.com/channel/UCAWvWsh-dZLLeUU7_J9HiOA) + +

@ Copyright 2022 CE Info Systems Pvt. Ltd. All Rights Reserved.
+ +
Terms & Conditions | Privacy Policy | Supplier Sustainability Policy | Health & Safety Policy | Environmental Policy & CSR Report + +
Customer Care: +91-9999333223
diff --git a/docs/v1.0.13/MapplsAnnotationExtension.md b/docs/v1.0.13/MapplsAnnotationExtension.md new file mode 100644 index 0000000..de42b7b --- /dev/null +++ b/docs/v1.0.13/MapplsAnnotationExtension.md @@ -0,0 +1,437 @@ +[

](https://www.mapmyindia.com/api) + +# Mappls Annotation Extension for iOS + +The Mappls Annotation Extension is a lightweight library you can use with the Mappls Map SDK for iOS to quickly add basic shapes, icons, and other annotations to a map. + +This extension leverages the power of runtime styling with an object oriented approach to simplify the creation and styling of annotations. + +## [Installation](#Installation) + +This plugin can be installed using CocoaPods. It is available with name `MapplsAnnotationExtension`. + +### [Using CocoaPods](#Using-CocoaPods) + +To install the Mappls Annotation Extension using CocoaPods: + +Create a Podfile with the following specification: + +``` +pod 'MapplsAnnotationExtension', '1.0.0' +``` + +Run `pod repo update && pod install` and open the resulting Xcode workspace. + +#### [Dependencies](#Dependencies) + +This library depends upon several Mappls's own and third party libraries. All dependent libraries will be automatically installed on using CocoaPods. + +Below are list of dependcies which are required to run this SDK: + +- [MapplsAPICore](MapplsAPICore.md) +- [MapplsAPIKit](MapplsAPIKit.md) +- [MapplsMaps](MapplsMap.md) + +### [Version History](#Version-History) + +| Version | Dated | Description | +| :---- | :---- | :---- | +| `1.0.0` | 14 June 2022 | Initial Mappls release. | + +## [Authorization](#Authorization) + +### [MapplsAPICore](#MapplsAPICore) +It is required to set MAPPLS's keys to use any MAPPL's SDK. Please see [here](MapplsAPICore.md) to achieve this. + +## [Usage](#Usage) + +The Mappls Annotation Extension supports the addition of circles, lines, polygons, and symbols. Each shape type has its own corresponding controller which manages the addition of multiple shape objects of the same type. + +Since the map needs to be finished loading before adding shapes to it, all shapes should be added within the `MGLMapView:didFinishLoadingStyle:` delegate method. + +### Circles (`MGLCircleStyleAnnotation`) + +_Circles represent a coordinate point on a map with an associated radius, measured in pixels._ + +Circle can be created by two ways. + +One is by creating instance of `MGLCircleStyleAnnotation`, either using a coordinate or Mappls Pin. + +```swift +let circle = MGLCircleStyleAnnotation(center: CLLocationCoordinate2D(latitude: 59.31, longitude: 18.06), radius: 3.0, color: .blue) +``` +or +```swift +let circle = MGLCircleStyleAnnotation(centerMapplsPin: "MMI000", radius: 3.0, color: .blue) +``` + +See code below to plot circle on map: + +```swift +func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) { + let circleAnnotationController = MGLCircleAnnotationController(mapView: self.mapView) + let circle = MGLCircleStyleAnnotation(center: CLLocationCoordinate2D(latitude: 59.31, longitude: 18.06), radius: 3.0, color: .blue) + circle.opacity = 0.5 + circleAnnotationController.add(circle) +} +``` + +Second is by passing a geoJSON (with point geometry) string in function `create` of instance of `MGLCircleAnnotationController`. As mentioned below. + +```swift +let circleGeoJSON = "{\"type\": \"FeatureCollection\",\"features\": [{\"type\": \"Feature\",\"properties\": {\"circle-radius\": \"50\",\"circle-color\": \"rgba(0, 0, 255, 1)\",\"circle-blur\": \"0\",\"circle-opacity\": \"0.7\",\"circle-stroke-width\": \"5\",\"circle-stroke-color\": \"rgba(0, 255, 0, 1)\",\"circle-stroke-opacity\": \"0.6\",\"is-draggable\": true},\"geometry\": {\"type\": \"Point\",\"coordinates\": [174.70458984375,-39.588757276965445]}}]}" + +func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) { + let circleAnnotationController = MGLCircleAnnotationController(mapView: self.mapView) + circleAnnotationController.create(fromGeoJSON: circleGeoJSON) { (annotations, error) in + if let error = error { + print(error.localizedDescription) + } else if let annotations = annotations, annotations.count > 0 { + // Do custom actions here. + } else { + print("No result found") + } + } +} +``` + +### Lines (`MGLLineStyleAnnotation`) +_Lines represent a connected series of coordinates._ + +Line can be created by two ways. + +One is by creating instance of `MGLLineStyleAnnotation` using array of coordinates. As mentioned below. + +```swift +func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) { + let lineAnnotationController = MGLLineAnnotationController(mapView: self.mapView) + + let lineCoordinates = [ + CLLocationCoordinate2D(latitude: 59, longitude: 18), + CLLocationCoordinate2D(latitude: 60, longitude: 20) + ] + + let line = MGLLineStyleAnnotation(coordinates: lineCoordinates, count: UInt(lineCoordinates.count)) + line.color = .purple + lineAnnotationController.add(line) +} +``` + +Second is by passing a geoJSON (with line geometry) string in function `create` of instance of `MGLLineAnnotationController`. As mentioned below. + +```swift +let lineGeoJSON = "{\"type\": \"FeatureCollection\",\"features\": [{\"type\": \"Feature\",\"properties\": {\"line-join\": \"bevel\",\"line-opacity\": \"0.7\",\"line-color\":\"rgba(0, 255, 0, 1)\",\"line-width\": \"10\",\"line-gap-width\": \"1\",\"line-offset\": \"2\",\"line-blur\": \"0\"},\"geometry\": {\"type\": \"LineString\",\"coordinates\": [[168.5302734375,-46.377254205100265],[169.0576171875,-46.36209301204983],[169.65087890625,-46.13417004624325],[170.5078125,-45.782848351976746],[170.68359375,-45.213003555993964],[170.79345703124997,-44.840290651397986],[171.2109375,-44.16644466445859],[171.84814453125,-43.80281871904721],[172.59521484375,-43.309191099856854],[172.83691406249997,-42.81152174509788],[173.38623046875,-42.342305278572816]]}}]}" + +func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) { + let lineAnnotationController = MGLLineAnnotationController(mapView: self.mapView) + + lineAnnotationController.create(fromGeoJSON: lineGeoJSON) { (annotations, error) in + if let error = error { + print(error.localizedDescription) + } else if let annotations = annotations, annotations.count > 0 { + // Do custom actions here. + } else { + print("No result found") + } + } +} +``` + +### Polygons (`MGLPolygonStyleAnnotation`) +_Polygons represent a connected series of coordinates, where the first and last coordinates are equal._ + +Polygons can be created by two ways. + +One is by creating instance of `MGLPolygonStyleAnnotation` using array of coordinates. As mentioned below. + +```swift +func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) { + let polygonAnnotationController = MGLPolygonAnnotationController(mapView: self.mapView) + + let polygonCoordinates = [ + CLLocationCoordinate2DMake(59, 18), + CLLocationCoordinate2DMake(62, 19), + CLLocationCoordinate2DMake(54, 20), + CLLocationCoordinate2DMake(59, 18) + ] + + let polygon = MGLPolygonStyleAnnotation(coordinates: polygonCoordinates, count: UInt(polygonCoordinates.count)) + polygon.fillOutlineColor = .red + polygonAnnotationController.add(line) +} +``` + +Second is by passing a geoJSON (with polygon geometry) string in function `create` of instance of `MGLPolygonAnnotationController`. As mentioned below. + +```swift +let polygonGeoJSON = "{\"type\": \"FeatureCollection\",\"features\": [{\"type\": \"Feature\",\"properties\": {\"fill-opacity\": \"0.6\",\"fill-color\": \"rgba(0, 0, 255, 1)\",\"fill-outline-color\": \"rgba(255, 0, 0, 1)\",\"is-draggable\": true},\"geometry\": {\"type\": \"Polygon\",\"coordinates\": [[[170.947265625,-40.38002840251182],[172.59521484375,-39.90973623453718],[172.77099609375,-39.06184913429153],[172.77099609375,-38.03078569382294],[171.97998046874997,-37.579412513438385],[170.859375,-38.169114135560854],[169.93652343749997,-38.685509760012],[169.0576171875,-38.90813299596704],[168.99169921875,-40.563894530665074],[170.947265625,-40.38002840251182]]]}}]}" + +func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) { + let polygonAnnotationController = MGLPolygonAnnotationController(mapView: self.mapView) + + polygonAnnotationController.create(fromGeoJSON: polygonGeoJSON) { (annotations, error) in + if let error = error { + print(error.localizedDescription) + } else if let annotations = annotations, annotations.count > 0 { + // Do custom actions here. + } else { + print("No result found") + } + } +} +``` + +### Symbols (`MGLSymbolStyleAnnotation`) +_Symbols represent a coordinate point on a map with a label and an associated optional icon image. An image must be supplied to the map's style before being able to assign it to be the icon image of a symbol._ + +Symbol can be created by two ways. + +One is by creating instance of `MGLSymbolStyleAnnotation` either using a coordinate or Mappls Pin. + +```swift +let symbol = MGLSymbolStyleAnnotation(coordinate: CLLocationCoordinate2DMake(59, 18)); +``` +or +```swift +let symbol = MGLSymbolStyleAnnotation(mapplsPin: "MMI000") +``` + +See code below to plot symbol marker on map: + +```swift +func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) { + let attraction = UIImage(named: "attraction") + + if let styleImage = attraction { + self.mapView.style?.setImage(styleImage, forName: "attraction") + } + + let symbolAnnotationController = MGLSymbolAnnotationController(mapView: self.mapView) + + let symbol = MGLSymbolStyleAnnotation(coordinate: CLLocationCoordinate2DMake(59, 18)); + symbol.iconImageName = "attraction" + symbol.text = "This is a cool place!" + symbol.textFontSize = 16 + symbolAnnotationController.add(symbol) +} +``` + +Second is by passing a geoJSON (with point geometry) string in function `create` of instance of `MGLSymbolAnnotationController`. As mentioned below. + +```swift +let symbolGeoJSON = "{\"type\": \"FeatureCollection\",\"features\": [{\"type\": \"Feature\",\"properties\": {\"symbol-sort-key\": \"0\",\"icon-size\": \"1\",\"icon-image\": \"star-icon-image\",\"icon-rotate\": \"45\",\"icon-offset\": [5,10],\"icon-anchor\": \"bottom\",\"text-field\": \"Hello\",\"text-font\": [\"Open Sans Bold\"],\"text-size\": \"30\",\"text-max-width\": \"200\",\"text-letter-spacing\": \"1\",\"text-justify\": \"right\",\"text-radial-offset\": \"10\",\"text-anchor\": \"center\",\"text-rotate\": \"-30\",\"text-transform\": \"uppercase\",\"text-offset\": [5,10],\"icon-opacity\": \"0.6\",\"icon-color\": \"rgba(0, 0, 255, 1)\",\"icon-halo-color\": \"#00FF00\",\"icon-halo-width\": \"10\",\"icon-halo-blur\": \"0\",\"text-opacity\": \"0.5\",\"text-color\": \"rgba(255, 0, 0, 1)\",\"text-halo-color\": \"hsla(100, 50%, 50%, 1)\",\"text-halo-width\": \"5\",\"text-halo-blur\": \"0\",\"is-draggable\": true},\"geometry\": {\"type\": \"Point\",\"coordinates\": [172.5732421875,-46.31658418182218]}}]}" + +func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) { + let attraction = UIImage(named: "attraction") + + if let styleImage = attraction { + self.mapView.style?.setImage(styleImage, forName: "attraction") + } + + let symbolAnnotationController = MGLSymbolAnnotationController(mapView: self.mapView) + + symbolAnnotationController.create(fromGeoJSON: symbolGeoJSON) { (annotations, error) in + if let error = error { + print(error.localizedDescription) + } else if let annotations = annotations, annotations.count > 0 { + // Do custom actions here. + } else { + print("No result found") + } + } +} +``` + +### Displaying callouts for style annotations + +Style annotations support callouts that appear when the annotation is selected. Each callout can display additional information about its annotation. + +1) To enable callouts for a style annotation, create a class property with the controller type you are enabling interaction for: + +```swift +class ViewController: UIViewController { + var mapView: MGLMapView! + var circleAnnotationController: MGLCircleAnnotationController! +} +``` + +2) The style annotation must contain a title and must implement two delegate methods using the Maps SDK for iOS. The first method, `annotationCanShowCallout` should return `true`. The second method, `viewFor annotation:` should return an empty +`MGLAnnotationView` matching the size of the style annotation's shape, as shown below. + +```swift +extension ViewController : MapplsMapViewDelegate { + + func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) { + circleAnnotationController = MGLCircleAnnotationController(mapView: self.mapView) + let circle = MGLCircleStyleAnnotation(center: CLLocationCoordinate2D(latitude: 59.31, longitude: 18.06), radius: 3.0, color: .blue) + circle.opacity = 0.5 + circle.title = "Title" + circleAnnotationController.add(circle) + } + + func mapView(_ mapView: MGLMapView, annotationCanShowCallout annotation: MGLAnnotation) -> Bool { + return true; + } + + func mapView(_ mapView: MGLMapView, viewFor annotation: MGLAnnotation) -> MGLAnnotationView? { + return MGLAnnotationView(frame: CGRect(x: 0, y: 0, width: 10, height: 10)) + } +} +``` + +## [Supported Properties](#Supported-Properties) + +Each `MGLStyleAnnotation` class can be assigned a specific set of properties to configure its layout and style. Additionally, `MGLAnnotationController`s also have properties that can assign a specific layout property to all of its child `MGLStyleAnnotation`s. + +**MGLCircleStyleAnnotation** + +- `circleRadius` +- `circleColor` +- `circleOpacity` +- `circleStrokeWidth` +- `circleStrokeColor` +- `circleStrokeOpacity` + +**MGLCircleAnnotationController** + +- `circleTranslation` +- `circleTranslationAnchor` +- `circlePitchAlignment` +- `circleScaleAlignment` + +**MGLLineStyleAnnotation** + +- `lineJoin` +- `lineBlur` +- `lineColor` +- `lineGapWidth` +- `lineOffset` +- `lineOpacity` +- `linePattern` +- `lineWidth` + +**MGLLineAnnotationController** + +- `lineCap` +- `lineMiterLimit` +- `lineRoundLimit` +- `lineDashPattern` +- `lineTranslation` +- `lineTranslationAnchor` + +**MGLPolygonStyleAnnotation** + +- `fillOpacity` +- `fillColor` +- `fillOutlineColor` +- `fillPattern` + +**MGLPolygonAnnotationController** + +- `fillAntialiased` +- `fillTranslation` +- `fillTranslationAnchor` + +**MGLSymbolStyleAnnotation** + +_Icon images_ + +- `iconScale` +- `iconImageName` +- `iconRotation` +- `iconOffset` +- `iconAnchor` +- `iconOpacity` +- `iconColor` +- `iconHaloColor` +- `iconHaloWidth` +- `iconHaloBlur` + +_Symbol text_ + +- `text` +- `fontNames` +- `textFontSize` +- `maximumTextWidth` +- `textLetterSpacing` +- `textJustification` +- `textRadialOffset` +- `textAnchor` +- `textRotation` +- `textTransform` +- `textOffset` +- `textOpacity` +- `textColor` +- `textHaloColor` +- `textHaloWidth` +- `textHaloBlur` + +_Icon image & symbol text_ + +- `symbolSortKey` + +**MGLSymbolAnnotationController** + +_Icon images_ + +- `iconAllowsOverlap` +- `iconIgnoresPlacement` +- `iconOptional` +- `iconPadding` +- `iconPitchAlignment` +- `iconRotationAlignment` +- `iconTextFit` +- `iconTranslation` +- `iconTranslationAnchor` +- `keepsIconUpright` + +_Symbol text_ + +- `textAllowsOverlap` +- `textLineHeight` +- `textOptional` +- `textPadding` +- `textPitchAlignment` +- `textRotationAlignment` +- `textVariableAnchor` +- `textTranslation` +- `textTranslationAnchor` +- `keepsTextUpRight` +- `maximumTextAngle` + +_Icon image & symbol text_ + +- `symbolAvoidsEdges` +- `symbolPlacement` +- `symbolSpacing` +- `symbolZOrder` + +


+ +## Our many happy customers: + +![](https://www.mapmyindia.com/api/img/logos1/PhonePe.png)![](https://www.mapmyindia.com/api/img/logos1/Arya-Omnitalk.png)![](https://www.mapmyindia.com/api/img/logos1/delhivery.png)![](https://www.mapmyindia.com/api/img/logos1/hdfc.png)![](https://www.mapmyindia.com/api/img/logos1/TVS.png)![](https://www.mapmyindia.com/api/img/logos1/Paytm.png)![](https://www.mapmyindia.com/api/img/logos1/FastTrackz.png)![](https://www.mapmyindia.com/api/img/logos1/ICICI-Pru.png)![](https://www.mapmyindia.com/api/img/logos1/LeanBox.png)![](https://www.mapmyindia.com/api/img/logos1/MFS.png)![](https://www.mapmyindia.com/api/img/logos1/TTSL.png)![](https://www.mapmyindia.com/api/img/logos1/Novire.png)![](https://www.mapmyindia.com/api/img/logos1/OLX.png)![](https://www.mapmyindia.com/api/img/logos1/sun-telematics.png)![](https://www.mapmyindia.com/api/img/logos1/Sensel.png)![](https://www.mapmyindia.com/api/img/logos1/TATA-MOTORS.png)![](https://www.mapmyindia.com/api/img/logos1/Wipro.png)![](https://www.mapmyindia.com/api/img/logos1/Xamarin.png) + +
+ +For any queries and support, please contact: + +[

](https://about.mappls.com/api/) + +Email us at [apisupport@mappls.com](mailto:apisupport@mappls.com) + +![](https://www.mapmyindia.com/api/img/icons/support.png) +[Support](https://about.mappls.com/contact/) +Need support? contact us! + +

+ +[

](https://stackoverflow.com/questions/tagged/mappls-api)[![](https://www.mapmyindia.com/api/img/icons/blog.png)](https://about.mappls.com/blog/)[![](https://www.mapmyindia.com/api/img/icons/gethub.png)](https://github.com/mappls-api)[

](https://www.npmjs.com/org/mapmyindia) + +[

](https://www.facebook.com/Mapplsofficial)[![](https://www.mapmyindia.com/june-newsletter/icon2.png)](https://twitter.com/mappls)[![](https://www.mapmyindia.com/newsletter/2017/aug/llinkedin.png)](https://www.linkedin.com/company/mappls/)[![](https://www.mapmyindia.com/june-newsletter/icon3.png)](https://www.youtube.com/channel/UCAWvWsh-dZLLeUU7_J9HiOA) + +

@ Copyright 2022 CE Info Systems Pvt. Ltd. All Rights Reserved.
+ +
Terms & Conditions | Privacy Policy | Supplier Sustainability Policy | Health & Safety Policy | Environmental Policy & CSR Report + +
Customer Care: +91-9999333223
diff --git a/docs/v1.0.13/MapplsDirectionUI.md b/docs/v1.0.13/MapplsDirectionUI.md new file mode 100644 index 0000000..e547434 --- /dev/null +++ b/docs/v1.0.13/MapplsDirectionUI.md @@ -0,0 +1,253 @@ +[

](https://www.mapmyindia.com/api) + +# MapplsDirectionUI for iOS + +## [Introduction](#Introduction) + +MapplsDirectionUI SDK provides the UI components to quickly integrate Route API from MapplsAPIKit framework in iOS application. It offers the following basic functionalities: + +1. Takes support of Mappls's Place search for searching locations of origin, destinations and via points. +2. It allows to use origin and destinations in Mappls's digital address (semicolon separated) Mappls Pin or WGS 84 geographical coordinates both. +3. The ability to set the vehicle profile like driving, and biking. +4. Easily set the resource for traffic and ETA information. + +For details, please contact apisupport@mappls.com. + +## [Installation](#Installation) + +This plugin can be installed using CocoaPods. It is available with name `MapplsDirectionUI`. + +### [Using CocoaPods](#Using-CocoaPods) + +To install the MapplsDirectionUI using CocoaPods: + +Create a Podfile with the following specification: + +``` +pod 'MapplsDirectionUI', '1.0.4' +``` + +Run `pod repo update && pod install` and open the resulting Xcode workspace. + +#### [Dependencies](#Dependencies) + +This library depends upon several Mappls's own and third party libraries. All dependent libraries will be automatically installed using CocoaPods. + +Below are list of dependcies which are required to run this SDK: + +- [MapplsAPICore](MapplsAPICore.md) +- [MapplsAPIKit](MapplsAPIKit.md) +- [MapplsMaps](MapplsMap.md) +- [MapplsUIWidgets](MapplsUIWidgets.md) + +### [Version History](#Version-History) + +| Version | Dated | Description | +| :---- | :---- | :---- | +| `1.0.4` | 10 Jun 2023 | Improvements and bug fixes. | +| `1.0.3` | 03 May 2023 | added a delegate to set route option and bug fixes. | +| `1.0.2` | 17 Apr 2023 | Imporvements and bug fixes. | +| `1.0.1` | 22 June 2022 | Added Objective c support. and Added directionListDefault button.| +| `1.0.0` | 14 June 2022 | Initial MapplsDirectionUI version. | + +## [Authorization](#Authorization) + +### [MapplsAPICore](#MapplsAPICore) +It is required to set MAPPLS's keys to use any MAPPL's SDK. Please see [here](MapplsAPICore.md) to achieve this. + +## [Usage](#Usage) + +The MapplsDirectionUI makes it easy to integrate Route from MapplsAPIKit SDK to your iOS application. It gives you all the tools you need to add Directions related UI components to your application. + + +### [MapplsDirectionsViewController](#MapplsDirectionsViewController) + +`MapplsDirectionsViewController` is type of UIViewController which you can use to show screen for getting input from user to choose origin and destination and show routes after that. + +```swift +let directionVC = MapplsDirectionViewController(for: [MapplsDirectionLocation]()) +self.navigationController?.pushViewController(directionVC, animated: false) +``` + +As from above code you can see it requires an array of object type `MapplsDirectionLocation`. It can be an blank array to launch screen without any chosen locations. + +Also you can pass fixed locations and launch instnace of `MapplsDirectionViewController`, as shown in below code: + +```swift +var locationModels = [MapplsDirectionLocation]() +let source = MapplsDirectionLocation(location: "77.2639,28.5354", displayName: "Govindpuri", displayAddress: "", locationType: .suggestion) + +let viaPoint = MapplsDirectionLocation(location: "12269L", displayName: "Sitamarhi", displayAddress: "", locationType: .suggestion) + +let destination = MapplsDirectionLocation(location: "1T182A", displayName: "Majorganj", displayAddress: "", locationType: .suggestion) + +self.locationModels.append(source) +self.locationModels.append(viaPoint) +self.locationModels.append(destination) +let directionVC = MapplsDirectionViewController(for: self.locationModels) +directionVC.profileIdentifier = .driving +directionVC.attributationOptions = [.congestionLevel] +directionVC.resourceIdentifier = .routeETA +self.navigationController?.pushViewController(directionVC, animated: false) +``` + + +Objective-c +```swift +MapplsDirectionViewController * directionVC = [[MapplsDirectionViewController alloc]init]; +directionVC.delegate = self; +directionVC.modalPresentationStyle = UIModalPresentationFullScreen; +[self presentViewController:directionVC animated:false completion:nil]; + +OR + +MapplsDirectionLocation* source = [[MapplsDirectionLocation alloc] initWithLocation:@"78.00,28.00" displayName:@"haridwar" displayAddress:@"" locationType:0]; +MapplsDirectionLocation* destination = [[MapplsDirectionLocation alloc] initWithLocation:@"1T182A" displayName:@"Majorganj" displayAddress:@"" locationType:1]; + +NSArray* locations = [[NSArray alloc] initWithObjects:current,destination, nil]; + +MapplsDirectionViewController * directionVC = [[MapplsDirectionViewController alloc]initFor:locations style:nil]; + +directionVC.delegate = self; +directionVC.modalPresentationStyle = UIModalPresentationFullScreen; +[self presentViewController:directionVC animated:false completion:nil]; + + + +``` +#### [Configuration](#Configuration) + +Here are the properties use to configure `MapplsDirectionViewController` route. + +##### [Profile Identifier](Profile-Identifier) +It is instance of enum DirectionsProfileIdentifier which can accepts values driving, walking, biking, trucking. By default its value is driving. + +##### [Resource Identifier](Resource-Identifier) +It is instance of enum DirectionsResourceIdentifier which can accepts values routeAdv, routeETA. By default its value is routeAdv. + +Note: To use RouteETA ‘resourceIdentifier’ should be routeETA and ‘profileIdentifier’ should be driving. In response of RouteETA a unique identifier to that request will be received which can be get using parameter routeIdentifier of object Route. + +##### [AttributeOptions](AttributeOptions) +AttributeOptions for the route. Any combination of `AttributeOptions` can be specified. +By default, no attribute options are specified. + +##### [IncludesAlternativeRoutes](IncludesAlternativeRoutes) + A Boolean value indicating whether alternative routes should be included in the response. +The default value of this property is `true`. + + +##### [autocompleteViewController](autocompleteViewController) +MapplsAutocompleteViewController provides an interface that displays a table of autocomplete predictions that updates as the user enters text. Place selections made by the user are returned to the app via the `MapplsAutocompleteViewControllerResultsDelegate`. + + +##### [autocompleteAttributionSetting](autocompleteAttributionSetting) +AutocompleteAttributionSetting allow to change the appearance of the logo in `MapplsAutocompleteViewController` + +##### [autocompleteFilter](autocompleteFilter) +This property represents a set of restrictions that may be applied to autocomplete requests. This allows customization of autocomplete suggestions to only those places that are of interest. + +##### [routeShapeResolution](routeShapeResolution) + A `routeShapeResolution` indicates the level of detail in a route’s shape, or whether the shape is present at all its default value is `.full` + +##### [includesSteps](includesSteps) +A Boolean value indicating whether `MapplsRouteStep` objects should be included in the response. its default value is `true`. + +##### [isShowStartNavigation](isShowStartNavigation) +To show the Start Navigation button if the origin is current location. +

+ + +`MapplsDirectionViewController` is created using several UI components whose appearance can be changed according to user requirements. Some of them are listed as below: + +- `MapplsDirectionTopBannerView` +- `MapplsDirectionBottomBannerView` + +### [MapplsDirectionViewControllerDelegates](#MapplsDirectionViewControllerDelegates) + +It is a protocol class which will be used for callback methods as shown below: + +### Call Back Handler +Swift +```swift +/// This meathod will be called when back button is clicked in `TopBannerView` +1. didRequestForGoBack(for view: MapplsDirectionTopBannerView) + +``` + +```swift +/// The meathod will be called when add viapoint button will clicked in `TopBannerView`. +2. didRequestForAddViapoint(_ sender: UIButton,for isEditMode: Bool) + +``` + +```swift +/// The meathod will be called when Directions button will clicked in `BottomBannerView`. +3. didRequestDirections() + +``` + +```swift +//The meathod will be called when start button will clicked in `BottomBannerView`. +4. didRequestForStartNavigation(for routes: [Route], viewController: UIViewController, locations: [MapplsDirectionLocation], selectedRouteIndex: Int, error: NSError) + +``` + +```swift +// The meathod will be called when user click on auto search result +5. didDirectionsAutocomplete(viewController: MapplsAutocompleteViewController, withPlace place: MapplsAtlasSuggestion, resultType type: MapplsAutosuggestResultType) + +``` + +```swift +// The meathod will be called when user click on auto search favourite places +6. didDirectionsAutocomplete(viewController: MapplsAutocompleteViewController, withFavouritePlace place: MapplsUIWidgetAutosuggestFavouritePlace) + +``` + + +### [MapplsDirectionTopBannerView](#MapplsDirectionTopBannerView) + + `MapplsDirectionTopBannerView` is type of UIView which show the source, destination and viapoint locations at the top of `MapplsDirectionViewController` + +This class accepts array of `MapplsDirectionLocation` from which it set value of source, destination and viapoint. + + +### [MapplsDirectionBottomBannerView](#MapplsDirectionBottomBannerView) + + `MapplsDirectionBottomBannerView` is class of type UIView, it used for showing the route information i.e ArivalTime, DistanceRemening, TimeRemening. + + To use this class it takes we need to call a function `updateBottomBanner` which accepts three parameters i.e route, selectedRoute, locationModel. + +- **route:** It is an array of the Routes which is required to update bottom banner view. + - **selectedRoute:** If you have multiple routes then it will give the selected route in `Integer` + - **locationModel:** LocationModel is an array of the type `MapplsDirectionLocation` which is required to manage bottom banner view. + +


+ +## Our many happy customers: + +![](https://www.mapmyindia.com/api/img/logos1/PhonePe.png)![](https://www.mapmyindia.com/api/img/logos1/Arya-Omnitalk.png)![](https://www.mapmyindia.com/api/img/logos1/delhivery.png)![](https://www.mapmyindia.com/api/img/logos1/hdfc.png)![](https://www.mapmyindia.com/api/img/logos1/TVS.png)![](https://www.mapmyindia.com/api/img/logos1/Paytm.png)![](https://www.mapmyindia.com/api/img/logos1/FastTrackz.png)![](https://www.mapmyindia.com/api/img/logos1/ICICI-Pru.png)![](https://www.mapmyindia.com/api/img/logos1/LeanBox.png)![](https://www.mapmyindia.com/api/img/logos1/MFS.png)![](https://www.mapmyindia.com/api/img/logos1/TTSL.png)![](https://www.mapmyindia.com/api/img/logos1/Novire.png)![](https://www.mapmyindia.com/api/img/logos1/OLX.png)![](https://www.mapmyindia.com/api/img/logos1/sun-telematics.png)![](https://www.mapmyindia.com/api/img/logos1/Sensel.png)![](https://www.mapmyindia.com/api/img/logos1/TATA-MOTORS.png)![](https://www.mapmyindia.com/api/img/logos1/Wipro.png)![](https://www.mapmyindia.com/api/img/logos1/Xamarin.png) + +
+ +For any queries and support, please contact: + +[

](https://about.mappls.com/api/) + +Email us at [apisupport@mappls.com](mailto:apisupport@mappls.com) + +![](https://www.mapmyindia.com/api/img/icons/support.png) +[Support](https://about.mappls.com/contact/) +Need support? contact us! + +

+ +[

](https://stackoverflow.com/questions/tagged/mappls-api)[![](https://www.mapmyindia.com/api/img/icons/blog.png)](https://about.mappls.com/blog/)[![](https://www.mapmyindia.com/api/img/icons/gethub.png)](https://github.com/mappls-api)[

](https://www.npmjs.com/org/mapmyindia) + +[

](https://www.facebook.com/Mapplsofficial)[![](https://www.mapmyindia.com/june-newsletter/icon2.png)](https://twitter.com/mappls)[![](https://www.mapmyindia.com/newsletter/2017/aug/llinkedin.png)](https://www.linkedin.com/company/mappls/)[![](https://www.mapmyindia.com/june-newsletter/icon3.png)](https://www.youtube.com/channel/UCAWvWsh-dZLLeUU7_J9HiOA) + +

@ Copyright 2020 CE Info Systems Pvt. Ltd. All Rights Reserved.
+ +
Terms & Conditions | Privacy Policy | Supplier Sustainability Policy | Health & Safety Policy | Environmental Policy & CSR Report + +
Customer Care: +91-9999333223
diff --git a/docs/v1.0.13/MapplsDrivingRangePlugin.md b/docs/v1.0.13/MapplsDrivingRangePlugin.md new file mode 100644 index 0000000..d857d1e --- /dev/null +++ b/docs/v1.0.13/MapplsDrivingRangePlugin.md @@ -0,0 +1,187 @@ +[

](https://www.mapmyindia.com/api) + +# MapplsDrivingRangePlugin for iOS + +## [Introduction](#Introduction) + +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:-** +## [Installation](#Installation) + +This plugin can be installed using CocoaPods. It is available with name `MapplsDrivingRangePlugin`. + +### [Using CocoaPods](#Using-CocoaPods) + +Create a Podfile with the following specification: + +```cocoapods +pod 'MapplsDrivingRangePlugin', '1.0.2' +``` + +Run `pod repo update && pod install` and open the resulting Xcode workspace. + +### [Version History](#Version-History) + +| Version | Dated | Description | +|:--------|:--------------|:------------| +| `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. | + +#### [Dependencies](#Dependencies) + +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: + +- [MapplsAPIKit](MapplsAPIKit.md) +- [MapplsMap](MapplsMap.md) + +### [Authorization](#Authorization) + +#### [MapplsAPICore](#MapplsAPICore) +It is required to set Mappls keys to use any MAPPL's SDK. Please refer the documenatation [here](MapplsAPICore.md). + +**Step 2:-** +## [Plugin Initialization](#Plugin-Initialization) + +### [MapplsDrivingRangePlugin](#MapplsDrivingRangePlugin) + +`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. + +```swift +var drivingRangePlugin = MapplsDrivingRange(mapView: self.mapView) + +self.drivingRangePlugin.delegate = self // optional +``` + +**Step 3:-** +## [Get And Plot Driving Range](#Get-And-Plot-Driving-Range) + +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: + +```swift +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) +``` + +## [Additional Features](#Additional-Features) + +### [Clear Driving Range](#Clear-Driving-Range) + +Plotted driving range on Map can be removed by calling function `clearDrivingRangeFromMap`. + +Below is line of code to use it: + +```swift +drivingRangePlugin.clearDrivingRangeFromMap() +``` + +### [Update Driving Range](#Update-Driving-Range) + +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: + +```swift +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) +``` + +## [Reference](#Reference) + +### [MapplsDrivingRangeDelegate](#MapplsDrivingRangeDelegate) + +It is a protocol class which provides different callbacks of events of `MapplsDrivingRange`. + +Below are different callback functions avaialble: + +#### [drivingRange(_:didFailToGetAndPlotDrivingRange:)](#drivingRange(_:didFailToGetAndPlotDrivingRange:)) + +Called when the plugin fails to get and plot driving range. + +**DECLARATION** + +```swift +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. + + +#### [drivingRangeDidSuccessToGetAndPlotDrivingRange(_:)](#drivingRangeDidSuccessToGetAndPlotDrivingRange(_:)) + +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. + +


+ +## Our many happy customers: + +![](https://www.mapmyindia.com/api/img/logos1/PhonePe.png)![](https://www.mapmyindia.com/api/img/logos1/Arya-Omnitalk.png)![](https://www.mapmyindia.com/api/img/logos1/delhivery.png)![](https://www.mapmyindia.com/api/img/logos1/hdfc.png)![](https://www.mapmyindia.com/api/img/logos1/TVS.png)![](https://www.mapmyindia.com/api/img/logos1/Paytm.png)![](https://www.mapmyindia.com/api/img/logos1/FastTrackz.png)![](https://www.mapmyindia.com/api/img/logos1/ICICI-Pru.png)![](https://www.mapmyindia.com/api/img/logos1/LeanBox.png)![](https://www.mapmyindia.com/api/img/logos1/MFS.png)![](https://www.mapmyindia.com/api/img/logos1/TTSL.png)![](https://www.mapmyindia.com/api/img/logos1/Novire.png)![](https://www.mapmyindia.com/api/img/logos1/OLX.png)![](https://www.mapmyindia.com/api/img/logos1/sun-telematics.png)![](https://www.mapmyindia.com/api/img/logos1/Sensel.png)![](https://www.mapmyindia.com/api/img/logos1/TATA-MOTORS.png)![](https://www.mapmyindia.com/api/img/logos1/Wipro.png)![](https://www.mapmyindia.com/api/img/logos1/Xamarin.png) + +
+ +For any queries and support, please contact: + +[

](https://about.mappls.com/api/) + +Email us at [apisupport@mappls.com](mailto:apisupport@mappls.com) + +![](https://www.mapmyindia.com/api/img/icons/support.png) +[Support](https://about.mappls.com/contact/) +Need support? contact us! + +

+ +[

](https://stackoverflow.com/questions/tagged/mappls-api)[![](https://www.mapmyindia.com/api/img/icons/blog.png)](https://about.mappls.com/blog/)[![](https://www.mapmyindia.com/api/img/icons/gethub.png)](https://github.com/mappls-api)[

](https://www.npmjs.com/org/mapmyindia) + +[

](https://www.facebook.com/Mapplsofficial)[![](https://www.mapmyindia.com/june-newsletter/icon2.png)](https://twitter.com/mappls)[![](https://www.mapmyindia.com/newsletter/2017/aug/llinkedin.png)](https://www.linkedin.com/company/mappls/)[![](https://www.mapmyindia.com/june-newsletter/icon3.png)](https://www.youtube.com/channel/UCAWvWsh-dZLLeUU7_J9HiOA) + +

@ Copyright 2022 CE Info Systems Pvt. Ltd. All Rights Reserved.
+ +
Terms & Conditions | Privacy Policy | Supplier Sustainability Policy | Health & Safety Policy | Environmental Policy & CSR Report + +
Customer Care: +91-9999333223
diff --git a/docs/v1.0.13/MapplsFeedbackKit.md b/docs/v1.0.13/MapplsFeedbackKit.md new file mode 100644 index 0000000..277759c --- /dev/null +++ b/docs/v1.0.13/MapplsFeedbackKit.md @@ -0,0 +1,176 @@ +[

](https://www.mapmyindia.com/api) + +# MapplsFeedbackKit for iOS + +## [Introduction](#Introduction) + +Feedback Kit for IOS is a wrapper SDK for Mappls's feedback API. It allows developers to integrate feedback module in their application. Using feedback module user can submit location related feedback to Mappls's server. + +**Note:** Sample for UI view controllers with source code is also provided by Mappls which user can directly use to show feedback screen. Information about how to use UI sample is also provided in this documentation. + +If you don't want to implement own logic and use sample from Mappls Jump to Sample UI Kit section. + +### [Version History](#Version-History) + +| Version | Dated | Description | +| :------ | :---- | :---------- | +| `1.0.0` | 22 June, 2022 | Initial release. | + +## [Setup your Project](#Setup-your-Project) + +### [Using CocoaPods](#Using-CocoaPods) + +To install the `MapplsFeedbackKit` using CocoaPods: + +Create a Podfile with the following specification: + +``` +pod 'MapplsFeedbackKit', '1.0.0' +``` + +Run `pod repo update && pod install` and open the resulting Xcode workspace. + +### [Authorization](#Authorization) + +#### [MapplsAPICore](#MapplsAPICore) +It is required to set Mappls keys to use any MAPPL's SDK. Please refer the documenatation [here](MapplsAPICore.md) + +## [Usage](#Usage) + +**Steps to submit feedback:** + +1. An authoraization key i.e moduleId (provided by Mappls) against which feedback will be submitted wiil be required to use this SDK . + +1. List of categories need to be fetched first under which feedback will be submitted. For more informatatio see [here](#Get-Report-Categories). + + **Notes:** + + - Fetched report categories can be saved for offline use or to prevent fetching report categories multiple times. + + - It will require to separate out them on basis of parentId i.e Separate as Parent and Child Categories, where if parent Id is null means they are parent categories otherwise child of some parent category. + **Note:** ParentId of a child category is reportId of parent category. + +1. On basis of parent and child categories, different User Interfaces or scenarios can be designed as per requirements. + +1. User must pass have location oordinate for which feedback will be submitted. + +1. After selecting of parent and child category user must take some input as a text for feedback. + +1. After Collection all values i.e Module Id, Location Coordinates, Parent Category, Child Category and Feedback Text, feedback can be submitted using functions available in this SDK. See [here](#Submit-Feedback). + +## [Get Report Categories](#Get-Report-Categories) + +Categories for reporting can be fetched using getReportCategories method of MapplsFeedBackKitManager class by using shared instance. +In response you will receive an error or an array of MapplsReportCategories. Yo will find below useful properties in reportCategories object which is an array of `ParentCategories`: + +- *ParentCategories* + +- *ChildCategories* + +- *SubChildCategories* + +##### Swift + +```swift +MapplsFeedBackKitManager.shared.getReportCategories { (reportCategories, error) in + if let error = error { + print(error.localizedDescription) + self.dismiss(animated: true, completion: nil) + } else { + let categories = reportCategories ?? [ParentCategories]() + if categories.count > 0 { + self.allReportCategories = categories + print(self.allReportCategories.first?.id) + self.currentStep = 1 + } else { + print("No report categories found") + self.dismiss(animated: true, completion: nil) + } +} +``` + +## [Submit Feedback](#Submit-Feedback) + +To submit feedback to Mappls's server you can use `saveUserData` function of `MapplsSaveUserDataAPIManager` class by using shared instance. + +`saveUserData` function will accept an object of `MapplsSaveUserDataOptions` class. + +To create instance of MapplsSaveUserDataOptions user provide following parameters. + +### [Mandatory Parameters](#Mandatory-Parameters) +1. location(String) : It can be either Mappls Pin (The 6-digit alphanumeric code for any location) or coordinate (latitude, longitude) in `string` format. +1. parentCategory(Integer) : Parent category of the report. +1. childCategory (Integer) : Child category of the report. + +### [Optional Parameters](#Optional-Parameters) +1. placeName(string) : Name of the place where the event is taking place. It should be derived on the basis of Mappls Pin and coordinates. +2. desription(String) : A description about your event. Min length 10 characters and Max length 250 characters. +3. subChildCategory(Integer)(Internal) : Sub Child category of the report. +4. flag(Integer) : If navroute is active then 1 else 0. +5. speed(Integer) : User's speed in kilometers. +6. alt(Integer) : Altitude of the user’s location, in meters. +7. quality(Integer) : Quality of user's location. +8. bearing(Integer) : Bearing of the user’s location, in degrees. +9. accuracy(Integer) : Accuracy of user's location. +10. utc(Long) : Date time in unix timestamp format. +11. expiry(Long) : Date time in unix timestamp format to set expiry for the report. +12. zeroId(String) : to be used only incase of NAVIMAPS . +13. pushEvent(Boolean)(internal) : to be used only when traffic events are to be pushed back to the traffic event editor. Allowed values: a) true +b) false +14. appVersion(String) : Version of the app +15. osVersionoptional(String) : Version of the os +16. deviceName(String) : Name of the device + + + +##### Swift + +```swift +let saveOptions = MapplsSaveUserDataOptions(location: "MMI000", parentCategory: parentCategory.id ?? 0, childCategory: childCategory.id ?? 0, description: "This is descriptions", subChildCategory: self.selectedSubChildCategories?.id, accuracy: 3) + +MapplsSaveUserDataAPIManager.shared.saveUserData(saveOptions, { (isSucess, error) in + + if let error = error { + print(error.localizedDescription) + } else if isSucess { + print("feedback submited successfully") + self.dismiss(animated: true, completion: nil) + } else { + print("No results") + } +}) +``` + +# [Mappls Feedback UI Kit](#Mappls-Feedback-UI-Kit) + +A UI control `MapplsFeedbackUIKit` is available to use SDK MapplsFeedbackKit. To know more about it see [here](MapplsFeedbackUIKit.md). + +


+ +## Our many happy customers: + +![](https://www.mapmyindia.com/api/img/logos1/PhonePe.png)![](https://www.mapmyindia.com/api/img/logos1/Arya-Omnitalk.png)![](https://www.mapmyindia.com/api/img/logos1/delhivery.png)![](https://www.mapmyindia.com/api/img/logos1/hdfc.png)![](https://www.mapmyindia.com/api/img/logos1/TVS.png)![](https://www.mapmyindia.com/api/img/logos1/Paytm.png)![](https://www.mapmyindia.com/api/img/logos1/FastTrackz.png)![](https://www.mapmyindia.com/api/img/logos1/ICICI-Pru.png)![](https://www.mapmyindia.com/api/img/logos1/LeanBox.png)![](https://www.mapmyindia.com/api/img/logos1/MFS.png)![](https://www.mapmyindia.com/api/img/logos1/TTSL.png)![](https://www.mapmyindia.com/api/img/logos1/Novire.png)![](https://www.mapmyindia.com/api/img/logos1/OLX.png)![](https://www.mapmyindia.com/api/img/logos1/sun-telematics.png)![](https://www.mapmyindia.com/api/img/logos1/Sensel.png)![](https://www.mapmyindia.com/api/img/logos1/TATA-MOTORS.png)![](https://www.mapmyindia.com/api/img/logos1/Wipro.png)![](https://www.mapmyindia.com/api/img/logos1/Xamarin.png) + +
+ +For any queries and support, please contact: + +[

](https://about.mappls.com/api/) + +Email us at [apisupport@mappls.com](mailto:apisupport@mappls.com) + +![](https://www.mapmyindia.com/api/img/icons/support.png) +[Support](https://about.mappls.com/contact/) +Need support? contact us! + +

+ +[

](https://stackoverflow.com/questions/tagged/mappls-api)[![](https://www.mapmyindia.com/api/img/icons/blog.png)](https://about.mappls.com/blog/)[![](https://www.mapmyindia.com/api/img/icons/gethub.png)](https://github.com/mappls-api)[

](https://www.npmjs.com/org/mapmyindia) + +[

](https://www.facebook.com/Mapplsofficial)[![](https://www.mapmyindia.com/june-newsletter/icon2.png)](https://twitter.com/mappls)[![](https://www.mapmyindia.com/newsletter/2017/aug/llinkedin.png)](https://www.linkedin.com/company/mappls/)[![](https://www.mapmyindia.com/june-newsletter/icon3.png)](https://www.youtube.com/channel/UCAWvWsh-dZLLeUU7_J9HiOA) + +

@ Copyright 2022 CE Info Systems Pvt. Ltd. All Rights Reserved.
+ +
Terms & Conditions | Privacy Policy | Supplier Sustainability Policy | Health & Safety Policy | Environmental Policy & CSR Report + +
Customer Care: +91-9999333223
diff --git a/docs/v1.0.13/MapplsFeedbackUIKit.md b/docs/v1.0.13/MapplsFeedbackUIKit.md new file mode 100644 index 0000000..8e68eea --- /dev/null +++ b/docs/v1.0.13/MapplsFeedbackUIKit.md @@ -0,0 +1,94 @@ +[

](https://www.mapmyindia.com/api) + +# MapplsFeedbackUIKit for iOS + +## [Introduction](#Introduction) + +FeedbackUI Kit for IOS is a UI kit to use wrapper for Mappls's feedback API. It allows developers to integrate feedback module in their application. Using feedback module user can submit location related feedback to Mappls's server. + +**Note:** Sample for UI view controllers with source code is also provided by Mappls which user can directly use to show feedback screen. Information about how to use UI sample is also provided in this documentation. + +If you don’t want to implement own logic and use sample from Mappls Jump to Sample UI Kit section. + +### [Version History](#Version-History) + +| Version | Dated | Description | +| :------ | :---- | :---------- | +| `1.0.0` | 22 June, 2022 | Initial release. | +| `1.0.1` | 14 Sept, 2022 | Bug fixes. | +| `1.0.2` | 23 Sep, 2022 | Added a Bool property `isShowStepProgress` to hide stepProgress.| + +## [Setup your Project](#Setup-your-Project) + +### [Using CocoaPods](#Using-CocoaPods) + +To install the MapplsFeedbackUIKit using CocoaPods: + +Create a Podfile with the following specification: + +``` +pod 'MapplsFeedbackUIKit', '1.0.1' +``` + +Run `pod repo update && pod install` and open the resulting Xcode workspace. + +### [Authorization](#Authorization) + +#### [MapplsAPICore](#MapplsAPICore) +It is required to set Mappls keys to use any MAPPL's SDK. Please refer the documenatation [here](MapplsAPICore.md) + +## [Usage](#Usage) + +`MapplsFeedbackUIKitManager` is the class which will help to use this UI Control.Access shared instance of that class and call `getViewController` method to get instance of ViewController and present or push according to requirement. + +### [Properties](#Properties) +**isShowStepProgress**: It is a shared property use to hide stepProgress, its default value `true` + +##### Objective-C + +```objectivec +CLLocation *location = [[CLLocation alloc] initWithLatitude:_mapView.centerCoordinate.latitude longitude:_mapView.centerCoordinate.longitude]; + +UINavigationController *navVC = [[MapplsFeedbackUIKitManager sharedManager] getViewControllerWithLocation:location moduleId:ModuleId]; +[self presentViewController:navVC animated:YES completion:nil]; +``` + +##### Swift + +```swift +let navVC = MapplsFeedbackUIKitManager.shared.getViewController(location: CLLocation(latitude: mapView.centerCoordinate.latitude, longitude: mapView.centerCoordinate.longitude), moduleId: ModuleId) + +self.present(navVC, animated: true, completion: nil) +``` + +`MapplsFeedbackUIKit` implicitly use functionalities of MapplsFeedBackKitManager module and provides a beautiful user expereience to submit feedback. + +


+ +## Our many happy customers: + +![](https://www.mapmyindia.com/api/img/logos1/PhonePe.png)![](https://www.mapmyindia.com/api/img/logos1/Arya-Omnitalk.png)![](https://www.mapmyindia.com/api/img/logos1/delhivery.png)![](https://www.mapmyindia.com/api/img/logos1/hdfc.png)![](https://www.mapmyindia.com/api/img/logos1/TVS.png)![](https://www.mapmyindia.com/api/img/logos1/Paytm.png)![](https://www.mapmyindia.com/api/img/logos1/FastTrackz.png)![](https://www.mapmyindia.com/api/img/logos1/ICICI-Pru.png)![](https://www.mapmyindia.com/api/img/logos1/LeanBox.png)![](https://www.mapmyindia.com/api/img/logos1/MFS.png)![](https://www.mapmyindia.com/api/img/logos1/TTSL.png)![](https://www.mapmyindia.com/api/img/logos1/Novire.png)![](https://www.mapmyindia.com/api/img/logos1/OLX.png)![](https://www.mapmyindia.com/api/img/logos1/sun-telematics.png)![](https://www.mapmyindia.com/api/img/logos1/Sensel.png)![](https://www.mapmyindia.com/api/img/logos1/TATA-MOTORS.png)![](https://www.mapmyindia.com/api/img/logos1/Wipro.png)![](https://www.mapmyindia.com/api/img/logos1/Xamarin.png) + +
+ +For any queries and support, please contact: + +[

](https://about.mappls.com/api/) + +Email us at [apisupport@mappls.com](mailto:apisupport@mappls.com) + +![](https://www.mapmyindia.com/api/img/icons/support.png) +[Support](https://about.mappls.com/contact/) +Need support? contact us! + +

+ +[

](https://stackoverflow.com/questions/tagged/mappls-api)[![](https://www.mapmyindia.com/api/img/icons/blog.png)](https://about.mappls.com/blog/)[![](https://www.mapmyindia.com/api/img/icons/gethub.png)](https://github.com/mappls-api)[

](https://www.npmjs.com/org/mapmyindia) + +[

](https://www.facebook.com/Mapplsofficial)[![](https://www.mapmyindia.com/june-newsletter/icon2.png)](https://twitter.com/mappls)[![](https://www.mapmyindia.com/newsletter/2017/aug/llinkedin.png)](https://www.linkedin.com/company/mappls/)[![](https://www.mapmyindia.com/june-newsletter/icon3.png)](https://www.youtube.com/channel/UCAWvWsh-dZLLeUU7_J9HiOA) + +

@ Copyright 2022 CE Info Systems Pvt. Ltd. All Rights Reserved.
+ +
Terms & Conditions | Privacy Policy | Supplier Sustainability Policy | Health & Safety Policy | Environmental Policy & CSR Report + +
Customer Care: +91-9999333223
diff --git a/docs/v1.0.13/MapplsGeoanalytics.md b/docs/v1.0.13/MapplsGeoanalytics.md new file mode 100644 index 0000000..1eb6095 --- /dev/null +++ b/docs/v1.0.13/MapplsGeoanalytics.md @@ -0,0 +1,298 @@ +[

](https://www.mapmyindia.com/api) + +# MapplsGeoanalytics Plugin for iOS + +## [Introduction](#Introduction) + +`MapplsGeoanalytics` is a plugin over Mappls's `GeoAnalytics APIs`. Geoanalytics APIs gives the users the power to display, style, and edit the data which is archived in Mappls's Database and overlay it on the user created maps. + + - Enables data selection, visualization, queries & styling with rich base map available at various level of granularity + - Build maps quickly and easily without coordinates, using country, pin codes or simply place names + - Drill and analyze different type of map layers such as districts, pincode, villages, city etc at Pan India level or restricted to limited bound /Area of interest +- Allows user to set their own styling parameters such as label color scheme, geometry color schemes, opacity, width, stroke etc. +- Allows to create rich thematic visuals using combination of value ranges + +This plugin gets the layer specified which is stored in Mappls’s Database and gives a WMS layer as an output with any filters or styles specified by the user. + +## [Installation](#Installation) + + +This plugin can be installed using CocoaPods. It is available with the name `MapplsGeoanalytics`. + +### [Using CocoaPods](#Using-CocoaPods) + +Create a Podfile with the following specification: + +``` +pod 'MapplsGeoanalytics', '0.2.0' +``` + +Run `pod repo update && pod install` and open the resulting Xcode workspace. + +### [Version History](#Version-History) + +| Version | Dated | Description | +| :---- | :---- | :---- | +| `1.0.0` | 05 June 2022 | Initial version release with a Mappls geoanalytics. | + +#### [Dependencies](#Dependencies) + +This library depends upon several Mappls's own libraries. All dependent libraries will be automatically installed using CocoaPods. + +Below are list of dependencies which are required to run this SDK: + +- [MapplsAPICore](https://github.com/mappls-api/mappls-ios-sdk/docs/v1.0.0/MapplsAPICore.md) +- [MapplsAPIKit](https://github.com/mappls-api/mappls-ios-sdk/docs/v1.0.0/MapplsAPIKit.md) +- [MapplsMaps](https://github.com/mappls-api/mappls-ios-sdk/docs/v1.0.0/MapplsMap.md) + +## [Authorization](#Authorization) + +### [MapplsAPICore](#MapplsAPICore) +It is required to set Mappls keys to use any MAPPL's SDK. Please refer the documenation [here](MapplsAPICore.md). + +## [Precap](#Precap) + +### [Geoanalytics Layer Types](#Geoanalytics-Layer-Types) + +An enum `MapplsGeoanalyticsLayerType` can be used to get different types of layers. Below are different types which are available: + +1. `MapplsGeoanalyticsLayerTypeState` +2. `MapplsGeoanalyticsLayerTypeDistrict` +3. `MapplsGeoanalyticsLayerTypeSubDistrict` +4. `MapplsGeoanalyticsLayerTypeCity` +5. `MapplsGeoanalyticsLayerTypeTown` +6. `MapplsGeoanalyticsLayerTypeLocality` +7. `MapplsGeoanalyticsLayerTypeSubLocality` +8. `MapplsGeoanalyticsLayerTypeSubSubLocality` +9. `MapplsGeoanalyticsLayerTypePanchayat` +10. `MapplsGeoanalyticsLayerTypeVillage ` +11. `MapplsGeoanalyticsLayerTypeWard` +12. `MapplsGeoanalyticsLayerTypePincode` +13. `MapplsGeoanalyticsLayerTypeBlock` + +**Now that you’re all caught up with the features, let's get down right to them and look at how you can integrate our GeoAnalytics plugin to add data on your map in few simple steps.** + +## [Initialization MapplsGeoanalyticsPlugin](#Initialization-MapplsGeoanalyticsPlugin) + +```swift +var geoanalyticsPlugin : MapplsGeoanalyticsPlugin = MapplsGeoanalyticsPlugin(mapView: mapView) +``` + +## [Use of GeoAnalytics API](#Use-of-GeoAnalytics-API) + +Use instance of `MapplsGeoanalyticsPlugin` to show response of GeoAnalytics API as Map Layers. + +**For infomation about `GeoAnalytics API` go [here](https://about.mappls.com/api/advanced-maps/geoanalytics-web-js/geo-analytics-mapmyindia-js).** + +### Step 1 - Get GeoAnalytics layers + +To get response of GeoAnalytics API, Create an instance of `MapplsGeoanalyticsLayerRequest`. Below is code snipet for this. + +``` swift +let apperenceState = GeoanalyticsLayerAppearance() +apperenceState.fillColor = "42a5f4" +apperenceState.fillOpacity = "0.5" +apperenceState.labelColor = "000000" +apperenceState.labelSize = "10" +apperenceState.strokeColor = "000000" +apperenceState.strokeWidth = "0" + +let geoboundArray = [MapplsGeoanalyticsGeobound(geobound: "HARYANA", appearance: apperenceState), MapplsGeoanalyticsGeobound(geobound: "UTTAR PRADESH", appearance: apperenceState),MapplsGeoanalyticsGeobound(geobound: "KERALA", appearance: apperenceState)] + +let layerRequestState = MapplsGeoanalyticsLayerRequest(geoboundType: "stt_nme", geobound: geoboundArray, propertyName: ["stt_nme","stt_id","t_p"], layerType: .state) + +layerRequestState.attribute = "t_p"; +layerRequestState.query = ">0"; +layerRequestState.transparent = true; +``` + +#### [MapplsGeoanalyticsLayerRequest](#MapplsGeoanalyticsLayerRequest) + +Below are parameters of `MapplsGeoanalyticsLayerRequest` class. + +- **geoboundType** (mandatory): It is of type `String`. It accepts type of geographical extents on which data would be bound. eg. "India", "State", "District" etc. + +- **geobound** (mandatory): It is an array of type `MapplsGeoanalyticsGeobound`. For more info see [here](#MapplsGeoanalyticsGeobound). + +- **propertyName** (mandatory): It is an array of type `String`. eg. ["stt_nme"], ["stt_id"], ["t_p"]. + +- **layerType** (mandatory): It is the type of layer that user want to show on map it is an enum of type `MapplsGeoanalyticsLayerType`. + +The following are optional parameters + + - **query** (optional): A string containing an operator and a value which would be applied to +the attribute filter. < (Less than)/ > (Greater then)/ <> (Between). +Note: (*) Mandatory if Attribute is given. Example-I: ‘> 10000’, Example-II: BETWEEN +‘value1’ AND ‘value2’ + + - **attribute** (optional): The name of Attribute to filter the output. For eg: Population/Household + + - **transparent:** (optional): It is the property to make the layer transparent. + + +#### [MapplsGeoanalyticsGeobound](#MapplsGeoanalyticsGeobound) + +Instance of `MapplsGeoanalyticsGeobound` is used as a parameter in class `MapplsGeoanalyticsLayerRequest`. It has two properties `geobound` and `appearance`(optional). Where appearance is of type `GeoanalyticsLayerAppearance`. + +##### [GeoanalyticsLayerAppearance](#GeoanalyticsLayerAppearance): + +This is the class used to set the appearance of the layer, i.e layerColor, textColor, border color etc. it has following properties: +- fillColor +- fillOpacity +- labelColor +- labelSize +- strokeColor +- strokeWidth + +### Step 2 - Adding GeoAnalytics layer on Map + +A function `showGeoanalyticsLayer` available in `MapplsGeoanalyticsPlugin` which accepts a parameter of type `MapplsGeoanalyticsLayerRequest`. +Plugin internally consume that request to get response and plot layer on Map accordingly. + +``` swift +self.geoanalyticsPlugin.showGeoanalyticsLayer(layerRequestState) +``` + +### Other Methods Available: + +**1. Remove GeoAnalytics Layer** + +`removeGeonalyticsLayer` is a function which accepts request of type `MapplsGeoanalyticsLayerRequest` to remove related layer from map. + +``` swift +geoanalyticsPlugin.removeGeoanalyticsLayer(layerRequestState)) +``` + +**2. GeoAnalytics Layer Info** + +A delegate function can be used for information of layer where map is tapped. +Below is the delegate function which returns response of feature info api. + +```swift +func didGetFeatureInfoResponse(_ featureInfoResponse:GeoanalyticsGetFeatureInfoResponse) { + print(featureInfoResponse.features) +} +``` + +**3. Layer Popup** + +A popup will be shown for information of layer where map is tapped. There is a property `shouldShowPopupForGeoanalyticsLayer` available to enable or disable that popup. It is of type Bool by default its value is `false`. + +```swift +geoanalyticsPlugin.shouldShowPopupForGeoanalyticsLayer = true +``` + +**4. Custom Popup** + +A delegate function can be used to show custom popup for layer information. Below is delegate function for the same. + +```swift +// To show default popup return nil. +func view(forGeoanalyticsInfo response: GeoanalyticsGetFeatureInfoResponse) -> UIView? { + return nil +} +``` + +Delegate gives information of layer and accepts to return an instance of `UIView` to show as custom popup. + +## [Use of Listing API](#Use-of-Listing-API) + +### Introduction: + +MapplsGeoanalytics plugin contains a manager class to consume Mappls's `Listing API`. Listing API is an API that gives the user's information on the different layers & attributes available within Geo-Analytics Core APIs. This API acts as an assisting API to quickly get the necessary details that are required to accurately fetch the required overlays from the core Geo-Analytics APIs. + +It provides list of attributes along with unique ID. User can get bounding box of the required feature/area as well. + +For more information about `Listing API` see [here](https://www.Mappls.com/api/advanced-maps/geoanalytics-web-js/listingapi). + +### Step 1 - Create Request + +First create an instance of `GeoanalyticsListingAPIRequest` as shown below. + +```swift +let listingRequest = GeoanalyticsListingAPIRequest(geoboundType: "stt_nme", geobound: ["HARYANA","UTTAR PRADESH","ANDHRA PRADESH","KERALA"], attribute: "b_box", api: .state) +``` + +Possible request parameters in class of `GeoanalyticsListingAPIRequest` are listed below. + +#### GeoanalyticsListingAPIRequest + +- **geoboundType:** It is of type string which accepts the type of geobound. +- **geobound:** Single valued parent type, for example: stt_nme, dst_nme, sdb_nme etc. + **Note**: For parent type reference, contact [apisupport@Mappls.com](mailto:apisupport@Mappls.com) +- **attribute:** field name/bounding Box requested w.r.t api (api) & parent type (geo_bound_type). Bounding box can be requested as "b_box" variable. +- **api:** It is an enum of type `MapplsGeoanalyticsLayerType` which specifie type of listing api. + +### Step 2 - Send Request + +Use shared instance of `MapplsGeoanalyticsListingManager` and call `getListingInfo` method which accepts request parameter of type `GeoanalyticsListingAPIRequest` as created in previous step. Method `getListingInfo` returns response of type `GeoanalyticsListingAPIsResponse` and error of type `NSError` in completion code block. + +``` swift +let listingManager = MapplsGeoanalyticsListingManager.shared() +listingManager.getListingInfo(listingRequest) { (response, error) in + if (error != nil) { + print(error.code) + } else { + print(response) + } +} +``` + +#### GeoanalyticsListingAPIsResponse + +`GeoanalyticsListingAPIsResponse` contains following properties. + +- ***responseCode:*** It is of type `NSString` + +- ***version:*** It is the response attribute of type `NSString` + +- ***totalFeatureCount:*** IT is the response attribute of type `NSString`. + +- ***results:*** It is the response parameter which is of type +`GeoanalyticsListingAPIsResult`. + +GeoanalyticsListingAPIsResult is the class which contains following property. + +- ***apiName:*** it the parameter of type `NSString` + +- ***attribute:*** it is the parameter of type `NSString` + +- ***getAttrValues:*** it is an array of type `GeoanalyticsGetAttrValues` + + +GeoanalyticsGetAttrValues is class which contains following attribute. + +- ***geo_bound:*** It is of type `NSSting`. + +- ***getAttrValues:*** It is the array of type `NSDictionary`. + + +


+ +## Our many happy customers: + +![](https://www.mapmyindia.com/api/img/logos1/PhonePe.png)![](https://www.mapmyindia.com/api/img/logos1/Arya-Omnitalk.png)![](https://www.mapmyindia.com/api/img/logos1/delhivery.png)![](https://www.mapmyindia.com/api/img/logos1/hdfc.png)![](https://www.mapmyindia.com/api/img/logos1/TVS.png)![](https://www.mapmyindia.com/api/img/logos1/Paytm.png)![](https://www.mapmyindia.com/api/img/logos1/FastTrackz.png)![](https://www.mapmyindia.com/api/img/logos1/ICICI-Pru.png)![](https://www.mapmyindia.com/api/img/logos1/LeanBox.png)![](https://www.mapmyindia.com/api/img/logos1/MFS.png)![](https://www.mapmyindia.com/api/img/logos1/TTSL.png)![](https://www.mapmyindia.com/api/img/logos1/Novire.png)![](https://www.mapmyindia.com/api/img/logos1/OLX.png)![](https://www.mapmyindia.com/api/img/logos1/sun-telematics.png)![](https://www.mapmyindia.com/api/img/logos1/Sensel.png)![](https://www.mapmyindia.com/api/img/logos1/TATA-MOTORS.png)![](https://www.mapmyindia.com/api/img/logos1/Wipro.png)![](https://www.mapmyindia.com/api/img/logos1/Xamarin.png) + +
+ +For any queries and support, please contact: + +[

](https://about.mappls.com/api/) + +Email us at [apisupport@mappls.com](mailto:apisupport@mappls.com) + +![](https://www.mapmyindia.com/api/img/icons/support.png) +[Support](https://about.mappls.com/contact/) +Need support? contact us! + +

+ +[

](https://stackoverflow.com/questions/tagged/mappls-api)[![](https://www.mapmyindia.com/api/img/icons/blog.png)](https://about.mappls.com/blog/)[![](https://www.mapmyindia.com/api/img/icons/gethub.png)](https://github.com/mappls-api)[

](https://www.npmjs.com/org/mapmyindia) + +[

](https://www.facebook.com/Mapplsofficial)[![](https://www.mapmyindia.com/june-newsletter/icon2.png)](https://twitter.com/mappls)[![](https://www.mapmyindia.com/newsletter/2017/aug/llinkedin.png)](https://www.linkedin.com/company/mappls/)[![](https://www.mapmyindia.com/june-newsletter/icon3.png)](https://www.youtube.com/channel/UCAWvWsh-dZLLeUU7_J9HiOA) + +

@ Copyright 2022 CE Info Systems Pvt. Ltd. All Rights Reserved.
+ +
Terms & Conditions | Privacy Policy | Supplier Sustainability Policy | Health & Safety Policy | Environmental Policy & CSR Report + +
Customer Care: +91-9999333223
diff --git a/docs/v1.0.13/MapplsGeofenceUI.md b/docs/v1.0.13/MapplsGeofenceUI.md new file mode 100644 index 0000000..86e4314 --- /dev/null +++ b/docs/v1.0.13/MapplsGeofenceUI.md @@ -0,0 +1,438 @@ +[

](https://www.mapmyindia.com/api) + +# MapplsGeofenceUI Plugin for iOS + +## [Introduction](#Introduction) +Mappls Geofence Plugin SDK provides the functionalities to create a geofence in circle and polygon shape. + +## [Getting Started](#Getting-Started) + +Anyone can integrate the Mappls Geofence Plugin by following simple steps.Please note that this Plugin for iOS supports iOS SDK 9.0 and above. + +To integrate Geofence SDK, it is important to pass an object of **MapplsMapView** which is part of Mappls's MapplsMap SDK. + +## Step 1 :- [Setup your Project](#Setup-your-Project) + +1. To start with, MapplsAPIKit and MapplsMap frameworks are required to be added in your project. These are available on Cocoapods and it can be accessed by using below pod commands. + + ```cocoapods + pod 'MapplsGeofenceUI', '1.0.1' + ``` + + **Note:** Mappls's SDK keys will required to initialize MapplsMap SDK. + + Fore more information on setting Click [here](https://github.com/mappls-api/mappls-ios-sdk/). + user can get the keys by login/signup on Mappls's developer [Dashboard](https://about.mappls.com/api/signup). + + **Below are commands to install SDK using Cocoapods:** + + - `cd Your Project path` + - `pod init` + - `pod install` + - `open your xcworkspace` + +### [Version History](#Version-History) + +| Version | Dated | Description | +| :---- | :---- | :---- | +| `1.0.1` | 01 Nov, 2022 | Bug fixes due to dependency of APIKit version 2.0.7 | +| `1.0.0` | 10 June, 2022 | Initial Mappls Release | + +## Step 2 :- [Authorization](#Authorization) + +### [MapplsAPICore](#MapplsAPICore) +It is required to set Mappls keys to use any MAPPL's SDK. Please refer the documentatation [here](MapplsAPICore.md). + +## Step 3 :- [Initialization of GeofenceViewUI](#Initialization) + +To Initialize, add **MapplsGeofenceUI** and **MapplsMap Framework** in your controller File. + +```swift +import MapplsMap +import MapplsGeofenceUI +var geofenceView: MapplsGeofenceView! + override func viewDidLoad() { + super.viewDidLoad() + // If you're on a background thread and want to execute code on the main thread, you need to call async() + DispatchQueue.main.async { +let geofenceInstance: MapplsGeofenceView = { +geofenceView = MapplsGeofenceView.init(geofenceframe: self.view.bounds) +geofenceView?.autoresizingMask = [.flexibleWidth, .flexibleHeight] + return geofenceView +}() +geofenceInstance.delegate = self +self.view.addSubview(geofenceInstance) +} +} +``` + +User must implement the **MapplsGeofenceViewDelegate** protocol class to use delegate methods of MapplsGeofenceView + +``` + geofenceInstance.delegate = self + ``` + +**Thats All!** The plugin is added in your application. + +This highly customizable plugin offers a wide range of properties can be edited based on the requirements of the users. Lets have alook at them. + +## [Customizing the Geofence using various properties](##Customizing): + +1. **Set Geofence Mode:** To set Geofence mode as a circle or a polygon + + ```swift + geofenceView.setMode(mode: .circle) + ``` + +2. **Show/Hide Default Slider:** To show/hide CircleSlider. Defaults to true. + + ```swift + geofenceView.isShowDefaultSliderForCircle = false + ``` +3. **Mode Panel:** To show/hide modePanel for Circle and Polygon. Defaults to true. + + ```swift + geofenceView.isShowDefaultModePanel = false + ``` + +4. **Polygon Delete Button Image:** To change PolygonDelete button default image + + ```swift + geofenceView.deleteBtnDefaultImage = UIImage(named: "") + ``` +5. **Polygon Drag Point To Move DeleteImage:** To change polygonDeleteImage while dragging to any point. + + ```swift + geofenceView.deleteBtnDeleteImage = UIImage(named: "") + ``` +6. **Circle Fill Color:** To set fill color of circle + + ```swift + geofenceView.circlefillColor = .red + ``` +7. **Circle Stroke Color :** To set the stroke color of the circle. + + ```swift + geofenceView.circleStrokeColor = .red + ``` +8. **Polygon Fill Color :** To set the fill color of the polygon + + ```swift + geofenceView.polygonFillColor = .red + ``` + +9. **Polygon Stroke Color:** To set the stroke of the polygon + + ```swift + geofenceView.polygonStrokeColor = .red + ``` +10. **Polygon ToolTipBackgroundColor:** To change top instruction tool tip Background Color. + + ```swift + geofenceView.toolTipBackgroundColor = .blue + ``` +11. **Marker Fill Color :** To change Marker Annotation Color. + + ```swift + geofenceView.markerFillColor = .blue + ``` + +12. **Marker Stroke Color :** To change Polygon Marker Stroke Color. + + ```swift + geofenceView.markerStrokeColor = .blue + ``` +13. **Mid Marker Fill Color :** To change Polygon Mid Marker Color. + + ```swift + geofenceView.midMarkerFillColor = .blue + ``` +14. **Circle Slider MinTrack Color :** To change CircleSlider MinTrackColor by using this property. Defaults to blue color. + + ```swift + geofenceView.sliderMinTrackColor = .blue + ``` +15. **Circle Slider MaxTrack Color :** To change CircleSlider MaxTrackColor by using this property. Defaults to Grey color. + + ```swift + geofenceView.sliderMaxTrackColor = .blue + ``` +16. **Circle Slider ThumbTint Color :** To change CircleSlider ThumbTintColor by using this property. Defaults to white. + + ```swift + geofenceView.sliderThumbTintColor = .blue + ``` + +17. **Dragging Edges line Color :** To set geofence Dragging Edges line Color. + + ```swift + geofenceView.draggingEdgesLineColor = .red + ``` +18. **Geofence Stroke Width :** To set geofence Stroke width. + + ```swift + geofenceView.geofenceStrokeWidth = 2.5 + ``` +19. **Geofence Circle Center marker Image :** To set the Circle Center marker Image. + + ```swift + geofenceView.circleCenterMarker = UIImage(named: "image") + ``` +20. **Geofence sketch board overlay :** To set sketch board overlay color. + + ```swift + geofenceView.polygonDrawingOverlayColor = .red + ``` +21. **Dynamic zoom level adjustment :** +To set zoom of map. + + ```swift + geofenceView.mapview.zoomlevel = 18 + ``` +22. **DefaultOverlayToolTipView :** To remove default overlay tool tip view. + + ```swift + geofenceView.showHideDefaultOverlayIcons = true + ``` +23. **BackgroundOvarlayColor :** To set polygon background overlay color. + + ```swift + geofenceView.polygonDrawingOverlayColor = UIColor.clear + ``` +24. **IsShowDeleteControl :** To remove DeleteControlPoint.. Defaults to true. + + ```swift + geofenceView.IsShowDeleteControl = false + ``` +25. **Polygon Direction :** To set polygon direction in Clockwise, anticlockwise or None. If set clockwise,the current points will convert in clockwise shape. + + ```swift + geofenceView.convertPointsToClockWise(pointsType: .clockWise) + ``` + +26. **Circle Radius :** To set the radius of the circle . + + ```swift + // user can pass your slider value over here + geofenceView.circleRadius = slider.value + ``` +27. **Circle Minimum Radius :** To set the minimum value of the circle in the slider. + + ```swift + geofenceView.circleMinRadius = Double(slider.minimumValue) + ``` +28. **Circle Maximum Radius :** To set the maximum value of the circle in the slider. + + ```swift + geofenceView.circleMaxRadius = Double(slider.maximumValue) + ``` + +29. **Geofence Anchor Point :** To set Geofence tip marker(Anchor Point) with the help of this property. Default property value is (x=0,y=0). For top tip marker user can set cgpoint value as below example. + + ```swift + geofenceView.setGeofenceAnchorPoint = CGPoint(x: 0.5, y: 1.0) + ``` + +30. **Circle Proposed Radius :** It is the dotted line draw around a circle when user moves the slider value. Code to use this feature is as follows : + + ```swift + @IBAction func btnSliderValueChanged(_ sender: UISlider, forEvent event: UIEvent) { + + if let touchEvent = event.allTouches?.first { + switch touchEvent.phase { + case .began: + print("Slider Began") + break + // handling the drag began + case .moved: + print("Slider Moved") + + geofenceView.circleProposedRadius = Double(sender.value) + + break + // handling the drag moved + case .ended: + print("Slider Ended") + + geofenceView.circleRadius = Double(sender.value) + + break + handle drag ended + default: + break + } + } + ``` + +31. **Circle Center Coordinate :** To set center of circle using coordinates. + + ```swift + geofenceView.setCircleCenterCoordinate(coordinate: CLLocationCoordinate2D(latitude: 28.7041, longitude: 77.1025)) + ``` + +32. **Geofence Polygon Drawing Enabled :** To enable or disable the polygon drawing board. + + **Note:** *While using Polygon Mode and using setMode functions, it resets property `isPolygonDrawingEnabled` to true. Value of this property must be considered on receiving callback using delegate method geofenceShapeDidChanged.* + + ```swift + geofenceView.isPolygonDrawingEnabled = true + ``` + +33. **Polygon Drawing Stroke Width :** To set the width of stroke of drawing board while creating polygon geofence. Default value is 2. + + ```swift + geofenceView.polygonDrawingStorkeWidth = 2 + ``` + +34. **Polygon Drawing Stroke Color :** To set the color of stroke of drawing board while creating polygon geofence. + + ```swift + geofenceView.polygonDrawingStrokeColor = UIColor.gray + ``` + +35. **Change Polygon's Mid Marker Image :** To change image of marker in the middle of polygon edge lines. + + ```swift + geofenceView.midMarkerViewImage = UIImage(named: "pinMid") + ``` + +36. **Change Polygon's Creation Mode :** Polygon can be created either by free hand drawing on a drawing overlay or by simply tapping on the map. + + As suggested by name itself, it is property is used change mode of creating polygon.Default to `draw`. + + **Note:** *On setting its value to `tap`, value of `isPolygonDrawingEnabled` will be changed to false automatically.* + + ```swift + geofenceView.polygonCreationMode = .tap + ``` + +37. **Auto Hide Edge Markers :** Control points of polygon while dragging are visible by default so the value remains false. To hide them, user can set below property to true. + + ```swift + geofenceView.isHiddenPolygonControlPoints = true + ``` + +38. **MapplsGeofenceViewDelegate :** It is a protocol class which will be used for callback methods as shown below: + + **1. Call Back Handler :** Geofence's Shape object can be queried by using this protocol. + Geofence shape data will return in following case. + + - When CircleSlider Value Changed. + - When circle centre points changed. + - When set radius changed. + - When free hand drawing finished. + - When polygon point dragging finished. + - When any polygon point to move and Delete. + - When Geofence Circle did end dragging. + + ```swift + geofenceShapeDidChanged(_ shape: MapplsGeofenceShape) + ``` + + **2. Mode Callback :** It basically returns your current mode like circle or polygon + + ```swift + geofenceModeChanged (mode: MapplsOverlayShapeGeometryType) + ``` + + **3. Circle Radius Changed :** To get circle radius changed value in this delegate method. + + ```swift + circleRadiusChanged(radius: Double) + ``` + **3. Circle Radius Changed :** To get if circle did end dragging. + + ```swift + didDragGeofence(isdragged: Bool) + ``` + +39. **Custom Marker on Geofence View :** +For adding custom marker on geofence view, we have created one class in sample `Custom geofence annotation`. This class is inherited with `MGLPointAnnotation` and `GeofenceAnnotation`. + + Basically **geofence Annotation** is protocol class that contain annotation image. User can set image by using this property `geofenceAnnotationImage`. + + **Note** *- To help more, we are showing one marker on the top right corner in the sample app (ClassCustomGeofenceVC)*. + + + To Check this, Refer to the code below after creating Polygon Click marker button: + + ```swift + // Use this class to test marker on map. + let annotation = CustomGeofenceAnnotation() + annotation.title = "" + annotation.coordinate = coordinate + if let image = UIImage(named: "pin.png") { + annotation.geofenceAnnotationImage = image + } + geofenceView.mapView.addAnnotation(annotation) + ``` + +41. **Polygon Center as Coordinate :** +We have added property and method to get polygon center as Coordinates. +Below code refers one Class function and another as global property to get the Polygon Center as coordinate. + + ```swift + let center = geofenceView.polygonCenterCoordinate + print(center) + let location = MapplsGeofenceView.centerCoordinateOf(coordinates: polygonPints, mapView: geofenceView.mapView) + print(location) + ``` + +42. **Rectangle Polygon:** +To draw a rectangle-shaped polygon, mode must be set to polygon, polygonCreationMode property must be set to be tap, isPolygonDrawingEnabled property must be set to false and isRectangleShapeSelected must be set to true. See below code snippet + + ```swift + geofenceView.polygonCreationMode = .tap + geofenceView.setMode(mode: .polygon) + geofenceView.isPolygonDrawingEnabled = false + geofenceView.isRectangleShapeSelected = true + ``` + +# Sample App + +In the Sample **Version 0.5.0**, we have added some more functionalities like: + +#### **1. Polygon points Check (Anticlockwise or Clockwise)** +To see if the polygon points are drawn clockwise or antoclockwise, draw polygon points in sampleApp. We have one button that shows direction in top right corner of custom geofence class. + +#### **2. Draw Geofence Shape View** +To view your geofence created shape by clicking on Apply button(In customGeofenceVC Class). When the user clicks on Apply button, it will navigate to related list in class(DrawCircleVC). + +#### **3. Edit Geofence Shape** +In Class (DrawCircle) we are showing one option to edit on click. +It will navigate to the related geofence screen with current shape, here, user can modified it. + +After clicking Apply button, it will reflect in (DrawCircleVCClass). + +#### **4. Delete Geofence Shape** +We have provided a delete button in (rawCircleVC Class). Clicking on this, will delete the current shape in the list. + +


+ +## Our many happy customers: + +![](https://www.mapmyindia.com/api/img/logos1/PhonePe.png)![](https://www.mapmyindia.com/api/img/logos1/Arya-Omnitalk.png)![](https://www.mapmyindia.com/api/img/logos1/delhivery.png)![](https://www.mapmyindia.com/api/img/logos1/hdfc.png)![](https://www.mapmyindia.com/api/img/logos1/TVS.png)![](https://www.mapmyindia.com/api/img/logos1/Paytm.png)![](https://www.mapmyindia.com/api/img/logos1/FastTrackz.png)![](https://www.mapmyindia.com/api/img/logos1/ICICI-Pru.png)![](https://www.mapmyindia.com/api/img/logos1/LeanBox.png)![](https://www.mapmyindia.com/api/img/logos1/MFS.png)![](https://www.mapmyindia.com/api/img/logos1/TTSL.png)![](https://www.mapmyindia.com/api/img/logos1/Novire.png)![](https://www.mapmyindia.com/api/img/logos1/OLX.png)![](https://www.mapmyindia.com/api/img/logos1/sun-telematics.png)![](https://www.mapmyindia.com/api/img/logos1/Sensel.png)![](https://www.mapmyindia.com/api/img/logos1/TATA-MOTORS.png)![](https://www.mapmyindia.com/api/img/logos1/Wipro.png)![](https://www.mapmyindia.com/api/img/logos1/Xamarin.png) + +
+ +For any queries and support, please contact: + +[

](https://about.mappls.com/api/) + +Email us at [apisupport@mappls.com](mailto:apisupport@mappls.com) + +![](https://www.mapmyindia.com/api/img/icons/support.png) +[Support](https://about.mappls.com/contact/) +Need support? contact us! + +

+ +[

](https://stackoverflow.com/questions/tagged/mappls-api)[![](https://www.mapmyindia.com/api/img/icons/blog.png)](https://about.mappls.com/blog/)[![](https://www.mapmyindia.com/api/img/icons/gethub.png)](https://github.com/mappls-api)[

](https://www.npmjs.com/org/mapmyindia) + +[

](https://www.facebook.com/Mapplsofficial)[![](https://www.mapmyindia.com/june-newsletter/icon2.png)](https://twitter.com/mappls)[![](https://www.mapmyindia.com/newsletter/2017/aug/llinkedin.png)](https://www.linkedin.com/company/mappls/)[![](https://www.mapmyindia.com/june-newsletter/icon3.png)](https://www.youtube.com/channel/UCAWvWsh-dZLLeUU7_J9HiOA) + +

@ Copyright 2022 CE Info Systems Pvt. Ltd. All Rights Reserved.
+ +
Terms & Conditions | Privacy Policy | Supplier Sustainability Policy | Health & Safety Policy | Environmental Policy & CSR Report + +
Customer Care: +91-9999333223
diff --git a/docs/v1.0.13/MapplsIntouch.md b/docs/v1.0.13/MapplsIntouch.md new file mode 100644 index 0000000..6f14f16 --- /dev/null +++ b/docs/v1.0.13/MapplsIntouch.md @@ -0,0 +1,2545 @@ +[

](https://www.mapmyindia.com/api) + +# MapplsIntouch - Intouch SDK for iOS + +## [Introduction](#Introduction) + +This SDK is collection of API wrappers of different APIs of Mappls Intouch platform for iOS Platform. + +### [Dependencies](#Dependencies) + +This library depends upon several Mappls's own libraries. All dependent libraries will be automatically installed using CocoaPods. + +Below are list of dependencies which are required to run this SDK: + +- [MapplsAPICore](https://github.com/mappls-api/mappls-ios-sdk/docs/v1.0.0/MapplsAPICore.md) + +## [Installation](#Installation) + +This library is available through `CocoaPods`. To install, simply add the following line to your `podfile`: + +```ruby +pod 'MapplsIntouch', '1.0.1' +``` +On running `pod install` command it will automatically download and setup `MapplsUIWidgets` and dependent frameworks. + +### [Version History](#Version-History) + +| Version | Dated | Description | +| :---- | :---- | :---- | +| `1.0.1` | 24 Mar, 2023 | Bug fixes.| +| `1.0.0` | 30 Jan, 2023 | Initial Mappls UIWidget Release.| + +## [Authorization](#Authorization) + +### [MapplsAPICore](#MapplsAPICore) +It is required to set Mappls keys to use any Mappls SDK. Please refer the documentation [here](MapplsAPICore.md). + +## [Device Details](#Device-Details) + +Get accurate live location and related data of vehicles, assets & people with help of connected devices/sensors/mobiles to provide location awareness to users of your app. + +Below mentioned methods provide real-time visibility of your tracked objects, giving not just location information, but multiple additional fields which add value to your application. + +### 1) Get live device details by single or multiple IDs. + +#### a) Get the list of all devices live data in your account. + +### Objective-c +```objc +[Intouch.shared getDevicesWithIncludeInActive:true ignoreBeacon:true lastUpdateTime:@"" completionHandler:^(IntouchDeviceResponse * _Nullable response, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```Swift + Intouch.shared.getDevices(includeInActive: false, ignoreBeacon: false, lastUpdateTime: "0") { (response, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + +#### b) Get the list of selected devices live data. + +### Objective-C +```objc +[Intouch.shared getDevicesWithListOfDeviceIds:_deviceIdarr includeInActive:false ignoreBeacon:false lastUpdateTime:@"" completionHandler:^(IntouchDeviceResponse * _Nullable response, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```Swift +Intouch.shared.getDevices(listOfDeviceIds: devicesIds, includeInActive: false, ignoreBeacon: false, lastUpdateTime: "") { (response, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` +#### c) Get a single device live data + +### Objective-c +```objc +[Intouch.shared getDevicesWithDeviceId:123 lastUpdateTime:@"" completionHandler:^(IntouchDeviceResponse * _Nullable response, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```Swift +Intouch.shared.getDevices(deviceId: id, lastUpdateTime: "") { (response, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + +#### Request Parameters + +1. ```deviceId```(Int) - This is the device ID +2. ```includeInActive``` (Boolean) -If "true" then API response will include inactive devices along with active devices. If "false" then API will return only active devices. +3. ```ignoreBeacon``` (Boolean) - If set to "true" then API will return all devices except those with device type as a beacon(mobile). +4. ```lastUpdateTime``` (Double) - Give EPOCH timestamp to fetch only those live locations of devices that have come after the given timestamp. If "lastUpdateTime" is given then by default only active devices will be fetched irrespective of the status of "includeInActive" attribute else set the value as 0. + + +### Response Code (as HTTP response code) + +#### Success: + +1. 200: To denote a successful API call. + +#### Client-side issues: + +1. 400: Bad Request, User made an error while creating a valid request. +2. 401: Unauthorized, the Developer’s key is not allowed to send a request with restricted parameters. +3. 403: Forbidden, the Developer’s key has hit its daily/hourly limit. + +#### Server-Side Issues: + +1. 500: Internal Server Error, the request caused an error in our systems. +2. 503: Service Unavailable, It comes during our maintenance break or server downtimes. + +### Response Messages (as HTTP response message) +1. 200: Success +2. 203: Device Not Found +3. 400: Bad Request - Invalid device ID supplied or invalid data type. For example, the input attribute "id" is an integer but string value gets passed. +4. 401: Unauthorized Request. Access to API is forbidden. +5. 404: Not Found - URL Not Found + +### Response Parameter +`DevicesResponse` class object returns the API response as a JSON object. + + #### DeviceResponse result parameters: + 1. ```id (Int)``` - Id of the device. + 2. ```active (string) ```- Device active status + 3. ```status (string)``` - Device movement status + 4. ```vehicleBattery (Double)``` - Device battery status + 5. ```location (Location)``` - Device live location object like latitude, longitude etc. + 6. ```deviceDetails(DeviceDetails)``` - Device info object like name etc. + 7. ```alerts (Alerts)``` - Alert object + 8. ```canInfo (CanInfo)``` - Device CanInfo object. + 9. ```deviceFaults (ArrayList)``` - List of various fault. + 10. ```currentGeofence (ArrayList)``` - list of current geofences id. + 11. ```todaysDrive (TodaysDrive)``` - TodaysDrive object. + +##### Location parameters: +1. ```gpsTime (Long)``` - Time at which data is being fetched from the device +2. ```gprsTime (Long)``` - Time at which data is being received at the server end. +3. ``` latitude (Double)``` - Device location latitude +4. ```longitude (Double)``` - Device location Longitude +5. ```altitude (Double)``` - Device location Altitude +6. ```heading (Double)``` - Angle at which is the device is moving +7. ```speedKph (Double)``` - Device or vehicle's GPS based speed. +8. ```address (String)``` - Complete address of the location. +9. ```odometer (Double)``` - Either GPS or CAN Odometer based on the configuration. + +##### DeviceDetails parameters: +1. ```deviceId (Long)``` - Id of device. +2. ```registrationNumber (String)``` Device registration number. +3. ```deviceType (String)``` - Type of device like a car, truck, bus, bike, tractor, JCB, excavator, etc. + +##### Alerts parameters: +1. ```deviceId (Long)``` - Id of device. +2. ```timestamp (Long)``` - EPOCH time at which alarm was generated +3. ```latitude (Double)```- Location latitude of alarm. +4. ```longitude (Double)``` - Location longitude of alarm. +5. ```address (String)``` - Location address at which the alarm got generated +6. ```alarmType (Integer)``` - Type of alarm to create. The following are the alarm types & their corresponding IDs. +IGNITION: 21, OVERSPEED: 22, UNPLUGGED: 23, PANIC: 24, GEOFENCE: 26, STOPPAGE: 27, IDLE: 28, TOWING: 29, GPRS CONNECTIVITY: 126, VEHICLE BATTERY: 129, MILEAGE: 133, GPS CONNECTIVITY: 146, DISTANCE COVERED: 151, INTERNAL BATTERY VOLTAGE:161 +7. ```limit (Integer)```- Alarm limit as set in the config. For example, if an Overspeed alarm set on the limit of 44 km/hr in the alarm config setting, then this attribute will return 44 km/hr +8. ```duration (Long)``` - Alarm duration limit as set in the alarm config section. For example, if the duration of Overspeed alarm is set as 20 secs, then the alarm will generate when the vehicle over speeds for a duration of 20 secs +9. ```actualLimit (Integer)``` - The actual data received from the device at that particular moment when the alarm got generated. For example, when the over-speed alert generated the vehicle actual speed was 56km/hr. +10. ```actualDuration (Integer)``` - Actual duration for which the device breached the alarm config limit +11. ```severity (Integer)``` - 0:Low Severity. 1:High Severity +12. ```data (Integer)``` - Describes the state of the alarm. IGNITION(type = 21), 0: OFF & 1: ON. AC(type=25), 0: OFF, 1: ON. GEOFENCE(type=26), 1: Entry & Exit Geofence 2: Entry Geofence, 3: Leaving Geofence & 4: Long Stay In Geofence +13. ```geofenceId (Long)``` - Unique ID of the geofence for which the alarm got generated. + +##### CanInfo parameters: +1. ```calcEngineVal (Integer) ```- Calculated Engine value. +2. ```greenDriveType (String)``` - HA(Harsh acceleration), HB(Harsh Braking), HC(Harsh Cornering). +3. ```canTimestamp (Long)``` - Exact EPOCH time at which the CAN data got generated by the device. +4. ```coolantTemp (Integer)``` - Coolant temperature. +5. ```engineRPM (Integer)``` - Rpm value of engine. +6. ```accelPedal (Double)``` - This is accelerator pedal value in percentage. +7. ```pedoMeter (Integer)``` - Pedometer value in steps. +8. ```parkBrake (Double)``` - This is the parking brake. 0 means parking brake is disengaged & 1 means parking brake is engaged. +9. ```brakePedal (Double)``` - 1 means brake pedal is engaged & 0 means brake pedal is disengaged. +10. ```fuelLevel (Integer)``` - The level of the fuel in liters. +11. ```driverDoor (Double)``` - 1 means door is open & 0 means door is closed. +12. ```passDoor (Double)``` - 1 means door is open & 0 means door is closed. +13. ```headLights (Double)``` - 1 means ON & 0 means OFF. +14. ```blinker (Double)``` - 1 means ON & 0 means OFF. +15. ```ac (Integer)``` - 1 means AC is ON & 0 means AC is OFF. +16. ```fuelConsAVG (Integer)``` - Fuel constant average. +17. ```intakeAirTemp (Double)``` - Intake air temperature of the engine. +18. ```intakeabsolutePress (Integer)``` - Intake absolute pressure of the engine. It is defined in Pa(Pascal) + +##### DeviceFault parameters: +1. ```code (String)``` - Fault code. +2. ```timestamp (Long)``` - Duration as EPOCH Time. +3. ```status (Integer)``` - Describes the status of the fault which was detected. 0: OPEN & 1: Close. +4. ```closedOn (Long)```- The EPOCH time at which fault code closed. This will come for the closed case. + +##### TodaysDrive parameters: +1. ```todayKms (Double)``` - Distance in Km(s). +2. ```todayMovementTime (Long)``` - Movement time in sec(s). +3. ```todayIdleTime (Long)``` - Idle time in sec(s). +4. ```todayDriveCount (Long)``` - Drive count for today. + +### 2) Get Device info + +Below method returns the basic info of devices such as their registration number, type of entity, manufacturer etc. + +#### a) Get all devices info + +### Objective-c +```objc +[Intouch.shared getDevicesInfoWithCompletionHandler:^(IntouchDeviceInfoResponse * _Nullable response, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +Intouch.shared.getDevicesInfo { (deviceinfoResponse, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = deviceinfoResponse { + // write your code here. + } +} +``` + +#### b) Get the selected device info + +### Objective-c +```objc + NSArray*deviceIdarr = [[NSArray alloc]initWithObjects:@"8440",@"8440",@"8404", nil]; + [Intouch.shared getDevicesInfoWithDeviceIds: completionHandler:^(IntouchDeviceInfoResponse * _Nullable response, NSError * _Nullable error) { + if(error) + { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + else{ + // write your code here. + } + }]; +``` + +### Swift +```swift +Intouch.shared.getDevicesInfo(deviceIds: [array of deviceIds]) { (response, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` +### Request Parameters + +1. ```id```(Long) - This is the device ID. You may pass single or multiple ids in an array. + + +### Response Code (as HTTP response code) + +#### Success: + +1. 200: To denote a successful API call. + +#### Client-side issues: + +1. 400: Bad Request, User made an error while creating a valid request. +2. 401: Unauthorized, the Developer’s key is not allowed to send a request with restricted parameters. +3. 403: Forbidden, the Developer’s key has hit its daily/hourly limit. + +#### Server-Side Issues: + +1. 500: Internal Server Error, the request caused an error in our systems. +2. 503: Service Unavailable, It comes during our maintenance break or server downtimes. + +### Response Messages (as HTTP response message) +1. 200: Success +2. 203: Device Not Found +3. 400: Bad Request - Invalid device ID supplied or invalid data type. For example, the input attribute "id" is an integer but string value gets passed. +4. 401: Unauthorized Request. Access to API is forbidden. +5. 404: Not Found - URL Not Found + +### Response Parameter +`DeviceInfoResponse` class object returns the API response as a JSON object. + + #### DeviceInfo result parameters: + 1. ```id (Integer)``` - Id of the device. + 2. ```name(string) ```- Name of the device. + 3. ```type(Integer)``` - Type of entity like 0 - car, 1 - person, 2 - asset, 3 - bike, 4 - bus, 5 - truck, 6 - tractor. + 4. ```creationOn(long)``` - Date when the device was created. + 5. ```updationOn(long)``` - Date when device info got updated. + 6. ```expiryDate(long)``` - Date when device validity subscription will get expired. + 7. ```active(Boolean)``` - Whether device is active or not. + 8. ```registrationNumber(String)``` - Device's registration number. + 9. ```manufacturer(String)``` - Device manufactured by. + 10. ```model(String)``` - Device's model type. + 11. ```color(String)``` - Color of the device. + 12. ```geofenceIds(List)``` - IDs of the geofences associated with the device. + 13. ```tag(List)``` - Tag of the vehicle with the custom string value + 14. ```chasisNo``` - Chassis number of the device. + 15. ```initialOdometer``` - Initial odometer reading. + +### [Event Data](#Event-Data) + +Get the Trails (Travelled path) of a device in your account using the below methods. + +### Objective-c +```objc +[Intouch.shared getLocationsEventWithDeviceId:0 startTime:0 endTime:0 skipPeriod:1 completionHandler:^(DeviceEventResponse * _Nullable response, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +Intouch.shared.getLocationsEvent(deviceId: 0, startTime: 0, endTime: 0, skipPeriod: 0) { (response, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + +### Request Parameters +1. ```deviceId ```(Long) Id of the device for which the location data need to be fetched. +2. ```startTime ```(Long) Start Epoch timestamp from which the events need to be fetched. +3. ```endTime ```(Long) End Epoch timestamp till which the events need to be fetched. +4. ```skipPeriod```(int) Defined in minutes. For example, if 2 is passed then the returned data packet will have a minimum difference of 2 mins else 0. + +### Response Code +#### Success: +1. 200: To denote a successful API call. + +#### Client-side issues: + +1. 400: Bad Request, User made an error while creating a valid request. +2. 401: Unauthorized, the Developer’s key is not allowed to send a request with restricted parameters. +3. 403: Forbidden, the Developer’s key has hit its daily/hourly limit. + +#### Server-Side Issues: + +1. 500: Internal Server Error, the request caused an error in our systems. +2. 503: Service Unavailable, during our maintenance break or server downtimes. + +### Response Messages (as HTTP response message) +1. 200: Success +2. 203: Device Not Found +3. 400: Bad Request - Invalid device ID supplied or invalid data type. For example, the input attribute "id" is an integer but string value gets passed. +4. 401: Unauthorized Request. Access to API is forbidden. +5. 404: Not Found - URL Not Found + +### Response Parameter +`LocationEventResponse` class object returns the API response as a JSON object. + +#### LocationEventResponse result parameters: +1. ```deviceId (Long)``` - Device id of selected device. +2. ```drivingBehaviourCount (DrivingBehaviourCount)``` - Driving behavior count in the selected device. +3. ```summary (Summary)``` - Brief summary of all locations. +4. ```positionList (List)``` - List of location positions. + +#### Summary parameters: +1. ```distance (Double)``` - Total drive distance in KM(s). +2. ```duration (Long)``` - Total drive duration in seconds. +3. ```avgSpeed (Double)``` - Average speed in km/hr. +4. ```startAddress (String)``` - Start address of the location. +5. ```endAddress (String)``` - End address of the location. +6. ```startTimestamp (Long)``` - Start Epoch time of the event. i,e) the time at which the data first came from the device for the selected day +7. ```endTimestamp (Long)``` - End Epoch time of the event. i,e) the time at which the last data came from the device for the selected day. + +#### DrivingBehaviourCount parameters: +1. ```haCount (Integer)``` - Harsh acceleration count. +2. ```hbCount (Integer)``` - Harsh braking count. +3. ```hcCount (Integer)``` - Harsh cornering count. + +#### PositionList parameters: +1. ```address (String)``` - Address of particular location. +2. ```timestamp (Long)``` - Epoch Time at a particular location. +3. ```longitude (Double)``` - Location longitude. +4. ```latitude (Double)``` - Location latitude. +5. ```heading (Double)``` - Device heading direction in degrees from North. +6. ```speed (Double)``` - Device speed at this particular location. +7. ```powerSupplyVoltage (Double)``` - Battery voltage value in millivolts. +8. ```ignition (Boolean)``` - Whether vehicle ignition is On or Off. 0 means ignition is OFF and 1 means ignition is ON. +9. ```gpsFix (Boolean)``` - GPS fixes or not for the device. true means GPS is fixed and false means GPS is not fixed. +10. ```validGPS (Boolean)``` - Checks whether GPS is valid or not. +11. ```accOff (Boolean)``` - Checks for whether adaptive cruise control is enabled or not. +12. ```movementStatus (String)``` - Checks the movement status of the device. 1:Moving, 2:Idle, 3:Stopped, 4:Towing, 5:No Data 6:Power Off, 7:No Gps, 8:On Trip, 9:Free Vehicle +13. ```mobileInfos (MobileInfo)``` - MobileInfo object + +#### MobileInfo parameters: +1. ```locationSource (Integer)``` - Returns location source i.e 1 - GPS connected, 2 - GPRS connected. +2. ```mockLocation (Boolean)``` - If true means mock location is enabled else false means real GPS location being sent by the user. +3. ```isAirplanemode (Boolean)``` - Checks whether mobile's airplane mode is ON or OFF. +4. ```callStatus (Integer)``` - Current call status like 0:CALL_STATE_IDLE, 1:CALL_STATE_RINGING, 2:CALL_STATE_ONCALL +6. ```deviceStatus (Integer)``` - Status of the device in the current location. 0: IN_VEHICLE, 1: ON_BICYCLE, 2: ON_FOOT, + 3:STILL, 4:UNKNOWN, 5:TILTING, 6:WALKING, 7:RUNNING. +7. ```phoneEvent (Integer)``` - Checks the location permission that the user enables/disables in the mobile phone. For eg:- 5 for location permission denied. 6 for location provider off etc. + +### [Drive Data](#Drive-Data) + +Get the drive details of a vehicle/user in an InTouch account using the below method. A drive is a list of reported geo-positions with the start and end location of a vehicle according to pre-defined conditions. Time duration, distance covered during the drive, HA, HB, HC events are also returned along with the drive details. + +### Objective-c +```objc +// IntouchDriveResponse - returns drives as response if success else returns error. +[Intouch.shared getDriveDataWithDeviceId:0 startTime:0 endTime:0 completionHandler:^(IntouchDriveResponse * _Nullable response, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +// IntouchDriveResponse - returns drives as response if success else returns error. +Intouch.shared.getDriveData(deviceId: 0, startTime: 0, endTime: 0) { (DriveDataResponse, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + +### Request Parameters + +1. ```deviceId```(Int)- Id of the device for which the drives need to be fetched. + +2. ```startTime```(Long)- The start Epoch timestamp from which the drives need to be fetched. + +3. ```endTime ```(Long)- The end Epoch timestamp till which the drives need to be fetched. + +### Response Code +#### Success: +1. 200: To denote a successful API call. + +#### Client-side issues: + +1. 400: Bad Request, User made an error while creating a valid request. +2. 401: Unauthorized, the developer’s key is not allowed to send a request with restricted parameters. +3. 403: Forbidden, the developer’s key has hit its daily/hourly limit. + +#### Server-Side Issues: + +1. 500: Internal Server Error, the request caused an error in our systems. +2. 503: Service Unavailable, during our maintenance break or server downtimes. + +### Response Messages (as HTTP response message) +1. 200: Success +2. 203: Device Not Found +3. 400: Bad Request - Invalid device ID supplied or invalid data type. For example, the input attribute "id" is an integer but string value gets passed. +4. 401: Unauthorized Request. Access to API is forbidden. +5. 404: Not Found - URL Not Found + + +### Response Parameter +`DriveResponse` Class object returns the API response as a JSON object. + +#### DriveResponse result parameters: +1. ```deviceId (Int)``` - Device id of selected device. +2. ```drivingBehaviourCount (DrivingBehaviourCount)``` - Driving behavior count in the selected drive. +3. ```movement(Movement)``` - Movement info object. +4. ```location (Location)``` - Location info object. + +#### Movement parameters: +1. ```duration (Long)``` - Drive duration in seconds. +2. ```distance (Long)``` - The driving distance in KMs. +3. ```idleTime (Long)``` -Idle time in seconds. +4. ```movementTime (Long)``` - Movement time in seconds. +5. ```stoppageTime (Long)``` - Stoppage time in seconds. + +#### DrivingBehaviourCount parameters: +1. ```haCount (Integer)``` - Harsh acceleration count. +2. ```hbCount (Integer)``` - Harsh braking count. +3. ```hcCount (Integer)``` - Harsh cornering count. + +#### PositionList parameters: +1. ```startAddress(String)``` - Start address of particular drive. +2. ```startTimestamp(Long)``` - Start Epoch time of particular drive. +3. ```endAddress(String)``` - End address of particular drive. +4. ```endTimestamp(Long)``` - Start Epoch time of particular drive. +5. ```avgSpeed(Double)``` - Speed in km/hr. + +## [Geofences](#Geofences) + +A geofence is a user-defined bounded area to trigger Entry and Exit alert of the user/vehicle. Custom areas or places can be created as a Geofence under your account, For example, it could be a hotel, Restaurant, Office, work area, retail store, and so on. + +MapmyIndia InTouch SDK supports Point, Circle, and Polygon (Custom Region/Area) geofences. You can Create, Update, or Delete geofences using the below methods. Also, get the total time spent inside the geofence using the below methods. + +### a) Create Geofence + +The create geofence method helps you to create a geofence under your account. Three types of geofence can be created: Point, Circle, Polygon. + +#### Point Geofence + +Input the Lat, long, and the name of the geofence to create the point geofence. A point geofence has a fixed radius of 100 meters, so the user need not put the radius of the geofence. To customize the radius of geofence refers to the circle geofence method. + +### objective-c +```objc +// Point type geofence +//IntouchGeometryPoint - it accepts point coordinate. +//IntouchPointGeofence - it accepts geometry coordinate and name. +//IntouchGeofenceOptions - class it accepts object of geofence + +CLLocation*referenceLocation = [[CLLocation alloc] initWithLatitude:28.550667 longitude:77.268959]; +IntouchGeometryPoint*point = [[IntouchGeometryPoint alloc]initWithPoint:referenceLocation]; IntouchPointGeofence*point1 = [[IntouchPointGeofence alloc]initWithName:@"test" geometry:point]; +self.geofenceOptions = [[IntouchGeofenceOptions alloc]initWithGeofence:point1]; + [Intouch.shared createGeoFenceWithGeofence:_geofenceOptions completionHandler:^(NSInteger status, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +let geometry = IntouchGeometryPoint(point: CLLocation(latitude: 23.343, longitude: 77.232)) + let geofence2 = IntouchPointGeofence(name: "Test", geometry: geometry) + let geofenceoption = IntouchGeofenceOptions(geofence: geofence2) + Intouch.shared.createGeoFence(geofence: geofenceoption) { (status, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = status { + // write your code here. + } +} +``` + +#### Circle Geofence + +Create a circle geofence with a radius of your choice. Input Lat, long, Radius, and name of the geofence to create the circle geofence. + +### objective-c +```objc +// Circle type geofence, the radius will be in meters. +// Status - returns success if geofence created else error as callback methods. +// IntouchPointGeofence - it will accepts geometry, name and circle radius. + +NSNumber *myDoubleNumber = [NSNumber numberWithDouble:500]; + IntouchPointGeofence*withBuffer = [[IntouchPointGeofence alloc]initWithName:@"Test" buffer:myDoubleNumber geometry:point]; + +IntouchGeofenceOptions*geofenceOptionsWithRadius = [[IntouchGeofenceOptions alloc]initWithGeofence:withBuffer]; + +[Intouch.shared createGeoFenceWithGeofence:_geofenceOptionsWithRadius completionHandler:^(NSInteger status, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; + ``` + +### Swift +```swift +let geometry = IntouchGeometryPoint(point: CLLocation(latitude: 23.343, longitude: 77.232)) + let geofence2 = IntouchPointGeofence(name: "Test", buffer: 500, geometry: + geometry) + +let geofenceoption = IntouchGeofenceOptions(geofence: geofence2) + +Intouch.shared.createGeoFence(geofence: geofenceoption) { (status, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = status { + // write your code here. + } +} + ``` + + #### Polygon Geofence + +To draw a polygon geofence we need at least three points. Multiple points can be added to create the custom shape Geofence. Input a list of geofence points (Lat, long) in the comma-separated format. + +### objective-c +```objc +// Polygon Geofence +// IntouchGeometryPolygon- class accepts multiple coordinates. +// IntouchPolygonGeofence- it accepts geofenceName and geometry. +//IntouchGeofenceOptions - it accepts created geometry object. + +CLLocation* referenceLocation1 = [[CLLocation alloc] initWithLatitude:28.550667 longitude:77.268959]; + CLLocation* referenceLocation2 = [[CLLocation alloc] initWithLatitude:28.550667 longitude:77.268959]; + CLLocation* referenceLocation3 = [[CLLocation alloc] initWithLatitude:28.550667 longitude:77.268959]; + CLLocation* referenceLocation4 = [[CLLocation alloc] initWithLatitude:28.550667 longitude:77.268959]; + +NSMutableArray*arr = [[NSMutableArray alloc]initWithObjects:referenceLocation1,referenceLocation2,referenceLocation3,referenceLocation4, nil]; + +IntouchGeometryPolygon* geometryPolygon = [[IntouchGeometryPolygon alloc]initWithPoints:arr]; + +IntouchPolygonGeofence* geofencePolygon = [[IntouchPolygonGeofence alloc]initWithName:@"Test" geometry:geometryPolygon]; + +IntouchGeofenceOptions*polygonGeofence = [[IntouchGeofenceOptions alloc]initWithGeofence:geofencePolygon]; + +[Intouch.shared createGeoFenceWithGeofence:_polygonGeofence completionHandler:^(NSInteger status, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` +### Swift +```swift + let coordinates = [ + CLLocation(latitude: 28.550704, longitude: 77.268961), + CLLocation(latitude: 28.549415, longitude: 77.271757), + CLLocation(latitude: 28.54711, longitude: 77.263637), + CLLocation(latitude: 28.550704, longitude: 77.268961) + ] + +let geometry1 = IntouchGeometryPolygon(points: coordinates) + +let geofence1 = IntouchPolygonGeofence(name: "test5", geometry: geometry1) + +let geofenceoption1 = IntouchGeofenceOptions(geofence: geofence1) + +Intouch.shared.createGeoFence(geofence: geofenceoption1) { (status, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = status { + // write your code here. + } +} +``` + +### Request Parameters +1.```geoFenceName(String)```- Name of the geofence. + +2.```IntouchGeometryPolygon(Points)```- Geofence point(s). List of "GeoFencePoint" for polygon else single object required. + +3.```3 IntouchPointGeofence(Points)```- Geofence point(s). single object required. + +### Response Code +#### Success: +1. 201: To denote a successful record is being created. + +#### Client-side issues: + +1. 400: Bad Request, User made an error while creating a valid request. +2. 401: Unauthorized, the Developer’s key is not allowed to send a request with restricted parameters. +3. 403: Forbidden, the Developer’s key has hit its daily/hourly limit. + +#### Server-Side Issues: + +1. 500: Internal Server Error, the request caused an error in our systems. +2. 503: Service Unavailable, during our maintenance break or server downtimes. + +### Response Messages (as HTTP response message) +1. 200: Success +2. 203: Device Not Found +3. 400: Bad Request - Invalid device ID supplied or invalid data type. For example, the input attribute "id" is an integer but string value gets passed. +4. 401: Unauthorized Request. Access to API is forbidden. +5. 404: Not Found - URL Not Found + +### Response Parameter +`CreateGeoFenceResponse` class object returns the API response as a JSON object. + + #### CreateGeoFenceResponse result parameters: + ```id (Int)```- Id of the newly created geofence. + +#### Get Geofence(s) + +InTouch Get Geofences methods can be used to request the list of geofence areas using the unique geofence IDs which is being assigned by InTouch. + +#### Get All Geofence(s) with geometry +Get all the geofences created under your account using the below method. It returns the name and unique Id of the geofence. +Get the geofence response with shape by setting ignore geometry value as false. for example, the type will be either a point, polygon, or circle. +### objective-c +```objc +// ignoreGeometry is a boolean value. If the user doesn't need geometry with geofence pass true else false. +// IntouchGetGeofencesResponse- returns all geoFences with geometry in response if success else errors as callback methods. +[Intouch.shared getAllGeoFencesWithIgnoreGeometry:NO completionHandler:^(IntouchGetGeofencesResponse * _Nullable response, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +Intouch.shared.getAllGeoFences(ignoreGeometry: false) { (response, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + +#### Get single Geofence + +Input Geofence Id to get a single geofence detail in the get method. + +### objective-c +```objc +// Get single geofence +// IntouchGetGeofencesResponse- returns single geoFence in response if success else error as callback methods. +[Intouch.shared getAllGeoFencesWithGeofenceID:0 ignoreGeometry:NO completionHandler:^(IntouchGetGeofencesResponse * _Nullable response, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +Intouch.shared.getAllGeoFences(geofenceID: 0, ignoreGeometry: false) { (response, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + +#### Get multiple Geofence with geometry Value. + +Get multiple geofences for an array of geofence Ids with ignoreGeometry parameter value set as false. + +### Objective-c +```objc +// Get multiple geofences with geometry value +// IntouchGetGeofencesResponse- returns multiple geoFences in response if success else error as callback methods. +NSMutableArray*geofenceIds = [[NSMutableArray alloc]initWithObjects:@12,@12,@23, nil]; + +[Intouch.shared getAllGeoFencesWithGeofenceIds:_geofenceIds ignoreGeometry:NO completionHandler:^(IntouchGetGeofencesResponse * _Nullable response, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +Intouch.shared.getAllGeoFences(geofenceIds: [], ignoreGeometry: false) { (response, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + +### Request Parameters +1.```id(Int)```- Geofence id. Use this if you want to get details of specific multiple geofence IDs. + +2.```ignoreGeometry(boolean)``` - Non-mandatory field, boolean value to fetch geometry details. + +### Response Code + +#### Success: +1. 200: To denote a successful API call. + +#### Client-side issues: + +1. 400: Bad Request, User made an error while creating a valid request. +2. 401: Unauthorized, the Developer’s key is not allowed to send a request with restricted parameters. +3. 403: Forbidden, the Developer’s key has hit its daily/hourly limit. + +#### Server-Side Issues: + +1. 500: Internal Server Error, the request caused an error in our systems. +2. 503: Service Unavailable, during our maintenance break or server downtimes. + +### Response Messages (as HTTP response message) +1. 200: Success +2. 203: Device Not Found +3. 400: Bad Request - Invalid device ID supplied or invalid data type. For example, the input attribute "id" is an integer but string value gets passed. +4. 401: Unauthorized Request. Access to API is forbidden. +5. 404: Not Found - URL Not Found + +### Response Parameter +`CreateGeoFenceResponse`- Class object returns the API response as a JSON object. + +#### InTouchGeoFenceResponse result parameters: + ```- List```- List of GeoFenceResult. + +##### GeoFenceResult Parameters: + 1. ```id(Int)```- Geofence ID + 2. ```name(String)```- Name of the geofence + 3. ```geometry(Geometry)```- Geofence Geometry object. + 4. ```type(String)```- Depending on the type of geofence this value can be Circle(buffer > 50 meters), Polygon or Point(buffer = 50 mtrs) + 5. ```buffer(Double)```- Radius(in meters) of a circular geofence + 6. ```creationTime(long)```- Epoch Timestamp at which the geofence was created. + 7. ```updationTime(Long)```- Epoch Timestamp at which the geofence was updated. + + ##### Geometry Parameters: + 1. ```type(String)```-This defines the type of geofence, it can be point or polygon. + 2. ```coordinates(Object)```- Geofence geometry coordinates. + 3. ```latLng(GeoFencePoint)```- GeoFencePoint object. Use this in case of geofence type "Point or Circle". + 4. ```points(List>)```- List of GeoFencePoint list. Use this in case of geofence type "Polygon". + +#### Update Geofence(s) + +Use Geofence ID to update Geofence name, latitude, longitude, and radius in below method + +#### Update point Geofence + +Update geofence values like geofence name and lat, long using below method + +### objective-c +```objc +// update single geofence +// status - returns success if gefence updated successfully, else error as callback methods. + +CLLocation *referenceLocation = [[CLLocation alloc] initWithLatitude:28.550667 longitude:77.268959]; + +IntouchGeometryPoint *point = [[IntouchGeometryPoint alloc]initWithPoint:referenceLocation]; + +IntouchPointGeofence *point1 = [[IntouchPointGeofence alloc]initWithName:@"test" geometry:point]; + +IntouchGeofenceOptions *geofenceOptions = [[IntouchGeofenceOptions alloc]initWithGeofence:point1]; + +[Intouch.shared updateGeoFencesWithGeofenceaID:597386 geofence:_geofenceOptions completionHandler:^(NSInteger status, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +let geometry = IntouchGeometryPoint(point: CLLocation(latitude: 23.343, longitude: 77.232)) + +let geofence2 = IntouchPointGeofence(name: "Test", geometry: geometry) + +let geofenceoption = IntouchGeofenceOptions(geofence: geofence2) + +Intouch.shared.updateGeoFences(geofenceaID: 597386, geofence: geofenceoption) { (status, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + +#### Update circle Geofence + +Update geofence name, latitude, longitude, and Radius for a circle geofence using the below method. + +### objective-c +```objc +// update single geofence with buffer value. Buffer is like a radius in meters. +NSNumber *myDoubleNumber = [NSNumber numberWithDouble:500]; + +IntouchPointGeofence*withBuffer = [[IntouchPointGeofence alloc]initWithName:@"Test" buffer:myDoubleNumber geometry:point]; + +IntouchGeofenceOptions*geofenceOptionsWithRadius = [[IntouchGeofenceOptions alloc]initWithGeofence:withBuffer]; + +[Intouch.shared updateGeoFencesWithGeofenceaID:597386 geofence:_geofenceOptionsWithRadius completionHandler:^(NSInteger status, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +let geometry = IntouchGeometryPoint(point: CLLocation(latitude: 23.343, longitude: 77.232)) + +let geofence2 = IntouchPointGeofence(name: "Test", buffer: 500, geometry: geometry) + +let geofenceoption = IntouchGeofenceOptions(geofence: geofence2) + +Intouch.shared.updateGeoFences(geofenceaID: 597386, geofence: geofenceoption) { (status, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + +#### Update Polygon Geofence + +Update the geofence name, and the latitude, longitude of the polygon geofence using the below method. + +### objective-c +```objc +// Update polygon geofence. +CLLocation* referenceLocation1 = [[CLLocation alloc] initWithLatitude:28.550667 longitude:77.268959]; + +CLLocation* referenceLocation2 = [[CLLocation alloc] initWithLatitude:28.550667 longitude:77.268959]; + +CLLocation* referenceLocation3 = [[CLLocation alloc] initWithLatitude:28.550667 longitude:77.268959]; + +CLLocation* referenceLocation4 = [[CLLocation alloc] initWithLatitude:28.550667 longitude:77.268959]; + +NSMutableArray*arr = [[NSMutableArray alloc]initWithObjects:referenceLocation1,referenceLocation2,referenceLocation3,referenceLocation4, nil]; + +IntouchGeometryPolygon* geometryPolygon = [[IntouchGeometryPolygon alloc]initWithPoints:arr]; + +IntouchPolygonGeofence* geofencePolygon = [[IntouchPolygonGeofence alloc]initWithName:@"Test" geometry:geometryPolygon]; + +IntouchGeofenceOptions*polygonGeofence = [[IntouchGeofenceOptions alloc]initWithGeofence:geofencePolygon]; + +[Intouch.shared updateGeoFencesWithGeofenceaID:597386 geofence:_polygonGeofence completionHandler:^(NSInteger status, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +let coordinates = [ + CLLocation(latitude: 28.550704, longitude: 77.268961), + CLLocation(latitude: 28.549415, longitude: 77.271757), + CLLocation(latitude: 28.54711, longitude: 77.263637), + CLLocation(latitude: 28.550704, longitude: 77.268961) + ] + +let geometry = IntouchGeometryPolygon(points: coordinates) + +let geofence2 = IntouchPolygonGeofence(name: "Test1", geometry: geometry) + +let geofenceoption = IntouchGeofenceOptions(geofence: geofence2) + +Intouch.shared.updateGeoFences(geofenceaID: 577059, geofence: geofenceoption) { (status, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = status { + // write your code here. + } +} +``` + +### Request Parameters +1. ```geoFenceId(Int)```- Id of the existing geofence. +2. ```geoFenceName(String)```- Name of the geofence. If you need to update the existing one then use this else pass null. +3. ```geoFencePoint(GeoFencePoint)``` -List of "GeoFencePoint" for polygon geofence else single object required. +3. ```IntouchGeometryPolygon()``` -List of "GeoFencePoint" for polygon geofence. +### Response Code +#### Success: +1. 200: To denote a successful API call. + +#### Client-side issues: + +1. 400: Bad Request, User made an error while creating a valid request. +2. 401: Unauthorized, the Developer’s key is not allowed to send a request with restricted parameters. +3. 403: Forbidden, the Developer’s key has hit its daily/hourly limit. + +#### Server-Side Issues: + +1. 500: Internal Server Error, the request caused an error in our systems. +2. 503: Service Unavailable, during our maintenance break or server downtimes. + +### Response Messages (as HTTP response message) +1. 200: Success +2. 203: Device Not Found +3. 400: Bad Request - Invalid device ID supplied or invalid data type. For example, the input attribute "id" is an integer but string value gets passed. +4. 401: Unauthorized Request. Access to API is forbidden. +5. 404: Not Found - URL Not Found + +### Response Parameter +`UpdateGeoFenceResponse`- Class object returns the API response as a JSON object. + + #### UpdateGeoFenceResponse parameters: + ```message```- Describes the type of error based on the type of response code. + + +#### Delete Geofence + +Delete Geofences by mentioning the geofence IDs in the following methods + +#### Delete single Geofence + +Use the below method to delete a particular geofence by mentioning the geofence ID. +### Objective-c +```objc +// Delete single geofence +// status- returns success if gefence deleted successfully, else error as callback methods. +[Intouch.shared deleteGeofenceWithGeofenceaID:23 completionHandler:^(NSInteger status, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +Intouch.shared.deleteGeofence(geofenceaID: 23) { (status, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = status { + // write your code here. + } +} +``` + +#### Delete multiple Geofence + +Use the below method to delete a list of geofence Ids at once. + +### Objective-c +```objc +// Delete multiple geofences +NSMutableArray*geofenceIds = [[NSMutableArray alloc]initWithObjects:@12,@12,@23, nil]; + +[Intouch.shared deleteGeofenceWithGeofenceIds:_geofenceIds completionHandler:^(NSInteger status, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +Intouch.shared.deleteGeofence(geofenceIds: []) { (status, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = status { + // write your code here. + } +} +``` + + ### Request Parameters +1. ```geoFenceId(Int)```- Id or array of Ids of existing geofence(s). + +### Response Code +#### Success: +1. 200: To denote a successful API call. + +#### Client-side issues: + +1. 400: Bad Request, User made an error while creating a valid request. +2. 401: Unauthorized, the Developer’s key is not allowed to send a request with restricted parameters. +3. 403: Forbidden, the Developer’s key has hit its daily/hourly limit. + +#### Server-Side Issues: + +1. 500: Internal Server Error, the request caused an error in our systems. +2. 503: Service Unavailable, during our maintenance break or server downtimes. + +### Response Messages (as HTTP response message) +1. 200: Success +2. 203: Device Not Found +3. 400: Bad Request - Invalid device ID supplied or invalid data type. For example, the input attribute "id" is an integer but string value gets passed. +4. 401: Unauthorized Request. Access to API is forbidden. +5. 404: Not Found - URL Not Found + +#### 4.5 Get Geofence Activity +The below method helps to fetch the details of all the geofence activities, such as geofence entry time, exit time, etc, and total time spent inside the geofence, which devices perform w.r.t various geofences across a defined date/time range. + +#### 4.5.1 Get Geofence Activity for selected devices +### objective-c +```objc +// IntouchGeofenceActivityResponse-returns activity list , else error as callback methods. +[Intouch.shared getGeoFenceActivityWithDevicesIds:_geofenceIds startTime:123.3 endTime:1232.3 completionHandler:^(IntouchGeofenceActivityResponse * _Nullable response, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +Intouch.shared.getGeoFenceActivity(devicesIds: [], startTime: 0, endTime: 0) { (response, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = status { + // write your code here. + } +} +``` + +#### Get Geofence Activity for selected devices and geofence(s) + +### objective-c +```objc +//IntouchGeofenceActivityResponse- return selected activity data otherwise returns error. +NSMutableArray*geofenceIds = [[NSMutableArray alloc]initWithObjects:@12,@12,@23, nil]; + +NSArray*deviceId = @[@1, @2, @3, @4, @5, @6]; + +[Intouch.shared getGeoFenceActivityWithGeofenceIds:_geofenceIds devicesIds:deviceIds startTime:12.33 endTime:12.22 completionHandler:^(IntouchGeofenceActivityResponse * _Nullable response, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +Intouch.shared.getGeoFenceActivity(geofenceIds: [], devicesIds: [], startTime: 0, endTime: 0) { (resonse, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = resonse { + // write your code here. + } +} +``` + +### Request Parameters +1. ```deviceId(Int[])``` - Int array of the device(s) Id(s) for which you want to fetch the geofence activities. +2. ``` geofenceId(Int[])``` - Int array of the geofence(s) Id(s) for which you want to fetch the geofence activities done by the device. +3. ```startTime(long)``` - Value in timestamp. Start time from where you want to fetch the geofence activities +4. ```endTime(long)```- Value in timestamp. End time till where you want to fetch the geofence activities + +### Response Code +#### Success: +1. 200: To denote a successful API call. + +#### Client-side issues: + +1. 400: Bad Request, User made an error while creating a valid request. +2. 401: Unauthorized, the Developer’s key is not allowed to send a request with restricted parameters. +3. 403: Forbidden, the Developer’s key has hit its daily/hourly limit. + +#### Server-Side Issues: + +1. 500: Internal Server Error, the request caused an error in our systems. +2. 503: Service Unavailable, during our maintenance break or server downtimes. +### Response Parameter +`GeoFenceActivityResponse`- Class object returns the API response as a JSON object. + +#### InTouchGeoFenceResponse result parameters: + ```- List```- List of GeoFenceActivity. + +##### GeoFenceResult Parameters: +1. ```entryLongitude(Double)```- Longitude where the particular device entered the geofence. +2. ```entryLatitude(Double)```- Latitude where the particular device entered the geofence. +3. ```exitLongitude(Double)```- Longitude where the particular device exited the geofence. +4. ```exitLatitude(Double)```- Latitude where the particular device exited the geofence. +5. ```entryTimestamp(Integer)```- Time at which the device entered the particular geofence. +6. ```exitTimestamp(Integer)```- Time at which the device exited the particular geofence. +7. ```geofenceName(String)```- Name of the geofence. +8. ```geofenceId(Integer)``` - Id of the geofence where the activity took place. +9. ```deviceId(Integer)``` - Id of the device which is performing the activities w.r.t the geofence. + +## 5) Alarms +Users can get an alert whenever a particular event occurs by configuring alarm to your vehicle or user. For example, an alert can be sent to the user whenever user or vehicle Enters/Exits the particular area or if the vehicle or user is Over Speeding or vehicle battery is low, etc. etc. These alerts are highly configurable based on different requirements. + +#### 5.1) Configure Alarms + +Some of the important and more frequently used alarms for different use cases are listed below. + - Geofence + - Ignition + - OverSpeed + - UnPlugged + - Panic + - Stoppage + - Idle + - Towing + - GPRS Connectivity + - Vehicle Battery + - Mileage + - GPS connectivity + - Distance Covered + - Internal Battery Voltage + +#### 5.1.1) Geofence Alarm + +Configure geofence alarm by assigning the vehicle to a particular Geofence to get an alert when the user or vehicle enters/ exits the particular area. Geofence should be created before assigning the vehicle to geofence in alarms configuration. Refer to Create Geofence documentation to create Geofence. Get the Geofence method will fetch Geofence Ids. + + +##### Mandatory parameters: +- Alarm Type, id(s) of device(s), Id(s) of geofence(s)and Type of geofence + +##### 5.1.2) Ignition Alarm + +Configure Ignition alarm to trigger an alert when the vehicle ignition is switched On or Off. Assign vehicles against this alarm. + +##### Mandatory Parameters +- Alarm Type, Id(s) of the device(s) and type of Ignition + + +##### 5.1.3) Overspeed Alarm + +Configure the Overspeed alarm to trigger an alert when the user or vehicle crosses the configured speed limit. + +##### Mandatory parameters: +- Alarm Type, Id(s) of the device(s), Limit and Duration + +##### 5.1.4) Unplugged Alarm + +Configure an unplugged alarm to trigger an alert when a vehicle tracking device is removed from the vehicle battery + +##### Mandatory parameters: +- Alarm Type and Id(s) of the device(s) + +##### 5.1.5) Panic Alarm + +Configure Panic alert using the below method. Assign this alert to the device to trigger an alert whenever the user presses the panic button. + +##### Mandatory parameters: +- Alarm Type and Id(s) of the device(s) + +##### 5.1.6) Stoppage Alarm + +Configure Stoppage alarm to alert you when the user or vehicle continuously stays in the stopped condition for more than the defined duration. + +##### Mandatory parameters: +- Alarm Type, Id(s) of device(s) and Duration + +##### 5.1.7) Idle Alarm + +Configure Idle alarm to alert you when the vehicle continuously stays in the Idle condition (Engine is on but the speed is less than 7 km/hr) for more than the defined duration. + + +##### Mandatory parameters: +- Alarm Type, Id(s) of device(s) and Duration + +##### 5.1.8) Towing Alarm + +Configure Towing alarm to alert you when the vehicle moves at more than 7km/hr speed in Engine off state. + +##### Mandatory parameters: +- Alarm Type, Id(s) of device(s) and Duration + +##### 5.1.9) GPRS Connectivity Alarm + +Configure GPRS connectivity alarm to alert you when the user or vehicle doesn't send the data to the server for more than the defined duration as per configuration. + +##### Mandatory parameters: +- Alarm Type, Id(s) of device(s) and Duration + +##### 5.1.10) Vehicle Battery Alarm + +Configure Vehicle battery alarm to alert you when the vehicle battery goes below the configured voltage value. + +##### Mandatory parameters: +- Alarm Type, Id(s) of the device(s), Limit and Duration + +##### 5.1.11) Mileage Alarm + +Configure Mileage alarm to alert you when the vehicle or user travels the configured distance within the time duration. The distance can be configured for Daily and Monthly limit. + +##### Mandatory parameters: +- Alarm Type, Id(s) of device(s) , Type and Duration + +##### 5.1.12) GPS Connectivity Alarm + +Configure GPS connectivity alarm to trigger an alert when the user or vehicle doesn't send the valid location to the server for more than the defined duration as per configuration. + +##### Mandatory parameters: +- Alarm Type, Id(s) of device(s) and Duration + +##### 5.1.13) Distance Covered Alarm + +Configure Distance covered alarm to trigger an alert when the vehicle or user covers the particular distance in the given duration or if the user travels less than the limit in the given duration then the alert will be triggered. + +There are two types of distance covered alarm. +- At least +- At Most. + +For example **At least** will be used whenever a user doesn't travel 30 km within 1 hr. + +**At most** can be used when the user travels more than 30 km in 1hr. + + +##### Mandatory parameters: +- Alarm Type, Id(s) of the device(s), Type, Limit and Duration + +##### 5.1.14) Internal Battery Voltage Alarm + +Configure Internal battery alarm to alert you when the Vehicle Tracking device Internal battery goes below the configured voltage value for a certain duration. + +##### Mandatory parameters: +- Alarm Type, Id(s) of the device(s), Limit and Duration + + +#### Create Alarm Method + +Define the hashmap as mentioned above based on the required alarm then call the below method. +### Objective-c +```objc +// IntouchAlarmCreatedResponse - returns success if alarm created successfully, else error as callback methods. +IntouchAlarmOptions*optionAlarm = [[IntouchAlarmOptions alloc]initWithAlarmType:1 deviceIds:1 type:1 duration:1 limit:1 geofenceIds:1 severity:1]; + +[Intouch.shared getAlarmCreatedWithAlarmParam:optionAlarm completionHandler:^(IntouchAlarmCreatedResponse * _Nullable response, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` +### Swift +```swift +// IntouchAlarmOptions class accepts below param +let options = IntouchAlarmOptions(alarmType: 13, deviceIds: [8440,8501], type: 1, duration: 11, limit: 55, geofenceIds: [23434], severity: 0) + +Intouch.shared.getAlarmCreated(alarmParam: options) { (response, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + +### Request Parameters based on different Alarms. +1. ```deviceId``` - Device id(s). You can pass a single device Id or multiple device Ids in the array. +2. ```type``` - Type is based on different alarms. Only required in case of the Geofence, Ignition, Mileage, and Distance Covered alarm. For this directly you can enter the respective integer values as mentioned below or else you can use the InTouch Constants. e.g: for AlarmType - Geofence(value-26), one of the type value is InTouchConstants.ALARM_GEOFENCE_ENTRY (value -2). [Click](https://github.com/MapmyIndia/mapmyindia-intouch-android-sdk/wiki/InTouch-Constants) to see more values. +3. ```duration``` - Time duration in seconds. Only required in case of Overspeed, stoppage, idle, towing, GPRS connectivity, vehicle battery, GPS connectivity, distance covered, internal battery alarm. +4. ```limit``` - Limits for various alarms based on alarm type. It is an integer. eg: 55. Unit changes for different alarm types. + - Overspeed Alarm - km/hr + - vehicle battery - millivolts + - mileage - in km/hr + - distance covered - meters + - internal battery alarm - millivolts +5. ``` geofenceId```- Geofence Id(s). Only required in case of alarm Type Geofence. You can pass a single geofence ID or multiple geofence IDs in array. +6. ```alarmType```- For each type of alarm constant value is being assigned. +Type of alarm to create. Following are the alarm types & their corresponding IDs. Ignition: 21, Overspeed: 22, Unplugged: 23, Panic: 24, Geofence: 26, Stoppage: 27, Idle: 28, Towing: 29, GPRS Connectivity: 126, Vehicle Battery: 129, Mileage: 133, GPS Connectivity: 146, Distance Covered: 151, Internal Battery Voltage:161 + + +#### Note:- User can use these request parameters as key in HashMap according to different alarms type and mandatory fields required for that alarm type. + + Users may use [InTouchConstants](https://github.com/MapmyIndia/mapmyindia-intouch-android-sdk/wiki/InTouch-Constants)class of InTouch Sdk for different alarm type values like for geofence alarm type is 26, user can use InTouchConstants.ALARM_GEOFENCE instead of 26. + +### Response Code + +#### Success +1. 201 To denote a successful record is being created. + +#### Client-side issues + +1. 400 Bad Request, the user made an error while creating a valid request. +2. 401 Unauthorized, Developer’s key is not allowed to send a request with restricted parameters. +3. 403 Forbidden, the Developer’s key has hit its daily hourly limit. + +#### Server-Side Issues + +1. 500 Internal Server Error, the request caused an error in our systems. +2. 503 Service Unavailable, during our maintenance break or server downtimes. + +### Response Messages (as HTTP response message) +1. 200 Success +2. 203 Device Not Found +3. 400 Bad Request - Invalid device ID supplied or invalid data type. For example, input attribute id is an integer but string value gets passed. +4. 401 Unauthorized Request. Access to API is forbidden. +5. 404 Not Found - URL Not Found + +### Response Parameter +`CreateAlarmResponse` - class object returns the API response as a JSON object. + #### Create Alarm Response result parameters + ```id (Long)``` Id of the newly created Alarm. + +### 5.2 Get Alarm configurations + +Use the below methods to retrieve the configured alarms in your account with a unique alarm ID. + +#### 5.2.1 Get All Alarm configurations + +Call the GetAlarmConfigs method without any input parameter to display all the configured alarms from the account in response. +### Objective-c +```objc + +\\\ Get all Alarm config +// Response - returns all alarms configurations if success, else error as callback methods. +[Intouch.shared getAlarmConfigWithCompletionHandler:^(IntouchAlarmConfigResponse * _Nullable response, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +Intouch.shared.getAlarmConfig { (response, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + +#### 5.2.2 Get alarm configurations based on the selected parameter + +In the getAlarmConfigs(), Input parameters like devices or Alarm type or Alarm Ids can be passed to filter the particular set alarm configurations. +### Objective-c +```objc +// Alarms configurations based on different selected parameters. Users can pass null if none of the given parameters is required. + +_NSArray*alarmId = @[@1, @2, @3, @4, @5, @6]; +_NSArray*deviceId = @[@1, @2, @3, @4, @5, @6]; +_NSArray*alarmTypeID = @[@1, @2, @3, @4, @5, @6]; + +[Intouch.shared getAlarmConfigWithAlarmIds:_alarmId deviceIds:_deviceId alarmTypes:_alarmTypeID completionHandler:^(IntouchAlarmConfigResponse * _Nullable response, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +Intouch.shared.getAlarmConfig(alarmIds: [], deviceIds: [], alarmTypes: []) { (response, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + ### Request Parameters +1.```alarmIds (Int[])``` - Array of alarm ids. Users can pass alarm ids array to get alarm configurations for provided ids otherwise pass null for all configurations. + +2.```deviceIds (Int[])``` - Array of device ids. Users can pass device ids array for selected devices alarm configurations otherwise pass null for all configurations. + +3.```alarmTypes (Integer[])```- Array of alarm types. Users can pass alarm types array for selected alarm type alarms configurations otherwise pass null for all configurations. + +### Response Code +#### Success +1. 200 To denote a successful API call. +#### Client-side issues + +1. 400 Bad Request, the user made an error while creating a valid request. +2. 401 Unauthorized, Developer’s key is not allowed to send a request with restricted parameters. +3. 403 Forbidden, the Developer’s key has hit its daily hourly limit. + +#### Server-Side Issues + +1. 500 Internal Server Error, the request caused an error in our systems. +2. 503 Service Unavailable, during our maintenance break or server downtimes. + +### Response Messages (as HTTP response message) +1. 200 Success +2. 203 Device Not Found +3. 400 Bad Request - Invalid device ID supplied or invalid data type. For example, input attribute id is an integer but string value gets passed. +4. 401 Unauthorized Request. Access to API is forbidden. +5. 404 Not Found - URL Not Found +### Response Parameter +`InTouchAlarmResponse ` class object returns the API response as a JSON object. + + #### InTouchGeoFenceResponse result parameters + ```- ListAlarmsConfig```- List of AlarmsConfig. + ##### AlarmsConfig Parameters + 1. ```id(Long)```- Id of alarm + 2. ```deviceId(Long)```- Device Id(s) on which the alarm config got created. + 3. ```alarmType(Integer)``` -Type of alarm for eg - 21 (InTouchConstants.ALARM_IGNITION) etc. + 4. ```limit(Integer)```- Min or Max limit for particular alarm. + 5. ```duration (integer)``` - Min or Max duration in second(s) for particular alarm. + 6. ```type(Integer)```- Values depends on the type of alarm configured for eg for Mileage alarm it should be 0 (InTouchConstants.ALARM_MILEAGE_DAILY) or 1 (InTouchConstants.ALARM_MILEAGE_MONTHLY). + 7. ```updationTime(Long)```- Epoch Time at which the alarm got updated. + 8. ```creationTime(Long)```- Epoch Time at which the alarm got configured. + 9. ```geofenceId(Long[])```- If returned alarm type is geofence (26), then this will return the list of geofences for which alarms were configured. + + 10.```severity(Integer)```- Severity of alarm i.e) 0 (ALARM_SEVERITY_NORMAL) or 1 (ALARM_SEVERITY_HIGH) . + + +### 5. 3 Update Alarms(s) + +Already created alarms can be updated using the below-mentioned methods. It is similar to create alarm but additionally, alarm ID should be the input parameter to update the respective individual alarm configurations. + +Alarm Id can be fetched from the Get Alarm config. + +Based on the Alarm type, the Mandatory parameter should be passed in the Class. +### Objective-c +```objc + IntouchAlarmOptions*optionUpdateAlarm = [[IntouchAlarmOptions alloc]initWithAlarmType:1 deviceIds:1 type:1 duration:1 limit:1 geofenceIds:1 severity:1]; + +[Intouch.shared updateAlarmWithAlarmId:12 param:optionUpdateAlarm completionHandler:^(NSInteger status, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +let options = IntouchAlarmOptions(alarmType: 1, deviceIds: [], type: 1, duration: 11, limit: 55, geofenceIds: [], severity: 0) + +Intouch.shared.updateAlarm(alarmId: 0, param: options) { (status, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + + ### Request Parameters +1. ```alarmId(Long)``` - Id of the existing alarm. +2. ```deviceId (Long[])``` - Array of device id(s). You can pass a single device iD or multiple device iDs in an array. +3. ```type (Integer)``` - Type is based on different alarms i.e) Only required in case of the geofence, ignition, mileage, and Distance Covered alarm. +4. ```duration (Integer)``` - Time duration in seconds. Only required in case of Overspeed, stoppage, idle, towing, GPRS connectivity, vehicle battery, GPS connectivity, distance covered, internal battery alarm. +5. ```limit (Integer)``` - Limits for various alarms based on alarm type. +6. ``` geofenceId (Long [])``` - Array of geofence id(s). Only required in case of alarm Type Geofence. You can pass a single geofence ID or multiple geofence IDs in an array. +7. ```alarmType (Integer)``` - For each type of alarm constant value is being assigned. Selected alarm id's alarm type should be passed. It can be passed from the IntouchConstants or as an integer value. The following are the alarm types & their corresponding IDs. Ignition: 21, Overspeed: 22, Unplugged: 23, Panic: 24, Geofence: 26, Stoppage: 27, Idle: 28, Towing: 29, GPRS Connectivity: 126, Vehicle Battery: 129, Mileage: 133, GPS Connectivity: 146, Distance Covered: 151, Internal Battery Voltage:161 + +### Response Code +#### Success +1. 200 To denote a successful API call. +#### Client-side issues + +1. 400 Bad Request, the user made an error while creating a valid request. +2. 401 Unauthorized, Developer’s key is not allowed to send a request with restricted parameters. +3. 403 Forbidden, the Developer’s key has hit its daily hourly limit. + +#### Server-Side Issues + +1. 500 Internal Server Error, the request caused an error in our systems. +2. 503 Service Unavailable, during our maintenance break or server downtimes. + +### Response Messages (as HTTP response message) +1. 200 Success +2. 203 Device Not Found +3. 400 Bad Request - Invalid device ID supplied or invalid data type. For example, input attribute id is an integer but string value gets passed. +4. 401 Unauthorized Request. Access to API is forbidden. +5. 404 Not Found - URL Not Found + +### Response Parameter +API response will return as ```Status``` onSuccess() or onError(String reason, String errorIdentifier, String errorDescription) methods. + +#### 5. 4 Delete Alarm configuration. + +`deleteAlarm` method can be used to delete the already configured alarm. In this method, an alarm ID needs to be passed to delete the configurations. + +#### 5. 4. 1 Delete single Alarm configuration +### objective-C +```objc +// Delete single alarm +[Intouch.shared DeleteAlarmWithAlarmId:0 completionHandler:^(NSInteger status, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +Intouch.shared.DeleteAlarm(alarmId: 0) { (statusCode, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + +#### 5. 4. 2 Delete Multiple Alarm configuration + +### objective-c +```Objc + //Delete multiple alarm +NSArray*alarmId = @[@1, @2, @3, @4, @5, @6]; +[Intouch.shared DeleteAlarmsWithAlarmIds:alarmId completionHandler:^(NSInteger status, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` +### Swift +```swift +Intouch.shared.DeleteAlarms(alarmIds: []) { (statusCode, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + + ### Request Parameters +1. ```alarmId(Long)``` - Id or Long[] ids of the alarm config(s) which user wants to delete. + +### Response Code +#### Success +1. 200 To denote a successful API call. + +#### Client-side issues + +1. 400 Bad Request, the user made an error while creating a valid request. +2. 401 Unauthorized, Developer’s key is not allowed to send a request with restricted parameters. +3. 403 Forbidden, the Developer’s key has hit its daily hourly limit. + +#### Server-Side Issues +1. 500 Internal Server Error, the request caused an error in our systems. +2. 503 Service Unavailable, during our maintenance break or server downtimes. + +### Response Messages (as HTTP response message) +1. 200 Success +2. 203 Device Not Found +3. 400 Bad Request - Invalid device ID supplied or invalid data type. For example, input attribute id is an integer but string value gets passed. +4. 401 Unauthorized Request. Access to API is forbidden. +5. 404 Not Found - URL Not Found + +#### 5. 5 Alarm Logs + +Once the alert is triggered based on the configured alarms, the below method can be used to get the Alarm log details. +The alarm log gives the information about the device name, Alarm type location, and time at which alert is being triggered. + +#### 5. 5. 1 Get All alarm Logs. + +Get all types of alarm logs between the start and end times of the input using the below method. + ### objective-c +```objc +// Get Alarm Logs +// IGetAlarmsLogResponse - returns all alram logs if success, else error as callback methods. +[Intouch.shared getAlarmLogsWithStartTime:double endTime:double completionHandler:^(IntouchAlarmConfigLogResponse * _Nullable IGetAlarmsLogResponse, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` +### Swift +```swift +Intouch.shared.getAlarmLogs(startTime: 0, endTime: 0) { (response, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + +#### 5. 5. 2 Get alarm Logs with filter. + +Get the filtered alarm log information between the start and end time by sending the filter details like device id, Alarm type. +### objective-c +```objc +//with filter +[Intouch.shared getAlarmLogsWithDeviceId:_deviceId alarmId:_alarmId startTime:0 endTime:0 completionHandler:^(IntouchAlarmConfigLogResponse * _Nullable response, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +Intouch.shared.getAlarmLogs(deviceId: [], alarmId: [], startTime: 0, endTime: 0) { (IntouchAlarmConfigLogResponse, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + + ### Request Parameters +1. ```startTime(Long)```- Mandatory field. This is start EPOCH timestamp in seconds. +2. ```endTime(Long)```- Mandatory field. This is end EPOCH timestamp in seconds +3. ```deviceId(Long[])``` - Non mandatory field. This is the ID of the device for which the alarm logs need to be fetched. You can pass a single device ID or multiple device IDs separated by a comma. For eg new Long[]{1L} or null. +4. ```alarmType(Integer[])```- Non mandatory field. This is the type of alarm for which the alarm log needs to be fetched. You can pass a single alarm type or multiple alarm type separated by a comma. For eg new Integer[]{IntouchConstant.ALARM_IGNITION} or new Integer[]{21} or null. + +### Response Code +#### Success +1. 200 To denote a successful API call. + +#### Client-side issues +1. 400 Bad Request, the user made an error while creating a valid request. +2. 401 Unauthorized, Developer’s key is not allowed to send a request with restricted parameters. +3. 403 Forbidden, the Developer’s key has hit its daily hourly limit. + +#### Server-Side Issues +1. 500 Internal Server Error, the request caused an error in our systems. +2. 503 Service Unavailable, during our maintenance break or server downtimes. + +### Response Messages (as HTTP response message) +1. 200 Success +2. 203 Device Not Found +3. 400 Bad Request - Invalid device ID supplied or invalid data type. For example, input attribute id is an integer but string value gets passed. +4. 401 Unauthorized Request. Access to API is forbidden. +5. 404 Not Found - URL Not Found + +### Response Parameter +`InTouchAlarmResponse `- Class object returns the API response as a JSON object. + +#### InTouchAlarmLogsResponse result parameters +```- ListAlarmLogs``` - List of AlarmLogs. + +##### AlarmsConfig Parameters +1. ```deviceId(Long)``` - Id of the device for which the alarm got generated. +2. ```timestamp(Long)```- EPoch Time at which the alert got generated. +3. ```latitude(Double)``` - Location latitude +4. ```longitude(Double)```- Location longitude. +5. ```address(String)``` - Location address at which the alarm got generated. +6. ```alarmType(Integer)``` - Type of alarm to create alarm. The following are the alarm types & their corresponding IDs. +Ignition 21, Overspeed 22, Unplugged 23, Panic 24, Geofence 26, Stoppage 27, Idle 28, Towing 29, GPRS connectivity 126, Vehicle Battery 129, Mileage 133, GPS Connectivity 146, Distance Covered 151, Internal Battery Voltage 161, + +7. ```limit(Integer)```- Alarm limit as set in the config. For example, if an Overspeed alarm set on limit of 44 km/hr in the alarm config setting, then this attribute will return 44 km/hr. +8. ```duration(Integer)``` - Alarm duration limit as set in the alarm config section. For example, if duration of the Overspeed alarm is set as 20 secs, then the alarm will generate when the vehicle speeds for 20 secs. +9. ```actualLimit(Integer)``` -The actual data received from the device at that particular moment the alarm got generated. +10. ```actualDuration(Integer)``` - Actual duration for which the device breached the alarm +11. ```severity(Integer)``` - 0 - Low Severity. 1 - High Severity +12. ```data(Integer)```- Describes the state of the alarm. Ignition(type = 21), 0 Off & 1 On. +AC(type=25), 0 OFF, 1 ON. Geofence (type=26), 1 Entry & Exit Geofence 2 Entry Geofence, 3 Geofence & 4 Long Stay In Geofence. +14. ```geofenceId(Integer)```- This is the ID of the geofence for which the alarm got generated. will come only when the 'type' field returns 26 i.e) geofence. + +## 6) Trips + +Trips module helps you to create a Trip and assign it to the vehicle and the trip compliance. InTouch provides the three major functionalities of Trips modules. + +Trip Module Features - + +1. Start a trip with or without destination and via points or with scheduled end time, +2. Get the latest trip information. ( Total traveled distance during the trip, Travelled path vs planned route, ETA to the destination, etc.) +3. Trip completion. + - Trips can be completed/closed in three different ways. + - Based on the scheduled end time + - On reaching the destination. + - Manually close. + +When the trip is created with a destination, InTouch will provide the actual time of the destination and waypoints. + +#### 6.1) Create Trip + +InTouch provides four ways to create a new trip. Depending on the use case, You can use the below methods to start a new trip. Based on the selected trip creation method, either trip gets closed/completed automatically or by calling the manual method. + +- Trips without a destination +- Trips with scheduled end time but without a destination +- Trips with destination and scheduled end time. +- Trips with destination but without a scheduled end time. + +#### 1. 1. 1 Create Trip without a destination +This method can be used to share a live location with someone else. In this case, the trip shall be closed by calling the close trip method (6.4). + +Also, if the force close is enabled then on the new trip assignment, the active old trip will be force closed. +### Objective-c +```Objective-c +//IntouchCreateTripResponse - Returned trip ID else return error +NSDictionary*metaData = [[NSDictionary alloc] initWithObjectsAndKeys:@"test",@"alpha",nil]; + +IntouchCreateTripOptions*createTripOptions = [[IntouchCreateTripOptions alloc]initWithDeviceId:232 name:@"" forceClose:NO metaData:_metaData]; + +[Intouch.shared createTripDataWithOptons:_createTripOptions completionHandler:^(IntouchCreateTripResponse * _Nullable response, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +let metaData: [String: String] = [ + "alpha": "test", + ] + +let options = IntouchCreateTripOptions(name:"",deviceId: 67790, forceClose: true, metaData: metaData) + +Intouch.shared.createTripData(optons: options) { (status, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + +#### 6.1.2) Create Trip with Destination and Geofences. + +This method helps to create trips with a destination and waypoints. Here trip will get close only if the vehicle reaches the destination. otherwise, the manual close trip option can be used to close the trip. + +Also if the force close is enabled then on the new trip assignment, the active old trip will be force closed. + +### Objective-c +```obj + +NSDictionary*metaData = [[NSDictionary alloc] initWithObjectsAndKeys:@"test",@"alpha",nil]; + +IntouchGeometryPoint*tripGeoemetry = [[IntouchGeometryPoint alloc]initWithPoint:referenceLocation]; + +IntouchTripDestination*tripDestination =[[IntouchTripDestination alloc]initWithGeoemtry:tripGeoemetry radius:500 scheduledAt:0 metadata:_metaData]; + +IntouchTripsGeofences*tripGeofence =[[IntouchTripsGeofences alloc]initWithGeoemtry:tripGeoemetry radius:500 scheduledAt:0 metadata:_metaData]; + +IntouchTripsGeofences*tripGeofence1 =[[IntouchTripsGeofences alloc]initWithGeoemtry:tripGeoemetry radius:500 scheduledAt:0 metadata:_metaData]; + +NSArray*arrGeofence = [[NSArray alloc]initWithObjects:tripGeofence,tripGeofence1, nil]; + +IntouchCreateTripOptions*createTripOptionsWithGeofence = [[IntouchCreateTripOptions alloc]initWithGeofences:arrGeofence tripDestination:tripDestination name:@"" deviceId:324 forceClose:false metaData:_metaData]; + +[Intouch.shared createTripDataWithOptons:_createTripOptionsWithGeofence completionHandler:^(IntouchCreateTripResponse * _Nullable response, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +let metaData: [String: String] = [ + "alpha": "test", + ] + +let optiongeo = IntouchGeometryPoint(point: CLLocation(latitude: 23.343, longitude: 77.232)) + +let tripdestination = IntouchTripDestination(geoemtry: optiongeo, radius: 500, scheduledAt: 0, metadata: metaData) + +let tripGeofence = IntouchTripsGeofences(geoemtry: optiongeo, radius: 500, scheduledAt: 0,metadata: metaData) + +let options = IntouchCreateTripOptions(geofences: [tripGeofence], tripDestination: tripdestination,name:"" deviceId: 67790, forceClose: true, metaData: metaData) + +Intouch.shared.createTripData(optons: options) { (response, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + +#### 6.1.3) Create Trip with Destination and Geofences using scheduled end time. + +In this method, the trip will get close to the scheduled end time. It is based on the trip duration. Irrespective of the vehicle arrival status on the geofence, the trip will get close after the trip duration (Scheduled end time). Otherwise, the manual close trip option can be used. + +Also, if the force close is enabled then on the new trip assignment , active old trip will be force closed. + +### Objective-c +```objc +IntouchGeometryPoint*tripGeoemetry = [[IntouchGeometryPoint alloc]initWithPoint:referenceLocation]; + +IntouchTripDestination*tripDestination =[[IntouchTripDestination alloc]initWithGeoemtry:tripGeoemetry radius:500 scheduledAt:0 metadata:_metaData]; + +IntouchTripsGeofences*tripGeofence =[[IntouchTripsGeofences alloc]initWithGeoemtry:tripGeoemetry radius:500 scheduledAt:0 metadata:_metaData]; + +IntouchTripsGeofences*tripGeofence1 =[[IntouchTripsGeofences alloc]initWithGeoemtry:tripGeoemetry radius:500 scheduledAt:0 metadata:_metaData]; + +NSArray*arrGeofence = [[NSArray alloc]initWithObjects:tripGeofence,tripGeofence1, nil]; + +IntouchCreateTripOptions*createTripOptionsWithSeheduleTimeAndGeometry = [[IntouchCreateTripOptions alloc]initWithGeofence:arrGeofence tripDestination:tripDestination name:@"" deviceId:324 forceClose:false scheduledEndTime:1111222 metaData:_metaData]; + +[Intouch.shared createTripDataWithOptons:_createTripOptionsWithSeheduleTimeAndGeometry completionHandler:^(IntouchCreateTripResponse * _Nullable response, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` +### Swift +```swift +let metaData: [String: String] = [ + "alpha": "test", + ] + +let coordinates = [ + CLLocation(latitude: 28.550704, longitude: 77.268961), + CLLocation(latitude: 28.549415, longitude: 77.271757), + CLLocation(latitude: 28.54711, longitude: 77.263637), + CLLocation(latitude: 28.550704, longitude: 77.268961) + ] + +let optiongeo = IntouchGeometryPolygon(points: coordinates) + +let optionPoint = IntouchGeometryPoint(point: CLLocation(latitude: 23.343, longitude: 232)) + +let tripdestination = IntouchTripDestination(geoemtry: optiongeo, radius: 500, 0, metadata: metaData) + +let tripGeofence = IntouchTripsGeofences(geoemtry: optiongeo, radius: 500, scheduledAt: metadata: metaData) + +let tripGeofence1 = IntouchTripsGeofences(geoemtry: optionPoint, radius: 500, 0,metadata: metaData) + +let options = IntouchCreateTripOptions(geofence: [tripGeofence,tripGeofence1tripDestination: tripdestination,name:"", deviceId: 67790, forceClose: scheduledEndTime: 1602238429, metaData: metaData) + +Intouch.shared.createTripData(optons: options) { (response, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + + ### Request Parameters +1. ```deviceId(Int)``` - Intouch unique Id of the device for which the trip is getting created. +2. ````(boolean)``` - If true then the trip will get automatically closed as soon as the device gets associated with another trip. +3. ```metadata(NSDictionary)``` - List of GeoFences points of the trip. This is an optional object. +7. ```isFroceCloseEnable(boolean)``` - if true then trip will get automatically closed as soon as the device gets associated with another trip. + +### TripDestination Parameters +1. ```geometry(Geometry)``` - Geometry of destination points coordinates. +2. ```metadata(NSDictionary)``` - List of Longitude and Latitude. For example:- +``` + let coordinates = [ + CLLocation(latitude: 28.550704, longitude: 77.268961), + CLLocation(latitude: 28.549415, longitude: 77.271757), + CLLocation(latitude: 28.54711, longitude: 77.263637), + CLLocation(latitude: 28.550704, longitude: 77.268961) + ] +``` + +### Response Code + +#### Success +1. 200 To denote a successful record is being created. + +#### Client-side issues + +1. 400 Bad Request, The User made an error while creating a valid request. +2. 401 Unauthorized, Developer’s key is not allowed to send a request with restricted parameters. +3. 403 Forbidden, the Developer’s key has hit its daily hourly limit. + +#### Server-Side Issues + +1. 500 Internal Server Error, the request caused an error in our systems. +2. 503 Service Unavailable, during our maintenance break or server downtimes. + +### Response Messages (as HTTP response message) +1. 200 Success +2. 203 Device Not Found +3. 400 Bad Request - Invalid device ID supplied or invalid data type. For example, input attribute id is an integer but string value gets passed. +4. 401 Unauthorized Request. Access to API is forbidden. +5. 404 Not Found - URL Not Found + + +### 6.2) Get List of Trips. + +Use this method to get the list of trips which is created under your account. You can get all trips or a filtered list of trips based on creation date, device id, trip status, etc. + +#### 6.2.1) Get List of all Trips +Using the below method you can get all the trip which is created under your account. + +### Objective-c +```objc +// IntouchGetAllTripsResponse - returned list of trips else error +[Intouch.shared getTripsWithCompletionHandler:^(IntouchGetAllTripsResponse * _Nullable response, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +Intouch.shared.getTrips { (response, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + +#### 6.2.2) Get List of trips with filters. + +Use the below method to get the selected list of trips. you can filter the trip using trip status, start and end time of the trip creation date. + +### Objective-c +```objc +IntouchGetAllTripsOptions*allTripsOptions = [[IntouchGetAllTripsOptions alloc]initWithDeviceIds:_deviceId startTime:12121 endTime:1212121 limit:1 status:1]; + +[Intouch.shared getTripsWithOptions:_allTripsOptions completionHandler:^(IntouchGetAllTripsResponse * _Nullable response, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` +### Swift +```swift +let options = IntouchGetAllTripsOptions(deviceIds: [67790], startTime: 1591368673, endTime: 1591368673, limit: 10, status: 2) + +Intouch.shared.getTrips(options: options) { (tripResponse, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + + ### Request Parameters +1. ```limit(int)``` - Will limit the records as per the passed value. +2. ```deviceIds (Long[])``` - Device IDs if you want to get trips associated with partcular devices. +3. ```status(int)``` - Pass 1 to get active trips & 2 for completed trips. +4. ```startTime(long)``` - Start timestamp of the trip. +5. ```endTime(long)``` - End timestamp of the trip. + + +### Response Code +#### Success +1. 200 To denote a successful API call. +#### Client-side issues + +1. 400 Bad Request, The User made an error while creating a valid request. +2. 401 Unauthorized, Developer’s key is not allowed to send a request with restricted parameters. +3. 403 Forbidden, the Developer’s key has hit its daily hourly limit. + +#### Server-Side Issues + +1. 500 Internal Server Error, the request caused an error in our systems. +2. 503 Service Unavailable, during our maintenance break or server downtimes. + +### Response Messages (as HTTP response message) +1. 200 Success +2. 203 Device Not Found +3. 400 Bad Request - Invalid device ID supplied or invalid data type. For example, input attribute id is an integer but string value gets passed. +4. 401 Unauthorized Request. Access to API is forbidden. +5. 404 Not Found - URL Not Found +### Response Parameter +`TripsResponse` class object returns the API response as a JSON object. + +#### Trip result parameters + 1. ```tripId(String)``` - Unique id for the trip. + 2. ```deviceId(long)``` - Unique Id of the device which is associated with the trip. + 3. ```status(Integer)``` - 1 - Active trip. 2 - Completed trip. + 4. ```closureType(Integer)``` - Type of trip closure. 1 - the trip will get closed based on the scheduled end time. 2 - the trip will close when the device enters the destination area/geofence. 3 - the trip will get closed manually by the user. + 5. ```forceClose(Boolean)``` - If true then the trip will get automatically closed as soon as the device gets associated with another trip. + 6. ```name(String)``` - The name of the trip. + 7. ```destination(Destination)``` - This will only get returned in case this object was explicitly defined while creating a trip. + 8. ```geofences(List)``` - A trip may have various points. This will only get returned in case these geofence points were explicitly mentioned while creating a trip. + 9. ```summary(Summary)``` - returns summary of particular trip. + 10. ```links(Links)``` - returns object of Links class. + +##### Destination Parameters +1. ```geometry(Geometry)```- Destination points coordinate geometry. This is standard geo json format. +2. ```radius(integer)```- Radius of the point. +3. ```plannedTime(Long)``` - Planned timestamp at which device reach the destination. +4. ```arrivalTime(Long)```- Actual timestamp at which device reach the destination. +5. ```departureTime(Long)``` - Departure timestamp at which device leaves the destination. +6. ```address(String)```- Address of the destination point. +7. ```time(Long)```- Planned timestamp is taken to reach the destination from the previous point. +8. ```distance(Integer)```- Planned distance is taken to reach the destination from the previous point. +9. ```pointName(String)```- The name given to the destination point. +10. ```metadata(Object)``` - This can be any key-value data pair and will get returned only if it mentioned while creating a +##### Geofence Parameters +1. ```geometry(Geometry)```- Geofence points coordinate geometry. This is in the standard geo JSON format. +2. ```radius(integer)```- Radius of the point. +3. ```plannedTime(Long)``` - Planned timestamp at which the device reaches the geofence. +4. ```arrivalTime(Long)```- Actual timestamp at which device reach the geofence. +5. ```departureTime(Long)``` - Departure timestamp at which device leaves the geofence. +6. ```address(String)```- Address of the destination point. +7. ```time(Long)```- planned timestamp is taken to reach the geofence from the previous point. +8. ```distance(Integer)```- Planned distance is taken to reach the destination from the previous point. +9. ```pointName(String)```- The name given to the geofence point. +10. ```metadata(Object)``` - This can be any key-value data pair and will get returned only if it mentioned while creating a trip. + + ##### Summary Parameters +1. ```startedOn(Long)```- The actual start timestamp of the trip. +2. ```duration(Long)```- The actual duration time (in seconds) of the trip. +3. ```distance(Double)``` - The actual distance (in meters) covered in the trip. +4. ```endedOn(Long)```- The actual end timestamp of the trip. +5. ```delayedBy(Long)``` - the actual timestamp by which the trip got delayed. +6. ```plannedEndTime(Long)```- The planned end timestamp of the trip. +7. ```plannedStartTime(Long)```- The planned start timestamp of the trip. +8. ```plannedDuration(long)```- The planned duration time (in seconds) of the trip. +9. ```plannedDistance(Integer)```- The planned distance (in meters) of the trip. + +##### Links Parameters +1. ```embedUrl(String)``` - An embedded URL link of the trip. You can use this link to visualize the trip on your web or mobile app. + +### 6.3) Trip Info + +Use the below method to get the detailed trip information using trip Id. + +#### 6.3.1) Get Trip by id. + +### Objective-c +```objc +// IntouchGetAllTripsResponse- returns TripInfoResponse if success, else error as callback methods. +[Intouch.shared getTripInfoWithTripId:@"5f58e80a8a92df57e80b032f" completionHandler:^(IntouchGetAllTripsResponse * _Nullable response, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` +### Swift +```swift +Intouch.shared.getTripInfo(tripId: "5f58e80a8a92df57e80b032f") { (response, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + +#### 6.3.2) Get Trip by id with filters. + +Using the below method you can get the limited set of information against the trip Ids. In this method, you can enable or disable some objects based on the requirement. + +### Objective-c +```objc +// IntouchGetAllTripsResponse- returns TripInfoResponse if success, else error as callback methods. +[Intouch.shared getTripInfoWithTripId:@"5f58e80a8a92df57e80b032f" isEventsEnable:false isLocationEnable:false isPolylineEnable:false completionHandler:^(IntouchGetAllTripsResponse * _Nullable response, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; +``` + +### Swift +```swift +Intouch.shared.getTripInfo(tripId: "5f58e80a8a92df57e80b032f", isEventsEnable: false, isLocationEnable: false, isPolylineEnable: true) { (response, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + + ### Request Parameters +1. ```tripId(string)``` - id of the trip which you want to fetch. +2. ```isEventsEnable(boolean)``` - will return all the position events of the device. +3. ```isLocationEnable(boolean)``` - will return the last know device location details. +4. ```isPolylineEnable(boolean)``` - will return the entire polyline locations of the route which was created for the trip. + + +### Response Code +#### Success +1. 200 To denote a successful API call. + +#### Client-side issues +1. 400 Bad Request, The User made an error while creating a valid request. +2. 401 Unauthorized, Developer’s key is not allowed to send a request with restricted parameters. +3. 403 Forbidden, the Developer’s key has hit its daily hourly limit. + +#### Server-Side Issues +1. 500 Internal Server Error, the request caused an error in our systems. +2. 503 Service Unavailable, during our maintenance break or server downtimes. + +### Response Messages (as HTTP response message) +1. 200 Success +2. 203 Device Not Found +3. 400 Bad Request - Invalid device ID supplied or invalid data type. For example, input attribute id is an integer but string value gets passed. +4. 401 Unauthorized Request. Access to API is forbidden. +5. 404 Not Found - URL Not Found + + +### Response Parameter +`TripInfoResponse` class object returns the API response as a JSON object. + + #### TripInfo result parameters + 1. ```tripId(String)``` - Id of the trip. + 2. ```deviceId(long)``` - Id of the device which is associated with the trip. + 3. ```status(Integer)``` - 1 - active trip. 2 - completed trip. + 4. ```closureType(Integer)``` - Type of trip closure. 1 - the trip will get closed based on the scheduled end time. 2 - the trip will close when the device enters the destination area/geofence. 3 - the trip will get closed manually by the user. + 5. ```forceClose(Boolean)``` - If true then the trip will get automatically closed as soon as the device gets associated with another trip. + 6. ```name(String)``` - The name of the trip. + 7. ```destination(Destination)``` - This will only get returned in case this object was explicitly defined while creating a trip. + 8. ```geofences(List)``` - A trip may have various points. This will only get returned in case these geofence points were explicitly mentioned while creating a trip. + 9. ```summary(Summary)``` - Returns summary of particular trip. + 10. ```polylinePoints(PolylinePoint)``` - This is the route polyline. + 11. ```location(Location)``` - Location data of the device. + 12. ```positionEvents(List)``` - Position events data of the device. + 13. ```links(Links)``` - returns object of Links class. + ##### Destination Parameters + 1. ```geometry(Geometry)```- Destination points coordinate geometry. This is standard geo json format. + 2. ```radius(integer)```- Radius of the point. + 3. ```plannedTime(Long)``` - Planned timestamp at which device reach the destination. + 4. ```arrivalTime(Long)```- Actual timestamp at which device reach the destination. + 5. ```departureTime(Long)``` - Departure timestamp at which device leaves the destination. + 6. ```address(String)```- Address of the destination point. + 7. ```time(Long)```- Planned time to reach the destination from the previous point. + 8. ```distance(Integer)```- Planned distance to reach the destination from the previous point. + 9. ```pointName(String)```- Destination point name. + 10. ```metadata(Object)``` - This can be any key-value data pair, and will get returned only if it was mentioned while creating a trip. + + ##### Geofence Parameters + 1. ```geometry(Geometry)```- Geofence points coordinate geometry.This is standard geo json format. + 2. ```radius(integer)```- Radius of the point. + 3. ```plannedTime(Long)``` - Planned timestamp at which device reach the geofence. + 4. ```arrivalTime(Long)```- Actual timestamp at which device reach the geofence. + 5. ```departureTime(Long)``` - Departure timestamp at which device leaves the geofence. + 6. ```address(String)```- Address of the destination point. + 7. ```time(Long)```- Planned time to reach the geofence from the previous point. + 8. ```distance(Integer)```- Planned distance to reach the destination from the previous point. + 9. ```pointName(String)```- Geofence/Stop point name. + 10. ```metadata(Object)``` - This can be any key-value data pair, and will get returned only if it was mentioned while creating a trip. + +##### Summary Parameters + 1. ```startedOn(Long)```- The actual start timestamp of the trip. + 2. ```duration(Long)```- The actual duration time (in seconds) of the trip. + 3. ```distance(Double)``` - The actual distance (in meters) covered in the trip. + 4. ```endedOn(Long)```- The actual end timestamp of the trip. + 5. ```delayedBy(Long)``` - The actual timestamp by which the trip got delayed. + 6. ```plannedEndTime(Long)```- The planned end timestamp of the trip. + 7. ```plannedStartTime(Long)```- The planned start timestamp of the trip. + 8. ```plannedDuration(long)```- The planned duration time (in seconds) of the trip. + 9. ```plannedDistance(Integer)```- The planned distance (in meters) of the trip. + +##### PolylinePoint Parameters + 1. ```coordinates(Coordinate)``` - Coordinates of polyline. +##### Coordinate Parameters + 1. ```lat(double)``` - Latitude value of polyline point. + 2. ```lng(double)``` - Longitude value of polyline point. + +##### Location Parameters +1. ```gpsTime(Long)```- Gps time of the device. +2. ```gprsTime(Long)```- Gprs time of the device. +3. ```latitude(Double)``` - Latitude value of location. +4. ```longitude(Double)```- Longitude value of location. +5. ```address(String)``` - Last location address of the device. +6. ```status(Integer)```- Movement status of the device. +1 - Moving, 2 - Idle, 3 - stopped, 4 - towing, 5 - No Data, 6 - power off i,e the device's battery is disconnected from the vehicle battery, 7 - No GPS, and 12 - Activation Pending. i,e) the device is not yet active and is yet to send the first ping. + +##### PositionEvent Parameters + 1. ```timestamp(long)```- The timestamp of position event. + 2. ```longitude(Double)```- Longitude value of position event. + 3. ```latitude(Double)``` - Latitude value of position event. + ##### Links Parameters + 1. ```embedUrl(String)``` - An embedded URL link of the trip. You can use this link to visualize the trip on your web or mobile app. + +#### 6.4) Close Trip + +The below method helps to close the trip manually. Just pass the trip Id in the method to close or complete the trip. + +### objective-C +```objc +// Status- returns success if trip closed successfully, else error as callback methods. +[Intouch.shared closeTripWithTripId:@"" completionHandler:^(NSInteger status, NSError * _Nullable error) { + if(error) { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } else { + // write your code here. + } +}]; + ``` + +### Swift +```swift +Intouch.shared.closeTrip(tripId: "") { (status, error) in + if let error = error { + // reason gives the error type. + // errorIdentifier gives information about error code. + // errorDescription gives a message for a particular error. + } + if let result = response { + // write your code here. + } +} +``` + +### Request Parameters +1. ```tripId(String)``` - id of the trip which you want to close. + +### Response Code +#### Success +1. 200 - To denote a successful API call. +#### Client-side issues + +1. 400 - Bad Request, User made an error while creating a valid request. +2. 401 - Unauthorized, the Developer’s key is not allowed to send a request with restricted parameters. +3. 403 - Forbidden, the Developer’s key has hit its daily hourly limit. + +#### Server-Side Issues + +1. 500 - Internal Server Error, the request caused an error in our systems. +2. 503 - Service Unavailable, during our maintenance break or server downtimes. + +### Response Messages (as HTTP response message) +1. 200 - Success +2. 203 - Device Not Found +3. 400 - Bad Request - Invalid device ID supplied or invalid data type. For example, input attribute id is an integer but string value gets passed. +4. 401 - Unauthorized Request. Access to API is forbidden. +5. 404 - Not Found - URL Not Found. + +## Our many customers: + +![](https://www.mapmyindia.com/api/img/logos1/PhonePe.png)![](https://www.mapmyindia.com/api/img/logos1/Arya-Omnitalk.png)![](https://www.mapmyindia.com/api/img/logos1/delhivery.png)![](https://www.mapmyindia.com/api/img/logos1/hdfc.png)![](https://www.mapmyindia.com/api/img/logos1/TVS.png)![](https://www.mapmyindia.com/api/img/logos1/Paytm.png)![](https://www.mapmyindia.com/api/img/logos1/FastTrackz.png)![](https://www.mapmyindia.com/api/img/logos1/ICICI-Pru.png)![](https://www.mapmyindia.com/api/img/logos1/LeanBox.png)![](https://www.mapmyindia.com/api/img/logos1/MFS.png)![](https://www.mapmyindia.com/api/img/logos1/TTSL.png)![](https://www.mapmyindia.com/api/img/logos1/Novire.png)![](https://www.mapmyindia.com/api/img/logos1/OLX.png)![](https://www.mapmyindia.com/api/img/logos1/sun-telematics.png)![](https://www.mapmyindia.com/api/img/logos1/Sensel.png)![](https://www.mapmyindia.com/api/img/logos1/TATA-MOTORS.png)![](https://www.mapmyindia.com/api/img/logos1/Wipro.png)![](https://www.mapmyindia.com/api/img/logos1/Xamarin.png) + +
+ +For any queries and support, please contact: + +[

](https://about.mappls.com/api/) + +Email us at [apisupport@mappls.com](mailto:apisupport@mappls.com) + +![](https://www.mapmyindia.com/api/img/icons/support.png) +[Support](https://about.mappls.com/contact/) +Need support? contact us! + +

+ +[

](https://stackoverflow.com/questions/tagged/mappls-api)[![](https://www.mapmyindia.com/api/img/icons/blog.png)](https://about.mappls.com/blog/)[![](https://www.mapmyindia.com/api/img/icons/gethub.png)](https://github.com/mappls-api)[

](https://www.npmjs.com/org/mapmyindia) + +[

](https://www.facebook.com/Mapplsofficial)[![](https://www.mapmyindia.com/june-newsletter/icon2.png)](https://twitter.com/mappls)[![](https://www.mapmyindia.com/newsletter/2017/aug/llinkedin.png)](https://www.linkedin.com/company/mappls/)[![](https://www.mapmyindia.com/june-newsletter/icon3.png)](https://www.youtube.com/channel/UCAWvWsh-dZLLeUU7_J9HiOA) + +

@ Copyright 2022 CE Info Systems Pvt. Ltd. All Rights Reserved.
+ +
Terms & Conditions | Privacy Policy | Supplier Sustainability Policy | Health & Safety Policy | Environmental Policy & CSR Report + +
Customer Care: +91-9999333223
diff --git a/docs/v1.0.13/MapplsMap.md b/docs/v1.0.13/MapplsMap.md new file mode 100644 index 0000000..2f1ce3f --- /dev/null +++ b/docs/v1.0.13/MapplsMap.md @@ -0,0 +1,1008 @@ +[

](https://www.mapmyindia.com/api) + +# [Mappls Map SDK]() + +## [Introduction]() + +This repository contains a sample project of an app built for iOS, which is based on Mappls's Map and other differennt SDKs. + +**Welcome to the Mappls iOS SDK** + +Explore the largest directory of APIs & SDKs for maps, routes and search. + +Mappls's APIs, SDKs, and live updating map data available for [238 nations](https://github.com/mappls-api/mapmyindia-rest-api/blob/master/docs/countryISO.md) give developers tools to build better mapping, navigation, and search experiences across platforms. + +In this section you will find documentation for :- + +- Detailed information about integration of Vector iOS Map. +- REST APIs module is a custom module for developers to consume our RESTful APIs within their applications, easily, and without having to develop such + functionality from scratch. +- Detailed information related to how to integrate Mappls Widgets. + +# [Map SDK](#Map-SDK) + +`MapplsMap` is a SDK to display map, mark locations, enhance with custom data and even draw routes or other shapes on top. + +## [Getting Started](#Getting-Started) + +Mappls's Map SDK for iOS lets you easily add Mappls Map and web services to your own iOS app. Mappls's Map SDK for iOS supports iOS SDK 9.0 and above and Xcode 10.1 or later. You can have a look at the map and features you will get in your own app by using the Mappls's Maps app for iOS. The SDK handles map tiles download and their display along with a bunch of controls and native gestures. + +## [Version History](#Version-History) + +| Version | Dated | Description | +| :------ | :---- | :---------- | +| `5.13.9` | 07 Jun, 2023 | Bug fixes & Improvements.| +| `5.13.8` | 30 May, 2023 | Domain of APIs changed.| +| `5.13.7` | 02 May, 2023 | Performance improvements and optimization.| +| `5.13.6` | 20 Mar, 2023 | Performance improvements and optimization.| +| `5.13.5` | 31 Jan, 2023 | Fixed `didFinishLoadingStyle` not getting called and added a class `MapplsMapAuthenticator` which can be used to initialize SDK using the method `initializeSDKSession`| +| `5.13.4` | 13 Oct, 2022 | Give `Mappls Pin` in delegate function `didTapPlaceWithMapplsPin` on map tap. Performance improvements and optimization. | +| `5.13.3` | 08 Sep, 2022 | Issue Resolved: Tiles not loading on CarPlay when phone is in locked state. | +| `5.13.2` | 18 Aug, 2022 | Bug Resolved: Session not resetting. | +| `5.13.1` | 20 Jul, 2022 | Bug Resolved: Duplicate Bundle Id. | +| `5.13.0` | 11 June, 2022 | Initial Mappls Map Release. | + +## [Setup your Project](#Setup-your-Project) + +#### Create a new project in Xcode. + +- Install libraries to your project which can be done in two ways either Manual or using Cocoapods. + + **Manual Procedure:** + - Drag and drop the Mappls's Map SDK xcframework (MapplsMap.xcframework) to your project. It must be added in embedded binaries. + - Drag and drop the `MapplsAPIKit` xcframework to your project. It must be added in embedded binaries. It is a dependent xcframework. + + **Cocoapods:** + + - Add below lines in pod file of your project: + ```Cocoapods + pod 'MapplsMap', '5.13.9' + ``` + - Run pod install or pod update (to update existing pods) + +- For iOS9 or later, make this change to your info.plist (Project target > info.plist > Add row and set keys `NSLocationAlwaysAndWhenInUseUsageDescription`, `NSLocationWhenInUseUsageDescription`, `NSLocationAlwaysUsageDescription`). As follows + ``` + NSLocationAlwaysAndWhenInUseUsageDescription + Your location is required + NSLocationAlwaysUsageDescription + Your location is required + NSLocationWhenInUseUsageDescription + Your location is required + ``` + Message should be appropriate, according to use of your application. + +## [Authorization](#Authorization) + +### [MapplsAPICore](#MapplsAPICore) +It is required to set Mappls keys to use any MAPPL's SDK. Please refer to documenatation [here](MapplsAPICore.md). + +### [MapplsMap](#mapplsmap) + +A class `MapplsMapAuthenticator` can be used to authorize the Map. + +It is recommended to call this method before initilizing `MapplsMapView`. + +Swift +```swift +MapplsMapAuthenticator.sharedManager().initializeSDKSession { isSucess, error in + if let error = error { + // Map cannot be initilize + print("error: \(error.localizedDescription)") + } else { + // Map is authorized sucessfully. + } +} +``` + +Objective - C + +```swift +[[MapplsMapAuthenticator sharedManager] initializeSDKSession:^(BOOL isSuccess, NSError * _Nullable error) { + if (isSuccess) { + // Map is authorized sucessfully. + } else { + // Map cannot be initilize + } +}]; + +``` + +Note: Although authorization of Map is done internally on initilizing `MapplsMapView`, **Using this in advance will reduce map loading time** + + +## [Usage](#Usage) + +## [Add a Mappls Map View](#Add-a-Mappls-Map-View) + +Map View on view controller can be added either using interface builder or programmatically. + +#### By Interface Builder +In a storyboard, add a view to your View Controller. In the Identity inspector, change its class to `MapplsMapView`. +**Note :-** Map style url need to be set at the time of load map + +#### By Programmatically +To add map on view Controller create an instance of `MapplsMapView`. and add this to view of `ViewController`. + +#### Objective C +```objectivec +#import +@interface ViewController () +@end +@implementation ViewController +``` +#### Swift +```swift +import MapplsMap +class ViewController: UIViewController, MapplsMapViewDelegate { + override func viewDidLoad() { + super.viewDidLoad() + let mapView = MapplsMapView(frame: view.bounds) + mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight] + view.addSubview(mapView) + } +}); +``` + +**Note** Also to handle app transport security exception add `NSAppTransportSecurity` in Info.plist of your project. As follows: +``` +NSAppTransportSecurity + + NSAllowsArbitraryLoads + + +``` + +## [Map Interactions](#Map-Interactions) + +### [Set Zoom Level](#Set-Zoom-Level) + +Set zoom to 4 for country level display and 18 for house number display. + +#### Objective C + +```objectivec +[mapView setZoom:4]; +``` + +#### Swift + +```swift +mapView.zoomLevel = 4 +``` + +### [Set Map Center](#Set-Map-Center) + +To set Center of map reference code is below: + +#### Objective C + +```objectivec +[self.mapView setCenterCoordinate: CLLocationCoordinate2DMake(28.551438, 77.265119)]; +``` + +#### Swift + +```swift +mapView.centerCoordinate = CLLocationCoordinate2DMake(28.551438, 77.265119) +``` + +## [Map Features](#Map-Features) + +### Current Location + +To show user's current location on map, use property `.showsUserLocation.` and set its value to true. + +#### Objective C + +```objectivec +mapView.showsUserLocation = YES; +``` + +#### Swift + +```swift +mapView.showsUserLocation = true +``` + +### Tracking Mode + +To move map with user location change use property `userTrackingMode`. Its an enum property of type `.MGLUserTrackingMode.`. You can set any value from following: + +- `followWithCourse` +- `followWithHeading` +- `none` + +#### Objective C + +```objectivec +self.mapView.userTrackingMode = MGLUserTrackingModeFollowWithCourse; +``` + +#### Swift + +```swift +mapView.userTrackingMode = .followWithCourse +``` + +## [Map Events](#Map-Events) + +The Map object should implement the methods of the `MapplsMapViewDelegate` protocol corresponding to the events you wish it to receive. This delegate can also be used to detect map overlays selection. Delegate handles gesture events, tap on annotation (marker) and map center coordinates. + + +### [Map Position Changes Events](#Map-Position-Changes-Events) +``` +-(BOOL)mapView:(MGLMapView *)mapView shouldChangeFromCamera:(MGLMapCamera*)oldCamera toCamera:(MGLMapCamera *)newCamera; +-(BOOL)mapView:(MGLMapView *)mapView shouldChangeFromCamera:(MGLMapCamera*)oldCamera toCamera:(MGLMapCamera *)newCamera reason:(MGLCameraChangeReason)reason; +-(void)mapView:(MGLMapView *)mapView regionWillChangeAnimated:(BOOL)animated; +-(void)mapView:(MGLMapView *)mapView regionWillChangeWithReason:(MGLCameraChangeReason)reason animated:(BOOL)animated; +-(void)mapViewRegionIsChanging:(MGLMapView *)mapView; +-(void)mapView:(MGLMapView *)mapView regionIsChangingWithReason:(MGLCameraChangeReason)reason; +-(void)mapView:(MGLMapView *)mapView regionDidChangeAnimated:(BOOL)animated;` +-(void)mapView:(MGLMapView *)mapView regionDidChangeWithReason:(MGLCameraChangeReason)reason animated:(BOOL)animated; +``` +### [Loading the Map Events](#Loading-the-Map-Events) + +#### [-authorizationCompleted:withError:]() + +This delegate function will be called whenever authorization process of map completed. It gives either sucess or error + +**Objective-C** +```objectivec +- (void)mapView:(MapplsMapView *)mapView authorizationCompleted:(BOOL)isSuccess withError:(nullable NSError *)error; +``` + +**Swift** +```swift +func mapView(_ mapView: MapplsMapView, authorizationCompleted isSuccess: Bool, withError error: Error?) { + + } +``` + + +#### [-mapViewWillStartLoadingMap:]() +Tells the delegate that the map view will begin to load. + +This method is called whenever the map view starts loading, including when a new style has been set and the map must reload. + +**Objective-C** +```objectivec +- (void)mapViewWillStartLoadingMap:(nonnull MGLMapView *)mapView; +``` + +**Swift** +```swift +optional func mapViewWillStartLoadingMap(_ mapView: MGLMapView) +``` + +#### [-mapViewDidFinishLoadingMap:]() + +Tells the delegate that the map view has finished loading. + +This method is called whenever the map view finishes loading, either after the initial load or after a style change has forced a reload. + +**Objective-C** +```objectivec +- (void)mapViewDidFinishLoadingMap:(nonnull MGLMapView *)mapView; +``` + +**Swift** +```swift +optional func mapViewDidFinishLoadingMap(_ mapView: MGLMapView) +``` + +#### [-mapViewDidFailLoadingMap:withError:]() + +Tells the delegate that the map view was unable to load data needed for displaying the map. + +This method may be called for a variety of reasons, including a network connection failure or a failure to fetch the style from the server. You can use the given error message to notify the user that map data is unavailable. + +**Objective-C** +```objectivec +- (void)mapViewDidFailLoadingMap:(nonnull MGLMapView *)mapView + withError:(nonnull NSError *)error; +``` + +**Swift** +```swift +optional func mapViewDidFailLoadingMap(_ mapView: MGLMapView, withError error: Error) +``` + + +#### [-mapViewWillStartRenderingFrame:]() + +Tells the delegate that the map view is about to redraw. + +This method is called any time the map view needs to redraw due to a change in the viewpoint or style property transition. This method may be called very frequently. Therefore, your implementation of this method should be as lightweight as possible to avoid affecting performance. + +**Objective-C** +```objectivec +- (void)mapViewWillStartRenderingFrame:(nonnull MGLMapView *)mapView; +``` + +**Swift** +```swift +optional func mapViewWillStartRenderingFrame(_ mapView: MGLMapView) +``` + +#### [-mapViewDidFinishRenderingFrame:fullyRendered:]() + +Tells the delegate that the map view has just redrawn. + +This method is called any time the map view needs to redraw due to a change in the viewpoint or style property transition. This method may be called very frequently. Therefore, your implementation of this method should be as lightweight as possible to avoid affecting performance. + +**Objective-C** +```objectivec +- (void)mapViewDidFinishRenderingFrame:(nonnull MGLMapView *)mapView + fullyRendered:(BOOL)fullyRendered; +``` + +**Swift** +```swift +optional func mapViewDidFinishRenderingFrame(_ mapView: MGLMapView, fullyRendered: Bool) +``` + +#### [-mapViewDidBecomeIdle:]() + +Tells the delegate that the map view is entering an idle state, and no more drawing will be necessary until new data is loaded or there is some interaction with the map. + +**Objective-C** +```objectivec +- (void)mapViewDidBecomeIdle:(nonnull MGLMapView *)mapView; +``` + +**Swift** +```swift +optional func mapViewDidBecomeIdle(_ mapView: MGLMapView) +``` + +#### [-mapView:didFinishLoadingStyle:]() + +Tells the delegate that the map has just finished loading a style. + +This method is called during the initialization of the map view and after any subsequent loading of a new style. + +**Objective-C** +```objectivec +- (void)mapView:(nonnull MGLMapView *)mapView + didFinishLoadingStyle:(nonnull MGLStyle *)style; +``` + +**Swift** +```swift +optional func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) +``` + +#### [-mapView:didTapPlaceWithMapplsPin:]() + +This delegate function gives `Mappls Pin`. + +This method is called on tap on map and gives either string value (Mappls Pin) or nil value (if no Mappls Pin found). + +**Objective-C** +```objectivec +- (void)mapView:(MGLMapView *)mapView didTapPlaceWithMapplsPin:(NSString *)mapplsPin; +``` + +**Swift** +```swift +optional func mapView(_ mapView: MGLMapView, didTapPlaceWithMapplsPin mapplsPin: String?) +``` + +### [SDK Error Codes](#SDK-Error-Codes) + +Map will fail with following error codes + +- MAPS_SDK_KEY_MISSING=1; //when map sdk key is not passed +- REST_API_KEY_MISSING=2; //when rest api key is not passed +- ATLAS_CLIENT_ID_MISSING=3; //when atlas client id is not passed +- ATLAS_CLIENT_SECRET_MISSING=4; //when atlas client secret is not passed +- ATLAS_GRANT_TYPE_MISSING=5; //* //when atlas grant type is not passed +- AUTHENTICATION_FAILED=7; //when map fails to authenticate itself with Mappls server +- UNKNOWN=8; // when map loading failed due to unknown error + +### [Tracking User Location Events](#Tracking-User-Location-Events) + +``` +-(void)mapViewWillStartLocatingUser:(MGLMapView *)mapView; +-(void)mapViewDidStopLocatingUser:(MGLMapView *)mapView; +-(void)mapView:(MGLMapView *)mapView didUpdateUserLocation:(nullableMGLUserLocation *)userLocation; +-(void)mapView:(MGLMapView *)mapView didFailToLocateUserWithError:(NSError*)error; +-(void)mapView:(MGLMapView *)mapView didChangeUserTrackingMode:(MGLUserTrackingMode)mode animated:(BOOL)animated; +``` + +### [Appearance of Annotations Events](#Appearance-of-Annotations-Events) + +``` +-(nullable MGLAnnotationImage *)mapView:(MGLMapView *)mapView imageForAnnotation:(id )annotation; +-(CGFloat)mapView:(MGLMapView *)mapView alphaForShapeAnnotation:(MGLShape*)annotation; +-(UIColor *)mapView:(MGLMapView *)mapView strokeColorForShapeAnnotation:(MGLShape *)annotation; +-(UIColor *)mapView:(MGLMapView *)mapView fillColorForPolygonAnnotation:(MGLPolygon *)annotation; +-(CGFloat)mapView:(MGLMapView *)mapView lineWidthForPolylineAnnotation:(MGLPolyline *)annotation; +``` + +### [Annotation Views Events](#Annotation-Views-Events) + +``` +-(nullable MGLAnnotationView *)mapView:(MGLMapView *)mapView viewForAnnotation:(id )annotation; +-(void)mapView:(MGLMapView *)mapView didAddAnnotationViews: (NS_ARRAY_OF(MGLAnnotationView *) *)annotationViews; +``` + +### [Selecting Annotations Events](#Selecting-Annotations-Events) +``` +-(void)mapView:(MGLMapView *)mapView didSelectAnnotation:(id )annotation; +-(void)mapView:(MGLMapView *)mapView didDeselectAnnotation:(id )annotation; +-(void)mapView:(MGLMapView *)mapView didSelectAnnotationView: (MGLAnnotationView *)annotationView; +-(void)mapView:(MGLMapView *)mapView didDeselectAnnotationView: (MGLAnnotationView *)annotationView; +``` + +### [Callout Views Events](#Callout-Views-Events) + +``` +-(BOOL)mapView:(MGLMapView *)mapView annotationCanShowCallout:(id )annotation; +-(nullable id )mapView:(MGLMapView *)mapView calloutViewForAnnotation:(id )annotation; +-(nullable UIView *)mapView:(MGLMapView *)mapView leftCalloutAccessoryViewForAnnotation:(id )annotation; +-(nullable UIView *)mapView:(MGLMapView *)mapView rightCalloutAccessoryViewForAnnotation:(id )annotation; +-(void)mapView:(MGLMapView *)mapView annotation:(id )annotation calloutAccessoryControlTapped:(UIControl *)control; +-(void)mapView:(MGLMapView *)mapView tapOnCalloutForAnnotation:(id )annotation; +``` + +## [Map Tap Events](#Map-Tap-Events) + +### [Single Tap Gesture](#Single-Tap-Gesture) + +To capture single tap on map events add a tap gesture to instance of `MapplsMapView`. Tapped CGPoint on map can be converted to CLLocationCoordinate object. Also if there is any mareker in tapped area that can also be retrieved. Code for reference to explain above features is below: + +#### Objective C + +```objectivec +UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] +initWithTarget:self action:@selector(didTapPress:)]; +[self.mapView addGestureRecognizer:singleTap]; + +-(void)didTapPress:(UILongPressGestureRecognizer *)gesture { + if(UIGestureRecognizerStateEnded == gesture.state) { + CGPoint touchPoint = [sender locationInView:self.mapView]; + + // Convert tapped area point to a CLLocationCoordinate object + CLLocationCoordinate2D location = [self.mapView convertPoint:touchPoint toCoordinateFromView:self.mapView; + + // Also existing annotation or features can be checked on tapped area point + NSArray> * visibleFeatures = [self.mapView visibleFeaturesAtPoint: touchPoint]; + if (visibleFeatures.count > 0) { + + } + } +} +``` + +#### Swift + +```swift +let singleTap = UITapGestureRecognizer(target: self, action: + #selector(didTapMap(tap:))) + mapView.addGestureRecognizer(singleTap) + @objc func didTapMap(tap: UITapGestureRecognizer) { + if tap.state == .ended { + let point = tap.location(in: mapView) + + // Convert tapped area point to a CLLocationCoordinate object + let coordinate = mapView.convert(point, toCoordinateFrom: mapView) + + // Also existing annotation or features can be checked on tapped area point + let visibleFeatures = mapView.visibleFeatures(at: point) + if visibleFeatures.count > 0 { + + } + } +} +``` + +### [Long Tap Gesture](#Long-Tap-Gesture) + +To capture long press on map events add a long press gesture to instance of `MapplsMapView`. + +#### Objective C + +```objectivec +UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer +alloc] initWithTarget:self action:@selector(didLongPress:)]; +[longPress setMinimumPressDuration:1.0]; + +[self.mapView addGestureRecognizer:longPress]; +-(void)didLongPress:(UILongPressGestureRecognizer *)gesture { + if(UIGestureRecognizerStateEnded == gesture.state) { + CGPoint touchPoint = [sender locationInView:self.mapView]; + + // Convert tapped area point to a CLLocationCoordinate object + CLLocationCoordinate2D location = [self.mapView convertPoint:touchPoint toCoordinateFromView:self.mapView; + + // Also existing annotation or features can be checked on tapped area point + NSArray> * visibleFeatures = [self.mapView visibleFeaturesAtPoint: touchPoint]; + if (visibleFeatures.count > 0) { + + } + } +} +``` + +#### Swift + +```swift +let longPress = UILongPressGestureRecognizer(target: self, action: +#selector(didLongPress(tap:))) +mapView.addGestureRecognizer(longPress) +@objc func didLongPress(tap: UILongPressGestureRecognizer) { +if tap.state == .ended { + let point = tap.location(in: mapView) + + // Convert tapped area point to a CLLocationCoordinate object + let coordinate = mapView.convert(point, toCoordinateFrom: mapView) + + // Also existing annotation or features can be checked on tapped area point + let visibleFeatures = mapView.visibleFeatures(at: point) + if visibleFeatures.count > 0 { + + } + } +} +``` + +## [Map Overlays](#Map-Overlays) + +### Add marker +To show an annotation on map create an instance of `MGLPointAnnotation` and add that object to instance of `MapplsMapView` using method `addAnnotation.`. + +After creating instance of `MGLPointAnnotation`, set coordinate and title property values. + +#### Objective C +```objectivec +MGLPointAnnotation *point = [[MGLPointAnnotation alloc] init]; +point.coordinate = CLLocationCoordinate2DMake(28.550834, 77.268918); +point.title = @"Annotation"; +[self.mapView addAnnotation:point]; +``` +#### Swift +```swift +var point = MGLPointAnnotation() +point.coordinate = CLLocationCoordinate2D(latitude: 28.550834, longitude: 77.268918) +point.title = "Annotation" +mapView.addAnnotation(point) +``` + +### Remove marker + +#### Objective C +```objectivec +[self.mapView removeAnnotation:point]; +``` +#### Swift +```swift +mapView.removeAnnotation(point) +``` + +### Custom Marker (Change Default Marker Icon) + +To change image for default marker you can use delegate methods of protocol +`MapplsMapViewDelegate`. +Either you can override whole view of marker by using below method of delegate: +``` +-(nullable MGLAnnotationView *)mapView:(MGLMapView *)mapView viewForAnnotation:(id )annotation; +``` +or you can override image of marker by using below method of delegate: +``` +-(nullable MGLAnnotationImage *)mapView:(MGLMapView *)mapView imageForAnnotation:(id )annotation; +``` + +### Show Info Window (Callout) + +To enable info window on tap of marker return true from below delegate method: + +```objectivec +- (BOOL)mapView:(MGLMapView *)mapView annotationCanShowCallout:(id )annotation; +``` + +### Custom Info Window(#Custom-Info-Window) + +To change default callout view of annotation use delegate function of `MapplsMapViewDelegate.` protocol and return custom view of callout from that function. + +```swift +func mapView(_ mapView: MGLMapView, calloutViewFor annotation: +MGLAnnotation) -> MGLCalloutView? { +return CustomCalloutView(representedObject: annotation) +} +``` + +To create custom callout view create a class inherited from `.MGLCalloutView.` and `.UIView.`. Override draw function of `UIView` to design your own callout view. + +## [Polylines](#Polylines) + +### Add a Polyline + +To show a polyline on map create an instance of `MGLPolyline` and add that object to instance of `MGLMapView` using method `.addAnnotation.`. + +To create instance of `MGLPolyline` an array of `CLLocationCoordinate2D` will be required so first create an array of `CLLocationCoordinate2D`. + +#### Objective C + +```objectivec +CLLocationCoordinate2D coordinates[] = { +CLLocationCoordinate2DMake(28.550834, 77.268918), +CLLocationCoordinate2DMake(28.551059, 77.268890), +CLLocationCoordinate2DMake(28.550938, 77.267641), +CLLocationCoordinate2DMake(28.551764, 77.267575), +CLLocationCoordinate2DMake(28.552068, 77.267599), +CLLocationCoordinate2DMake(28.553836, 77.267450), +}; +NSUInteger numberOfCoordinates = sizeof(coordinates) / sizeof(CLLocationCoordinate2D); +MGLPolyline *polyline = [MGLPolyline polylineWithCoordinates:coordinates count:numberOfCoordinates]; +[self.mapView addAnnotation:polyline]; +``` +#### Swift + +```swift +var coordinates = [ +CLLocationCoordinate2D(latitude: 28.550834, longitude: 77.268918), +CLLocationCoordinate2D(latitude: 28.551059, longitude: 77.268890), +CLLocationCoordinate2D(latitude: 28.550938, longitude: 77.267641), +CLLocationCoordinate2D(latitude: 28.551764, longitude: 77.267575), +CLLocationCoordinate2D(latitude: 28.552068, longitude: 77.267599), +CLLocationCoordinate2D(latitude: 28.553836, longitude: 77.267450), +] +let polyline = MGLPolyline(coordinates: &coordinates, count: UInt(coordinates.count)) +mapView.addAnnotation(polyline) +``` + +### [Remove a Polyline](#Remove-a-Polyline) + +#### Objective C + +```objectivec +[self.mapView removeAnnotation:polyline]; +``` + +#### Swift + +```swift +mapView.removeAnnotation(polyline) +``` + +### [Polyline Width](#Polyline-Width) + +Line width in points can be set when rendering the outline of a polyline annotation. It cab be achieve by using delegate method `lineWidthForPolylineAnnotation`. + +By default, the polyline is outlined with a line 3.0 points wide. + +#### Objective C + +```objectivec +- (CGFloat)mapView:(MGLMapView *)mapView lineWidthForPolylineAnnotation:(MGLPolyline *)annotation +{ + return 10.0; +} +``` + +#### Swift + +```swift +func mapView(_ mapView: MGLMapView, lineWidthForPolylineAnnotation annotation: MGLPolyline) -> CGFloat { + return 10.0 +} +``` + +## [Polygons](#Polygons) + +### [Add a Polygon](#Add-a-Polygon) + +To show a polygon on map create an instance of `MGLPolygon` and add that object to instance of `MGLMapView` using method `.addAnnotation.`. + +To create instance of `MGLPolygon` an array of `CLLocationCoordinate2D` will be required so first create an array of `CLLocationCoordinate2D`. + +#### Objective C + +```objectivec +CLLocationCoordinate2D coordinates[] = { +CLLocationCoordinate2DMake(28.550834, 77.268918), +CLLocationCoordinate2DMake(28.551059, 77.268890), +CLLocationCoordinate2DMake(28.550938, 77.267641), +CLLocationCoordinate2DMake(28.551764, 77.267575), +CLLocationCoordinate2DMake(28.552068, 77.267599), +CLLocationCoordinate2DMake(28.553836, 77.267450), +}; +NSUInteger numberOfCoordinates = sizeof(coordinates) / sizeof(CLLocationCoordinate2D); +MGLPolygon *polygon = [MGLPolygon polygonWithCoordinates:coordinates count:numberOfCoordinates];// +[self.mapView addAnnotation:polygon]; +``` + +#### Swift + +```swift +var coordinates = [ +CLLocationCoordinate2D(latitude: 28.550834, longitude: 77.268918), +CLLocationCoordinate2D(latitude: 28.551059, longitude: 77.268890), +CLLocationCoordinate2D(latitude: 28.550938, longitude: 77.267641), +CLLocationCoordinate2D(latitude: 28.551764, longitude: 77.267575), +CLLocationCoordinate2D(latitude: 28.552068, longitude: 77.267599), +CLLocationCoordinate2D(latitude: 28.553836, longitude: 77.267450), +] +let polygon = MGLPolygon(coordinates: &coordinates, count: UInt(coordinates.count)) +mapView.addAnnotation(polygon) +``` + + +### [Remove a Polygon](#Remove-a-Polygon) + +#### Objective C + +```objectivec +[self.mapView removeAnnotation:polygon]; +``` + +#### Swift + +```swift +mapView.removeAnnotation(polygon) +``` + +## [Map Camera](#Map-Camera) + +### [Fit Map Camera](#Fit-Map-Camera) + +`showAnnotations` function sets the visible region so that the map displays the specified annotations. + +#### Swift + +```swift +mapView.showAnnotations(annotations, animated: true) +``` + +### [Create Camera For Shape](#Create-Camera-For-Shape) + +A camera object that best fits the given shape with some additional padding on each side while looking in the specified direction can be retrieved using function `cameraThatFitsShape` of `MapplsMapView`. + +After creating a camera object using above function it can be set to fit map visible area. + +#### Objective C + +```objectivec +CLLocationCoordinate2D coordinates[] = { + CLLocationCoordinate2DMake(28.550834, 77.268918), + CLLocationCoordinate2DMake(28.551059, 77.268890), + CLLocationCoordinate2DMake(28.550938, 77.267641), + CLLocationCoordinate2DMake(28.551764, 77.267575), + CLLocationCoordinate2DMake(28.552068, 77.267599), + CLLocationCoordinate2DMake(28.553836, 77.267450), +}; + +NSUInteger numberOfCoordinates = sizeof(coordinates) / sizeof(CLLocationCoordinate2D); +MGLPolygon *polygon = [MGLPolygon polygonWithCoordinates:coordinates count:numberOfCoordinates];// +[self.mapView addAnnotation:polygon]; +MGLMapCamera *shapeCam = [self.mapView cameraThatFitsShape:polygon direction:(0) edgePadding:UIEdgeInsetsMake(20, 20, 20, 20)]; +[self.mapView setCamera:shapeCam]; +``` + +#### Swift + +```swift +var coordinates = [ + CLLocationCoordinate2D(latitude: 28.550834, longitude: 77.268918), + CLLocationCoordinate2D(latitude: 28.551059, longitude: 77.268890), + CLLocationCoordinate2D(latitude: 28.550938, longitude: 77.267641), + CLLocationCoordinate2D(latitude: 28.551764, longitude: 77.267575), + CLLocationCoordinate2D(latitude: 28.552068, longitude: 77.267599), + CLLocationCoordinate2D(latitude: 28.553836, longitude: 77.267450), +] +let polyline = MGLPolyline(coordinates: &coordinates, count: UInt(coordinates.count)) +let shapeCam = mapView.cameraThatFitsShape(polyline, direction: CLLocationDirection(0), edgePadding: UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20)) +mapView.setCamera(shapeCam, animated: false) +``` + +## [Miscellaneous](#Miscellaneous) + +### [Shape Stroke Color](#Shape-Stroke-Color) + +Color of `polyline` and stroke color of `polygon` can be changed by using delegate method `strokeColorForShapeAnnotation`. + +The default stroke color is the map view’s tint color. + +#### Objective C + +```objectivec +- (UIColor *)mapView:(MGLMapView *)mapView strokeColorForShapeAnnotation:(MGLShape *)annotation { + return [UIColor redColor]; +} +``` + +#### Swift + +```swift +func mapView(_ mapView: MGLMapView, strokeColorForShapeAnnotation annotation: MGLShape) -> UIColor { + return .red +} +``` + +### [Shape Fill Color](#Shape-Fill-Color) + +Fill Color of `polygon` can be changed by using delegate method `fillColorForPolygonAnnotation`. + +The default fill color is the map view’s tint color. + +#### Objective C + +```objectivec +- (UIColor *)mapView:(MGLMapView *)mapView fillColorForPolygonAnnotation:(MGLPolygon *)annotation { + return [UIColor redColor]; +} +``` + +#### Swift + +```swift +func mapView(_ mapView: MGLMapView, fillColorForPolygonAnnotation annotation: MGLPolygon) -> UIColor { + return UIColor.red +} +``` + +### [Shape Opacity](#Shape-Opacity) + +To change opacity of a shape i.e polyline or polygon, delegate method `alphaForShapeAnnotation` can be used. + +It sets the opacity of an entire shape, inclusive of its stroke and fill. + +#### Objective C + +```objectivec +- (CGFloat)mapView:(MGLMapView *)mapView alphaForShapeAnnotation:(MGLShape *)annotation +{ + return 0.5; +} +``` + +#### Swift + +```swift +func mapView(_ mapView: MGLMapView, alphaForShapeAnnotation annotation: MGLShape) -> CGFloat { + return 0.5 +} +``` + +### [Safety Status Strip](#Safety-Status-Strip) + +A safety status strip can be show on map based on user's location. COVID-19 status will be shown on map currently, It will show whether user's location lies in a containment zone or not and conaintment zone info like Containment Zone Name, District etc. For more info about how to use go to [Safety Strip](https://github.com/mappls-api/mappls-ios-sdk/Mappls-Safety-Strip). + +### [Cluster Based Authentication](#Cluster-Based-Authentication) + +Map SDK can be configured such that it can work only for specified unique identifier of a device and will show an error accordingly. + +#### [Set Cluster Device](#Set-Cluster-Device) + +Cluster Identifier can be set and retrieve using singelton class `MapplsAccountManager` which is part of Map SDK's dependency `MapplsAPICore`. + +Below is code for reference to set and get cluster identifier. + +#### Objective C + +```objectivec +// Set Cluster Identifier +[MapplsAccountManager setClusterId:@"YOUR_CLUSTER_DEVICE_IDENTIFIER"]; + +// Get Cluster Identifier +NSString * clusterId = [MapplsAccountManager clusterId]; +``` + +#### Swift + +```swift +// Set Cluster Identifier +MapplsAccountManager.setClusterId("YOUR_CLUSTER_DEVICE_IDENTIFIER") + +// Get Cluster Identifier +let clusterId = MapplsAccountManager.clusterId() +``` + +## [SwiftUI](#SwiftUI) + +### [Create Map View](#Create-MAPPLS-Map-View) + +1. In your project, add new SwiftUI View and name it MapView.swift +2. In order to use native UIKit views in `SwiftUI` view, you must use [UIViewRepresentable](https://developer.apple.com/documentation/swiftui/uiviewrepresentable) wrapper. The instance of custom type which adopts UIViewRepresentable protocol is responsible for creation and management a UIView object in your SwiftUI interface. + ``` + struct MapView: UIViewRepresentable { + ... + } + ``` +3. The UIViewRepresentable requires to implement makeUIViewController(context:) method that creates the instance of with the desired UIKit view. Add the following code to create map view instance + ``` + private let mapView: MapplsMapView = MapplsMapView(frame: .zero) + + func makeUIView(context: UIViewRepresentableContext) -> MapplsMapView { + mapView.delegate = context.coordinator + return mapView + } + ``` +4. The UIViewRepresentable view also requires to implement updateUIView(_:context:) which is used to configure the newly created instance. To show map only We dont need to configure anything so we will keep it empty. + ``` + func updateUIView(_ uiView: MapplsMapView, context: UIViewRepresentableContext) {} + ``` + +To add map annoations at design time add an `annotations` property in `MapView` struct as below: + +``` +@Binding var annotations: [MGLPointAnnotation] +``` + +Use below code to add marker at design time by setting annotations property. +``` +struct ContentView: View { + + @State var annotations: [MGLPointAnnotation] = [ + MGLPointAnnotation(title: "MAPPLS", coordinate: .init(latitude: 28.550679, longitude: 77.268949)) + ] + + var body: some View { + MapView(annotations: $annotations).centerCoordinate(.init(latitude: 28.550679, longitude: 77.268949)).zoomLevel(16) + } +} +``` + +### [Respond To Map Events](#Respond-To-Map-Events) + +In order to to respond to map events, for example perform an action after MapView initialization finished. In SwiftUI, a Coordinator can be used with delegates, data sources, and user events. The UIViewRepresentable protocol defines makeCoordinator() method which creates coordinator instance. Add the following code to declare coordinator class: + +``` +class Coordinator: NSObject, MGLMapViewDelegate { + var control: MapView + + init(_ control: MapView) { + self.control = control + } + + func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) { + // write your custom code which will be executed + // after map's style has been loaded + } +} +``` + +And then add the following method to the SwiftUI view: + +``` +func makeCoordinator() -> MapView.Coordinator { + Coordinator(self) +} +``` + +And finally set the reference coordinator on Mappls map view. + +``` +mapView.delegate = context.coordinator +``` + +


+ +## Our many happy customers: + +![](https://www.mapmyindia.com/api/img/logos1/PhonePe.png)![](https://www.mapmyindia.com/api/img/logos1/Arya-Omnitalk.png)![](https://www.mapmyindia.com/api/img/logos1/delhivery.png)![](https://www.mapmyindia.com/api/img/logos1/hdfc.png)![](https://www.mapmyindia.com/api/img/logos1/TVS.png)![](https://www.mapmyindia.com/api/img/logos1/Paytm.png)![](https://www.mapmyindia.com/api/img/logos1/FastTrackz.png)![](https://www.mapmyindia.com/api/img/logos1/ICICI-Pru.png)![](https://www.mapmyindia.com/api/img/logos1/LeanBox.png)![](https://www.mapmyindia.com/api/img/logos1/MFS.png)![](https://www.mapmyindia.com/api/img/logos1/TTSL.png)![](https://www.mapmyindia.com/api/img/logos1/Novire.png)![](https://www.mapmyindia.com/api/img/logos1/OLX.png)![](https://www.mapmyindia.com/api/img/logos1/sun-telematics.png)![](https://www.mapmyindia.com/api/img/logos1/Sensel.png)![](https://www.mapmyindia.com/api/img/logos1/TATA-MOTORS.png)![](https://www.mapmyindia.com/api/img/logos1/Wipro.png)![](https://www.mapmyindia.com/api/img/logos1/Xamarin.png) + +
+ +For any queries and support, please contact: + +[

](https://about.mappls.com/api/) + +Email us at [apisupport@mappls.com](mailto:apisupport@mappls.com) + +![](https://www.mapmyindia.com/api/img/icons/support.png) +[Support](https://about.mappls.com/contact/) +Need support? contact us! + +

+ +[

](https://stackoverflow.com/questions/tagged/mappls-api)[![](https://www.mapmyindia.com/api/img/icons/blog.png)](https://about.mappls.com/blog/)[![](https://www.mapmyindia.com/api/img/icons/gethub.png)](https://github.com/mappls-api)[

](https://www.npmjs.com/org/mapmyindia) + +[

](https://www.facebook.com/Mapplsofficial)[![](https://www.mapmyindia.com/june-newsletter/icon2.png)](https://twitter.com/mappls)[![](https://www.mapmyindia.com/newsletter/2017/aug/llinkedin.png)](https://www.linkedin.com/company/mappls/)[![](https://www.mapmyindia.com/june-newsletter/icon3.png)](https://www.youtube.com/channel/UCAWvWsh-dZLLeUU7_J9HiOA) + +

@ Copyright 2022 CE Info Systems Pvt. Ltd. All Rights Reserved.
+ +
Terms & Conditions | Privacy Policy | Supplier Sustainability Policy | Health & Safety Policy | Environmental Policy & CSR Report + +
Customer Care: +91-9999333223
diff --git a/docs/v1.0.13/MapplsMapStyle.md b/docs/v1.0.13/MapplsMapStyle.md new file mode 100644 index 0000000..81bef14 --- /dev/null +++ b/docs/v1.0.13/MapplsMapStyle.md @@ -0,0 +1,100 @@ +[

](https://www.mapmyindia.com/api) + +# [Set Map Style](#Set-Map-Style) + +Mappls offers a range of preset styles to rendering the map. The user has to retrieve a list of styles for a specific account. +The listing api would help in rendering specific style as well as facilitate the switching of style themes. + +From the below reference code it would become quite clear that user has to specify style names and not URLs to use them. +A default style is set for all account users to start with. +To know more about available styles, kindly contact apisupport@mappls.com + +**This feature is available from version v5.7.19** + +## [List of Available Styles](#list-of-available-styles) + +Explore and choose from our map style list on [Live Demo](https://www.mapmyindia.com/api/advanced-maps/WebSDK-LiveDemo/map_style) + +Subscribe the delegate to get the list of available styles: + +#### Swift +``` +func didLoadedMapplsMapsStyles(_ mapView: MapplsMapView, styles: [MapplsMapStyle], withError error: Error?) +``` + +#### Objective C +``` +- (void)didLoadedMapplsMapsStyles:(MapplsMapView *)mapView styles:(NSArray *)styles withError:(nullable NSError *)error; +``` + +`MapplsMapStyle` contains below parameters: + + 1. `style_Description(String)`: Description of the style + 2. `displayName(string)`: Generic Name of style mostly used in Mappls content. + 3. `imageUrl(String)`: Preview Image of style + 4. `name(String)`: Name of style used to change the style. + +## [Set Mappls Map Style](#set-Mappls-Map-Style) +To set MapplsMap style reference code is below: +#### Swift +``` +mapView.setMapplsMapStyle("style Name") +``` + +#### Objective C +``` +[self.mapView setMapplsMapStyle:@"Style Name"]; +``` + +## [To enable/disable last selected style](#To-enable-last-selected-style) +To enable/disable loading of last selected style: + +#### Swift +``` +MapplsMapConfiguration.setIsShowPreferedMapStyle(false) // true is enable & false is disable(default value is true) +``` +#### Objective C +``` +[MapplsMapConfiguration setIsShowPreferedMapStyle:false]; //true is enable & false is disable(default value is true) +``` + +## [didSetMapplsMapStyle](#did-Set-Mappls-Map-Style) +Tells the delegate that the style set by user is valid or not. +#### Swift +``` +func didSetMapplsMapStyle(_ mapView: MapplsMapView, isSuccess: Bool, withError error: Error?) +``` +#### Objective C +``` +-(void)didSetMapplsMapStyle:(MapplsMapView *)mapView isSuccess:(BOOL)isSuccess withError:(nullable NSError *)error; +``` + +


+ +## Our many happy customers: + +![](https://www.mapmyindia.com/api/img/logos1/PhonePe.png)![](https://www.mapmyindia.com/api/img/logos1/Arya-Omnitalk.png)![](https://www.mapmyindia.com/api/img/logos1/delhivery.png)![](https://www.mapmyindia.com/api/img/logos1/hdfc.png)![](https://www.mapmyindia.com/api/img/logos1/TVS.png)![](https://www.mapmyindia.com/api/img/logos1/Paytm.png)![](https://www.mapmyindia.com/api/img/logos1/FastTrackz.png)![](https://www.mapmyindia.com/api/img/logos1/ICICI-Pru.png)![](https://www.mapmyindia.com/api/img/logos1/LeanBox.png)![](https://www.mapmyindia.com/api/img/logos1/MFS.png)![](https://www.mapmyindia.com/api/img/logos1/TTSL.png)![](https://www.mapmyindia.com/api/img/logos1/Novire.png)![](https://www.mapmyindia.com/api/img/logos1/OLX.png)![](https://www.mapmyindia.com/api/img/logos1/sun-telematics.png)![](https://www.mapmyindia.com/api/img/logos1/Sensel.png)![](https://www.mapmyindia.com/api/img/logos1/TATA-MOTORS.png)![](https://www.mapmyindia.com/api/img/logos1/Wipro.png)![](https://www.mapmyindia.com/api/img/logos1/Xamarin.png) + +
+ +For any queries and support, please contact: + +[

](https://about.mappls.com/api/) + +Email us at [apisupport@mappls.com](mailto:apisupport@mappls.com) + +![](https://www.mapmyindia.com/api/img/icons/support.png) +[Support](https://about.mappls.com/contact/) +Need support? contact us! + +

+ +[

](https://stackoverflow.com/questions/tagged/mappls-api)[![](https://www.mapmyindia.com/api/img/icons/blog.png)](https://about.mappls.com/blog/)[![](https://www.mapmyindia.com/api/img/icons/gethub.png)](https://github.com/mappls-api)[

](https://www.npmjs.com/org/mapmyindia) + +[

](https://www.facebook.com/Mapplsofficial)[![](https://www.mapmyindia.com/june-newsletter/icon2.png)](https://twitter.com/mappls)[![](https://www.mapmyindia.com/newsletter/2017/aug/llinkedin.png)](https://www.linkedin.com/company/mappls/)[![](https://www.mapmyindia.com/june-newsletter/icon3.png)](https://www.youtube.com/channel/UCAWvWsh-dZLLeUU7_J9HiOA) + +

@ Copyright 2022 CE Info Systems Pvt. Ltd. All Rights Reserved.
+ +
Terms & Conditions | Privacy Policy | Supplier Sustainability Policy | Health & Safety Policy | Environmental Policy & CSR Report + +
Customer Care: +91-9999333223
diff --git a/docs/v1.0.13/MapplsNearbyUI.md b/docs/v1.0.13/MapplsNearbyUI.md new file mode 100644 index 0000000..ee32057 --- /dev/null +++ b/docs/v1.0.13/MapplsNearbyUI.md @@ -0,0 +1,163 @@ +[

](https://www.mapmyindia.com/api) + +# Mappls Nearby Search Widget for iOS + +## [Introduction](#Introduction) + +The MapplsNearbyUI makes it easy to integrate a widget with your iOS application. The Nearby Search widget provided as a means to enable radially search for Nearby Places on Mappls Map. + +The widget offers the following basic functionalities: + +- Ability to search for nearby places directly with Mappls Map visual interface. + +- A single method to initiate nearby search across all categories of places available on Mappls. + +- Ability to get information from Mappls Nearby Search widget through a callback. + +## [Widget Preview](#Widget) + +![](https://mmi-api-team.s3.amazonaws.com/moveSDK/ios/resources/MapmyIndiaNearbyUI/MapmyIndiaNearbyUI.gif) + +
This can be done by following simple steps. + +**Step 1:-** +## [Installation](#Installation) + + +This widget can be installed using CocoaPods. It is available with the name `MapplsNearbyUI`. + +### [Using CocoaPods](#Using-CocoaPods) + +Create a Podfile with the following specification: + +``` +pod 'MapplsNearbyUI', '1.0.1' +``` + +Run `pod repo update && pod install` and open the resulting Xcode workspace. + +### [Version History](#Version-History) + +| Version | Dated | Description | +| :---- | :---- | :---- | +| `1.0.1` | 01 Nov 2022 | Bug fixes due to dependency of APIKit version 2.0.7| +| `1.0.0` | 01 Jun 2022 | Initial Mappls NearbyUI Release.| + +
+ +#### [Dependencies](#Dependencies) + +This library depends upon several Mappls's own libraries. All dependent libraries will be automatically installed using CocoaPods. + +Below are list of dependencies which are required to run this SDK: + +- [MapplsAPICore](https://github.com/mappls-api/mappls-ios-sdk/docs/v1.0.0/MapplsAPICore.md) +- [MapplsAPIKit](https://github.com/mappls-api/mappls-ios-sdk/docs/v1.0.0/MapplsAPIKit.md) +- [MapplsMap](https://github.com/mappls-api/mappls-ios-sdk/docs/v1.0.0/MapplsMap.md) +- [MapplsUIWidgets](https://github.com/mappls-api/mappls-ios-sdk/docs/v1.0.0/MapplsUIWidgets.md) + +#### [Authorization](#Authorization) + +##### [MapplsAPICore](#MapplsAPICore) +It is required to set Mappls keys to use any Mappls SDK. Please refer the documentation [here](https://github.com/mappls-api/mappls-ios-sdk/docs/v1.0.0/MapplsAPICore.md). + +**Step 2:-** +## [Launching with default configuration](#Launching-with-default-configuration) + + +### [MapplsNearbyCategoriesViewController](#MapplsNearbyCategoriesViewController) + +`MapplsNearbyCategoriesViewController` is type of UIViewController which is entry ViewController for MapplsNearbyUI SDK. + +```swift +let nearbyUI = MapplsNearbyCategoriesViewController() +self.navigationController?.pushViewController(nearbyUI, animated: false) +``` +Thats all ! you are now ready with the MapplsNearbyUI widget within your app. + +To enhance further and making UI as per your own requirements, refer to the section below: + +#### [Properties of MapplsNearbyCategoriesViewController](#Properties-of-MapplsNearbyCategoriesViewController) + + - **nearbyCategories:** - An array of an object of type `MapplsNearbyCategories` which will help to make your own custom categories to show on `MapplsNearbyCategoriesViewController`. + +It can be used as follows. +``` swift + var nearbyCategories = [MapplsNearbyCategories]() + + let selectedImage = UIImage(named: "placePickerMarker")?.withRenderingMode(.alwaysTemplate) + let categoriesImage = UIImage(named: "Coffee") + + let coffeeCategory = MapplsNearbyCategories(title: "Coffee", selectedBackgroundColor: selectedColor, unselectedBackgroundColor: .white, selectedImage: selectedImage ?? UIImage(), unselectedImage: selectedImage ?? UIImage(), unselectedTextColor: .black, selectedTextColor: .white, isSelected: true, categoryKeywords: ["FODCOF"], mapNearbyCategoryIcon: categoriesImage) + + nearbyCategories.append(coffeeCategory) + + nearbyUI.nearbyCategories = nearbyCategories + +``` + + - **nearbyCategoryConfiguration:-** A object of type `MapplsNearbyCategoryConfiguration` which will be required to set the UI Configuration of `MapplsNearbyCategoriesViewController` + + - **nearbyConfiguration:-** A object of type [MapplsNearbyConfiguration](#MapplsNearbyConfiguration) which will be required in `MapplsNearbyMapViewController` to configure the UI components and nearby request parametes. + + +- **delegate:-** A delegate object of type `MapplsNearbyCategoriesViewControllerDelegate` to provide different callbacks as per different actions of MapplsNearbyUI. + +### [MapplsNearbyCategoriesViewControllerDelegate](#MapplsNearbyCategoriesViewControllerDelegate) + +It is a protocol class that will be used for callback methods as shown below: + +#### Call Back Handler +``` swift + /// A delegate method which will be called when the user click next button in `MapplsNearbyCategoriesViewController` class + /// - Parameters: + /// - refLocation: It is location selected from place picker or your current location or location provided by used as refLocation. + /// - selectedCategories: It is the array of `MapplsNearbyCategories` items selected from the categories + /// - error: This will show an error message in case of any failure in `MapplsNearbyCategoriesViewController` class on next button clicked. + + func didNextButtonClicked(refLocation: String?, selectedCategories: [MapplsNearbyCategories]?, error: String? ) + ``` + +``` swift + /// A delegate method will be called when the nearby icon is taped on the map. It will return a nearby response for the taped icon. + /// - Parameter place: A concrete subclass of `MapplsSuggestion` to represent suggestedLocations object in results of requests. + + func didSelectNearbyIcon(place: MapplsAtlasSuggestion) + ``` + + ``` swift + /// A delegate method will be called when the nearby result in ListView is tapped. It will return a nearby response for the tapped item. + /// - Parameter place: A concrete subclass of `MapplsSuggestion` to represent suggestedLocations object in results of requests. + + func didSelectNearbySuggestionFromTable(place: MapplsAtlasSuggestion) + ``` + +


+ +## Our many happy customers: + +![](https://www.mapmyindia.com/api/img/logos1/PhonePe.png)![](https://www.mapmyindia.com/api/img/logos1/Arya-Omnitalk.png)![](https://www.mapmyindia.com/api/img/logos1/delhivery.png)![](https://www.mapmyindia.com/api/img/logos1/hdfc.png)![](https://www.mapmyindia.com/api/img/logos1/TVS.png)![](https://www.mapmyindia.com/api/img/logos1/Paytm.png)![](https://www.mapmyindia.com/api/img/logos1/FastTrackz.png)![](https://www.mapmyindia.com/api/img/logos1/ICICI-Pru.png)![](https://www.mapmyindia.com/api/img/logos1/LeanBox.png)![](https://www.mapmyindia.com/api/img/logos1/MFS.png)![](https://www.mapmyindia.com/api/img/logos1/TTSL.png)![](https://www.mapmyindia.com/api/img/logos1/Novire.png)![](https://www.mapmyindia.com/api/img/logos1/OLX.png)![](https://www.mapmyindia.com/api/img/logos1/sun-telematics.png)![](https://www.mapmyindia.com/api/img/logos1/Sensel.png)![](https://www.mapmyindia.com/api/img/logos1/TATA-MOTORS.png)![](https://www.mapmyindia.com/api/img/logos1/Wipro.png)![](https://www.mapmyindia.com/api/img/logos1/Xamarin.png) + +
+ +For any queries and support, please contact: + +[

](https://about.mappls.com/api/) + +Email us at [apisupport@mappls.com](mailto:apisupport@mappls.com) + +![](https://www.mapmyindia.com/api/img/icons/support.png) +[Support](https://about.mappls.com/contact/) +Need support? contact us! + +

+ +[

](https://stackoverflow.com/questions/tagged/mappls-api)[![](https://www.mapmyindia.com/api/img/icons/blog.png)](https://about.mappls.com/blog/)[![](https://www.mapmyindia.com/api/img/icons/gethub.png)](https://github.com/mappls-api)[

](https://www.npmjs.com/org/mapmyindia) + +[

](https://www.facebook.com/Mapplsofficial)[![](https://www.mapmyindia.com/june-newsletter/icon2.png)](https://twitter.com/mappls)[![](https://www.mapmyindia.com/newsletter/2017/aug/llinkedin.png)](https://www.linkedin.com/company/mappls/)[![](https://www.mapmyindia.com/june-newsletter/icon3.png)](https://www.youtube.com/channel/UCAWvWsh-dZLLeUU7_J9HiOA) + +

@ Copyright 2022 CE Info Systems Pvt. Ltd. All Rights Reserved.
+ +
Terms & Conditions | Privacy Policy | Supplier Sustainability Policy | Health & Safety Policy | Environmental Policy & CSR Report + +
Customer Care: +91-9999333223
diff --git a/docs/v1.0.13/MapplsPinStrategy.md b/docs/v1.0.13/MapplsPinStrategy.md new file mode 100644 index 0000000..45a00ec --- /dev/null +++ b/docs/v1.0.13/MapplsPinStrategy.md @@ -0,0 +1,95 @@ +[

](https://www.mapmyindia.com/api) + +# Mappls Pin Strategy in Mappls's Map SDK for iOS + +## [Add Marker Using Mappls Pin](#Add-Marker-Using-Mappls-Pin) + +A marker on Mappls Map can be added using only Mappls Pin. For this it will require an object of `MapplsPointAnnotation`. + +To create object of `MapplsPointAnnotation` it will require Mappls Mappls Pin(unique code of a Place) in its initializer. + +### Single Marker + +**Swift** +```swift +let annotation11 = MapplsPointAnnotation(mapplsPin: "7gbcyf") +mapView.addMapplsAnnotation(annotation11, completionHandler: nil) +``` + +### Multiple Markers + +**Swift** +```swift +var annotations = [MapplsPointAnnotation]() +let mapplsPins = [ "mmi000", "7gbcyf", "5MEQEL", "k595cm"] +for mapplsPin in mapplsPins { + let annotation = MapplsPointAnnotation(mapplsPin: mapplsPin) + annotations.append(annotation) +} +self.mapView.addMapplsAnnotations(annotations, completionHandler: nil) +``` +## [Set Map Center Using Mappls Pin](#Set-Map-Center-Using-Mappls-Pin) + +Mappls's Map can be centered to a Place using its Mappls Pin. +Different functions are available to achieve this. Below are code snippets to use it. + +**Swift** +```swift +mapView.setMapCenterAtMapplsPin("mmi000", animated: false, completionHandler: nil) +``` + +```swift +mapView.setMapCenterAtMapplsPin("mmi000", zoomLevel: 17, animated: false, completionHandler: nil) +``` + +```swift +mapView.setMapCenterAtMapplsPin("mmi000", zoomLevel: 17, direction: 0, animated: false, completionHandler: nil) +``` + +## [Set Map View Bounds Using List of Mappls Pin](#Set-Map-View-Bounds-Using-List-of-Mappls-Pin) + +Mappls's Map's bounds can be set to fit bounds for a list of Mappls Pins. +A method `showMapplsPins:` is available to achieve this. Below is code snipped to demonstrated its usage + +**Swift** +```swift +let mapplsPins = ["mmi000", "7gbcyf", "5MEQEL", "k595cm"] +self.mapView.showMapplsPins(MapplsPins, animated: false, completionHandler: nil) +``` +## [Distance Between Locations Using Mappls Pins](#Distance-Between-Locations-Using-Mappls-Pins) + +Code snipet for getting distance between different locations using Mappls Pins is below. For more information please see [here](https://github.com/mappls-api/mappls-ios-sdk/docs/1.0.0/RESTAPIKit#Distance-Using-MapplsPin). + +## [Directions Between Locations Using Mappls Pins](#Directions-Between-Locations-Using-Mappls-Pins) + +Directions between different locations can be get using Mappls Pins. For more information please see [here](https://github.com/MapmyIndia/mapmyindia-maps-vectorSDK-iOS/wiki/REST-API-Kit#Routing-API) and [here](https://github.com/MapmyIndia/mapmyindia-maps-vectorSDK-iOS/wiki/REST-API-Kit#Directions-Using-Mappls-Pins). + +


+ +## Our many happy customers: + +![](https://www.mapmyindia.com/api/img/logos1/PhonePe.png)![](https://www.mapmyindia.com/api/img/logos1/Arya-Omnitalk.png)![](https://www.mapmyindia.com/api/img/logos1/delhivery.png)![](https://www.mapmyindia.com/api/img/logos1/hdfc.png)![](https://www.mapmyindia.com/api/img/logos1/TVS.png)![](https://www.mapmyindia.com/api/img/logos1/Paytm.png)![](https://www.mapmyindia.com/api/img/logos1/FastTrackz.png)![](https://www.mapmyindia.com/api/img/logos1/ICICI-Pru.png)![](https://www.mapmyindia.com/api/img/logos1/LeanBox.png)![](https://www.mapmyindia.com/api/img/logos1/MFS.png)![](https://www.mapmyindia.com/api/img/logos1/TTSL.png)![](https://www.mapmyindia.com/api/img/logos1/Novire.png)![](https://www.mapmyindia.com/api/img/logos1/OLX.png)![](https://www.mapmyindia.com/api/img/logos1/sun-telematics.png)![](https://www.mapmyindia.com/api/img/logos1/Sensel.png)![](https://www.mapmyindia.com/api/img/logos1/TATA-MOTORS.png)![](https://www.mapmyindia.com/api/img/logos1/Wipro.png)![](https://www.mapmyindia.com/api/img/logos1/Xamarin.png) + +
+ +For any queries and support, please contact: + +[

](https://about.mappls.com/api/) + +Email us at [apisupport@mappls.com](mailto:apisupport@mappls.com) + +![](https://www.mapmyindia.com/api/img/icons/support.png) +[Support](https://about.mappls.com/contact/) +Need support? contact us! + +

+ +[

](https://stackoverflow.com/questions/tagged/mappls-api)[![](https://www.mapmyindia.com/api/img/icons/blog.png)](https://about.mappls.com/blog/)[![](https://www.mapmyindia.com/api/img/icons/gethub.png)](https://github.com/mappls-api)[

](https://www.npmjs.com/org/mapmyindia) + +[

](https://www.facebook.com/Mapplsofficial)[![](https://www.mapmyindia.com/june-newsletter/icon2.png)](https://twitter.com/mappls)[![](https://www.mapmyindia.com/newsletter/2017/aug/llinkedin.png)](https://www.linkedin.com/company/mappls/)[![](https://www.mapmyindia.com/june-newsletter/icon3.png)](https://www.youtube.com/channel/UCAWvWsh-dZLLeUU7_J9HiOA) + +

@ Copyright 2022 CE Info Systems Pvt. Ltd. All Rights Reserved.
+ +
Terms & Conditions | Privacy Policy | Supplier Sustainability Policy | Health & Safety Policy | Environmental Policy & CSR Report + +
Customer Care: +91-9999333223
diff --git a/docs/v1.0.13/MapplsTrafficVectorTileOverlay.md b/docs/v1.0.13/MapplsTrafficVectorTileOverlay.md new file mode 100644 index 0000000..d6cbdbc --- /dev/null +++ b/docs/v1.0.13/MapplsTrafficVectorTileOverlay.md @@ -0,0 +1,65 @@ +[

](https://www.mapmyindia.com/api) + +# [Mappls Traffic Vector Tiles Overlay](#Mappls-Traffic-Vector-Tiles-Overlay) + +Mappls Traffic Vector Tiles is an overlay that you can use to display real-time traffic conditions on a map. +The overlay provides constantly updating congestion information best viewed on Mappls map (Available with all styles of Mappls Map). + +Read more for [List of Available Styles](https://github.com/mappls-api/mappls-ios-sdk/blob/main/docs/v1.0.0/MapplsMapStyle.md) + +## Preview Image + +[

](https://about.mappls.com/api/) + + +## Implementation +To enable/disable Tiles Overlay follow the below code snippet. Default is false. +```swift +self.mapView.isTrafficEnabled = false; //To enable/disable all Traffic +``` +To choose from different traffic flow information use below referred code. Default is true. + +```swift + self.mapView.isClosureTrafficEnabled = false //To enable/disable Traffic Closure Overlay + +self.mapView.isFreeFlowTrafficEnabled = false //To enable/disable Free Flow (Green) Overlay + +self.mapView.isNonFreeFlowTrafficEnabled = false //To enable/disable Non free flow (Red/Orange) Overlay + +self.mapView.isStopIconTrafficEnabled = false //To enable/disable Traffic Closure Overlay +``` + + +Please Note : Custom styles overlaid with traffic tiles are not offered coherently. +Contact [API Support](apisupport@mappls.com) in case of custom styles and details of available custom claims of traffic tiles. + +
+ +For any queries and support, please contact: + +[

](https://about.mappls.com/api/) +Email us at [apisupport@mappls.com](mailto:apisupport@mappls.com) + + +![](https://www.mapmyindia.com/api/img/icons/support.png) +[Support](https://about.mappls.com/contact/) +Need support? contact us! + +

+

+ +[

](https://stackoverflow.com/questions/tagged/mappls-api)[![](https://www.mapmyindia.com/api/img/icons/blog.png)](https://about.mappls.com/blog/)[![](https://www.mapmyindia.com/api/img/icons/gethub.png)](https://github.com/Mappls-api)[

](https://www.npmjs.com/org/mapmyindia) + + + +[

](https://www.facebook.com/Mapplsofficial)[![](https://www.mapmyindia.com/june-newsletter/icon2.png)](https://twitter.com/mappls)[![](https://www.mapmyindia.com/newsletter/2017/aug/llinkedin.png)](https://www.linkedin.com/company/mappls/)[![](https://www.mapmyindia.com/june-newsletter/icon3.png)](https://www.youtube.com/channel/UCAWvWsh-dZLLeUU7_J9HiOA) + + + + +

@ Copyright 2022 CE Info Systems Ltd. All Rights Reserved.
+ +
Terms & Conditions | Privacy Policy | Supplier Sustainability Policy | Health & Safety Policy | Environmental Policy & CSR Report + +
Customer Care: +91-9999333223
+ diff --git a/docs/v1.0.13/MapplsUIWidgets.md b/docs/v1.0.13/MapplsUIWidgets.md new file mode 100644 index 0000000..0d7c7ce --- /dev/null +++ b/docs/v1.0.13/MapplsUIWidgets.md @@ -0,0 +1,810 @@ +[

](https://www.mapmyindia.com/api) + +# MapplsUIWidgets - UI Components SDK for iOS + +## [Introduction](#Introduction) +The MapplsUIWidgets SDK for iOS allows you can build rich apps by quickly implement reday made UI components. Currently this SDK have a widget for Searching a place using [AutoSuggest API](https://about.mappls.com/api/advanced-maps/doc/autosuggest-api). + +### [Dependencies](#Dependencies) + +This library depends upon several Mappls's own libraries. All dependent libraries will be automatically installed using CocoaPods. + +Below are list of dependencies which are required to run this SDK: + +- [MapplsAPICore](https://github.com/mappls-api/mappls-ios-sdk/docs/v1.0.0/MapplsAPICore.md) +- [MapplsAPIKit](https://github.com/mappls-api/mappls-ios-sdk/docs/v1.0.0/MapplsAPIKit.md) +- [MapplsMap](https://github.com/mappls-api/mappls-ios-sdk/docs/v1.0.0/MapplsMap.md) +- [MapplsUIWidgets](https://github.com/mappls-api/mappls-ios-sdk/docs/v1.0.0/MapplsUIWidgets.md) + +## [Installation](#Installation) + +This library is available through `CocoaPods`. To install, simply add the following line to your `podfile`: + +```ruby +pod 'MapplsUIWidgets', '1.0.3' +``` +On running `pod install` command it will automatically download and setup `MapplsUIWidgets` and dependent frameworks. + +### [Version History](#Version-History) + +| Version | Dated | Description | +| :---- | :---- | :---- | +| `1.0.3` | 02 June, 2023 | Added functionality to show favourites/custom places in Autosuggest Widget. Added related callbacks etc.| +| `1.0.2` | 02 May, 2023 | Added `debounceInterval` property in `MapplsAutocompleteViewController` class and added `responseLanguage` property in `MapplsAutocompleteFilter` class.| +| `1.0.1` | 03 Sept, 2022 | Added hyperLocal property.| +| `1.0.0` | 12 June, 2022 | Initial Mappls UIWidget Release.| + +## [Authorization](#Authorization) + +### [MapplsAPICore](#MapplsAPICore) +It is required to set Mappls keys to use any Mappls SDK. Please refer the documentation [here](MapplsAPICore.md). + +## [Autocomplete](#Autocomplete) + + + +The autocomplete service in the SDK for iOS returns place predictions in response to user search queries. As the user types, the autocomplete service returns suggestions for places such as businesses, addresses and points of interest. + +You can add autocomplete to your app in the following ways: + +Add an autocomplete UI control to save development time and ensure a consistent user experience. + +Get place predictions programmatically to create a customized user experience. + +### Add an autocomplete UI control + +The autocomplete UI control is a search dialog with built-in autocomplete functionality. As a user enters search terms, the control presents a list of predicted places to choose from. When the user makes a selection, a MapplsAtlasSuggestion instance is returned, which your app can then use to get details about the selected place. + +* [Add a full screen control](#Add-a-full-screen-control) +* [Add a results controller](#Add-a-results-controller) +* [Use a table data source](#Use-a-table-data-source) + +### [Add a full-screen control](#Add-a-full-screen-control) + +Use the full-screen control when you want a modal context, where the autocomplete UI temporarily replaces the UI of your app until the user has made their selection. This functionality is provided by the MapplsAutocompleteViewController class. When the user selects a place, your app receives a callback. + +To add a full-screen control to your app: + +1. Create a UI element in your main app to launch the autocomplete UI control, for example a touch handler on a UIButton. +1. Implement the MapplsAutocompleteViewControllerDelegate protocol in the parent view controller. +1. Create an instance of MapplsAutocompleteViewController and assign the parent view controller as the delegate property. +1. Add a [MapplsAutocompleteFilter](#MapplsAutocompleteFilter) to constrain the query to a particular type of place. +1. Present the MapplsAutocompleteViewController using [self presentViewController...]. +1. Handle the user's selection in the didAutocompleteWithPlace delegate method. +1. Dismiss the controller in the didAutocompleteWithPlace, didFailAutocompleteWithError, and wasCancelled delegate methods. + +The following example demonstrates one possible way to launch MapplsAutocompleteViewController in response to the user tapping on a button. + +```swift +import UIKit +import MapplsUIWidgets + +class ViewController: UIViewController { + + override func viewDidLoad() { + makeButton() + } + + // Present the Autocomplete view controller when the button is pressed. + @objc func autocompleteClicked(_ sender: UIButton) { + let autocompleteController = MapplsAutocompleteViewController() + autocompleteController.delegate = self + + // Specify a filter. + let filter = MapplsAutocompleteFilter() + autocompleteController.autocompleteFilter = filter + + // Display the autocomplete view controller. + present(autocompleteController, animated: true, completion: nil) + } + + // Add a button to the view. + func makeButton() { + let btnLaunchAc = UIButton(frame: CGRect(x: 5, y: 150, width: 300, height: 35)) + btnLaunchAc.backgroundColor = .blue + btnLaunchAc.setTitle("Launch autocomplete", for: .normal) + btnLaunchAc.addTarget(self, action: #selector(autocompleteClicked), for: .touchUpInside) + self.view.addSubview(btnLaunchAc) + } + +} + +extension ViewController: MapplsAutocompleteViewControllerDelegate { + + // Handle the user's selection. + func didAutocomplete(viewController: MapplsAutocompleteViewController, withPlace place: MapplsAtlasSuggestion, resultType type: MapplsAutosuggestResultType) { + print("Place name: \(place.placeName)") + print("Place mapplsPin: \(place.mapplsPin)") + dismiss(animated: true, completion: nil) + } + + func didAutocomplete(viewController: MapplsAutocompleteViewController, withFavouritePlace place: MapplsUIWidgetAutosuggestFavouritePlace) { + print("Place name: \(place.placeName)") + print("Place mapplsPin: \(place.mapplsPin)") + } + + func didAutocomplete(viewController: MapplsAutocompleteViewController, withSuggestion suggestion: MapplsSearchPrediction) { + + } + + func didFailAutocomplete(viewController: MapplsAutocompleteViewController, withError error: NSError) { + // TODO: handle the error. + print("Error: ", error.localizedDescription) + } + + // User canceled the operation. + func wasCancelled(viewController: MapplsAutocompleteViewController) { + dismiss(animated: true, completion: nil) + } + + // Turn the network activity indicator on and off again. + func didRequestAutocompletePredictions(viewController: MapplsAutocompleteViewController) { + UIApplication.shared.isNetworkActivityIndicatorVisible = true + } + + func didUpdateAutocompletePredictions(viewController: MapplsAutocompleteViewController) { + UIApplication.shared.isNetworkActivityIndicatorVisible = false + } + +} +``` + +#### [SwiftUI Full Screen Control](#SwiftUI-Full-Screen-Control) + +##### [Create Autosuggest View Controller](#Create-Autosuggest-View-Controller) + +1. In your project, add new SwiftUI View and name it MapplsAutocompleteViewControllerSwiftUIView.swift +2. In order to use native UIKit view controller in `SwiftUI` view, you must use [UIViewControllerRepresentable](https://developer.apple.com/documentation/swiftui/uiviewcontrollerrepresentable) wrapper. The instance of custom type which adopts UIViewControllerRepresentable protocol is responsible for creation and management a UIViewController object in your SwiftUI interface. + ```swift + struct MapplsAutocompleteViewControllerSwiftUIWrapper: UIViewControllerRepresentable { + ... + } + ``` +3. The UIViewControllerRepresentable requires to implement makeUIViewController(context:) method that creates the instance of with the desired UIKit view. Add the following code to create map view instance + ```swift + @Environment(\.presentationMode) var presentationMode + + func makeUIViewController(context: UIViewControllerRepresentableContext) -> MapplsAutocompleteViewController { + let autocompleteViewController = MapplsAutocompleteViewController() + autocompleteViewController.delegate = context.coordinator + return autocompleteViewController + } + ``` +4. The UIViewControllerRepresentable view also requires to implement updateUIViewController(_:context:) which is used to configure the newly created instance. To show autosuggest only We dont need to configure anything so we will keep it empty. + ```swift + func updateUIViewController(_ uiViewController: MapplsAutocompleteViewController, context: UIViewControllerRepresentableContext) { + + } + ``` +5. To use selected place from results of autosuggest add below property code as shown above: + ```swift + @Binding var placeSuggestion: MapplsAtlasSuggestion? + ``` +6. Use below code to create `SwiftUIView` to consume in another View. + ```swift + struct MapplsAutocompleteViewControllerSwiftUIView: View { + @Binding var placeSuggestion: MapplsAtlasSuggestion? + + var body: some View { + MapplsAutocompleteViewControllerSwiftUIWrapper(placeSuggestion: $placeSuggestion) + .navigationBarHidden(true) + } + } + ``` + +##### [Respond To Autosuggest Events](#Respond-To-Autosuggest-Events) + +In order to respond to Autosuggest events, for example perform an action on selecting a result from Autosuggest's results. In SwiftUI, a Coordinator can be used with delegates, data sources, and user events. The UIViewControllerRepresentable protocol defines makeCoordinator() method which creates coordinator instance. Add the following code to declare coordinator class: + +```swift +class Coordinator: NSObject, UINavigationControllerDelegate, MapplsAutocompleteViewControllerDelegate { + var parent: MapplsAutocompleteViewControllerSwiftUIWrapper + + init(_ parent: MapplsAutocompleteViewControllerSwiftUIWrapper) { + self.parent = parent + } + + func didAutocomplete(viewController: MapplsAutocompleteViewController, withSuggestion suggestion: MapplsSearchPrediction) { + + } + + func didAutocomplete(viewController: MapplsAutocompleteViewController, withFavouritePlace place: MapplsUIWidgetAutosuggestFavouritePlace) { + print("Place name: \(place.placeName)") + print("Place mapplsPin: \(place.mapplsPin)") + } + + + func didAutocomplete(viewController: MapplsAutocompleteViewController, withPlace place: MapplsAtlasSuggestion, resultType type: MapplsAutosuggestResultType) { + DispatchQueue.main.async { + print(place.description.description as Any) + self.parent.presentationMode.wrappedValue.dismiss() + self.parent.placeSuggestion = place + } + } + + func didFailAutocomplete(viewController: MapplsAutocompleteViewController, withError error: NSError) { + print("Error: ", error.localizedDescription) + } + + func wasCancelled(viewController: MapplsAutocompleteViewController) { + parent.presentationMode.wrappedValue.dismiss() + } + } +``` + +And then add the following method to the `MapplsAutocompleteViewControllerSwiftUIWrapper`: + +```swift +func makeCoordinator() -> MapView.Coordinator { + Coordinator(self) +} +``` + +**Note:** Reference coordinator is set using below code in above class. + +```swift +autocompleteViewController.delegate = context.coordinator +``` + +### [Add a results controller](#Add-a-results-controller) + +Use a results controller when you want more control over the text input UI. The results controller dynamically toggles the visibility of the results list based on input UI focus. + +To add a results controller to your app: + +1. Create a MapplsAutocompleteResultsViewController. +1. Implement the MapplsAutocompleteResultsViewControllerDelegate protocol in the parent view controller and assign the parent view controller as the delegate property. +1. Create a UISearchController object, passing in the MapplsAutocompleteResultsViewController as the results controller argument. +1. Set the MapplsAutocompleteResultsViewController as the searchResultsUpdater property of the UISearchController. +1. Add the searchBar for the UISearchController to your app's UI. +1. Handle the user's selection in the didAutocompleteWithPlace delegate method. + +There are several ways to place the search bar of a UISearchController into your app's UI: + +* [Add a search bar to the navigation bar](#Add-a-search-bar-to-the-navigation-bar) +* [Add a search bar to the top of a view](#Add-a-search-bar-to-the-top-of-a-view) + +#### [Add a search bar to the navigation bar](#Add-a-search-bar-to-the-navigation-bar) + +The following code example demonstrates adding a results controller, adding the searchBar to the navigation bar, and handling the user's selection: + +```swift +class ViewController: UIViewController { + + var resultsViewController: MapplsAutocompleteResultsViewController? + var searchController: UISearchController? + var resultView: UITextView? + + override func viewDidLoad() { + super.viewDidLoad() + + resultsViewController = MapplsAutocompleteResultsViewController() + resultsViewController?.delegate = self + + searchController = UISearchController(searchResultsController: resultsViewController) + searchController?.searchResultsUpdater = resultsViewController + + // Put the search bar in the navigation bar. + searchController?.searchBar.sizeToFit() + navigationItem.titleView = searchController?.searchBar + + // When UISearchController presents the results view, present it in + // this view controller, not one further up the chain. + definesPresentationContext = true + + // Prevent the navigation bar from being hidden when searching. + searchController?.hidesNavigationBarDuringPresentation = false + } +} + +// Handle the user's selection. +extension ViewController: MapplsAutocompleteResultsViewControllerDelegate { + func didAutocomplete(resultsController: MapplsAutocompleteResultsViewController, withPlace place: MapplsAtlasSuggestion, resultType type: MapplsAutosuggestResultType) { + searchController?.isActive = false + // Do something with the selected place. + print("Place name: \(place.placeName)") + print("Place mapplsPin: \(place.mapplsPin)") + } + + func didAutocomplete(resultsController: MapplsAutocompleteResultsViewController, withFavouritePlace place: MapplsUIWidgetAutosuggestFavouritePlace) { + print("Place name: \(place.placeName)") + print("Place mapplsPin: \(place.mapplsPin)") + } + + func didFailAutocomplete(resultsController: MapplsAutocompleteResultsViewController, withError error: NSError) { + // TODO: handle the error. + print("Error: ", error.localizedDescription) + } + + // Turn the network activity indicator on and off again. + func didRequestAutocompletePredictionsForResultsController(resultsController: MapplsAutocompleteResultsViewController) { + UIApplication.shared.isNetworkActivityIndicatorVisible = true + } + + func didUpdateAutocompletePredictionsFor(resultsController: MapplsAutocompleteResultsViewController) { + UIApplication.shared.isNetworkActivityIndicatorVisible = false + } +} +``` + +**Note:** For the search bar to display properly, your app's view controller must be enclosed within a [UINavigationController](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UINavigationController_Class/). + +#### [Add a search bar to the top of a view](#Add-a-search-bar-to-the-top-of-a-view) + +The following code example shows adding the searchBar to the top of a view. + +```swift +import UIKit +import MapplsUIWidgets + +class ViewController: UIViewController { + + var resultsViewController: MapplsAutocompleteResultsViewController? + var searchController: UISearchController? + var resultView: UITextView? + + override func viewDidLoad() { + super.viewDidLoad() + + resultsViewController = MapplsAutocompleteResultsViewController() + resultsViewController?.delegate = self + + searchController = UISearchController(searchResultsController: resultsViewController) + searchController?.searchResultsUpdater = resultsViewController + + let subView = UIView(frame: CGRect(x: 0, y: 65.0, width: 350.0, height: 45.0)) + + subView.addSubview((searchController?.searchBar)!) + view.addSubview(subView) + searchController?.searchBar.sizeToFit() + searchController?.hidesNavigationBarDuringPresentation = false + + // When UISearchController presents the results view, present it in + // this view controller, not one further up the chain. + definesPresentationContext = true + } +} + +// Handle the user's selection. +extension ViewController: MapplsAutocompleteResultsViewControllerDelegate { + func didAutocomplete(resultsController: MapplsAutocompleteResultsViewController, withPlace place: MapplsAtlasSuggestion, resultType type: MapplsAutosuggestResultType) { + searchController?.isActive = false + // Do something with the selected place. + print("Place name: \(place.placeName)") + print("Place mapplsPin: \(place.mapplsPin)") + } + + func didAutocomplete(resultsController: MapplsAutocompleteResultsViewController, withFavouritePlace place: MapplsUIWidgetAutosuggestFavouritePlace) { + print("Place name: \(place.placeName)") + print("Place mapplsPin: \(place.mapplsPin)") + } + + func didFailAutocomplete(resultsController: MapplsAutocompleteResultsViewController, withError error: NSError) { + // TODO: handle the error. + print("Error: ", error.localizedDescription) + } + + // Turn the network activity indicator on and off again. + func didRequestAutocompletePredictionsForResultsController(resultsController: MapplsAutocompleteResultsViewController) { + UIApplication.shared.isNetworkActivityIndicatorVisible = true + } + + func didUpdateAutocompletePredictionsFor(resultsController: MapplsAutocompleteResultsViewController) { + UIApplication.shared.isNetworkActivityIndicatorVisible = false + } +} +``` + +### [Use a table data source](#Use-a-table-data-source) + +You can use the MapplsAutocompleteTableDataSource class to drive the table view of a UISearchDisplayController. + +To use MapplsAutocompleteTableDataSource to display a search controller: + +1. Implement the MapplsAutocompleteTableDataSourceDelegate and UISearchDisplayDelegate protocols in the parent view controller. +1. Create a MapplsAutocompleteTableDataSource instance and assign the parent view controller as the delegate property. +1. Create an instance of UISearchDisplayController. +1. Add the searchBar for the UISearchController to your app's UI. +1. Handle the user's selection in the didAutocompleteWithPlace delegate method. +1. Dismiss the controller in the didAutocompleteWithPlace, didFailAutocompleteWithError, and wasCancelled delegate methods. + +The following code example demonstrates using the MapplsAutocompleteTableDataSource class to drive the table view of a UISearchDisplayController. + +```swift +import UIKit +import MapplsUIWidgets + +class ViewController: UIViewController, UISearchDisplayDelegate { + + var searchBar: UISearchBar? + var tableDataSource: MapplsAutocompleteTableDataSource? + var searchDisplayController: UISearchDisplayController? + + override func viewDidLoad() { + super.viewDidLoad() + + searchBar = UISearchBar(CGRect(x: 0, y: 0, width: 250.0, height: 44.0)) + + tableDataSource = MapplsAutocompleteTableDataSource() + tableDataSource?.delegate = self + + searchDisplayController = UISearchDisplayController(searchBar: searchBar!, contentsController: self) + searchDisplayController?.searchResultsDataSource = tableDataSource + searchDisplayController?.searchResultsDelegate = tableDataSource + searchDisplayController?.delegate = self + + view.addSubview(searchBar!) + } + + func didUpdateAutocompletePredictionsForTableDataSource(tableDataSource: MapplsAutocompleteTableDataSource) { + // Turn the network activity indicator off. + UIApplication.sharedApplication().networkActivityIndicatorVisible = false + // Reload table data. + searchDisplayController?.searchResultsTableView.reloadData() + } + + func didRequestAutocompletePredictionsFor(tableDataSource: MapplsAutocompleteTableDataSource) { + // Turn the network activity indicator on. + UIApplication.sharedApplication().networkActivityIndicatorVisible = true + // Reload table data. + searchDisplayController?.searchResultsTableView.reloadData() + } + +} + +extension ViewController: MapplsAutocompleteTableDataSourceDelegate { + func didAutocomplete(tableDataSource: MapplsAutocompleteTableDataSource, withPlace place: MapplsAtlasSuggestion, resultType type: MapplsAutosuggestResultType) { + searchDisplayController?.active = false + // Do something with the selected place. + print("Place name: \(place.name)") + print("Place address: \(place.formattedAddress)") + print("Place attributions: \(place.attributions)") + } + + func didAutocomplete(tableDataSource: MapplsAutocompleteTableDataSource, withFavouritePlace place: MapplsUIWidgets.MapplsUIWidgetAutosuggestFavouritePlace) { + print("Place name: \(place.placeName)") + print("Place mapplsPin: \(place.mapplsPin)") + } + + func didFailAutocomplete(tableDataSource: MapplsAutocompleteTableDataSource, withError error: NSError) { + // TODO: Handle the error. + print("Error: \(error.description)") + } +} +``` + +### [Get place predictions programmatically](#Get-place-predictions-programmatically) + +You can create a custom search UI as an alternative to the UI provided by the autocomplete widget. To do this, your app must get place predictions programmatically. Your app can get a list of predicted place names and/or addresses by using Mappls's library `MapplsAPIKit`. For more information [Goto](#MapplsAPIKit-SDK). + + +### [MapplsAutocompleteFilter](#MapplsAutocompleteFilter) + +This class represents a set of restrictions that may be applied to autocomplete requests. This allows customization of autocomplete suggestions to only those places that are of interest. + +#### Parameters: + +**origin:** + +A location to use as a hint when looking up the specified address. + +This property prioritizes results that are close to a specific location, which is typically the user’s current location. If the value of this property is nil – which it is by default – no specific location is prioritized. + +**zoom:** + +Zoom level to a location to use as a hint when looking up the specified address. + +**attributions:** + +It allows to get tokenize address in response. By default its value is `false`. If value true is passed then only in response of MapplsAtlasSuggestion addressTokens will be recieved which is of type MapplsAddressTokens + +**resultPlaceType:** + +On basis of this only specific type of Places in response will be returned. + +Its data type is MapplsPodType which is derived from [MapplsAPIKit](#MapplsAPIKit-SDK) + +**searchAreaRestrictions:** + +On basis of this only specific type of response returned. + +This can be set either an object of MapplsMapplsPinFilter or MapplsBoundsFilter. Which are derived from [MapplsAPIKit](#MapplsAPIKit-SDK) + +**country:** + +This is used to bias your search related to country region. Its datatype is MapplsRegionType(from [MapplsAPIKit](#MapplsAPIKit-SDK)). By default it sets to India region only. +Currently supported countries are Sri-Lanka, India, Bhutan, Bangladesh, Nepal. Default is India if none is provided + +### [Favourite Places](#Favourite-Places) + +Favourite or Custom Places can be set to show in result of Autosuggest. + +By default on searching by entering any text favourites will also be filtered. Filtering can be disabled by setting value `false` of global boolean property `IsSearchFavouritesEnabled`. By disabling it means it will always show favourites in results. + +By default maximum two favourites will be shown in results. This can be configured by setting value of property `FavouritesCountToShow`. Its default value is 2. Minimum value can be 0 and maximum can be 10. + +Below is line of code can be used to set favourite places. + +Callback of selected favourite item can be handled using different delegate methods. See [here](##Use-a-table-data-source). + +**Swift** + +```swift +MapplsUIWidgetAutosuggestFavouritePlaces = [ + MapplsUIWidgetAutosuggestFavouritePlace(placeName: "MapmyIndia", placeAdress: "Okhla Phase 3, Delhi", mapplsPin: "mmi000"), + MapplsUIWidgetAutosuggestFavouritePlace(placeName: "India Gate", placeAdress: "Delhi, New Delhi", mapplsPin: "1t182a") + ] + +MapplsUIWidgets.IsSearchFavouritesEnabled = false + +MapplsUIWidgets.FavouritesCountToShow = 5 +``` + +## [Place Picker View](#Place-Picker-View) + + + +
+ +The Place Picker View is a UIView component that allows a user to pick a Place using an interactive map. + +Users can select a location which from center of map after succesfully reverse geocoding that location. + +`PlacePickerView` is class whose instance can be created and can be added to ViewController. Below is sample code to understand: + +**Swift** + +```swift +import UIKit +import MapplsMap +import MapplsUIWidgets + +class PlacePickerViewExampleVC: UIViewController { + var mapView: MapplsMapView! + var placePickerView: PlacePickerView! + + override func viewDidLoad() { + super.viewDidLoad() + mapView = MapplsMapView() + // Do any additional setup after loading the view. + placePickerView = PlacePickerView(frame: self.view.bounds, parentViewController: self, mapView: mapView) + placePickerView.delegate = self + self.view.addSubview(placePickerView) + } +} + +extension PlacePickerViewExampleVC: PlacePickerViewDelegate { + func didFailedReverseGeocode(error: NSError?) { + if let error = error { + // failed for error + } else { + // No results found + } + } + + func didPickedLocation(placemark: MapplsGeocodedPlacemark) { + // Add your code on successfully selecting location from picker view. + } + + func didReverseGeocode(placemark: MapplsGeocodedPlacemark) { + // Add your code on successfully retrieving a new location + } +} +``` + +### [PlacePickerViewDelegate](#PlacePickerViewDelegate) + +As from above sample code `PlacePickerViewDelegate` is a protocol class which provides different delegate methods which can be used according to requirements. + +### [Customize Place Picker](#Customize-Place-Picker) + +On adding instance of `PlacePickerView` it will load a default view with a map marker image on map But default view can be modified with help of some properties which are described as below: + +**markerView:** + +View of marker on map can be ovrriden by using property 'markerView'. This is type of UIView so it can accept custom designed view and UIImageView as well. + +```swift +let customView = UIView(frame: CGRect(x: 0, y: 0, width: 50, height: 200)) +customView.backgroundColor = .red +placePickerView.markerView = customView +``` + +**isMarkerShadowViewHidden:** + +A shadow of marker is shows by defualt on dragging map. Visibility of this shadow can be changed by using property 'isMarkerShadowViewHidden'. + +```swift +placePickerView.isMarkerShadowViewHidden = true +``` + +**searchButtonBackgroundColor:** + +Background color of search button can be changed by using property 'searchButtonBackgroundColor'. + +```swift +placePickerView.searchButtonBackgroundColor = .yellow +``` + +**searchButtonImage:** + +Image of search button can be changed by using property 'searchButtonImage'. + +```swift +placePickerView.searchButtonImage = UIImage(named: "userSearch")! +``` + +**isSearchButtonHidden:** + +Visibility of search button can be changed by using property 'isSearchButtonHidden'. + +```swift +placePickerView.isSearchButtonHidden = true +``` + +**placeNameLabelTextColor:** + +Font color of label of name of place can be changed by using property 'placeNameLabelTextColor'. + +```swift +placePickerView.placeNameLabelTextColor = .blue +``` + +**addressLabelTextColor:** + +Font color of label of address of place can be changed by using property 'addressLabelTextColor'. + +```swift +placePickerView.addressLabelTextColor = .green +``` + +**pickerButtonTitleColor:** + +Font color of titile of button of select a location to pick can be changed by using property 'pickerButtonTitleColor'. + +```swift +placePickerView.pickerButtonTitleColor = .blue +``` + +**pickerButtonBackgroundColor:** + +Background color of button of select a location to pick can be changed by using property 'pickerButtonBackgroundColor'. + +```swift +placePickerView.pickerButtonBackgroundColor = .blue +``` + +**pickerButtonTitle:** + +Title of button of select a location to pick can be changed by using property 'pickerButtonTitle'. + +```swift +placePickerView.pickerButtonTitle = "Pick it" +``` + +**infoLabelTextColor:** + +Font color of label of tip info at bottom can be changed by using property 'infoLabelTextColor'. + +```swift +placePickerView.infoLabelTextColor = .green +``` + +**infoBottomViewBackgroundColor:** + +Background color of container of label of tip info at bottom can be changed by using property 'infoBottomViewBackgroundColor'. + +```swift +placePickerView.infoBottomViewBackgroundColor = .green +``` + +**placeDetailsViewBackgroundColor:** + +Background color of container of location info at bottom can be changed by using property 'placeDetailsViewBackgroundColor'. + +```swift +placePickerView.placeDetailsViewBackgroundColor = .green +``` + +**isBottomInfoViewHidden:** + +Visibility of tip info at bottom can be changed by using property 'isBottomInfoViewHidden'. + +```swift +placePickerView.isBottomInfoViewHidden = true +``` + +**isBottomPlaceDetailViewHidden:** + +Visibility of container of location info at bottom can be changed by using property 'isBottomPlaceDetailViewHidden'. + +```swift +placePickerView.isBottomPlaceDetailViewHidden = true +``` + +**isInitializeWithCustomLocation:** + +Initial location of place picker can be set by setting center of map but it will also required to set value of property 'isInitializeWithCustomLocation' to true. + +```swift +placePickerView.isInitializeWithCustomLocation = true +placePickerView.mapView.setCenter(CLLocationCoordinate2DMake(28.612936, 77.229546), zoomLevel: 15, animated: false) +``` + +## [Autocomplete Attribution Appearance](#Autocomplete-Attribution-Appearance) + +### [MapplsAttributionsSettings](#MapplsAttributionsSettings) + +A class `MapplsAttributionsSettings` is exist which represents a set of settings that can be applied to autocomplete to control appearance (Content Length, Size, Horizontal Content Alignment and Vertical Placement) of attribution. Appearance of attribution on can be controlled by different properties of `MapplsAttributionsSettings`. + +
+ + +#### Parameters: + +**attributionSize:** + +Size of attribution can be controlled by setting different values of this property. It is type of an enum `MapplsContentSize`. Which can be set to `small`, `medium` or `large`. By default it's value is `medium`. + +**attributionHorizontalContentAlignment:** + +Horizontal alignment of content of attribution can be controlled by setting different values of this property. It is type of an enum `MapplsHorizontalContentAlignment`. Which can be set to `left`, `center` or `right`. By default it's value is `center`. + +**attributionVerticalPlacement:** + +Placement (either before or after of autocomplete's results) of attribution can be controlled by setting different values of this property. It is type of an enum `MapplsVerticalPlacement`. Which can be set to `before` or `after`. By default it's value is `before`. + + +A property `attributionSettings` of type `MapplsAttributionsSettings` is exists in each class `MapplsAutocompleteTableDataSource`, `MapplsAutocompleteViewController`, `MapplsAutocompleteResultsViewController` and `PlacePickerView` whose values can be set in different scenarios accordingly. + +Code snippet to configure appearance of attribution in `MapplsAutocompleteViewController` is below: + +```swift +let vc = MapplsAutocompleteViewController() +vc.attributionSettings.attributionSize = .small +vc.attributionSettings.attributionHorizontalContentAlignment = .left +vc.attributionSettings.attributionVerticalPlacement = .after +``` + +Code snippet to configure appearance of attribution of Autocomplete in `PlacePickerView` is below: + +```swift +placePickerView = PlacePickerView(frame: self.view.bounds, parentViewController: self, mapView: mapView) + +let attributionSettings = MapplsAttributionsSettings() +attributionSettings.attributionSize = .small +attributionSettings.attributionHorizontalContentAlignment = .left +attributionSettings.attributionVerticalPlacement = .after + +placePickerView.autocompleteAttributionSettings = attributionSettings +``` + +


+ +## Our many happy customers: + +![](https://www.mapmyindia.com/api/img/logos1/PhonePe.png)![](https://www.mapmyindia.com/api/img/logos1/Arya-Omnitalk.png)![](https://www.mapmyindia.com/api/img/logos1/delhivery.png)![](https://www.mapmyindia.com/api/img/logos1/hdfc.png)![](https://www.mapmyindia.com/api/img/logos1/TVS.png)![](https://www.mapmyindia.com/api/img/logos1/Paytm.png)![](https://www.mapmyindia.com/api/img/logos1/FastTrackz.png)![](https://www.mapmyindia.com/api/img/logos1/ICICI-Pru.png)![](https://www.mapmyindia.com/api/img/logos1/LeanBox.png)![](https://www.mapmyindia.com/api/img/logos1/MFS.png)![](https://www.mapmyindia.com/api/img/logos1/TTSL.png)![](https://www.mapmyindia.com/api/img/logos1/Novire.png)![](https://www.mapmyindia.com/api/img/logos1/OLX.png)![](https://www.mapmyindia.com/api/img/logos1/sun-telematics.png)![](https://www.mapmyindia.com/api/img/logos1/Sensel.png)![](https://www.mapmyindia.com/api/img/logos1/TATA-MOTORS.png)![](https://www.mapmyindia.com/api/img/logos1/Wipro.png)![](https://www.mapmyindia.com/api/img/logos1/Xamarin.png) + +
+ +For any queries and support, please contact: + +[

](https://about.mappls.com/api/) + +Email us at [apisupport@mappls.com](mailto:apisupport@mappls.com) + +![](https://www.mapmyindia.com/api/img/icons/support.png) +[Support](https://about.mappls.com/contact/) +Need support? contact us! + +

+ +[

](https://stackoverflow.com/questions/tagged/mappls-api)[![](https://www.mapmyindia.com/api/img/icons/blog.png)](https://about.mappls.com/blog/)[![](https://www.mapmyindia.com/api/img/icons/gethub.png)](https://github.com/mappls-api)[

](https://www.npmjs.com/org/mapmyindia) + +[

](https://www.facebook.com/Mapplsofficial)[![](https://www.mapmyindia.com/june-newsletter/icon2.png)](https://twitter.com/mappls)[![](https://www.mapmyindia.com/newsletter/2017/aug/llinkedin.png)](https://www.linkedin.com/company/mappls/)[![](https://www.mapmyindia.com/june-newsletter/icon3.png)](https://www.youtube.com/channel/UCAWvWsh-dZLLeUU7_J9HiOA) + +

@ Copyright 2022 CE Info Systems Pvt. Ltd. All Rights Reserved.
+ +
Terms & Conditions | Privacy Policy | Supplier Sustainability Policy | Health & Safety Policy | Environmental Policy & CSR Report + +
Customer Care: +91-9999333223
diff --git a/docs/v1.0.13/Predictive-Route-APIs.md b/docs/v1.0.13/Predictive-Route-APIs.md new file mode 100644 index 0000000..5181231 --- /dev/null +++ b/docs/v1.0.13/Predictive-Route-APIs.md @@ -0,0 +1,383 @@ +[

](https://www.mapmyindia.com/api) + +# Predictive Routing APIs + +## [Predictive Routing API]() + +Calculate optimal routes between two or more specified locations. Support live and predictive traffic to calculate ETAs based on arrival or departure time. +#### Swift +``` +let origin = Waypoint(mapplsPin: "mmi000", name: "Mappls") +let destination = Waypoint(mapplsPin: "1t182a", name: "") +let viaPoint = Waypoint(mapplsPin: "arhmo0", name: "") + +let allWaypoints = [origin] + [viaPoint] + [destination] + +let options = MapplsPredictiveRouteOptions(waypoints: allWaypoints) +options.alternativeRouteCount = 2 +options.profileIdentifier = .driving +options.vehicleDetails = MapplsVehicleDetails() +MapplsPredictiveDirections.shared.calculate(options) { waypoints, response, error in + if let _ = error { + return + } + guard let response = response, let trip = response.trip else { + self.footerViewLabel.text = "No routes found for this route." + self.footerViewButton.isHidden = true + return + } + + var allRoutes: [MapplsPredictiveRouteTrip] = [trip] + if let alternates = response.alternates { + allRoutes.append(contentsOf: alternates.compactMap { $0.trip }) + } +} + ``` + +### Request Parameters +#### Mandatory Parameter +1. `waypoints`: Array of points (type of `Waypoint`) to calculate route where the first object will be treated as origin, last will be as destination point and all other middle ones will be via points. + - Waypoint can take *mappls pin* in parameter eg., `Waypoint(mapplsPin: "mmi000", name: "Mappls")` +#### Optional Parameter +1. `profileIdentifier`: Profile for routing engine. It is type of enum `MapplsDirectionsProfileIdentifier`. Available values are driving, biking, trucking, walking. Default is driving. +2. `speedTypes`: To specify the type of speed. It is type of protocol class `MapplsRouteSpeedType`. Instance of `MapplsRouteSpeedTypeOptimal` or `MapplsRouteSpeedTypeTraffic` or `MapplsRouteSpeedTypePredictive` can be set which are inherited from `MapplsRouteSpeedType`. + + - `MapplsRouteSpeedTypePredictive`: It takes value of type of protocol `MapplsRouteSpeedDateTime`. Instance of `MapplsRouteSpeedDateTimeCurrent` or `MapplsRouteSpeedDateTimeSpecified` can used to create instance of `MapplsRouteSpeedTypePredictive`. + +3. `headingFromSource`: It is type of integer. Preferred direction of travel for the start from the location. This can be useful for mobile routing where a vehicle is traveling in a specific direction along a road, and the route should start in that direction. The heading is indicated in degrees from north in a clockwise direction, where north is 0°, east is 90°, south is 180°, and west is 270°. It will take positive integer value only. Default value is -1. +4. `headingToleranceFromSource`: It is type of integer. How close in degrees a given street's angle must be in order for it to be considered as in the same direction of the heading parameter. The default value is 60 degrees if not set. +5. `preferredSide(MapplsRoutePreferredSide)`: It takes value of type of enum `MapplsRoutePreferredSide`. Available values are same, opposite and either. If the location is not offset from the road centerline or is closest to an intersection this option has no effect. Otherwise the determined side of street is used to determine whether or not the location should be visited from the same, opposite or either side of the road with respect to the side of the road the given locale drives on. In Germany (driving on the right side of the road), passing a value of same will only allow you to leave from or arrive at a location such that the location will be on your right. In Australia (driving on the left side of the road), passing a value of same will force the location to be on your left. A value of opposite will enforce arriving/departing from a location on the opposite side of the road from that which you would be driving on while a value of either will make no attempt limit the side of street that is available for the route. +6. `searchCutoff`: It is type of integer. The cutoff at which we will assume the input is too far away from civilisation to be worth correlating to the nearest graph elements. It will take positive integer value only. Default value is -1. +7. `avoidLocations`: It is type of array of `CLLocation`. It descibes as set of locations to exclude or avoid within a route can be specified using a JSON array of avoid_locations. The avoid_locations have the same format as the locations list. At a minimum each avoid location must include latitude and longitude. The avoid_locations are mapped to the closest road or roads and these roads are excluded from the route path computation.Any route formed on the avoid_locations will return an alternative route and if no alternative is found then "no route" is returned. +8. `avoidPolygons`: It is type of array of array of `CLLocation`. Where each array of `CLLocation` will be considered as One Polygon e.g. [[[lon1, lat1], [lon2,lat2]],[[lon1,lat1],[lon2,lat2]]]. Roads intersecting these rings will be avoided during path finding. If you only need to avoid a few specific roads, it's much more efficient to use avoid_locations. API will close open rings (i.e. copy the first coordinate to the last position). +9. `routeName`: It is type of string. Name your route request. If it is specified, it will be part of response as property `routeName`. +10. `useFerry`: It is type of Double. This value indicates the willingness to take ferries. This is a range of values between 0 and 1. Values near 0 attempt to avoid ferries and values near 1 will favor ferries. The default value is 0.5. Note that sometimes ferries are required to complete a route so values of 0 are not guaranteed to avoid ferries entirely. +11. `useHighways`: It is type of Double. This value indicates the willingness to take highways. This is a range of values between 0 and 1. Values near 0 attempt to avoid highways and values near 1 will favor highways. The default value is 1.0. Note that sometimes highways are required to complete a route so values of 0 are not guaranteed to avoid highways entirely. +12. `excludeTunnels`: It is type of Bool. It describes whether to exclude roads marked as tunnels. +13. `excludeBridges`: It is type of Bool. It describes whether to exclude roads marked as bridges. +14. `avoidTolls`: It is type of Bool. It describes whether to exclude roads contains tolls. +15. `alternativeRouteCount`: It is type of integer. A number denoting how many alternate routes should be provided. There may be no alternates or less alternates than the user specifies. Alternates are not yet supported on multipoint routes (that is, routes with more than 2 locations). + +**There are some Additional properties whose value will only be considered in case of value of `profileIdentifier` is trucking:** + +16. `vehicleDetails`: It is type of `MapplsVehicleDetails`. `MapplsVehicleDetails` have following properties + + - height - It is type of double. It will be consdered as height of the vehicle (in meters). + - width(Double) - It is type of double. It will be consdered as width of the vehicle (in meters). + - length(Double) - It is type of double. It will be consdered as length of the vehicle (in meters). . Default is 21.64. + - weight(Double) - It is type of double. It will be consdered as weight of the vehicle (in metric tons). Default is 21.77. + - axleLoad(Double) - It is type of double. It will be consdered as axle load of the vehicle (in metric tons). Default is 9.07. + - hazmat - It is type of Bool. A value indicating if the truck is carrying hazardous materials. Default false. + +### Response Code (as HTTP response code) +#### Success: +1. 200: To denote a successful API call. +2. 204: To denote the API was a success but no results were found. +#### Client side issues: +1. 400: Bad Request, User made an error while creating a valid request. +2. 401: Unauthorized, Developer’s key is not allowed to send a request with restricted parameters. +3. 403: Forbidden, Developer’s key has hit its daily/hourly limit. +#### Server-Side Issues: +1. 500: Internal Server Error, the request caused an error in our systems. +2. 503: Service Unavailable, during our maintenance break or server downtimes. + +### Response Messages (as HTTP response message) +1. 200: Success. +2. 204: No matches were found for the provided query. +3. 400: Something’s just not right with the request. +4. 401: Access Denied. +5. 403: Services for this key has been suspended due to daily/hourly transactions limit. +6. 500: Something went wrong. +7. 503: Maintenance Break. +### Response Parameters +1. `trip(PredictiveDirectionsTrip)` : he route results are returned as a trip. This is a JSON object that contains details about the trip, including locations, a summary with basic information about the entire trip, and a list of legs. +2. `id(String)`: Name your route request. If id is specified, the naming will be sent thru to the response. +3. `alternates(List)`: Array of PredictiveDirectionsTrip objects representing all alternative routes + +#### PredictiveDirectionsTrip Response result parameters +1. `summary(PredictiveDirectionSummary)`: Summary of the route +2. `statusMessage(String)`: description of the status (e.g. "Found route between points") +3. `legs(List)`: array of route object. +4. `locations(List)`: array of location objects. +5. `language(String)`: "en-US" +6. `units(String)`: unit of distance(e.g. "kilometers") + +#### PredictiveDirectionSummary Response result parameters +1. `minimumLongitude(Double)`: Minimum latitude of a bounding box containing the route. +2. `maximumLatitude(Double)`: Maximum latitude of a bounding box containing the route. +3. `maximumLongitude(Double)`: Maximum longitude of a bounding box containing the route. +4. `length(Double)`: Distance traveled for the entire trip. Units are kilometers +5. `time(Double)`: Estimated elapsed time to complete the trip. +6. `minimumLatitude(Double)`: Minimum latitude of a bounding box containing the route. + +#### PredictiveDirectionsLeg Response result parameters +1. `summary(PredictiveDirectionSummary)`: Summary of the route +2. `shape(String)`: geometry of the route. +3. `maneuvers(List)`: array of maneuver object + +#### PredictiveDirectionManeuver result parameters +1. `verbalMultiCue(Boolean)`: True if the verbal_pre_transition_instruction has been appended with the verbal instruction of the next maneuver. +2. `beginShapeIndex(Integer)`: Index into the list of shape points for the start of the maneuver. +3. `travelMode(String)`: Travel mode "drive" & "pedestrian" +4. `instruction(String)`: Written maneuver instruction. Describes the maneuver, such as "Turn right onto Main Street". +5. `length(Double)`: Maneuver length in the units specified. +6. `endShapeIndex(integer)`: Index into the list of shape points for the end of the maneuver. +7. `verbalPostTransitionInstruction(String)`: - Text suitable for use as a verbal message immediately after the maneuver transition. For example "Continue for 100 meters". +8. `time(Double)`: Estimated time along the maneuver in seconds. +9. `type(Integer)`: Type of maneuver. See below for a list. + - kNone = 0; + - kStart = 1; + - kStartRight = 2; + - kStartLeft = 3; + - kDestination = 4; + - kDestinationRight = 5; + - kDestinationLeft = 6; + - kBecomes = 7; + - kContinue = 8; + - kSlightRight = 9; + - kRight = 10; + - kSharpRight = 11; + - kUturnRight = 12; + - kUturnLeft = 13; + - kSharpLeft = 14; + - kLeft = 15; + - kSlightLeft = 16; + - kRampStraight = 17; + - kRampRight = 18; + - kRampLeft = 19; + - kExitRight = 20; + - kExitLeft = 21; + - kStayStraight = 22; + - kStayRight = 23; + - kStayLeft = 24; + - kMerge = 25; + - kRoundaboutEnter = 26; + - kRoundaboutExit = 27; + - kFerryEnter = 28; + - kFerryExit = 29; + - kTransit = 30; + - kTransitTransfer = 31; + - kTransitRemainOn = 32; + - kTransitConnectionStart = 33; + - kTransitConnectionTransfer = 34; + - kTransitConnectionDestination = 35; + - kPostTransitConnectionDestination = 36; + - kMergeRight = 37; + - kMergeLeft = 38; +10. `verbalPreTransitionInstruction(String)`: Text suitable for use as a verbal message immediately prior to the maneuver transition. For example "Walk west". +11. `travelType(String)`: Travel type for driving "car", Travel type for biking "motorcycle", Travel type for trucking "tractor_trailer", Travel type for walking "foot" +12. `roundaboutExitCount(Integer)`: The spoke to exit roundabout after entering. +13. `sign(String)`: Contains the interchange guide information at a road junction associated with this maneuver. See below for details. +- exit_number_elements +- exit_branch_elements +- exit_toward_elements +- exit_name_elements +14. `verbalTransitionAlertInstruction(String)`: Text suitable for use as a verbal alert in a navigation application. The transition alert instruction will prepare the user for the forthcoming transition. For example: "Turn right". +15. `streetNames(List`: List of street names that are consistent along the entire nonobvious maneuver. + +#### PredictiveDirectionLocation Response result parameter +1. `originalIndex(Integer)` +2. `city(String)` +3. `longitude(Double)` +4. `type(String)` +5. `latitude(Double)` + +## [Predictive Distance]() + +This service computes time and distance between a set of locations and returns them to you in the resulting matrix table. + +The distance can return a row matrix, a column matrix, or a general matrix of computed time and distance, depending on your input for the source and target parameters. The general case is a row ordered matrix with the time and distance from each source location to each target location. A row vector is considered a one_to_many distance-time matrix where there is one source location and multiple target locations, time and distance from the source location to all target locations is returned. A column matrix represents a many_to_one distance-time matrix where there are many sources and one target. Another special case is when the source location list is the same as the target location list. API also supports many_to_many distance-time matrix, this special case is often used as the input to optimized routing problems. + +#### Java +~~~java +MapplsPredictiveDistance mapplsPredictiveDistance = MapplsPredictiveDistance.builder() + .addSource(source) + .addDestination(destination) + .build(); +MapplsPredictiveDistanceManager.newInstance(mapplsPredictiveDistance).call(new OnResponseCallback() { + @Override + public void onSuccess(PredictiveDistanceResponse response) { + //Handle Response + } + @Override + public void onError(int code, String message) { + //Handle Error + } +}); + ~~~ +#### Kotlin +~~~kotlin +val mapplsPredictiveDistance = v.builder() + .addSource(source) + .addDestination(destination) + .build() +MapplsPredictiveDistanceManager.newInstance(mapplsPredictiveDistance).call(object : OnResponseCallback { + + override fun onSuccess(response: PredictiveDistanceResponse) { + //handle response + } + override fun onError(code: Int, message: String) { + //handle Error +} }) +~~~ +### Request Parameter +#### Manadatory Parameter + +1. `sources(List)`: A List full of Points which define sources. +2. `addSource(Point)`: To pass single source at a time + - coordinate can also takes mapplsPin eg., `addSource("MMI000")` +3. `sourceList(List)`: To pass the full list of mappls pins +4. `destinations(List)`: A List full of Points which define targets. +5. `addDestination(Point)`: To pass single target at a time + - coordinate can also takes mapplsPin eg., `addDestination("MMI000")` +6. `destinationList(List)`: To pass the full list of mappls pins +#### Optional Parameter +1. `profile(String)`: Profile for routing engine. **Below are the available profile:** + - `PredictiveDistanceCriteria.PROFILE_DRIVING` **(Default)**:Meant for car routing + - `PredictiveDistanceCriteria.PROFILE_BIKING`:Meant for two-wheeler routing. + - `PredictiveDistanceCriteria.PROFILE_WALKING`: Meant for pedestrian and hiking routing. This profile shows the shortest path by using sidewalks and trails. + - `PredictiveDistanceCriteria.PROFILE_TRUCKING`: Meant for Truck routing. +2. `speedType(MapplsDirectionSpeedType)`: To specify the type of speed. **Below are the available speed types:** + - `new MapplsDirectionSpeedTypeOptimal()`**(Default)** + - `new MapplsDirectionSpeedTypeTraffic()` + - `new MapplsDirectionSpeedTypePredictive(MapplsDirectionDateTime)` + _If value is predictive then date and time are required at the location and if value is optimal then date and time are not required._ + + - `new MapplsDirectionDateTimeCurrent()`: Current departure time. + - `new MapplsDirectionDateTimeSpecified(PredictiveDirectionsCriteria.SPECIFIED_DEPARTURE, timeInMillis)`: Specified departure time. + - `new MapplsDirectionDateTimeSpecified(PredictiveDirectionsCriteria.SPECIFIED_ARRIVAL, timeInMillis)`: Specified arrival time. + +### Response Code (as HTTP response code) +#### Success: +1. 200: To denote a successful API call. +2. 204: To denote the API was a success but no results were found. +#### Client side issues: +1. 400: Bad Request, User made an error while creating a valid request. +2. 401: Unauthorized, Developer’s key is not allowed to send a request with restricted parameters. +3. 403: Forbidden, Developer’s key has hit its daily/hourly limit. +#### Server-Side Issues: +1. 500: Internal Server Error, the request caused an error in our systems. +2. 503: Service Unavailable, during our maintenance break or server downtimes. + +### Response Messages (as HTTP response message) +1. 200: Success. +2. 204: No matches were found for the provided query. +3. 400: Something’s just not right with the request. +4. 401: Access Denied. +5. 403: Services for this key has been suspended due to daily/hourly transactions limit. +6. 500: Something went wrong. +7. 503: Maintenance Break. + +### Response Parameters +1. `trip`: It is type of `MapplsPredictiveRouteTrip`. The route results are returned as a trip. This is a object of type `MapplsPredictiveRouteTrip` that contains details about the trip, including locations, a summary with basic information about the entire trip, and a list of legs. +2. `alternates`: It is type of array of `MapplsPredictiveRouteAlternate`. Array of PredictiveDirectionsTrip objects representing all alternative routes. + + +#### MapplsPredictiveRouteTrip + +- `language`: It is type of string. eg. "en-US" +- `legs`: It is type of array of `MapplsPredictiveRouteLeg`. It will contain information about route. +- `locations`: It is type of array of `MapplsPredictiveRouteLocationInfo`. +- `status`: It is type of integer. +- `statusMessage`: It is type of string. Description of the status (e.g. "Found route between points") +- `summary`: It is type of `MapplsPredictiveRouteSummary`. It will describe summary of the route +- `units`: It is type of string. It is unit of distance(e.g. "kilometers") + +#### MapplsPredictiveRouteSummary + +- `minLat`: It is type of double. Minimum latitude of a bounding box containing the route. +- `minLon`: It is type of double. Minimum longitude of a bounding box containing the route. +- `maxLat`: It is type of double. Maximum latitude of a bounding box containing the route. +- `maxLon`: It is type of double. Maximum longitude of a bounding box containing the route. +- `length`: It is type of double. Distance traveled for the entire trip. Units are kilometers +- `time`: It is type of double. Estimated elapsed time to complete the trip. + +#### MapplsPredictiveRouteLeg + +- `summary`: It is type of `MapplsPredictiveRouteSummary`. It will describe summary of the route +- `shape`: It is type of string. It if geometry of the route. +- `maneuvers`: It is type of array of `MapplsPredictiveRouteManeuver`. + +#### MapplsPredictiveRouteManeuver + +- `beginShapeIndex`: It is type of integer. Index into the list of shape points for the start of the maneuver. +- `endShapeIndex`: It is type of integer. Index into the list of shape points for the end of the maneuver. +- `instruction`: It is type of string. Written maneuver instruction. Describes the maneuver, such as "Turn right onto Main Street". +- `length`: It is type of double. Maneuver length in the units specified. +- `streetNames`: It is type of array of string. List of street names that are consistent along the entire nonobvious maneuver. +- `time`: It is type of double. Estimated time along the maneuver in seconds. +- `travelMode`: It is type of string. Travel mode "drive" & "pedestrian". +- `travelType`: It is type of string. Travel type for driving "car", Travel type for biking "motorcycle", Travel type for trucking "tractor_trailer", Travel type for walking "foot" +- `type`: It is type of integer. Type of maneuver. See below for a list. + - kNone = 0; + - kStart = 1; + - kStartRight = 2; + - kStartLeft = 3; + - kDestination = 4; + - kDestinationRight = 5; + - kDestinationLeft = 6; + - kBecomes = 7; + - kContinue = 8; + - kSlightRight = 9; + - kRight = 10; + - kSharpRight = 11; + - kUturnRight = 12; + - kUturnLeft = 13; + - kSharpLeft = 14; + - kLeft = 15; + - kSlightLeft = 16; + - kRampStraight = 17; + - kRampRight = 18; + - kRampLeft = 19; + - kExitRight = 20; + - kExitLeft = 21; + - kStayStraight = 22; + - kStayRight = 23; + - kStayLeft = 24; + - kMerge = 25; + - kRoundaboutEnter = 26; + - kRoundaboutExit = 27; + - kFerryEnter = 28; + - kFerryExit = 29; + - kTransit = 30; + - kTransitTransfer = 31; + - kTransitRemainOn = 32; + - kTransitConnectionStart = 33; + - kTransitConnectionTransfer = 34; + - kTransitConnectionDestination = 35; + - kPostTransitConnectionDestination = 36; + - kMergeRight = 37; + - kMergeLeft = 38; + +- `verbalPreTransitionInstruction`: It is type of string. Text suitable for use as a verbal message immediately prior to the maneuver transition. For example "Walk west". +- `verbalPostTransitionInstruction`: It is type of string. Text suitable for use as a verbal message immediately after the maneuver transition. For example "Continue for 100 meters". + +


+ +## Our many happy customers: + +![](https://www.mapmyindia.com/api/img/logos1/PhonePe.png)![](https://www.mapmyindia.com/api/img/logos1/Arya-Omnitalk.png)![](https://www.mapmyindia.com/api/img/logos1/delhivery.png)![](https://www.mapmyindia.com/api/img/logos1/hdfc.png)![](https://www.mapmyindia.com/api/img/logos1/TVS.png)![](https://www.mapmyindia.com/api/img/logos1/Paytm.png)![](https://www.mapmyindia.com/api/img/logos1/FastTrackz.png)![](https://www.mapmyindia.com/api/img/logos1/ICICI-Pru.png)![](https://www.mapmyindia.com/api/img/logos1/LeanBox.png)![](https://www.mapmyindia.com/api/img/logos1/MFS.png)![](https://www.mapmyindia.com/api/img/logos1/TTSL.png)![](https://www.mapmyindia.com/api/img/logos1/Novire.png)![](https://www.mapmyindia.com/api/img/logos1/OLX.png)![](https://www.mapmyindia.com/api/img/logos1/sun-telematics.png)![](https://www.mapmyindia.com/api/img/logos1/Sensel.png)![](https://www.mapmyindia.com/api/img/logos1/TATA-MOTORS.png)![](https://www.mapmyindia.com/api/img/logos1/Wipro.png)![](https://www.mapmyindia.com/api/img/logos1/Xamarin.png) + +
+ +For any queries and support, please contact: + +[

](https://about.mappls.com/api/) + +Email us at [apisupport@mappls.com](mailto:apisupport@mappls.com) + +![](https://www.mapmyindia.com/api/img/icons/support.png) +[Support](https://about.mappls.com/contact/) +Need support? contact us! + +

+ +[

](https://stackoverflow.com/questions/tagged/mappls-api)[![](https://www.mapmyindia.com/api/img/icons/blog.png)](https://about.mappls.com/blog/)[![](https://www.mapmyindia.com/api/img/icons/gethub.png)](https://github.com/mappls-api)[

](https://www.npmjs.com/org/mapmyindia) + +[

](https://www.facebook.com/Mapplsofficial)[![](https://www.mapmyindia.com/june-newsletter/icon2.png)](https://twitter.com/mappls)[![](https://www.mapmyindia.com/newsletter/2017/aug/llinkedin.png)](https://www.linkedin.com/company/mappls/)[![](https://www.mapmyindia.com/june-newsletter/icon3.png)](https://www.youtube.com/channel/UCAWvWsh-dZLLeUU7_J9HiOA) + +

@ Copyright 2022 CE Info Systems Pvt. Ltd. All Rights Reserved.
+ +
Terms & Conditions | Privacy Policy | Supplier Sustainability Policy | Health & Safety Policy | Environmental Policy & CSR Report + +
Customer Care: +91-9999333223
diff --git a/docs/v1.0.13/README.md b/docs/v1.0.13/README.md new file mode 100644 index 0000000..8a6b0a6 --- /dev/null +++ b/docs/v1.0.13/README.md @@ -0,0 +1,135 @@ +[

](https://www.mapmyindia.com/api) + +# Mappls iOS SDK +Explore the largest directory of APIs & SDKs for maps, routes and search. + +`MAPPLS` will be there in every step of the way, building new tools that help you navigate, explore and get things done, wherever you are and users can touch or interact with map features clearly overlaid on your view of the world. + +Our APIs, SDKs, and live updating map data available for [200+ nations and territories](https://github.com/MapmyIndia/mapmyindia-rest-api/blob/master/docs/countryISO.md) give developer-friendly, easy-to-integrate plugins to add capabilities like intelligent +search and routes on map, to your web or mobile applications. + +You can get your api key to be used in this document here: [https://apis.mappls.com/console/](https://apis.mappls.com/console/) + +## [Documentation History](#Documentation-History) + +| Version | Supported SDK Version | +| ------- | --------------------- | +| [v1.0.13](README.md) | - [MapplsAPICore - 1.0.7](MapplsAPICore.md)
- [MapplsAPIKit - 2.0.16](MapplsAPIKit.md)
- [MappplsMap - 5.13.9](MapplsMap.md#Vector-iOS-Map)
- [MapplsUIWidget - 1.0.3](MapplsUIWidgets.md)
- [MapplsNearbyUI - 1.0.0](MapplsNearbyUI.md)
- [MapplsDirectionUI - 1.0.4](MapplsDirectionUI.md)
- [MapplsGeoanalytics - 1.0.0](MapplsGeoanalytics.md)
- [MapplsFeedbackKit - 1.0.0](MapplsFeedbackKit.md)
- [MapplsFeedbackUIKit - 1.0.0](MapplsFeedbackUIKit.md)
- [MapplsDrivingRangePlugin - 1.0.2](MapplsDrivingRangePlugin.md)
- [MapplsAnnotationExtension - 1.0.0](MapplsAnnotationExtension.md)
- [MapplsGeofenceUI - 1.0.1](MapplsGeofenceUI.md)
- [MapplsRasterCatalogue - 0.1.0](RasterCatalouge.md)
- [MapplsIntouch - 1.0.1](MapplsIntouch.md)| +| [v1.0.12](./docs/v1.0.12/README.md) | - [MapplsAPICore - 1.0.7](./docs/v1.0.12/MapplsAPICore.md)
- [MapplsAPIKit - 2.0.15](./docs/v1.0.12/MapplsAPIKit.md)
- [MappplsMap - 5.13.9](./docs/v1.0.12/MapplsMap.md#Vector-iOS-Map)
- [MapplsUIWidget - 1.0.3](./docs/v1.0.12/MapplsUIWidgets.md)
- [MapplsNearbyUI - 1.0.0](./docs/v1.0.12/MapplsNearbyUI.md)
- [MapplsDirectionUI - 1.0.4](./docs/v1.0.12/MapplsDirectionUI.md)
- [MapplsGeoanalytics - 1.0.0](./docs/v1.0.12/MapplsGeoanalytics.md)
- [MapplsFeedbackKit - 1.0.0](./docs/v1.0.12/MapplsFeedbackKit.md)
- [MapplsFeedbackUIKit - 1.0.0](./docs/v1.0.12/MapplsFeedbackUIKit.md)
- [MapplsDrivingRangePlugin - 1.0.1](./docs/v1.0.12/MapplsDrivingRangePlugin.md)
- [MapplsAnnotationExtension - 1.0.0](./docs/v1.0.12/MapplsAnnotationExtension.md)
- [MapplsGeofenceUI - 1.0.1](./docs/v1.0.12/MapplsGeofenceUI.md)
- [MapplsRasterCatalogue - 0.1.0](./docs/v1.0.12/RasterCatalouge.md)
- [MapplsIntouch - 1.0.1](./docs/v1.0.12/MapplsIntouch.md)| + +For More History Go Here: [Version History](../../Version-History.md) + +Reference to the documentation of Previous SDK versions [here](https://github.com/mappls-api/mapmyindia-maps-vectorSDK-iOS) + +## [Table Of Content](#Table-Of-Content) +- [Mappls API Core](MapplsAPICore.md)[](#Mappls-API-Core) + +- [Mappls API Kit](MapplsAPIKit.md) + * [Autosuggest API](MapplsAPIKit.md#Autosuggest-API) + * [Reverse Geocode API](MapplsAPIKit.md#Reverse-Geocoding-API) + * [Nearby API](MapplsAPIKit.md#Nearby-API) + * [Place Detail](MapplsAPIKit.md#Place-Detail) + * [Geocode API](MapplsAPIKit.md#Geocoding-API) + * [Routing API](MapplsAPIKit.md#Routing-API) + * [Driving Distance - Time Matrix API](MapplsAPIKit.md#Driving-Distance-Time-Matrix-API) + * [POI Along The Route](MapplsAPIKit.md#POI-Along-The-Route-API) + * [Nearby Reports API](MapplsAPIKit.md#Nearby-Reports-API) + * [Current Weather Condition API](MapplsAPIKit.md#Current-Weather-Condition-API) + * [Trip Cost Estimation API](MapplsAPIKit.md#Trip-Cost-Estimation-API) + +- [Set Country Regions](Regions.md) + - [Country List](https://github.com/mappls-api/mapmyindia-rest-api/blob/master/docs/countryISO.md) + +- [Mappls Map](MapplsMap.md#Vector-iOS-Map) + * [Getting Started](MapplsMap.md#Getting-Started) + * [Setup your Project](MapplsMap.md#Setup-your-Project) + * [Usage](MapplsMap.md#Usage) + * [Add a Mappls Map View](MapplsMap.md#Add-a-Mappls-Map-View) + * [SwiftUI](MapplsMap.md#SwiftUI) + * [Map Interactions](MapplsMap.md#Map-Interactions) + * [Map Features](MapplsMap.md#Map-Features) + * [Map Events](MapplsMap.md#Map-Events) + * [Map Overlays](MapplsMap.md#Map-Overlays) + * [Polylines](MapplsMap.md#Polylines) + * [Polygons](MapplsMap.md#Polygons) + * [Map Camera](MapplsMap.md#Map-Camera) + * [Miscellaneous](MapplsMap.md#Miscellaneous) + * [Cluster Based Authentication](MapplsMap.md#Cluster-Based-Authentication) + +- [Mappls Pin Strategy - Mappls Map](MapplsPinStrategy.md) + +- [Mappls Map Styles - Mappls Map](MapplsMapStyle.md) + +- [Interactive Layers - Mappls Map](InteractiveLayers.md) + +- [Traffic Vector Tiles Overlay - Mappls Map](MapplsTrafficVectorTileOverlay.md) + +- [Mappls UI Widgets](MapplsUIWidgets.md) + - [Introduction](MapplsUIWidgets.md#Introduction) + - [Installation](MapplsUIWidgets.md#Installation) + - [Version History](MapplsUIWidgets.md#Version-History) + - [Autocomplete](MapplsUIWidgets.md#Autocomplete) + - [SwiftUI](MapplsUIWidgets.md#SwiftUI-Full-Screen-Control) + - [Place Picker View](MapplsUIWidgets.md#Place-Picker-View) + - [Autocomplete Attribution Appearance](MapplsUIWidgets.md#Autocomplete-Attribution-Appearance) + +- [Mappls Nearby UI](MapplsNearbyUI.md) + - [Introduction](MapplsNearbyUI.md#Introduction) + - [Installation](MapplsNearbyUI.md#Installation) + - [Version History](MapplsNearbyUI.md#Version-History) + - [Launching with default configuration](MapplsNearbyUI.md#Launching-with-default-configuration) + - [MapplsNearbyCategoriesViewControllerDelegate](MapplsNearbyUI.md#MapplsNearbyCategoriesViewControllerDelegate) + +- [Mappls Direction UI Widget](MapplsDirectionUI.md) + - [Introduction](MapplsDirectionUI.md#Introduction) + - [Installation](MapplsDirectionUI.md#Installation) + - [Version History](MapplsDirectionUI.md#Version-History) + - [Usage](MapplsDirectionUI.md#Usage) + - [MapplsDirectionsViewController](MapplsDirectionUI.md#MapplsDirectionsViewController) + +- [Mappls Geoanalytics](MapplsGeoanalytics.md) + +- [Mappls Feedback Kit](MapplsFeedbackKit.md) + +- [Mappls Feedback UI Kit](MapplsFeedbackUIKit.md) + +- [Mappls Raster Catalogue Plugin](RasterCatalouge.md) + +- [Mappls Driving Range plugin](MapplsDrivingRangePlugin.md) + - [Introduction](MapplsDrivingRangePlugin.md#Introduction) + - [Installation](MapplsDrivingRangePlugin.md#Installation) + - [Version History](MapplsDrivingRangePlugin.md#Version-History) + +- [Mappls Annotation Extension](MapplsAnnotationExtension.md) + +- [Mappls Geofence UI Plugin](MapplsGeofenceUI.md) + +


+ +## Our many happy customers: + +![](https://www.mapmyindia.com/api/img/logos1/PhonePe.png)![](https://www.mapmyindia.com/api/img/logos1/Arya-Omnitalk.png)![](https://www.mapmyindia.com/api/img/logos1/delhivery.png)![](https://www.mapmyindia.com/api/img/logos1/hdfc.png)![](https://www.mapmyindia.com/api/img/logos1/TVS.png)![](https://www.mapmyindia.com/api/img/logos1/Paytm.png)![](https://www.mapmyindia.com/api/img/logos1/FastTrackz.png)![](https://www.mapmyindia.com/api/img/logos1/ICICI-Pru.png)![](https://www.mapmyindia.com/api/img/logos1/LeanBox.png)![](https://www.mapmyindia.com/api/img/logos1/MFS.png)![](https://www.mapmyindia.com/api/img/logos1/TTSL.png)![](https://www.mapmyindia.com/api/img/logos1/Novire.png)![](https://www.mapmyindia.com/api/img/logos1/OLX.png)![](https://www.mapmyindia.com/api/img/logos1/sun-telematics.png)![](https://www.mapmyindia.com/api/img/logos1/Sensel.png)![](https://www.mapmyindia.com/api/img/logos1/TATA-MOTORS.png)![](https://www.mapmyindia.com/api/img/logos1/Wipro.png)![](https://www.mapmyindia.com/api/img/logos1/Xamarin.png) + +
+ +For any queries and support, please contact: + +[

](https://about.mappls.com/api/) + +Email us at [apisupport@mappls.com](mailto:apisupport@mappls.com) + +![](https://www.mapmyindia.com/api/img/icons/support.png) +[Support](https://about.mappls.com/contact/) +Need support? contact us! + +

+ +[

](https://stackoverflow.com/questions/tagged/mappls-api)[![](https://www.mapmyindia.com/api/img/icons/blog.png)](https://about.mappls.com/blog/)[![](https://www.mapmyindia.com/api/img/icons/gethub.png)](https://github.com/mappls-api)[

](https://www.npmjs.com/org/mapmyindia) + +[

](https://www.facebook.com/Mapplsofficial)[![](https://www.mapmyindia.com/june-newsletter/icon2.png)](https://twitter.com/mappls)[![](https://www.mapmyindia.com/newsletter/2017/aug/llinkedin.png)](https://www.linkedin.com/company/mappls/)[![](https://www.mapmyindia.com/june-newsletter/icon3.png)](https://www.youtube.com/channel/UCAWvWsh-dZLLeUU7_J9HiOA) + +

@ Copyright 2022 CE Info Systems Pvt. Ltd. All Rights Reserved.
+ +
Terms & Conditions | Privacy Policy | Supplier Sustainability Policy | Health & Safety Policy | Environmental Policy & CSR Report + +
Customer Care: +91-9999333223
diff --git a/docs/v1.0.13/RasterCatalouge.md b/docs/v1.0.13/RasterCatalouge.md new file mode 100644 index 0000000..d7056ef --- /dev/null +++ b/docs/v1.0.13/RasterCatalouge.md @@ -0,0 +1,133 @@ +[

](https://www.mapmyindia.com/api) + +# MapplsRasterCatalogue Plugin for iOS + +## **DigitalSky Airspace Layers** + +## [Introduction](#Introduction) + +This is an easy & FREE to integrate DigitalSky Airspace zones layers widget by Mappls. + +The drone airspace map is an interactive map of India that demarcates the yellow and red zones across the country. + +The airspace map may be modified by authorised entities from time to time. +Anyone planning to operate a drone should mandatorily check the latest airspace map for any changes in zone boundaries. + +Follow the below steps to integrate the plugin + + +## [Installation](#Installation) + + +This plugin can be installed using CocoaPods. It is available with the name `MapplsRasterCatalogue`. + +### [Using CocoaPods](#Using-CocoaPods) + +Create a Podfile with the following specification: + +``` +pod 'MapplsRasterCatalogue', '0.1.0' +``` + +Run `pod repo update && pod install` and open the resulting Xcode workspace. + +### [Version History](#Version-History) + +| Version | Dated | Description | +| :---- | :---- | :---- | +| `0.1.0` | 18 Jul 2022 | Initial version release. | + +#### [Dependencies](#Dependencies) + +This library depends upon several Mappls's own libraries. All dependent libraries will be automatically installed using CocoaPods. + +Below are list of dependencies which are required to run this SDK: + +- [MapplsAPICore](https://github.com/mappls-api/mappls-ios-sdk/docs/v1.0.0/MapplsAPICore.md) +- [MapplsAPIKit](https://github.com/mappls-api/mappls-ios-sdk/docs/v1.0.0/MapplsAPIKit.md) +- [MapplsMaps](https://github.com/mappls-api/mappls-ios-sdk/docs/v1.0.0/MapplsMap.md) + +## [Authorization](#Authorization) + +### [MapplsAPICore](#MapplsAPICore) +It is required to set MAPPLS's keys to use any MAPPL's SDK. Please see [here](MapplsAPICore.md) to achieve this. + +## [Precap](#Precap) + +### [RasterCatalogue Layer Types](#Geoanalytics-Layer-Types) + +An enum `MapplsRasterCatalogueLayerType` can be used to get different types of layers. Below are different types which are available: + +1. `MapplsRasterCatalogueLayerTypeInternationalBoundary25KM` - Depicts International Boundary of India +2. `MapplsRasterCatalogueLayerTypeAirport8To12KMYellow` - This Yellow zone is the airspace above 400 feet in a designated green zone; above 200 feet in the area located between 8-12 km from the perimeter of an operational airport +3. `MapplsRasterCatalogueLayerTypeAirport5To8KM` - This Yellow zone is the airspace above 400 feet in a designated green zone; above 200 feet in the area located between 5-8 km from the perimeter of an operational airport +4. `MapplsRasterCatalogueLayerTypeAirport0To5KM` - Shows zone is the ‘no-drone zone’ within which drones can be operated only after a permission from the Central Government. + +**Now that you’re all caught up with the features, let's get down right to them and look at how you can integrate our RasterCatalogue plugin to add data on your map in few simple steps.** + +## [Initialization MapplsRasterCatalogue Plugin ](#Initialization-MapplsGeoanalyticsPlugin) + +```swift +var rasterCataloguePlugin : MapplsRasterCataloguePlugin = MapplsRasterCataloguePlugin(mapView: mapView) +``` + +## [Use of RasterCatalogue API](#Use-of-RasterCatalogue-API) + +Use instance of `MapplsRasterCataloguePlugin` to show response of RasterCatalogue API as Map Layers. + +#### [MapplsRasterCatalogueLayerOptions](#MapplsGeoanalyticsLayerRequest) + +Below are parameters of `MapplsRasterCatalogueLayerOptions` class. + +- **layerType** (mandatory): It is an enum of type `MapplsRasterCatalogueLayerType`. + +- **crossOrigin** (optional): It is of type `String`. For more info see [here](#MapplsGeoanalyticsGeobound). + +- **transparent** (optional): It is type `Bool`. its default value is `true`. + +- **zIndex** (optional): It is of type `BOOL`. its default value is 0 + +### Step 2 - Adding RasterCatalogue layer on Map + +A function `addRasterCatalogueLayer` available in `MapplsRasterCataloguePlugin` which accepts request of type `MapplsRasterCatalogueLayerOptions`. +Plugin internally consume that request to get response and plot layer on Map accordingly. + +``` swift +let request = MapplsRasterCatalogueLayerOptions(layerType: .airport5To8KM) +self.rasterCataloguePlugin.addRasterCatalogueLayer(request) +``` + +### Other Methods Available: + +**1. Remove RasterCatalogue Layer** + +`removeRasterCatalogueLayer` is a function which accepts request of type `MapplsRasterCatalogueLayerOptions` to remove related layer from map. + +``` swift +let request = MapplsRasterCatalogueLayerOptions(layerType: .airport5To8KM) +geoanalyticsPlugin.removeRasterCatalogueLayer(layerRequestState)) +``` + +
+ +For any queries and support, please contact: + +[

](https://about.mappls.com/api/) + +Email us at [apisupport@mappls.com](mailto:apisupport@mappls.com) + +![](https://www.mapmyindia.com/api/img/icons/support.png) +[Support](https://about.mappls.com/contact/) +Need support? contact us! + +

+ +[

](https://stackoverflow.com/questions/tagged/mappls-api)[![](https://www.mapmyindia.com/api/img/icons/blog.png)](https://about.mappls.com/blog/)[![](https://www.mapmyindia.com/api/img/icons/gethub.png)](https://github.com/mappls-api)[

](https://www.npmjs.com/org/mapmyindia) + +[

](https://www.facebook.com/Mapplsofficial)[![](https://www.mapmyindia.com/june-newsletter/icon2.png)](https://twitter.com/mappls)[![](https://www.mapmyindia.com/newsletter/2017/aug/llinkedin.png)](https://www.linkedin.com/company/mappls/)[![](https://www.mapmyindia.com/june-newsletter/icon3.png)](https://www.youtube.com/channel/UCAWvWsh-dZLLeUU7_J9HiOA) + +

@ Copyright 2020 CE Info Systems Pvt. Ltd. All Rights Reserved.
+ +
Terms & Conditions | Privacy Policy | Supplier Sustainability Policy | Health & Safety Policy | Environmental Policy & CSR Report + +
Customer Care: +91-9999333223
diff --git a/docs/v1.0.13/Regions.md b/docs/v1.0.13/Regions.md new file mode 100644 index 0000000..5891f67 --- /dev/null +++ b/docs/v1.0.13/Regions.md @@ -0,0 +1,66 @@ +[

](https://www.mapmyindia.com/api) + +# Setting Regions - Limiting Geographic Area + +Source data can often contain more information than what's needed in your map. +For example, an administrative places dataset may contain data for a country OR set of countries OR contain places for the entire world; when you may only need political boundaries for North America or the USA. +In this scenario, you can specify a region in SDK to limit the geographic extent of the data that will be tiled. + +As of now, **the tiles for global maps are enabled by default** for all users as a means for users to visually experience our international maps. + +Search and Routing APIs are available for the entire world as well; but they are enabled by default for India only for all customers. +If any customer wishes to use our Search and Routing Stacks of SDKs & APIs in their apps, please contact our API Support team. + +Why limit access? + +By reducing the amount of data querying & transference required, you can reduce your API transaction costs and also reduce the amount of time it takes for your job to process. + +Now what you as a developer need to do is to specify a region in our APIs/SDKs from the list of globally applicable region values and that's it !! +[See Country List](https://github.com/MapmyIndia/mapmyindia-rest-api/blob/master/docs/countryISO.md) + +To specify the region , refer to the below code. Default is India ("IND") + +```js +MapmyIndiaAccountManager.setDefaultRegion(MMIRegionTypeIdentifier("IND")) +``` +or + +```js +MapmyIndiaAccountManager.setDefaultRegion(MMIRegionTypeIdentifier("KWT")) +``` + +To select from a country list, use below code **(Available from MapmyIndiaAPIKit Version 1.4.19)**. Default is (.india) + +```js +MapmyIndiaAccountManager.setDefaultRegion(.kuwait) +``` + +


+ +## Our many happy customers: + +![](https://www.mapmyindia.com/api/img/logos1/PhonePe.png)![](https://www.mapmyindia.com/api/img/logos1/Arya-Omnitalk.png)![](https://www.mapmyindia.com/api/img/logos1/delhivery.png)![](https://www.mapmyindia.com/api/img/logos1/hdfc.png)![](https://www.mapmyindia.com/api/img/logos1/TVS.png)![](https://www.mapmyindia.com/api/img/logos1/Paytm.png)![](https://www.mapmyindia.com/api/img/logos1/FastTrackz.png)![](https://www.mapmyindia.com/api/img/logos1/ICICI-Pru.png)![](https://www.mapmyindia.com/api/img/logos1/LeanBox.png)![](https://www.mapmyindia.com/api/img/logos1/MFS.png)![](https://www.mapmyindia.com/api/img/logos1/TTSL.png)![](https://www.mapmyindia.com/api/img/logos1/Novire.png)![](https://www.mapmyindia.com/api/img/logos1/OLX.png)![](https://www.mapmyindia.com/api/img/logos1/sun-telematics.png)![](https://www.mapmyindia.com/api/img/logos1/Sensel.png)![](https://www.mapmyindia.com/api/img/logos1/TATA-MOTORS.png)![](https://www.mapmyindia.com/api/img/logos1/Wipro.png)![](https://www.mapmyindia.com/api/img/logos1/Xamarin.png) + +
+ +For any queries and support, please contact: + +[

](https://about.mappls.com/api/) + +Email us at [apisupport@mappls.com](mailto:apisupport@mappls.com) + +![](https://www.mapmyindia.com/api/img/icons/support.png) +[Support](https://about.mappls.com/contact/) +Need support? contact us! + +

+ +[

](https://stackoverflow.com/questions/tagged/mappls-api)[![](https://www.mapmyindia.com/api/img/icons/blog.png)](https://about.mappls.com/blog/)[![](https://www.mapmyindia.com/api/img/icons/gethub.png)](https://github.com/mappls-api)[

](https://www.npmjs.com/org/mapmyindia) + +[

](https://www.facebook.com/Mapplsofficial)[![](https://www.mapmyindia.com/june-newsletter/icon2.png)](https://twitter.com/mappls)[![](https://www.mapmyindia.com/newsletter/2017/aug/llinkedin.png)](https://www.linkedin.com/company/mappls/)[![](https://www.mapmyindia.com/june-newsletter/icon3.png)](https://www.youtube.com/channel/UCAWvWsh-dZLLeUU7_J9HiOA) + +

@ Copyright 2022 CE Info Systems Pvt. Ltd. All Rights Reserved.
+ +