Directions Plugin for Mappls Web Maps
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 PIN (eLoc) Plugin. See Sample Codes here
Introductionβ
A simple plugin / widget to render details of a particular place. The Place Details plugin for MapmyIndia Web Map JS library is provided as a means to enable rendering of MapmyIndia Places on MapmyIndia 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 map implementation. Thus it enables developers to include MapmyIndia Places SDK in their own customized solutions easily.
The SDK offers the following basic functionalities:
- Ability to render places directly on map with reference to the provided eLoc(s).
- A getPinDetails() method to fetch the details of a place.
- Customizable markers
- Remove markers from map.
Sample Implementationβ
Visit the samples for assistance to create a sample implementation with your own keys.
For detailed understanding, Letβs get started!
Plugin's configurationsβ
Adding the Place Details plugin in the script
Script URLβ
<script src="https://apis.mappls.com/advancedmaps/api/{access_token}/map_sdk_plugins?v=3.0&libraries=getPinDetails"></script>
Initializing the Place Details pluginβ
Methodβ
Mappls.getPinDetails()
Mappls.getPinDetails({ map: map, pin: '3F45CB'}, callback);
Mandatory Parametersβ
getPinDetails
: The pin (Mappls Pin/Eloc) whose details are required.callback
: to return data to a specified callback method.
Optional Parametersβ
map
: Map Objecticon
: custom icon url.divId
: The div to put the result in.markerPopup
(boolean): to show pop-ups on marker click. Default is true.(example:markerPopup:true
)popupHtml
: to show html pop up on marker click. User should define values to be shown while using this parameter.(example:obj.setPopup({content:"<h1>Hello MapmyIndia</h1>"})
)fitbounds
(boolean): To show all rendered eLoc(s) in a single view bound. (example:fitbounds:true
)fitboundOptions
: padding in fitbounds, if any. (Example:{ padding:50,maxZoom:18}
)infoDiv
(boolean): To render html div on map or not. Default is true. (example:infoDiv:true
)click_callback
: method to call on click of callback.
Method to remove the markers with callback populated by Place Details Pluginβ
pinObj.remove();
Method to set up the div content for populating details from getEloc() pluginβ
pinObj.setDivContent(βDiv html);
Method to set up the pop up content on marker as html.β
For Eg:
pinObj.setPopup({content:"<h1>Hello Mappls</h1>"});