var map = null;
var marker = [];
var latitudeArr = [28.549948, 28.552232, 28.551748, 28.551738, 28.548602, 28.554603, 28.545639, 28.544339, 28.553196, 28.545842];
var longitudeArr = [77.268241, 77.268941, 77.269022, 77.270164, 77.271546, 77.268305, 77.26480, 77.26424, 77.265407, 77.264195];
//var pth = window.location.href; /*get path of image folder*/
var full_path = "http://www.mapmyindia.com/api/advanced-maps/doc/sample";
window.onload = function() {
map = new MapmyIndia.Map('map', {
center: [28.549948, 77.268241],
zoomControl: true,
hybrid: true
});
/***
1. Create a MapmyIndia Map by simply calling new MapmyIndia.Map() and passing it a html div id, all other parameters are optional...
2. All leaflet mapping functions can be called simply by using "L" object.
3. In future, MapmyIndia may extend the customised/forked Leaflet object to enhance mapping functionality for developers,
which will be clearly documented in the MapmyIndia API documentation section.
***/
/***map-events****/
map.on("dblclick", function(e) {
var title = "Text marker sample!";
marker.push(addMarker(e.latlng, "", title));
});
};
function addMarker(position, icon, title, draggable) {
/* position must be instance of L.LatLng that replaces current WGS position of this object. Will always return current WGS position.*/
var event_div = document.getElementById("event-log");
if (icon == '') {
var mk = new L.Marker(position, {
draggable: draggable,
title: title
}); /*marker with a default icon and optional param draggable, title */
mk.bindPopup(title);
} else {
var mk = new L.Marker(position, {
icon: icon,
draggable: draggable,
title: title
}); /*marker with a custom icon */
mk.bindPopup(title);
}
map.addLayer(mk); /*add the marker to the map*/
/* marker events:*/
mk.on("click", function(e) {
event_div.innerHTML = "Marker clicked<br>" + event_div.innerHTML;
});
return...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.