Click here to Skip to main content
15,880,469 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
i want to remove first drawn circle and add a new circle with new radius on map.
how i do this?

What I have tried:

C#
var circle = new google.maps.Circle({
    strokeWeight: 1.0,
    fillOpacity: 0.1
  });
  circle.setMap(null);
  
  var radus = 300;
  var sel_rads = $('#mapradius option:selected').val();
  if (sel_rads != "0") {     
      radus = sel_rads * 100;
  }  
  var cityCircle = new google.maps.Circle({
      strokeColor: '#000',
      strokeOpacity: 0.8,
      strokeWeight: 2,
      fillColor: '#000',
      fillOpacity: 0.05,
      radius: radus,
      map: map,
      center: map.center
  });

  this.set('distance', opt_distance);
  this.set('active', false);
  this.bindTo('bounds', circle);

  circle.bindTo('center', this);
  circle.bindTo('zIndex', this);
  circle.bindTo('map', this);
  circle.bindTo('strokeColor', this);
  circle.bindTo('radius', this);
Posted
Updated 29-Jun-16 1:04am
v3
Comments
CHill60 22-Apr-16 8:39am    
What happens when you run your code?
ErBhati 25-Apr-16 1:24am    
again a new circle is drawn. with new radius
Peter_in_2780 26-Apr-16 8:34am    
Can you change the opacity on your first circle to zero. It will still be there, but invisible.

here is my solution
JavaScript
   distanceWidget.set('map', null);

and distanceWidget is:
 distanceWidget = new DistanceWidget({
                map: map,
                distance: rads, // Starting distance in km.
                maxDistance: 0.5, // Twitter has a max distance of 2500km.
                color: '#000000',
                activeColor: '#5599bb',
                sizerIcon: '../Contents/Images/resize-off.png',
                activeSizerIcon: '../Contents/Images/resize.png'
            });
 
Share this answer
 
Did you try calling map.clear(); before attempting to draw the second circle?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900