var map1;
var Marker2;
var center = "28.5507160000001,77.2689280000001";
var center = center.split(",");
var lat = center[0];var lng=center[1];
// Draw Polygon
document.getElementById('checkbox').addEventListener('change', (event) => {
if (event.target.checked) {
// cluster function call
cluster();
}
else{
MapmyIndia.remove({map:map1,layer:Marker2});
map1.setZoom(4);
map1.setCenter({lat: lat, lng: lng});
}
});
// Map Function
function initMap1() {
var center = {lat: lat, lng: lng};
map1 = new MapmyIndia.Map(document.getElementById('right-menu'),
{
center: center,
zoom: 4,
zoomControl: true,
location: true,
});
}
// cluster function
function cluster(){
var clusters = document.getElementById('clusters').value;
var geojson = document.getElementById('geojson').value;
var fitbounds1= document.getElementById('fitbounds1').value;
var icon_url = document.getElementById('icon_url').value;
var clustersoptions = document.getElementById('clustersoptions').value;
var ctype = document.getElementById('ctype').value;
// Mapmyindia multiple marker
Marker2 = MapmyIndia.Marker({
fitbounds:fitbounds1,
fitboundOptions:{padding: 120,duration:1000},
map:map1,
position:JSON.parse(geojson),
cType:JSON.parse(ctype),
clusters:clusters,
clustersOptions :JSON.parse(clustersoptions),
icon:icon_url
});
}
initMap1();
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.