mappls-api / mapmyindia-restapi-cordova-ionic-beta

MapmyIndia REST APIs for Cordova/Ionic - Beta 1 Hybrid SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MapmyIndia REST APIs for Cordova/Ionic - Beta 1

N|Solid

For full documentation contact MapmyIndia here:

MapmyIndia: apisupport@mapmyindia.com.

You can get your api key to be used in this document here: https://www.mapmyindia.com/api/signup

Version History

Version Last Updated Author
1.0.1 Sep 2019 MapmyIndia API Team (BM)

Technologies Used

  1. Java

  2. Javascript

  3. Cordova

  4. ObjectiveC

Supported Platform

  1. Andoroid

  2. Ios

  3. Browser

Supported Technologies

  1. Ionic

  2. Cordova

  3. Phonegap

Installation

git

> cordova  plugin  add https://github.com/mapmyindia/mapmyindia-restapi-cordova-ionic-beta.git
or 
> cordova  plugin  add mapmyindia-restapi-cordova-ionic-beta

Browser Installation

IONIC CORDOVA
ionic cordova platform add browser cordova platform add browser

Running in the browser

IONIC CORDOVA
ionic cordova run browser cordova run browser

Only if you are running cordova project in browser not for ionicframework

  • replace your <meta> tag in index.html
<meta  http-equiv="Content-Security-Policy"  content="default-src *; style-src 'self' http://* 'unsafe-inline'; script-src 'self' http://* 'unsafe-inline' 'unsafe-eval'" />

MapmyIndia Plugin requires Cordova to run.

  • Declare mmi_rest var globally
> declare  var  mmi_rest;

Inside mmi_rest function if you want to access this property you have to assign to a variable like

var thisObj = this outside the mmi_rest function body if you are working with IONIC V > 1

API Usage

Features:

  1. Autosuggest

  2. Geocoding [Legacy]

  3. Nearby

  4. Reverse Geocode

  5. Place detail

  6. Distance [Legacy]

  7. Routing [Legacy]

  8. Routing API

  9. Distance Matrix

  10. Atlas Geocode

Autosuggest

Parameters
  • client_id*

  • client_secret*

  • query*

  • successCallback*

  • errorCallback*

  • location

  • zoom

  • region

  • tokenizeAddress

  • pod

  • filter

Syntax
mmi_rest.atlas_auto(

{

client_id:  'clientId',

client_secret:  'clientSecret',

query:  'agr'

},SuccessCallback, Error  Callback);
Example
mmi_rest.atlas_auto({client_id:  'clientId', client_secret:  'clientSecret',query:  'agr'},

function(result)

{

console.log(result);

},

function(error)

{

console.log(error);

});

Geocode

Parameters

client_id: 'clientId',

client_secret: 'clientSecret',

address: 'agra'

  • successCallback*

  • errorCallback*

Syntax
mmi_rest.atlas_geocode(client_id:  'clientId', client_secret:  'clientSecret',address:  'agra'}, Success  Callback, Error  Callback);
Example
mmi_rest.atlas_geocode({client_id:  'clientId', client_secret:  'clientSecret',address:  'agra'},

function(result){

console.log(JSON.stringify(result));

},

function(err){

console.log(err);

});

Nearby

Parameters
  • key*

  • client_id*

  • client_secret*

  • keywords*

  • refLocation*

  • successCallback*

  • errorCallback*

Syntax
mmi_rest.atlas_nearby({client_id:  'clientId', client_secret:  'clientSecret', keywords:  'beer', refLocation:  '28.631460,77.217423'}, SuccessCallback, ErrorCallback);
Example
mmi_rest.atlas_nearby({client_id:  'clientId',client_secret:  'clientSecret',keywords:  'beer',refLocation:  '28.631460,77.217423'},

function(result)

{

console.log(JSON.stringify(result));

},

function(error)

{

console.log(error);

});

Reverse Geocode

Parameters
  • key*

  • lat*

  • lng*

  • successCallback*

  • errorCallback*

Syntax
mmi_rest.rev_geocode(key: 'YOUR API KEY', lat: '27.61234', lng: '77.61234'}, Success  Callback, Error  Callback);
Example
mmi_rest.rev_geocode({key:  'YOUR API KEY', lat:  '27.61234', lng:  '77.61234'},

function(result){

console.log(JSON.stringify(result));

},

function(err){

console.log(err);

});

Place Details / eLoc

Parameters
  • key*

  • placeId*

  • successCallback*

  • errorCallback*

Syntax
mmi_rest.place_detail({key:  'YOUR API KEY', placeId:  'MMI000'}, Success  Callback, Error  Callback);
Example
mmi_rest.place_detail({key:  'YOUR API KEY', placeId:  'MMI000'},

function(result)

{

console.log(JSON.stringify(result));

},

function(err)

{

console.log(err);

});

Driving Distance Matrix

Parameters
  • key*

  • lat*

  • lng*

  • points*

  • successCallback*

  • errorCallback*

Syntax
mmi_rest.distance({key:  'YOUR API KEY', lat:  '27.61234', lng:  '77.61234', points:'29,78|30,78|28,79'}, Success  Callback, ErrorCallback);
Example
mmi_rest.distance({key:  'YOUR API KEY', lat:  '27.61234', lng:  '77.61234', points:  '29,78|30,78|28,79'},

function(result)

{

console.log(JSON.stringify(result));

},

function(err)

{

console.log(err);

});

Routing (Deprecated)

Parameters

Note: "alternatives" and "advices" are optional parameters; send null if they are empty.

  • key*

  • start*

  • destination*

  • successCallback*

  • errorCallback*

Syntax
mmi_rest.route({key:  'YOUR API KEY', start:  '28.111,77.111', destination:  '28.22,77.22', alternatives:  null, advices:  null}, SuccessCallback, ErrorCallback);
Example
mmi_rest.route({key:  'YOUR API KEY', start:  '28.111,77.111', destination:  '28.22,77.22', alternatives:  null, advices:  null},

function(result)

{

console.log(JSON.stringify(result));

},

function(err)

{

console.log(JSON.stringify(err));

});

Routing API

Parameters
  • key*

  • start*

  • destination*

  • successCallback*

  • errorCallback*

  • geometries

  • steps

  • exclude

  • rtype

  • region

  • bearings

  • alternatives

  • radiuses

  • overview

Syntax
mmi_rest.route_new({key:  'YOUR API KEY', start:  '77.131123,28.552413', destination:  '77.113091,28.544649'}, SuccessCallback, ErrorCallback);
Example
mmi_rest.route_new({key:  'YOUR API KEY', start:  '77.131123,28.552413', destination:  '77.113091,28.544649'},

function(result)

{

alert(JSON.stringify(result));

},

function(err)

{

alert(JSON.stringify(err));

});

Atlas Geocode

Parameters
  • client_id*

  • client_secret*

  • addr*

  • successCallback*

  • errorCallback*

  • itemCount

  • bias

  • podFilter

  • bound

  • scores

Syntax
mmi_rest.atlas_geocode({client_id:  'ID', client_secret:  'secret', addr:  'mapmyindia'}, Success  Callback, Error  Callback);
Example
mmi_rest.atlas_geocode({client_id:  'ID', client_secret:  'secret', addr:  'mapmyindia'},

function(result)

{

alert(JSON.stringify(result));

},

function(error)

{

alert(error);

})

Distance Matrix

Parameters
  • key*

  • source*

  • secondryLocations*

  • successCallback*

  • errorCallback*

  • rtype

  • region

Syntax
mmi_rest.distance_new({key:  'YOUR API KEY', source:  '77.983936,28.255904', secondryLocations:  '90.379249,23.497178'}, Success  Callback, ErrorCallback);
Example
mmi_rest.distance_new({key:  'YOUR API KEY', source:  '77.983936,28.255904', secondryLocations:  '90.379249,23.497178'},

function(result)

{

alert(JSON.stringify(result));

},

function(err)

{

alert(err);

});

For any queries and support, please contact:

Email

Email us at apisupport@mapmyindia.com

Stack Overflow

Ask a question under the mapmyindia-api

Support

Need support? contact us!

Blog

Read about the latest updates & customer stories

© Copyright 2019. CE Info Systems Pvt. Ltd. All Rights Reserved. | Terms & Conditions

Written with StackEdit by MapmyIndia.

About

MapmyIndia REST APIs for Cordova/Ionic - Beta 1 Hybrid SDK

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Objective-C 36.8%Language:Java 35.0%Language:JavaScript 28.2%