var map1;
var center = "28.5507160000001,77.2689280000001";
var center = center.split(",");
var lat = center[0];var lng=center[1];
var mapmyindia_circle;
// Draw Circle
document.getElementById('checkbox').addEventListener('change', (event) => {
if (event.target.checked) {
// call Circle Function
circle();
}
else{
map1.setZoom(4);
MapmyIndia.remove({map:map1,layer:mapmyindia_circle});
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,
zoomControl: true,
location: true,
zoomControlOptions: {
position:MapmyIndia.ControlPosition.BOTTOM_LEFT
},
});
}
function circle(){
var circle_strokecolor= document.getElementById('circle_strokecolor').value;
var circle_strokeopacity= document.getElementById('circle_strokeopacity').value;
var circle_strokeweight= document.getElementById('circle_strokeweight').value;
var circle_events= document.getElementById('circle_events').value;
var circle_fillcolor= document.getElementById('circle_fillcolor').value;
var circle_fillopacity= document.getElementById('circle_fillopacity').value;
var circle_center= document.getElementById('circle_center').value;
var circle_radius= document.getElementById('circle_radius').value;
// Circle
mapmyindia_circle = new MapmyIndia.Circle({
center: JSON.parse(circle_center),
map: map1,
radius:JSON.parse(circle_radius),
strokeColor: circle_strokecolor,
strokeOpacity: JSON.parse(circle_strokeopacity),
strokeWeight: JSON.parse(circle_strokeweight),
fillColor: circle_fillcolor,
fillOpacity:JSON.parse(circle_fillopacity)
});
map1.setZoom(14);
map1.setCenter(JSON.parse(circle_center));
// Circle Events
mapmyindia_circle.addListener(circle_events, function() {
alert(circle_events+' Circle Event Works');
...
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.