var map1;
var center = "28.5507160000001,77.2689280000001";
var center = center.split(",");
var lat = center[0];var lng=center[1];
var mix;
// Addgeojson
document.getElementById('checkbox').addEventListener('change', (event) => {
if (event.target.checked) {
// call Addgeojson
addgeojson();
}
else {
map1.setZoom(4);
MapmyIndia.remove({map:map1,layer:mix});
map1.setCenter({lat: lat, lng: lng});
// mix=null;
}
});
// Map Function
function initMap1() {
var center = {lat: lat, lng: lng};
map1 = new MapmyIndia.Map(document.getElementById('right-menu'),
{
center: center,
zoomControl: true,
location: true,
});
}
// Addgeojson function
function addgeojson(){
var overlap= document.getElementById('overlap').value;
var mixjson= document.getElementById('mixjson').value;
var ctype = document.getElementById('ctype').value;
var fitbounds= document.getElementById('fitbounds').value;
//alert(mixjson);
mix=MapmyIndia.addGeoJson({
map:map1,data:JSON.parse(mixjson),
cType:JSON.parse(ctype),
overlap:JSON.parse(overlap),
preserveViewport:JSON.parse(fitbounds),
callback:mmi // call back function
});
// call back function for partikular marker
function mmi(e){
console.log(e);
}
}
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.