Place Search
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 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 Token Generation API.- To know more on how to create your access tokens, please use our authorization API URL. More details available here
- The
access token
is a valid by default for 24 hours from the time of generation. This can be configured by you in the API console.
- The sample codes are provided on our domain to help you understand the very basic functionality of Mappls Place Search Plugin. See Sample Codes here
Introductionβ
A simple plugin / widget to search for places powered by the best online maps from Mappls. The Place Search plugin for Mappls Web Map JS library is provided as a means to enable searching of 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 Places JS in their own customized solutions easily.
The SDK offers the following basic functionalities:
- Ability to search for places directly with or without Mappls Maps visual interface.
- A mappls.search() method to initiate search across all types places available on Mappls.
- Ability to get information from Mappls Place Search plugin through a callback
- Include the Place 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://apis.mappls.com/advancedmaps/api/{access_token}/map_sdk_plugins?v=3.0&libraries=search"></script>
Initializing the Place Search pluginβ
Methodβ
mappls.search()
/*Search plugin initialization*/
var placeOptions=
{
location:[28.61, 77.23]/*,
geolocation:true,
pod:'City',
bridge:true,
tokenizeAddress:true,*
filter:'cop:9QGXAM',
hyperLocal:true, Default is false. Location parameter is mandatory to use this parameter.
distance:true,
width:300,
height:300,
clearButton:false, //to hide cross button, which is right side of search input
blank_callback:function(){console.log("called when click on cross button or input value become blank");}
*/
};
new mappls.search(document.getElementById("auto"),placeOptions,callback);
Mandatory Parametersβ
inputQuery
: The string which will be passed as input query to the search engine.
Optional Parametersβ
Place Options
: Optional configurations for modifying the search request.location
: location coordinates which will be used as radial bias (not restriction; only BIAS). e.g.location:[28.61, 77.23]
pod
: Place type which you want to restrict the results by. e.g.pod:'city'
. Valid values are:- SLC (sub locality)
- LC (locality)
- CITY
- VLG (village)
- SDIST (sub district)
- DIST (district)
- STATE
- SSLC (sub sub locality)
filter
: a parameter to restrict results by. e.g.filter:'cop:9qgxam'
- Can be used to filter results by PIN code. e.g.
pin:110055
- Can be used to filter results by eLoc. e.g.
cop:9qgxam
- Can be used to filter results by view bound. e.g.
filter=bounds:28.598882,77.212407;28.467375,77.353513
- Can be used to filter results by PIN code. e.g.
bridge
: initiates a bridge to be created to provide applicable nearby API searches. Involves using Nearby Search Plugin in conjunction with Place Search Plugin.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 higher ranking than results far from the reference location. Highly prominent results will still appear in the search results, however theu will be lower in the list of results. This parameter will work ONLY in conjunction with the location parameter.tokenizeAddress
: boolean value used to return address tokens from the searched places from Mappls Search APIs. e.g.tokenizeAddress:true
distance
: boolean value used to show aerial distance from location passed inlocation
. of the searched place in results listing e.g.distance:true
geolocation
: boolean value used to enable or disable current location selection . Default is true.width
: width of the suggested div. e.g.width:300
height
: height of the suggested div. e.gheight:300
clearButton
: clear the value of input box. Default is true.
callback
: callback to get results/error after call or selection.blank_callback
: callback when user clicks the cross button or erase the value of input box.
Calling Mappls Place Search for programmatically fixed textβ
Following is an example of calling Mappls.search() method programmatically for a fixed text rather than depending on a UI driven approach:
/*CALL for fix text - LIKE THIS*/
new mappls.search("agra",placeOptions,callback);
Other Useful Methodsβ
setToken("token")
- This method is used when you receive a callback of token error. To set new token following method should be refered.
For Eg: if the users receives an error in callback like {error: "error-Passport invalid-Passport seems to be invalid or not active anymore-responsecode:401"}, use
mappls.setToken();