Please refer to the map properties implemented and available from version 1.5
<script src="https://apis.mapmyindia.com/advancedmaps/v1/<your-map-key>/map_load?v=1.5"></script>
var map= new MapmyIndia.Map
- mapDiv: The div where map is rendered.
- Center: centerpoints; defines the center of the map
- zoomControl: true; to show or hide the zoom controls
- coronaLink: false; to show or hide the corona layers link
- token_callback: function(d){console.log(d);} callback for token expiry
- search: false, to show or hide the search bar
- Traffic: true, to show or hide the traffic layer
- zoom:17; to set the zoom level of the map
- fullscreen: true, to allow full screen map
- scrollwheel: true to allow the scrollwheel for map zooming
- hybrid: true; to show or hide the hybrid layer
- location: true; Scopes the Map to the viewer’s current location
- Optional Other setting for location
location:{
callback: Method, _callback method to get every location change_
marker: false, _Hide current location marker, default true_
setView: false, _set Map view to current location, default true_
watch: true _continuous getting location if location button is active, it will inactive once map manually drag or click on active location
button again , default is false_
}
<!DOCTYPE html>
<html>
<head>
<title>MapmyIndia Maps: Hello World!</title>
<script type="text/javascript">
</script>
<script src="https://apis.mapmyindia.com/advancedmaps/api/<token>/map_load?v=1.5&callback=init" async defer></script>
<style>
#map {margin: 0;padding: 0;width: 100%;height: 100%;}
</style>
<script language="javascript">
function init() {
var centre = new L.LatLng(28.61, 77.23);
map=new MapmyIndia.Map('map',{center:centre,search:false,token_callback:tokenExpire });
var marker=L.marker(centre).addTo(map);/**--add marker at the centre of map--**/
marker.bindPopup('Hello World');
}
function tokenExpire(r)
{
window.location.reload();
/*map.setToken(<token>); // to set new token */
}
</script>
</head>
<body>
<div id="map"></div>
</body>
</html>
That's All Folks !