Easy To Integrate Maps & Location APIs & SDKs For Web & Mobile Applications
Powered with India's most comprehensive and robust mapping functionalities.
Now Available for Srilanka, Nepal, Bhutan and Bangladesh
- For full documentation contact MapmyIndia here:
Email: [email protected].
-
You can get your api key to be used in this document here: https://www.mapmyindia.com/api/signup
-
The beta code is provided to help you understand the basic functionality of MapmyIndia REST APIs working on React Native development platform.
Version | Last Updated | Author |
---|---|---|
0.0.11 | April 2021 | MapmyIndia API Team (MS) |
0.0.11 | February 2021 | MapmyIndia API Team (MA) |
0.0.10 | January 2021 | MapmyIndia API Team (MA) |
0.0.9 | October 2020 | MapmyIndia API Team (MA) |
0.0.8 | March 2019 | MapmyIndia API Team (BM) |
Mapmyindia is the location data platform for mobile and web applications. We provide building blocks to add location features like maps, search, and navigation into any experience you create. Use our simple and powerful APIs & SDKs for interactivity and control.
Not a Mapmyindia user yet? Sign up for an account here. Once you’re signed in, all you need to start building is a Mapmyindia key. Use this same short code with all of our interactive mapping libraries, JavaScript SDKs, and directly against our REST APIs. You can create and manage your access tokens on your Mapmyindia Account page.
Your MapmyIndia Maps SDK usage needs a set of license keys (get them here ) and is governed by the API terms and conditions.
As part of the terms and conditions, you cannot remove or hide the MapmyIndia logo and copyright information in your project.
Please see branding guidelines on MapmyIndia website for more details.
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.
$ npm install mapmyindia-restapi-react-native-beta --save
If you are using React-Native < 0.60.0
then you have to follow additional steps which are below
$ react-native link mapmyindia-restapi-react-native-beta
-
In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
-
Go to
node_modules
➜mapmyindia-restapi-react-native-beta
and addRNRestapi.xcodeproj
-
In XCode, in the project navigator, select your project. Add
libRNRestapi.a
to your project'sBuild Phases
➜Link Binary With Libraries
-
Run your project (
Cmd+R
)<
- Open up
android/app/src/main/java/[...]/MainActivity.java
-
Add
import com.restapi.reactnative.RNRestapiPackage;
to the imports at the top of the file -
Add
new RNRestapiPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:
include ':mapmyindia-restapi-react-native-beta'
project(':mapmyindia-restapi-react-native-beta').projectDir = new File(rootProject.projectDir, '../node_modules/mapmyindia-restapi-react-native-beta/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:
compile project(':mapmyindia-restapi-react-native-beta')
import Mapmyindia from 'mapmyindia-restapi-react-native-beta';
Mapmyindia.setRestApiKey('RestApiKey');
Mapmyindia.setClientId('AtlasClietId');
Mapmyindia.setClientSecret('AtlasClientSecret');
The Place detail API is to extract the details of a place with the help of its eLoc i.e. a 6 character code. Since a place may or may not have additional attributes associated with it, the response from the place details may be different for each record. However the response will be an extract from an existing set of master key-value pairs grouped as objects.
- eLoc: the id or eLoc of the place whose details are required. The 6-digit alphanumeric
code for any location. (e.g. mmi000). - response : successcallback of api call
Mapmyindia.place_details({eLoc: 'MMI000'}, (response) => {
alert(JSON.stringify(response));
});
The API is highly configurable to configuration enables to provide the required set of attributes to the user on the basis of assigned sub templates.
The default configuration with available with basic pay-as-you-go rates is that of General Details
subtemplate.
The parameters are group in sub templates. Here is the list of attributes with sub template information.
- Eloc (string) : 6 characters alphanumeric unique identifier
- placeName (string) : Name of the place
- address (string) : address of the place
- type: defines the type of location matched (HOUSE_NUMBER, HOUSE_NAME, POI, STREET, SUB_LOCALITY, LOCALITY, VILLAGE, DISTRICT, SUB_DISTRICT, CITY, STATE, SUBSUBLOCALITY, PINCODE)
- city (string): The name of the city in which the location exists.
- district (string): The name of the district in which the location exists.
- pincode (string): The pin code of the location area.
- subDistrict (string): The name of the sub-district in which the location exists.
- state (string): The name of the state in which the location exists.
- houseNumber (string): The house number of the location.
- houseName (string): The name of the location.
- locality (string): The name of the locality where the location exists.
- street (string): The name of the street of the location.
- subSubLocality (string): The name of the sub-sub-locality where the location exists.
- subLocality (string): The name of the sub-locality where the location exists.
- village (string): The name of the village if the location exists in a village.
- poi (string): The name of the POI if the location is a place of interest (POI).
- Mobile
- Telephone
- Website
- latitude(double): The latitude of the location.
- longitude(double): The longitude of the location.
- Entry_lat(double):The entry latitude of the location.
- Entry_lon(double):The entry longitude of the location.
- query (string) e.g. Shoes, Coffee, Versace, Gucci, H&M, Adidas, Starbucks, B130 {POI, House Number, keyword, tag}
- response : successcallback of api call
- location {string (latitude[double],longitude[double])} e.g. location=28.454,77.435
- zoom (double) = takes the zoom level of the current scope of the map (min: 4, max: 18).
- tokenizeAddress (boolean) = provides the different address attributes in a structured object.
- pod (string) = it takes in the place type code which helps in restricting the results to certain chosen type.
Below mentioned are the codes for the pod -- SLC: Sublocality
- LC: Locality
- CITY: City
- VLG: Village
- SDIST: Subdistrict
- DIST: District
- STATE: State
- SSLC: Subsublocality
- filter = this parameter helps you restrict the result either by mentioning a bounded area or to certain eloc (6 digit code to any poi, locality, city, etc.), below mentioned are the both types -
a. filter = bounds: lat1, lng1; lat2, lng2 (latitude, longitude) {e.g. filter=bounds: 28.598882, 77.212407; 28.467375, 77.353513}
b. filter = cop: {eloc} (string) {e.g. filter=cop:YMCZ0J}
Mapmyindia.atlas_auto({query: 'agr'}, (response) => {
alert(JSON.stringify(response));
});
- keywords (string) e.g. FODCOF, Shoes, Coffee, Versace, Gucci, H&M, Adidas, Starbucks, B130 {POI, House Number, keyword, tag}
- refLocation {string (latitude[double],longitude[double])}: Provides the location around which the search will be performed. It also supports Eloc. E.g. refLocation=28.454,77.435 or refLocation="MMI000"
- response : successcallback of api call
- page (integer): provides number of the page to provide results from.
- sort (string): provides configured sorting operations for the client on cloud. Below are the available sorts:
a) dist:asc & dist:desc - will sort data in order of distance from the passed location (default).
b) name:asc & name:desc - will sort the data on alphabetically bases. - radius (integer): provides the range of distance to search over (default: 1000, min: 500, max: 10000).
- bounds (string) : Allows the developer to send in map bounds to provide a nearby search within the bounds. {e.g. (bounds("28.56812,77.240519;28.532790,77.290854"))
- filter (string) : This parameter helps you get a specific type of EV charging Station - filter = model:(string);brandId:(string);plugType:(string)
Mapmyindia.atlas_nearby({keywords: 'beer', refLocation: '28.631460,77.217423'}, (response) => {
alert(JSON.stringify(response));
});
- lat:(double) the latitude of the location for which the address is required.
- lng:(double) the longitude of the location for which address is required.
- response : successcallback of api call
Mapmyindia.rev_geocode({lat: '27.61234', lng: '77.61234'}, (response) => {
alert(JSON.stringify(response));
});
- address(string) address to be geocoded e.g. 237 Okhla industrial estate phase 3 new delhi, delhi 110020
- response : successcallback of api call
- itemCount (integer): parameter can be set to get maximum number of result items from the API (default: 1).
- bias (integer): This parameter can be used to set Urban or Rural bias. A positive value sets the Urban bias and a negative value sets Rural bias. Allowed values are:
- 0 : Default: (No bias)
- -1 : Rural
- 1 : Urban
- podFilter (string): This parameter can be used to set admin level restriction. The result will be either the given admin level or equivalent admin or higher in the hierarchy. No lower admin will be considered for geocoding. Allowed values are:
- hno : house number
- hna : house name
- poi : point of interest
- street : street
- sslc : sub sub locality
- village : village
- slc : sub locality
- sdist : sub district
- loc : locality
- city : city
- dist : district
- pincode :pincode
- state : state
- bound (string): This parameter can be used to set admin boundary, which means geocoding will be done within the given admin. The allowed admin bounds are Sub-District, District, City, State and Pincode. The parameter accepts the admin eLoc as value.
Note: Please note that podFilter & bound parameters are mutually exclusive. They cannot be used together in an API call.
Mapmyindia.atlas_geocode({address: 'lucknow',itemCount:'1'}, (response) => {
alert(JSON.stringify(response));
});
- source:{string (longitude[double],latitude[double])}
- destination: is pair of comma separated longitude & latitude value.Last coordinate will be considered as end point (mandatory) and those in between are via points (optional). Example: {longitude},{latitude};{longitude},{latitude}
- response : successcallback of api call
- geometries(string): This parameter used to change the route geometry format/density (influences overview and per step). Default value is
- polyline with 5 digit precision;
- polyline6 for 6 digit precision;
- geojson for geometries as geojson.
- steps(boolean): Return route steps for each route leg. Possible values are true/false. By default it will be used as false. <Recommended=false; unless otherwise recommended by MapmyIndia>
- exclude(string): Additive list of road classes to avoid, order does not matter. Possible values are toll, motorway & ferry. Multiple values can be sent separated by.
- rtype: type of route (integer) required for navigation, where values mean:
- 0 optimal (default)
- 1 shortest (it will calculate route by excluding access penalties like private roads, etc.)
- region(string): This parameter is optional for India; for other countries (Sri Lanka, Nepal, Bangladesh & Bhutan) this parameter is mandatory. Possible values are ind (for India, default), lka (for Sri Lanka) , npl (for Nepal) , bgd (for Bangladesh) and btn (for Bhutan)
- bearings(integer): Limits the search to segments with given bearing in degrees. The referencing will be to the true north and in clockwise direction. (shall be part of premium offering)
- alternatives Search for alternative routes. Passing a number: e.g. alternatives=n searches for up to n alternative routes. Please note that even if alternative routes are requested, a result cannot be guaranteed.
- radiuses Limits the search to given radius in meters. For all way-points including start and end points. {radius};{radius}[;{radius} ...]. (shall be part of premium offering).
- overview(string): Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all. Possible values could be simplified (default), full, false. (shall be part of premium offering)
- profile :(string ) default driving
Mapmyindia.route_adv({`source`: '28.111,77.111', destination: '28.22,77.22'}, (response) => {
alert(JSON.stringify(response));
});
- source:{string (longitude[double],latitude[double])}
- destination: is pair of comma separated longitude & latitude value.Last coordinate will be considered as end point (mandatory) and those in between are via points (optional). Example: {longitude},{latitude};{longitude},{latitude}
- response : successcallback of api call
- geometries(string): This parameter used to change the route geometry format/density (influences overview and per step). Default value is
- polyline with 5 digit precision;
- polyline6 for 6 digit precision;
- geojson for geometries as geojson.
- steps(boolean): Return route steps for each route leg. Possible values are true/false. By default it will be used as false. <Recommended=false; unless otherwise recommended by MapmyIndia>
- exclude(string): Additive list of road classes to avoid, order does not matter. Possible values are toll, motorway & ferry. Multiple values can be sent separated by.
- **rtype ** type of route (integer) required for navigation, where values mean:
- 0 optimal (default)
- 1 shortest (it will calculate route by excluding access penalties like private roads, etc.)
- region(string): This parameter is optional for India; for other countries (Sri Lanka, Nepal, Bangladesh & Bhutan) this parameter is mandatory. Possible values are ind (for India, default), lka (for Sri Lanka) , npl (for Nepal) , bgd (for Bangladesh) and btn (for Bhutan)
- bearings(integer): Limits the search to segments with given bearing in degrees. The referencing will be to the true north and in clockwise direction. (shall be part of premium offering)
- alternatives Search for alternative routes. Passing a number: e.g. alternatives=n searches for up to n alternative routes. Please note that even if alternative routes are requested, a result cannot be guaranteed.
- radiuses Limits the search to given radius in meters. For all way-points including start and end points. {radius};{radius}[;{radius} ...]. (shall be part of premium offering).
- overview(string): Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all. Possible values could be simplified (default), full, false. (shall be part of premium offering)
- profile :(string ) default driving
Mapmyindia.route_eta({`source`: '28.111,77.111', destination: '28.22,77.22'}, (response) => {
alert(JSON.stringify(response));
});
- source:{string (longitude[double],latitude[double])}
- destinations: is pair of comma separated longitude & latitude value.Last coordinate will be considered as end point (mandatory) and those in between are via points (optional). Example: {longitude},{latitude};{longitude},{latitude}
- response : successcallback of api call
- rtype type of route (integer) required for navigation, where values mean:
- 0 optimal (default)
- 1 shortest (it will calculate route by excluding access penalties like private roads, etc.)
- region(string): This parameter is optional for India; for other countries (Sri Lanka, Nepal, Bangladesh & Bhutan) this parameter is mandatory. Possible values are ind (for India, default), lka (for Sri Lanka) , npl (for Nepal) , bgd (for Bangladesh) and btn (for Bhutan)
- profile :(string ) default driving
Mapmyindia.distance_matrix(source:'90.33687,23.470314',destinations:'90.379249,23.497178;90.497009,23.546286'}, (response) => {
alert(JSON.stringify(response));
});
- source:{string (longitude[double],latitude[double])}
- destinations: is pair of comma separated longitude & latitude value.Last coordinate will be considered as end point (mandatory) and those in between are via points (optional). Example: {longitude},{latitude};{longitude},{latitude}
- response : successcallback of api call
- rtype type of route (integer) required for navigation, where values mean:
- 0 optimal (default)
- 1 shortest (it will calculate route by excluding access penalties like private roads, etc.)
- region(string): This parameter is optional for India; for other countries (Sri Lanka, Nepal, Bangladesh & Bhutan) this parameter is mandatory. Possible values are ind (for India, default), lka (for Sri Lanka) , npl (for Nepal) , bgd (for Bangladesh) and btn (for Bhutan)
- profile :(string ) default driving
Mapmyindia.distance_matrix_eta(source:'90.33687,23.470314',destinations:'90.379249,23.497178;90.497009,23.546286'}, (response) => {
alert(JSON.stringify(response));
});
- eloc: the id or eLoc of the place whose details are required. The 6-digit alphanumeric
code for any location. (e.g. mmi000). - response : successcallback of api call
Mapmyindia.placeDetails({eloc: 'MMI000'}, (response) => {
alert(JSON.stringify(response));
});
For any queries and support, please contact:
Email us at [email protected]
Ask a question under the mapmyindia-api
Need support? contact us!
Read about the latest updates & customer stories
© Copyright 2021. CE Info Systems Pvt. Ltd. All Rights Reserved. | Terms & Conditions