Skip to main content

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.

  1. 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.
  2. 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:

  1. Ability to search for places directly with or without Mappls Maps visual interface.
  2. A mappls.search() method to initiate search across all types places available on Mappls.
  3. Ability to get information from Mappls Place Search plugin through a callback
  4. 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​

  1. inputQuery: The string which will be passed as input query to the search engine.

Optional Parameters​

  1. 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
    • 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 in location. 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.g height:300
    • clearButton : clear the value of input box. Default is true.
  2. callback: callback to get results/error after call or selection.
  3. 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();