Nearby Search Plugin for Mappls Web Maps¶
Easy To Integrate Maps & Location APIs & SDKs For Web & Mobile Applications
Powered with India's most comprehensive and robust mapping functionalities. Now Available for 200+ nations and territories accross the world.
Getting Access¶
Before using the API in the your solution, please ensure that the related access is enabled in the Mappls Console, within your app - be it for Mobile OR Web or Cloud integration.
- Copy and paste the key from your
credentials
section from your API keys into theaccess_token
query parameter.- Your static key can be secured by whitelisting its usage for particular IPs (in case of cloud app usage) OR a set of domains (in case of a web app)
- Your static key obtained from your Console is to be passed as a query parameter:
access_token
.
- The sample codes are provided on our domain to help you understand the very basic functionality of Mappls Nearby Search Plugin. See Sample Codes here
Authentication Object - access_token
mandatory query parameter.¶
access_token
: "hklmgbwzrxncdyavtsuojqpiefrbhqplnm".
Document Version History¶
Version | Last Updated | Team | Author | Remarks |
---|---|---|---|---|
1.0 | 07 Aug 2025 | SDK Product Team | Prabhjot Kaur (PK) | OAuth 2 |
Getting Access¶
Before using the Plugin in the your solution, please ensure that the related access is enabled in the Mappls Console, in the same project you set up for the Maps SDK.
- Copy and paste the generated
access token
from your API keys available in the dashboard in the sample code for interactive map development.- This APIs follow OAuth2 based security.
Access Token
can be generated using Mappls Portal
Introduction¶
A simple plugin / widget to search for nearby places powered by the best online maps from Mappls. The Nearby Search plugin for Mappls Web Map JS library is provided as a means to enable radially searching for Nearby Places on Mappls Maps.
The plugin can be used in combination with our Interactive Map JS library but it also possesses the adaptability to be used as an independent plugin within any web app implementation. Thus it enables developers to include Mappls web JS in their own customized solutions easily.
The SDK offers the following basic functionalities: 1. Ability to search for nearby places directly with or without Mappls Maps visual interface. 2. A Mappls.nearby() method to initiate nearby search across all categories of places available on Mappls. 3. Ability to get information from Mappls Place Search plugin through a callback 4. Include the Nearby Search Plugin with or without an interactive Map component.
Sample Implementation¶
Visit the samples for assistance to create a sample implementation with your own keys.
For detailed understanding of the plugin, Let’s get started!
Plugin's Configurations¶
Adding the Nearby Search plugin in the script
<script src="https://sdk.mappls.com/map/sdk/plugins?access_token=<Static Key>&v=3.0&libraries=nearby"></script>
1. Initializing the Nearby Search plugin¶
Method¶
mappls.nearby()
/*Nearby plugin initialization*/
var options = {
divId: 'nearby_search',
map: map,
keywords: 'atm',
refLocation: [28.632735, 77.219696],
fitbounds: true,
geolocation: true,
click_callback: function(d) {
alert(d);
}
}
mappls.nearby(options, callback);
Mandatory Parameters¶
keywords
: The string or JSON object which will be passed as input query to the search engine. Examples- As a string:
keywords:"atm"
. This parameter supports input in Hindi Languagekeywords:"चाय"
. To get the feature contact apisupport@mapmyindia.com. - As a JSON object:
keywords:{'FINATM':'ATMS','FODCOF':'Restaurants'}
. This parameter supports input in Hindi Languagekeywords:{'एचडीएफसी ':'एटीएम'}
. To get the feature contact apisupport@mapmyindia.com. This mechanism is used to display a selection of POI categories on a UI. Ifkeywords
parameter is used, thenrefLocation
input also becomes mandatory.
- As a string:
callback
: (method): results will be returned in this method if specified.
OR
hyperLink
: This is the URL received from Mappls Place Search plugin for bridged Nearby Search. i.e. A Nearby Search trigerred directly from the Place Search Plugin.
Optional Parameters¶
refLocation
: location coordinates which will be used as centroid of the radial search reference . e.g.refLocation:[28.61, 77.23]
ORrefLocation:[28.61, 77.23]
map
: A map object from our Maps SDK. Markers can also be passed here that will be displayed on map. Custom icons also can be passed here.divId
: The HTML where developer wishes results to be displayed. Example:divId:document.getElementbyId('Nrdiv');
divHeight
: (in pixels) for customizing or improving results display UI.icon
: (object) To set the icons of the resulting categories of results.- Single Category: Example:
icon: {
url: '2.png'
}
OR
icon: {
html: " < div > < img src = 'pin.png' > < /div>",
width: 30,
height: 40
}
- *Multiple Category*: Example:
icon: {
'FINATM': {
url: 'atm.png',
height: 40,
width: 30
},
'FODCOF': {
url: 'food.png',
height: 40,
width: 32
}
}
Optional parameters for icon configuration are as follows:
- `offset`: Example: `offset:[20,40]`
- `popupAnchor`: Example: `popupAnchor:[-10,20]`
popup
: (boolean) Default is true if map is used. Used to bind popup to markers.popupOptions
: (object) Used to define pop up optional configuration. Example:popupOptions: {maxWidth:250}
fitbounds
: (boolean) Default is true. Used to fit all markers to in map view bound.geolocation
: boolean value used to enable or disable current location selection . Default is true.radius
: (number): Defines the radius of nearby search.bounds
: (geographic bounds): Used to define the rectangular bounds within which nearby search will work.sortBy
: (string)Used to sort the nearby search results.page
: (number): to request another page of results if available.pod
: (string): to filter to a certain type of results.searchChars
: number of characters required to start search. e.g searchChars:2region
: To specify the region for various api response.e.g region : "USA"callback_click
: (method): a method that will be called when user clicks on any listing. The action returns the eLoc of the selected place.
Types of Nearby Search Implementations¶
1. Get data from category & coordinates¶
Following is an example of calling mappls.nearby() method to get data from category and coordinates:
var res=mappls.nearby({keywords:"atm",refLocation:"123ZRR"});
2. Get data from Mappls Search category url¶
var res=mappls.nearby({hyperLink:'https://atlas.mapmyindia.com/api/places/nearby/json?explain&richData&&refLocation=28.61,77.23&keywords=FINATM'});
3. Get data from category & location selection UI¶
var res=mappls.nearby({divId:'nearby_divId',keywords:{'FINATM':'ATMs', 'FODCOF':'Restaurants'}});
This will place a selection of keywords and a location selection UI inside divId
.
Remove Nearby Markers within callback from Map¶
Use remove() method to remove markers from map.
var markers=res.markers();
markers.remove();
Add Event to Markers¶
Use addListener() method to associate events to markers.
markers.addListener('click',function(data){ console.log(data);});
That's All ! Visit the samples for assistance to create a sample implementation with your own keys.
For any queries and support, please contact:
Email us at apisupport@mappls.com
Support
Need support? contact us!